oclgroup Posted September 3, 2003 Posted September 3, 2003 tly never had one. now when I try to access admin I get these errors. Parse error: parse error, unexpected '}' in /home/virtual/site22/fst/var/www/html/catalog/admin/includes/functions/database.php on line 20 Fatal error: Call to undefined function: tep_db_connect() in /home/virtual/site22/fst/var/www/html/catalog/admin/includes/application_top.php on line 142 The regular programmer is in the Hospital on a morphine drip and walked me thru entering the user name and pword in the top.php all the did was change the Fatal error line #. I changed the mySQL pword back to nothing but shouldn't it be whatever is in the line? I cannot past the whole code as I am at work a bit longer. I am terrified, this is not my store. :oops:
jpf Posted September 3, 2003 Posted September 3, 2003 Check your database setting in both catalogincludeconfiguation.php and catalogadminincludeconfigure.php near the bottom: // define our database connection define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers define('DB_SERVER_USERNAME', 'admin_username'); define('DB_SERVER_PASSWORD', 'abc123ABC123your_password_here'); define('DB_DATABASE', 'your_database_name'); Good luck!
Guest Posted September 3, 2003 Posted September 3, 2003 Most likely, there is nothing wrong with application_top.php. The error that you are getting in that file looks to be related to the error that you get in database.php. What the error says is that you have a } where it was expecting something else. This could mean that something is missing or that the } is extra. It will probably be pretty easy to see if you paste the first twenty lines (just up to where the error is announced) of includes/functions/database.php If you have sensitive info in that file for some reason, please x it out before posting (replacing it with Xs retains the structure but doesn't give away the info). Make a copy of the file before making further changes. Hth, Matt
oclgroup Posted September 3, 2003 Author Posted September 3, 2003 <?php /* $Id: database.php,v 1.18 2003/02/11 01:31:01 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ function tep_db_connect($server = DB_SERVER, $username = root, $password = bones, $database = DB_DATABASE, $link = sharpweblabs_com_-_) { global $$link; if (USE_PCONNECT == 'true') { $$link = mysql_pconnect($server, $username, $password); } else { $$link = mysql_connect($server, $username, $password); } if ($$link) mysql_select_db($database); return $$link; } function tep_db_close($link = 'db_link') { global $$link; return mysql_close($$link); } function tep_db_error($query, $errno, $error) { die('<font color="#000000"><b>' . $errno . ' - ' . $error . '<br><br>' . $query . '<br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>'); } function tep_db_query($query, $link = 'db_link') { global $$link; if (STORE_DB_TRANSACTIONS == 'true') { error_log('QUERY ' . $query . "n", 3, STORE_PAGE_PARSE_TIME_LOG); } $result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error()); if (STORE_DB_TRANSACTIONS == 'true') { $result_error = mysql_error(); error_log('RESULT ' . $result . ' ' . $result_error . "n", 3, STORE_PAGE_PARSE_TIME_LOG); } return $result; } function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') { reset($data); if ($action == 'insert') { $query = 'insert into ' . $table . ' ('; while (list($columns, ) = each($data)) { $query .= $columns . ', '; } $query = substr($query, 0, -2) . ') values ('; reset($data); while (list(, $value) = each($data)) { switch ((string)$value) { case 'now()': $query .= 'now(), '; break; case 'null': $query .= 'null, '; break; default: $query .= ''' . tep_db_input($value) . '', '; break; } } $query = substr($query, 0, -2) . ')'; } elseif ($action == 'update') { $query = 'update ' . $table . ' set '; while (list($columns, $value) = each($data)) { switch ((string)$value) { case 'now()': $query .= $columns . ' = now(), '; break; case 'null': $query .= $columns .= ' = null, '; break; default: $query .= $columns . ' = '' . tep_db_input($value) . '', '; break; } } $query = substr($query, 0, -2) . ' where ' . $parameters; } return tep_db_query($query, $link); } function tep_db_fetch_array($db_query) { return mysql_fetch_array($db_query, MYSQL_ASSOC); } function tep_db_num_rows($db_query) { return mysql_num_rows($db_query); } function tep_db_data_seek($db_query, $row_number) { return mysql_data_seek($db_query, $row_number); } function tep_db_insert_id() { return mysql_insert_id(); } function tep_db_free_result($db_query) { return mysql_free_result($db_query); } function tep_db_fetch_fields($db_query) { return mysql_fetch_field($db_query); } function tep_db_output($string) { return stripslashes($string); } function tep_db_input($string) { return addslashes($string); } function tep_db_prepare_input($string) { if (is_string($string)) { return trim(stripslashes($string)); } elseif (is_array($string)) { reset($string); while (list($key, $value) = each($string)) { $string[$key] = tep_db_prepare_input($value); } return $string; } else { return $string; } } ?> Help :cry:
oclgroup Posted September 3, 2003 Author Posted September 3, 2003 There isn't any sensitive info, is that part of the problem?
oclgroup Posted September 4, 2003 Author Posted September 4, 2003 Check your database setting in both catalogincludeconfiguation.php and catalogadminincludeconfigure.php near the bottom: // define our database connection define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers define('DB_SERVER_USERNAME', 'admin_username'); define('DB_SERVER_PASSWORD', 'abc123ABC123your_password_here'); define('DB_DATABASE', 'your_database_name'); Good luck! Did that now I am getting this; Warning: Access denied for user: 'sharpweb@localhost' (Using password: YES) in /home/virtual/site22/fst/var/www/html/catalog/admin/includes/functions/database.php on line 17 Unable to connect to database server!
oclgroup Posted September 4, 2003 Author Posted September 4, 2003 Error Message; Warning: Access denied for user: 'sharpweb@localhost' (Using password: YES) in /home/virtual/site22/fst/var/www/html/catalog/admin/includes/functions/database.php on line 17 Unable to connect to database server! <?php /* $Id: database.php,v 1.18 2003/02/11 01:31:01 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ function tep_db_connect($server = DB_SERVER, $username = sharpweb, $password = bones, $database = DB_DATABASE, $link = sharpweblabs_com) { global $$link; if (USE_PCONNECT == 'true') { $$link = mysql_pconnect($server, $username, $password); } else { $$link = mysql_connect($server, $username, $password); } if ($$link) mysql_select_db($database); return $$link; } function tep_db_close($link = 'db_link') { global $$link; return mysql_close($$link); } function tep_db_error($query, $errno, $error) { die('<font color="#000000"><b>' . $errno . ' - ' . $error . '<br><br>' . $query . '<br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>'); } function tep_db_query($query, $link = 'db_link') { global $$link; if (STORE_DB_TRANSACTIONS == 'true') { error_log('QUERY ' . $query . "n", 3, STORE_PAGE_PARSE_TIME_LOG); } $result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error()); if (STORE_DB_TRANSACTIONS == 'true') { $result_error = mysql_error(); error_log('RESULT ' . $result . ' ' . $result_error . "n", 3, STORE_PAGE_PARSE_TIME_LOG); } return $result; } function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') { reset($data); if ($action == 'insert') { $query = 'insert into ' . $table . ' ('; while (list($columns, ) = each($data)) { $query .= $columns . ', '; } $query = substr($query, 0, -2) . ') values ('; reset($data); while (list(, $value) = each($data)) { switch ((string)$value) { case 'now()': $query .= 'now(), '; break; case 'null': $query .= 'null, '; break; default: $query .= ''' . tep_db_input($value) . '', '; break; } } $query = substr($query, 0, -2) . ')'; } elseif ($action == 'update') { $query = 'update ' . $table . ' set '; while (list($columns, $value) = each($data)) { switch ((string)$value) { case 'now()': $query .= $columns . ' = now(), '; break; case 'null': $query .= $columns .= ' = null, '; break; default: $query .= $columns . ' = '' . tep_db_input($value) . '', '; break; } } $query = substr($query, 0, -2) . ' where ' . $parameters; } return tep_db_query($query, $link); } function tep_db_fetch_array($db_query) { return mysql_fetch_array($db_query, MYSQL_ASSOC); } function tep_db_num_rows($db_query) { return mysql_num_rows($db_query); } function tep_db_data_seek($db_query, $row_number) { return mysql_data_seek($db_query, $row_number); } function tep_db_insert_id() { return mysql_insert_id(); } function tep_db_free_result($db_query) { return mysql_free_result($db_query); } function tep_db_fetch_fields($db_query) { return mysql_fetch_field($db_query); } function tep_db_output($string) { return stripslashes($string); } function tep_db_input($string) { return addslashes($string); } function tep_db_prepare_input($string) { if (is_string($string)) { return trim(stripslashes($string)); } elseif (is_array($string)) { reset($string); while (list($key, $value) = each($string)) { $string[$key] = tep_db_prepare_input($value); } return $string; } else { return $string; } } ?>
jpf Posted September 4, 2003 Posted September 4, 2003 Warning: Access denied for user: 'sharpweb@localhost' (Using password: YES) in /home/virtual/site22/fst/var/www/html/catalog/admin/includes/functions/database.php on line 17 Unable to connect to database server! I have to assume you have something like this: // define our database connection define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers define('DB_SERVER_USERNAME', 'sharpweb'); define('DB_SERVER_PASSWORD', '********'); define('DB_DATABASE', 'your_database_name'); Your User or Password or both is not vaild. in MySQL (like PHPMYADMIN) make sure you have the following users - host: sharpweb - % sharpweb - localhost sharpweb - 127.0.0.1 all with the same password. Good Luck
Recommended Posts
Archived
This topic is now archived and is closed to further replies.