The log files do not give any hints as to why the database isn't being found
I reset both passwords just to confirm. No change. I added a new user. No change. How would you go about testing the DB auth?
C:\>netstat -an | find /I ":3306"
TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING
TCP [::]:3306 [::]:0 LISTENING
I have tried localhost and the ipv4 address. I do not have workbench installed. I will work on that. Same code for php5 as in php7. I switched wamp to php5 and the same error occurs.
" do you test whether $connection is defined when passing it? If you iss and pass as undefined variable."
*** I don't know how to do this.
Both users were reset to the same password.
Using Work Bench it didn't look like the user existed. I added the user and now I am getting a new error. I also included the connections.php and kernel.php file.
<?php
/* Version 1.0.1 - 10:16 PM 26/07/2009 */
/* 1.0.1 - Added SQL class */
session_start();
header("Cache-control: private");
error_reporting(E_ALL);
require_once("base/vrk_classes/VRKMessage.php");
require_once("base/vrk_classes/Connections.php");
require_once("base/vrk_classes/SQLMaps.php");
require_once("base/vrk_classes/Parser.php");
require_once("base/vrk_classes/Validator.php");
require_once("base/vrk_classes/JSCompiler.php");
require_once("base/vrk_classes/Datasource.php");
require_once("base/vrk_classes/LoopStack.php");
require_once("base/vrk_classes/SQL.php");
require_once("base/vrk_modules/Display.php");
require_once("base/vrk_modules/MySQL.php");
require_once("base/modules/Array.php");
require_once("base/modules/String.php");
require_once("base/vrk_abstracts/ExtTag.php");
require_once("base/functions.php");
global $vrk_jsc
, $vrk_connections
, $vrk_sql_maps
, $vrk_parser
, $vrk_validator
, $vrk_message;
$vrk_jsc = new JSCompiler();
$vrk_connections = new Connections();
$vrk_sql_maps = new SQLMaps();
$vrk_parser = new Parser();
$vrk_validator = new Validator();
$vrk_message = new VRKMessage();
if (file_exists("config/loader.php")) require_once("config/loader.php");
include_once("config/connections.php");
?>
<?php
/* Version 1.0.0 - 8:54 PM 05/07/2009 */
get_parsed_struct(file_get_contents(dirname(__FILE__)."/connections.xml"), $connection_data);
for ($i = 0; $i < count($connection_data); $i++)
{
if ($connection_data[$i]["tag"] == "connection" && $connection_data[$i]["type"] == "open")
{
$vrk_connections->create_connection($connection_data[$i]["attributes"]["name"]);
}
else if ($connection_data[$i]["tag"] != "connections" && $connection_data[$i]["type"] == "complete")
{
$vrk_connections->add_connection_tag($connection_data[$i]["tag"], $connection_data[$i]["value"]);
}
}
?>
Final update for the evening - only getting a single error now after reading the error on the following line:
if (!mysqli_select_db($vrk_connections->cur_db, $connection["dbname"]))
Error selecting database 'copps_installed_sales' on connection 'installed_sales'. Ensure you have the correct database name.
Am I missing anything else?
Tried to change the host to localhost or 127.0.0.1 but it fails. Getting access denied still. Tried to change the user to any host and the same error occurs.
Yes - same computer.
Custom code that we paid a private developer to do. 2009 sounds about right.
It is proprietary.
I am not sure how to do this. Does EE still allow to hire experts? I can provide the full code and a blank database. The Wamp installation is a basic install with nothing additional. We do use AD authentication but I am sure that could be bypassed to test.
if (!mysqli_select_db($connection["dbname"], $vrk_connections->cur_db)) {
die("Error selecting database '".$connection["dbname"]."' on connection
'".$connection_name."'. Ensure you have the correct database name.");
}
if (!mysqli_select_db($vrk_connections->cur_db, $connection["dbname"],)){
die("Error selecting database '".$connection["dbname"]."' on connection
'".$connection_name."'. Ensure you have the correct database name.");
}
Still getting the error. Attached new MySQL file with revised code and error.
<?php
/* Version 1.0.0 - 1:12 PM 25/07/2009 */
function mysqli_truncate_table($connection, $table)
{
mysqli_initialize($connection);
mysqli_query("TRUNCATE TABLE ".mysqli_real_escape_string($table));
}
function mysqli_count_rows($connection, $table, $condition = "1=1")
{
mysqli_initialize($connection);
$res = mysqli_query("SELECT * from ".mysqli_real_escape_string($table)." WHERE $condition");
if ($res) return mysqli_num_rows($res);
else return 0;
}
function mysqli_optimize($connection, $table)
{
mysqli_initialize($connection);
return mysqli_query("OPTIMIZE TABLE ".mysqli_real_escape_string($table));
}
function mysqli_delete_row($connection, $table, $condition)
{
mysqli_initialize($connection);
$result = mysqli_query("DELETE from ".mysqli_real_escape_string($table)." WHERE $condition");
return $result;
}
function mysqli_update_row($connection, $table, $values, $condition)
{
mysqli_initialize($connection);
$i = 0;
$update_values = "";
foreach ($values as $key => $value)
{
($i != 0) ? $update_values.="," : $i = 1;
if (strtolower(substr($value, 0, 4)) == "sql:") $update_values.= "`".mysqli_real_escape_string($key)."`=".mysqli_real_escape_string(substr($value, 4));
else $update_values.= "`".mysqli_real_escape_string($key)."`='".mysqli_real_escape_string($value)."'";
}
if (mysqli_query("UPDATE ".mysqli_real_escape_string($table)." SET $update_values WHERE $condition")) return true;
else
{
echo mysqli_error();
return false;
}
}
function mysqli_insert_row($connection, $table, $values)
{
mysqli_initialize($connection);
if (isset($values[0]))
{
$insert_values = "'".$values[0]."'";
for ($i = 1; $i < count($values); $i++)
{
if (strtolower(substr($values[$i], 0, 4)) == "sql:") $insert_values.= ",".mysqli_real_escape_string(substr($values[$i], 4));
else $insert_values.= ",'".mysqli_real_escape_string($values[$i])."'";
}
$query = "INSERT INTO ".mysqli_real_escape_string($table)." VALUES ($insert_values)";
}
else
{
$table_cols = "";
$insert_values = "";
foreach ($values as $key => $value)
{
$table_cols.= ",`".mysqli_real_escape_string($key)."`";
if (strtolower(substr($value, 0, 4)) == "sql:") $insert_values.= ",".mysqli_real_escape_string(substr($value, 4));
else $insert_values.= ",'".mysqli_real_escape_string($value)."'";
}
// remove extra comma
$table_cols = substr($table_cols, 1);
$insert_values = substr($insert_values, 1);
$query = "INSERT INTO ".mysqli_real_escape_string($table)." ($table_cols) VALUES ($insert_values)";
}
if (mysqli_query($query)) return true;
else
{
echo mysqli_error();
return false;
}
}
function mysqli_does_row_exist($connection, $table, $condition)
{
mysqli_initialize($connection);
$result = mysqli_query("SELECT * FROM ".mysqli_clean($connection, $table)." WHERE $condition");
if ($result) return ($row = mysqli_fetch_assoc($result));
return false;
}
function mysqli_get_field_query($connection, $field, $table, $condition = "", $offset = "")
{
mysqli_initialize($connection);
if ($condition != "") $condition = " WHERE $condition";
if ($offset != "") $order = " OFFSET $offset";
$result = mysqli_query("SELECT `$field` FROM `".mysqli_real_escape_string($table)."`$condition LIMIT 1$offset");
if ($result)
{
$row = mysqli_fetch_assoc($result);
return $row[$field];
}
return "";
}
function mysqli_clean($connection, $val)
{
mysqli_initialize($connection);
return mysqli_real_escape_string($val);
}
function mysqli_single_row_query($connection, $sql_query, $offset = "")
{
mysqli_initialize($connection);
if ($offset != "") $order = " OFFSET $offset";
$result = mysqli_query($sql_query." LIMIT 1$offset");
if ($result) return mysqli_fetch_assoc($result);
return "";
}
function mysqli_multi_row_query($connection, $sql_query, $order = "", $limit = "", $offset = "")
{
mysqli_initialize($connection);
if (isset($_GET["vrksort"]) && $_GET["vrksort"] != "")
{
if (substr($_GET["vrksort"], 0, 2) == "d:") $order = " ORDER BY ".substr($_GET["vrksort"], 2)." DESC";
else $order = " ORDER BY ".$_GET["vrksort"];
}
else if ($order != "") $order = " ORDER BY $order";
if (isset($_GET["vrklimit"]) && $_GET["vrklimit"] != "") $limit = " LIMIT ".$_GET["vrklimit"];
else if ($limit != "") $limit = " LIMIT $limit";
if (isset($_GET["vrkoffset"]) && $_GET["vrkoffset"] != "") $offset = " OFFSET ".$_GET["vrkoffset"];
else if ($offset != "") $offset = " OFFSET $offset";
$result = mysqli_query($sql_query.$order.$limit.$offset);
$res_array = array();
if ($result) while ($row = mysqli_fetch_assoc($result)) $res_array[count($res_array)] = $row;
else echo mysqli_error();
if (!isset($res_array)) return "";
else return $res_array;
}
function mysqli_last_id()
{
return mysqli_insert_id();
}
function mysqli_found_rows()
{
$result = mysqli_query("SELECT FOUND_ROWS()");
if ($result)
{
$row = mysqli_fetch_assoc($result);
}
else
{
echo mysqli_error();
}
if (!isset($row))
{
return 0;
}
else
{
return $row["FOUND_ROWS()"];
}
}
function mysqli_initialize($connection_name)
{
global $vrk_connections;
$connection = $vrk_connections->get_connection($connection_name);
$vrk_connections->cur_db = mysqli_connect($connection["dbhost"],
$connection["dbuser"], $connection["dbpassword"]);
if (!$vrk_connections->cur_db)
{
die("Unable to connect to host. Ensure you have the correct connection information.");
}
/* if (!mysqli_select_db($connection["dbname"], $vrk_connections->cur_db))
{
die("Error selecting database '".$connection["dbname"]."' on connection '".$connection_name."'. Ensure you have the correct database name.");
} */
if (!mysqli_select_db($vrk_connections->cur_db, $connection["dbname"],))
{
die("Error selecting database '".$connection["dbname"]."' on connection '".$connection_name."'. Ensure you have the correct database name.");
}
}
?>
If only I knew how to code PHP (lol). Any way you can re-write the code for me to what it should be?
Changed the connection back to the IP Address. No errors other than the database error now. No errors in MySQL. PHP was logging this but is now gone with the change:
[16-Feb-2020 18:25:25 UTC] PHP Warning: mysqli_connect(): (HY000/1045): Access denied for user 'installedsales'@'localhost' (using password: YES) in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 191
[16-Feb-2020 18:25:25 UTC] PHP Stack trace:
[16-Feb-2020 18:25:25 UTC] PHP 1. {main}() C:\wamp\www\main.php:0
[16-Feb-2020 18:25:25 UTC] PHP 2. product_type_get_all() C:\wamp\www\main.php:45
[16-Feb-2020 18:25:25 UTC] PHP 3. mysqli_multi_row_query() C:\wamp\www\vrk\modules\Jobs.php:16
[16-Feb-2020 18:25:25 UTC] PHP 4. mysqli_initialize() C:\wamp\www\vrk\base\vrk_modules\MySQL.php:135
[16-Feb-2020 18:25:25 UTC] PHP 5. mysqli_connect() C:\wamp\www\vrk\base\vrk_modules\MySQL.php:191
There is only one reference to connections.xml. There are two connection.php files in different folders:
<?php
/* Version 1.0.0 - 8:54 PM 05/07/2009 */
get_parsed_struct(file_get_contents(dirname(__FILE__)."/connections.xml"), $connection_data);
for ($i = 0; $i < count($connection_data); $i++)
{
if ($connection_data[$i]["tag"] == "connection" && $connection_data[$i]["type"] == "open")
{
$vrk_connections->create_connection($connection_data[$i]["attributes"]["name"]);
}
else if ($connection_data[$i]["tag"] != "connections" && $connection_data[$i]["type"] == "complete")
{
$vrk_connections->add_connection_tag($connection_data[$i]["tag"], $connection_data[$i]["value"]);
}
}
?>
<?php
/* Version 1.0.1 - 8:55 PM 05/07/2009 */
/* 1.0.1 - remove cur_db variable as it is no longer needed */
class Connections
{
var $connections;
var $_last_connection;
function __construct()
{
$connections = array();
}
function get_connection($name)
{
return $this->connections[$name];
}
function create_connection($name)
{
$this->connections[$name] = array();
$this->_last_connection = &$this->connections[$name];
}
function add_connection_tag($tag, $value)
{
$this->_last_connection[$tag] = $value;
}
}
?>
I apologize - I meant to set it back and didn't.
// connections.php - in the same directory as connections.xml
<?php
/* Version 1.0.0 - 8:54 PM 05/07/2009 */
get_parsed_struct(file_get_contents(dirname(__FILE__)."/connections.xml"), $connection_data);
for ($i = 0; $i < count($connection_data); $i++)
{
if ($connection_data[$i]["tag"] == "connection" && $connection_data[$i]["type"] == "open")
{
$vrk_connections->create_connection($connection_data[$i]["attributes"]["name"]);
}
else if ($connection_data[$i]["tag"] != "connections" && $connection_data[$i]["type"] == "complete")
{
$vrk_connections->add_connection_tag($connection_data[$i]["tag"], $connection_data[$i]["value"]);
}
}
?>
// MySQL.php
<?php
/* Version 1.0.0 - 1:12 PM 25/07/2009 */
function mysqli_truncate_table($connection, $table)
{
mysqli_initialize($connection);
mysqli_query("TRUNCATE TABLE ".mysqli_real_escape_string($table));
}
function mysqli_count_rows($connection, $table, $condition = "1=1")
{
mysqli_initialize($connection);
$res = mysqli_query("SELECT * from ".mysqli_real_escape_string($table)." WHERE $condition");
if ($res) return mysqli_num_rows($res);
else return 0;
}
function mysqli_optimize($connection, $table)
{
mysqli_initialize($connection);
return mysqli_query("OPTIMIZE TABLE ".mysqli_real_escape_string($table));
}
function mysqli_delete_row($connection, $table, $condition)
{
mysqli_initialize($connection);
$result = mysqli_query("DELETE from ".mysqli_real_escape_string($table)." WHERE $condition");
return $result;
}
function mysqli_update_row($connection, $table, $values, $condition)
{
mysqli_initialize($connection);
$i = 0;
$update_values = "";
foreach ($values as $key => $value)
{
($i != 0) ? $update_values.="," : $i = 1;
if (strtolower(substr($value, 0, 4)) == "sql:") $update_values.= "`".mysqli_real_escape_string($key)."`=".mysqli_real_escape_string(substr($value, 4));
else $update_values.= "`".mysqli_real_escape_string($key)."`='".mysqli_real_escape_string($value)."'";
}
if (mysqli_query("UPDATE ".mysqli_real_escape_string($table)." SET $update_values WHERE $condition")) return true;
else
{
echo mysqli_error();
return false;
}
}
function mysqli_insert_row($connection, $table, $values)
{
mysqli_initialize($connection);
if (isset($values[0]))
{
$insert_values = "'".$values[0]."'";
for ($i = 1; $i < count($values); $i++)
{
if (strtolower(substr($values[$i], 0, 4)) == "sql:") $insert_values.= ",".mysqli_real_escape_string(substr($values[$i], 4));
else $insert_values.= ",'".mysqli_real_escape_string($values[$i])."'";
}
$query = "INSERT INTO ".mysqli_real_escape_string($table)." VALUES ($insert_values)";
}
else
{
$table_cols = "";
$insert_values = "";
foreach ($values as $key => $value)
{
$table_cols.= ",`".mysqli_real_escape_string($key)."`";
if (strtolower(substr($value, 0, 4)) == "sql:") $insert_values.= ",".mysqli_real_escape_string(substr($value, 4));
else $insert_values.= ",'".mysqli_real_escape_string($value)."'";
}
// remove extra comma
$table_cols = substr($table_cols, 1);
$insert_values = substr($insert_values, 1);
$query = "INSERT INTO ".mysqli_real_escape_string($table)." ($table_cols) VALUES ($insert_values)";
}
if (mysqli_query($query)) return true;
else
{
echo mysqli_error();
return false;
}
}
function mysqli_does_row_exist($connection, $table, $condition)
{
mysqli_initialize($connection);
$result = mysqli_query("SELECT * FROM ".mysqli_clean($connection, $table)." WHERE $condition");
if ($result) return ($row = mysqli_fetch_assoc($result));
return false;
}
function mysqli_get_field_query($connection, $field, $table, $condition = "", $offset = "")
{
mysqli_initialize($connection);
if ($condition != "") $condition = " WHERE $condition";
if ($offset != "") $order = " OFFSET $offset";
$result = mysqli_query("SELECT `$field` FROM `".mysqli_real_escape_string($table)."`$condition LIMIT 1$offset");
if ($result)
{
$row = mysqli_fetch_assoc($result);
return $row[$field];
}
return "";
}
function mysqli_clean($connection, $val)
{
mysqli_initialize($connection);
return mysqli_real_escape_string($val);
}
function mysqli_single_row_query($connection, $sql_query, $offset = "")
{
mysqli_initialize($connection);
if ($offset != "") $order = " OFFSET $offset";
$result = mysqli_query($sql_query." LIMIT 1$offset");
if ($result) return mysqli_fetch_assoc($result);
return "";
}
function mysqli_multi_row_query($connection, $sql_query, $order = "", $limit = "", $offset = "")
{
mysqli_initialize($connection);
if (isset($_GET["vrksort"]) && $_GET["vrksort"] != "")
{
if (substr($_GET["vrksort"], 0, 2) == "d:") $order = " ORDER BY ".substr($_GET["vrksort"], 2)." DESC";
else $order = " ORDER BY ".$_GET["vrksort"];
}
else if ($order != "") $order = " ORDER BY $order";
if (isset($_GET["vrklimit"]) && $_GET["vrklimit"] != "") $limit = " LIMIT ".$_GET["vrklimit"];
else if ($limit != "") $limit = " LIMIT $limit";
if (isset($_GET["vrkoffset"]) && $_GET["vrkoffset"] != "") $offset = " OFFSET ".$_GET["vrkoffset"];
else if ($offset != "") $offset = " OFFSET $offset";
$result = mysqli_query($sql_query.$order.$limit.$offset);
$res_array = array();
if ($result) while ($row = mysqli_fetch_assoc($result)) $res_array[count($res_array)] = $row;
else echo mysqli_error();
if (!isset($res_array)) return "";
else return $res_array;
}
function mysqli_last_id()
{
return mysqli_insert_id();
}
function mysqli_found_rows()
{
$result = mysqli_query("SELECT FOUND_ROWS()");
if ($result)
{
$row = mysqli_fetch_assoc($result);
}
else
{
echo mysqli_error();
}
if (!isset($row))
{
return 0;
}
else
{
return $row["FOUND_ROWS()"];
}
}
function mysqli_initialize($connection_name)
{
global $vrk_connections;
$connection = $vrk_connections->get_connection($connection_name);
$vrk_connections->cur_db = mysqli_connect($connection["dbhost"],
$connection["dbuser"], $connection["dbpassword"]);
if (!$vrk_connections->cur_db)
{
die("Unable to connect to host. Ensure you have the correct connection information.");
}
/* if (!mysqli_select_db($connection["dbname"], $vrk_connections->cur_db))
{
die("Error selecting database '".$connection["dbname"]."' on connection '".$connection_name."'. Ensure you have the correct database name.");
} */
if (!mysqli_select_db($vrk_connections->cur_db, $connection["dbname"],))
{
die("Error selecting database '".$connection["dbname"]."' on connection '".$connection_name."'. Ensure you have the correct database name.");
}
}
?>
// Connections.php
<?php
/* Version 1.0.1 - 8:55 PM 05/07/2009 */
/* 1.0.1 - remove cur_db variable as it is no longer needed */
class Connections
{
var $connections;
var $_last_connection;
function __construct()
{
$connections = array();
}
function get_connection($name)
{
return $this->connections[$name];
}
function create_connection($name)
{
$this->connections[$name] = array();
$this->_last_connection = &$this->connections[$name];
}
function add_connection_tag($tag, $value)
{
$this->_last_connection[$tag] = $value;
}
}
?>
// connections.xml
<connections>
<connection name="installed_sales">
<dbname>copps_installed_sales</dbname>
<dbuser>installedsales</dbuser>
<dbpassword>sanitized</dbpassword>
<dbhost>192.168.0.225</dbhost>
</connection>
</connections>
More errors.
I updated the MySQL.php file with the "MySQL---modified.php" and now I am getting:
( ! ) Parse error: syntax error, unexpected '}', expecting end of file in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 206 |
---|
If I remove the last } it returns to this:
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Notice: Undefined variable: vrk_connections in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 202 | ||||
1 | 0.0001 | 393656 | {main}( ) | ...\login.php:0 |
2 | 0.0002 | 393912 | require_once( 'C:\wamp\www\vrk\Kernel.php' ) | ...\login.php:2 |
3 | 0.0024 | 401456 | require_once( 'C:\wamp\www\vrk\base\vrk_modules\MySQL.php' ) | ...\Kernel.php:21 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Notice: Trying to get property 'cur_db' of non-object in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 202 | ||||
1 | 0.0001 | 393656 | {main}( ) | ...\login.php:0 |
2 | 0.0002 | 393912 | require_once( 'C:\wamp\www\vrk\Kernel.php' ) | ...\login.php:2 |
3 | 0.0024 | 401456 | require_once( 'C:\wamp\www\vrk\base\vrk_modules\MySQL.php' ) | ...\Kernel.php:21 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Notice: Undefined variable: connection in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 202 | ||||
1 | 0.0001 | 393656 | {main}( ) | ...\login.php:0 |
2 | 0.0002 | 393912 | require_once( 'C:\wamp\www\vrk\Kernel.php' ) | ...\login.php:2 |
3 | 0.0024 | 401456 | require_once( 'C:\wamp\www\vrk\base\vrk_modules\MySQL.php' ) | ...\Kernel.php:21 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Warning: mysqli_select_db() expects parameter 1 to be mysqli, null given in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 202 | ||||
1 | 0.0001 | 393656 | {main}( ) | ...\login.php:0 |
2 | 0.0002 | 393912 | require_once( 'C:\wamp\www\vrk\Kernel.php' ) | ...\login.php:2 |
3 | 0.0024 | 401456 | require_once( 'C:\wamp\www\vrk\base\vrk_modules\MySQL.php' ) | ...\Kernel.php:21 |
4 | 0.0096 | 402088 | mysqli_select_db ( ) | ...\MySQL.php:202 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Notice: Undefined variable: connection in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 204 | ||||
1 | 0.0001 | 393656 | {main}( ) | ...\login.php:0 |
2 | 0.0002 | 393912 | require_once( 'C:\wamp\www\vrk\Kernel.php' ) | ...\login.php:2 |
3 | 0.0024 | 401456 | require_once( 'C:\wamp\www\vrk\base\vrk_modules\MySQL.php' ) | ...\Kernel.php:21 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Notice: Undefined variable: connection_name in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 204 | ||||
1 | 0.0001 | 393656 | {main}( ) | ...\login.php:0 |
2 | 0.0002 | 393912 | require_once( 'C:\wamp\www\vrk\Kernel.php' ) | ...\login.php:2 |
3 | 0.0024 | 401456 | require_once( 'C:\wamp\www\vrk\base\vrk_modules\MySQL.php' ) | ...\Kernel.php:21 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Notice: Undefined property: Connections::$cur_db in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 190 | ||||
1 | 0.0002 | 391432 | {main}( ) | ...\main.php:0 |
2 | 0.0008 | 417936 | product_type_get_all( ) | ...\main.php:45 |
3 | 0.0008 | 417936 | mysqli_multi_row_query( ) | ...\Jobs.php:16 |
4 | 0.0008 | 417936 | mysqli_initialize( ) | ...\MySQL.php:136 |
Using the MySQL---modified I get this:
( ! ) Parse error: syntax error, unexpected '}', expecting end of file in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 206
Using MySQL.php I get this:
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Notice: Undefined property: Connections::$cur_db in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 190 | ||||
1 | 0.0005 | 391304 | {main}( ) | ...\main.php:0 |
2 | 0.0048 | 418768 | product_type_get_all( ) | ...\main.php:45 |
3 | 0.0048 | 418768 | mysqli_multi_row_query( ) | ...\Jobs.php:16 |
4 | 0.0048 | 418768 | mysqli_initialize( ) | ...\MySQL.php:136 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 207 | ||||
1 | 0.0005 | 391304 | {main}( ) | ...\main.php:0 |
2 | 0.0048 | 418768 | product_type_get_all( ) | ...\main.php:45 |
3 | 0.0048 | 418768 | mysqli_multi_row_query( ) | ...\Jobs.php:16 |
4 | 0.0048 | 418768 | mysqli_initialize( ) | ...\MySQL.php:136 |
5 | 0.0085 | 465664 | mysqli_select_db ( ) | ...\MySQL.php:207 |
File updated:
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 202 | ||||
1 | 0.0002 | 391304 | {main}( ) | ...\main.php:0 |
2 | 0.0010 | 417808 | product_type_get_all( ) | ...\main.php:45 |
3 | 0.0010 | 417808 | mysqli_multi_row_query( ) | ...\Jobs.php:16 |
4 | 0.0010 | 417808 | mysqli_initialize( ) | ...\MySQL.php:136 |
5 | 0.0017 | 464168 | mysqli_select_db ( ) | ...\MySQL.php:202 |
Yes to php7 - i have tried version version 5.6 as well previously (not since I opened this question).
MySQL---modified.php
Error selecting database 'copps_installed_sales' on connection 'installed_sales'. Ensure you have the correct database name.
MySQL.php
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Notice: Undefined property: Connections::$cur_db in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 190 | ||||
1 | 0.0002 | 391304 | {main}( ) | ...\main.php:0 |
2 | 0.0036 | 418768 | product_type_get_all( ) | ...\main.php:45 |
3 | 0.0036 | 418768 | mysqli_multi_row_query( ) | ...\Jobs.php:16 |
4 | 0.0036 | 418768 | mysqli_initialize( ) | ...\MySQL.php:136 |
I tried both files above ... currently it is the "MySQL.php" file. The error is from loading main.php which loads after active directory is authenticated.
<?php
require_once("vrk/Kernel.php");
if (account_is_logged_in())
{
// everyone has access to these options
$applications = array(array("application_url" => "new_install.php?type=install", "application_name" => "New Install Quote Request")
, array("application_url" => "new_install.php?type=material", "application_name" => "New Material Only Quote Request"));
$show_jobs = "none";
if (!account_is_in_users_group() || count(account_get_product_types()) > 0)
{
$show_jobs = "table-cell";
$applications[] = array("application_url" => "job_search.php", "application_name" => "Job Search");
}
// add job type links, if not admin
if (!account_is_admin())
{
$has_prod_type = false;
foreach (account_get_product_types() as $product_type)
{
if (strpos($product_type, "Manage Staff") === false)
{
$applications[] = array("application_url" => "job_section_menu.php?product_type=".$product_type, "application_name" => $product_type." Jobs");
if (!product_type_exists($product_type))
{
// create product type
product_type_create($product_type);
}
}
$has_prod_type = true;
}
if ($has_prod_type)
{
$applications[] = array("application_url" => "jobs_completed_but_not_paid.php", "application_name" => "Jobs Completed But Not Paid For");
}
}
else
{
// admins have access to all job types, get all job types and then add the menus
foreach (product_type_get_all() as $product_type)
{
$applications[] = array("application_url" => "job_section_menu.php?product_type=".$product_type["product_type"], "application_name" => $product_type["product_type"]." Jobs");
}
$applications[] = array("application_url" => "jobs_completed_but_not_paid.php", "application_name" => "Jobs Completed But Not Paid For");
}
if (account_manage_staff())
{
$applications[] = array("application_url" => "manage_staff.php", "application_name" => "Manage Staff");
}
// if admin add admin menu options
if (account_is_admin())
{
$applications[] = array("application_url" => "admin_sub_menu.php", "application_name" => "Administrator");
$applications[] = array("application_url" => "settings.php", "application_name" => "Settings");
}
$user = account_get_logged_in_name();
$jobs = get_calendar_jobs(account_get_product_types());
$out_jobs = array();
foreach ($jobs as $job)
{
if (count($out_jobs) > 0 && $out_jobs[count($out_jobs) - 1]["work_date"] == $job["work_date"])
{
$out_jobs[count($out_jobs) - 1]["details"].= "<a href=\"update_job.php?job_id=".$job["raw_id"]."\">Job ID: ".$job["job_id"]."</a><br />
Customer: ".$job["customer_name"]."<br />
Product Type: ".$job["product_type"]."<br /><br />";
}
else
{
$out_jobs[]["work_date"] = $job["work_date"];
$out_jobs[count($out_jobs) - 1]["details"] = "<a href=\"update_job.php?job_id=".$job["raw_id"]."\">Job ID: ".$job["job_id"]."</a><br />
Customer: ".$job["customer_name"]."<br />
Product Type: ".$job["product_type"]."<br /><br />";
}
}
display_html("xmls/main.xml", "xmls/template.xml");
}
else
{
header("Location: index.php");
}
?>
I am fine with this ...
I can see some of the webpage now!!! But here is the new errors. It looks like localhost and the IP are returning the same errors.
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Notice: Undefined index: 192.168.0.225 in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 191 | ||||
1 | 0.0004 | 142312 | {main}( ) | ...\main.php:0 |
2 | 0.0169 | 872992 | product_type_get_all( ) | ...\main.php:45 |
3 | 0.0169 | 873160 | mysqli_multi_row_query( ) | ...\Jobs.php:16 |
4 | 0.0169 | 873344 | mysqli_initialize( ) | ...\MySQL.php:136 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Notice: Undefined index: installedsales in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 192 | ||||
1 | 0.0004 | 142312 | {main}( ) | ...\main.php:0 |
2 | 0.0169 | 872992 | product_type_get_all( ) | ...\main.php:45 |
3 | 0.0169 | 873160 | mysqli_multi_row_query( ) | ...\Jobs.php:16 |
4 | 0.0169 | 873344 | mysqli_initialize( ) | ...\MySQL.php:136 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Notice: Undefined index: XXXXXXXXXXXXXX in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 192 | ||||
1 | 0.0004 | 142312 | {main}( ) | ...\main.php:0 |
2 | 0.0169 | 872992 | product_type_get_all( ) | ...\main.php:45 |
3 | 0.0169 | 873160 | mysqli_multi_row_query( ) | ...\Jobs.php:16 |
4 | 0.0169 | 873344 | mysqli_initialize( ) | ...\MySQL.php:136 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Notice: Undefined index: copps_installed_sales in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 192 | ||||
1 | 0.0004 | 142312 | {main}( ) | ...\main.php:0 |
2 | 0.0169 | 872992 | product_type_get_all( ) | ...\main.php:45 |
3 | 0.0169 | 873160 | mysqli_multi_row_query( ) | ...\Jobs.php:16 |
4 | 0.0169 | 873344 | mysqli_initialize( ) | ...\MySQL.php:136 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Warning: mysqli_query() expects at least 2 parameters, 1 given in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 151 | ||||
1 | 0.0004 | 142312 | {main}( ) | ...\main.php:0 |
2 | 0.0169 | 872992 | product_type_get_all( ) | ...\main.php:45 |
3 | 0.0169 | 873160 | mysqli_multi_row_query( ) | ...\Jobs.php:16 |
4 | 0.0309 | 881048 | mysqli_query ( ) | ...\MySQL.php:151 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 155 | ||||
1 | 0.0004 | 142312 | {main}( ) | ...\main.php:0 |
2 | 0.0169 | 872992 | product_type_get_all( ) | ...\main.php:45 |
3 | 0.0169 | 873160 | mysqli_multi_row_query( ) | ...\Jobs.php:16 |
4 | 0.0338 | 881088 | mysqli_error ( ) | ...\MySQL.php:155 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Notice: Undefined index: 192.168.0.225 in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 191 | ||||
1 | 0.0004 | 142312 | {main}( ) | ...\main.php:0 |
2 | 0.0365 | 882448 | get_calendar_jobs( ) | ...\main.php:65 |
3 | 0.0365 | 884408 | mysqli_multi_row_query( ) | ...\Jobs.php:406 |
4 | 0.0365 | 884552 | mysqli_initialize( ) | ...\MySQL.php:136 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Notice: Undefined index: installedsales in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 192 | ||||
1 | 0.0004 | 142312 | {main}( ) | ...\main.php:0 |
2 | 0.0365 | 882448 | get_calendar_jobs( ) | ...\main.php:65 |
3 | 0.0365 | 884408 | mysqli_multi_row_query( ) | ...\Jobs.php:406 |
4 | 0.0365 | 884552 | mysqli_initialize( ) | ...\MySQL.php:136 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Notice: Undefined index: XXXXXXXXXXXX in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 192 | ||||
1 | 0.0004 | 142312 | {main}( ) | ...\main.php:0 |
2 | 0.0365 | 882448 | get_calendar_jobs( ) | ...\main.php:65 |
3 | 0.0365 | 884408 | mysqli_multi_row_query( ) | ...\Jobs.php:406 |
4 | 0.0365 | 884552 | mysqli_initialize( ) | ...\MySQL.php:136 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Notice: Undefined index: copps_installed_sales in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 192 | ||||
1 | 0.0004 | 142312 | {main}( ) | ...\main.php:0 |
2 | 0.0365 | 882448 | get_calendar_jobs( ) | ...\main.php:65 |
3 | 0.0365 | 884408 | mysqli_multi_row_query( ) | ...\Jobs.php:406 |
4 | 0.0365 | 884552 | mysqli_initialize( ) | ...\MySQL.php:136 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Warning: mysqli_query() expects at least 2 parameters, 1 given in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 151 | ||||
1 | 0.0004 | 142312 | {main}( ) | ...\main.php:0 |
2 | 0.0365 | 882448 | get_calendar_jobs( ) | ...\main.php:65 |
3 | 0.0365 | 884408 | mysqli_multi_row_query( ) | ...\Jobs.php:406 |
4 | 0.0521 | 886440 | mysqli_query ( ) | ...\MySQL.php:151 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\wamp\www\vrk\base\vrk_modules\MySQL.php on line 155 | ||||
1 | 0.0004 | 142312 | {main}( ) | ...\main.php:0 |
2 | 0.0365 | 882448 | get_calendar_jobs( ) | ...\main.php:65 |
3 | 0.0365 | 884408 | mysqli_multi_row_query( ) | ...\Jobs.php:406 |
4 | 0.0555 | 884696 | mysqli_error ( ) | ...\MySQL.php:155 |
# | Time | Memory | Function | Location |
---|---|---|---|---|
Call Stack | ||||
( ! ) Warning: Creating default object from empty value in C:\wamp\www\vrk\extensions\vrk\loop_item.Tag.php on line 26 | ||||
1 | 0.0004 | 142312 | {main}( ) | ...\main.php:0 |
2 | 0.0587 | 882864 | display_html( ) | ...\main.php:85 |
3 | 0.0587 | 883008 | Parser->build_output( ) | ...\Display.php:7 |
4 | 0.0593 | 919776 | Parser->_parse_tags( ) | ...\Parser.php:60 |
5 | 0.0645 | 975976 | loop_item->build( ) | ...\Parser.php:104 |
MySQL log is clean. I really appreciate what you have done so far.
I added the following into the my.cnf file. It was not previously defined.
max_connections = 400
max_user_connections=200
No change unfortunately.
Hi Arnold,
I have attached n
<?php
require_once("vrk/Kernel.php");
if (account_is_logged_in())
{
// everyone has access to these options
$applications = array(array("application_url" => "new_install.php?type=install", "application_name" => "New Install Quote Request")
, array("application_url" => "new_install.php?type=material", "application_name" => "New Material Only Quote Request"));
$show_jobs = "none";
if (!account_is_in_users_group() || count(account_get_product_types()) > 0)
{
$show_jobs = "table-cell";
$applications[] = array("application_url" => "job_search.php", "application_name" => "Job Search");
}
// add job type links, if not admin
if (!account_is_admin())
{
$has_prod_type = false;
foreach (account_get_product_types() as $product_type)
{
if (strpos($product_type, "Manage Staff") === false)
{
$applications[] = array("application_url" => "job_section_menu.php?product_type=".$product_type, "application_name" => $product_type." Jobs");
if (!product_type_exists($product_type))
{
// create product type
product_type_create($product_type);
}
}
$has_prod_type = true;
}
if ($has_prod_type)
{
$applications[] = array("application_url" => "jobs_completed_but_not_paid.php", "application_name" => "Jobs Completed But Not Paid For");
}
}
else
{
// admins have access to all job types, get all job types and then add the menus
foreach (product_type_get_all() as $product_type)
{
$applications[] = array("application_url" => "job_section_menu.php?product_type=".$product_type["product_type"], "application_name" => $product_type["product_type"]." Jobs");
}
$applications[] = array("application_url" => "jobs_completed_but_not_paid.php", "application_name" => "Jobs Completed But Not Paid For");
}
if (account_manage_staff())
{
$applications[] = array("application_url" => "manage_staff.php", "application_name" => "Manage Staff");
}
// if admin add admin menu options
if (account_is_admin())
{
$applications[] = array("application_url" => "admin_sub_menu.php", "application_name" => "Administrator");
$applications[] = array("application_url" => "settings.php", "application_name" => "Settings");
}
$user = account_get_logged_in_name();
$jobs = get_calendar_jobs(account_get_product_types());
$out_jobs = array();
foreach ($jobs as $job)
{
if (count($out_jobs) > 0 && $out_jobs[count($out_jobs) - 1]["work_date"] == $job["work_date"])
{
$out_jobs[count($out_jobs) - 1]["details"].= "<a href=\"update_job.php?job_id=".$job["raw_id"]."\">Job ID: ".$job["job_id"]."</a><br />
Customer: ".$job["customer_name"]."<br />
Product Type: ".$job["product_type"]."<br /><br />";
}
else
{
$out_jobs[]["work_date"] = $job["work_date"];
$out_jobs[count($out_jobs) - 1]["details"] = "<a href=\"update_job.php?job_id=".$job["raw_id"]."\">Job ID: ".$job["job_id"]."</a><br />
Customer: ".$job["customer_name"]."<br />
Product Type: ".$job["product_type"]."<br /><br />";
}
}
display_html("xmls/main.xml", "xmls/template.xml");
}
else
{
header("Location: index.php");
}
?>
loop_item.Tag.php
<?php
/* Version 1.0.0 - 4:22 PM 18/07/2009 */
class loop_item extends ExtTag
{
function load()
{
}
function validate()
{
global $vrk_loop_stack;
if ($vrk_loop_stack == NULL)
{
return $this->throw_missing_parent_ex("vrk:loop_item", "vrk:loop");
}
}
function build()
{
global $vrk_loop_stack;
if ($vrk_loop_stack->cur_loop->can_parse_loop_item())
{
if ($this->type != "close")
{
$vrk_loop_stack->current_loop->parse = true;
$this->handle_loop();
return $this->value;
}
}
}
}
?>
Hi Arnold,
I think at this point I am way over my head so I am going to bow out. I am going to try and hire a PHP developer to see if the issue can be fixed. I appreciate all of the effort you have offered.