$php_mysql$ Posted August 15, 2011 Share Posted August 15, 2011 so supposing my table is deleted or problem connection to database, how will one hide table names showing up in browser? currently if i drop the table then it browser it will say Table 'table table_name' doesn't exist, this maybe lead a site to get hack right? Link to comment https://forums.phpfreaks.com/topic/244855-how-to-hide-table-table_name-doesnt-exist-message/ Share on other sites More sharing options...
AyKay47 Posted August 15, 2011 Share Posted August 15, 2011 sounds like you have display_errors set to on..? on a live server, you will want this setting off... and can even control where the error messages are sent so only you have access to them.. Link to comment https://forums.phpfreaks.com/topic/244855-how-to-hide-table-table_name-doesnt-exist-message/#findComment-1257811 Share on other sites More sharing options...
$php_mysql$ Posted August 15, 2011 Author Share Posted August 15, 2011 sounds like you have display_errors set to on..? on a live server, you will want this setting off... and can even control where the error messages are sent so only you have access to them.. just checked php.ini and yes it says on display_errors ; Default Value: On ; Development Value: On ; Production Value: Off so i tried to turn it off display_errors ; Default Value: Off ; Development Value: Off ; Production Value: Off but still it shows? i even restarted my wamp server. but this is on my laptop how will i control it on shared webhosting? Link to comment https://forums.phpfreaks.com/topic/244855-how-to-hide-table-table_name-doesnt-exist-message/#findComment-1257813 Share on other sites More sharing options...
AyKay47 Posted August 15, 2011 Share Posted August 15, 2011 your host should provide a php.ini file that you can make changes to.. only other reason that I can think of as to why the error(s) is still showing is that you have the error in a die() or exit() function.. ? Link to comment https://forums.phpfreaks.com/topic/244855-how-to-hide-table-table_name-doesnt-exist-message/#findComment-1257815 Share on other sites More sharing options...
$php_mysql$ Posted August 15, 2011 Author Share Posted August 15, 2011 this is my coding for db connect if(!$conn = mysql_connect($host, $user, $password)) { die("Could't connect to database server.....".mysql_error()); } else { mysql_select_db($database, $conn) or die(mysql_error()); return $conn; } } Link to comment https://forums.phpfreaks.com/topic/244855-how-to-hide-table-table_name-doesnt-exist-message/#findComment-1257819 Share on other sites More sharing options...
AyKay47 Posted August 15, 2011 Share Posted August 15, 2011 is this the relevant error that you are receiving? Link to comment https://forums.phpfreaks.com/topic/244855-how-to-hide-table-table_name-doesnt-exist-message/#findComment-1257820 Share on other sites More sharing options...
$php_mysql$ Posted August 15, 2011 Author Share Posted August 15, 2011 i get this die("Could't connect to database server.....".mysql_error()); when username or password to database is wrong, else if table inside it i drop then it says Table table table_name dosnt exist Link to comment https://forums.phpfreaks.com/topic/244855-how-to-hide-table-table_name-doesnt-exist-message/#findComment-1257821 Share on other sites More sharing options...
AyKay47 Posted August 15, 2011 Share Posted August 15, 2011 on a live server you will not want to use the die function or exit function to display the errors that you would normally want to see during the debugging process.. i recomend using trigger_error to send custom messages to the error.log Link to comment https://forums.phpfreaks.com/topic/244855-how-to-hide-table-table_name-doesnt-exist-message/#findComment-1257825 Share on other sites More sharing options...
$php_mysql$ Posted August 15, 2011 Author Share Posted August 15, 2011 so i replace die() with trigger_error() and whatsoever the mysql_error() has send it elsewhere? Link to comment https://forums.phpfreaks.com/topic/244855-how-to-hide-table-table_name-doesnt-exist-message/#findComment-1257827 Share on other sites More sharing options...
AyKay47 Posted August 15, 2011 Share Posted August 15, 2011 it will send it to the error log.. which is where errors should go unless you would like to send them to another file.. as long as the user cannot see any errors that occur on the server.. Link to comment https://forums.phpfreaks.com/topic/244855-how-to-hide-table-table_name-doesnt-exist-message/#findComment-1257831 Share on other sites More sharing options...
$php_mysql$ Posted August 15, 2011 Author Share Posted August 15, 2011 tried this if(!$conn = mysql_connect($host, $user, $password)) { trigger_error("Could't connect to database server.....".mysql_error($conn), E_USER_ERROR); } else { mysql_select_db($database, $conn) or trigger_error(mysql_error($conn), E_USER_ERROR); return $conn; } } still error shows any idea? guess im doing it wrong? Link to comment https://forums.phpfreaks.com/topic/244855-how-to-hide-table-table_name-doesnt-exist-message/#findComment-1257835 Share on other sites More sharing options...
KevinM1 Posted August 15, 2011 Share Posted August 15, 2011 Did you read the part where it talks about using set_error_handler? Without setting a custom error handler, trigger_error will use the default handler, and simply spit out whatever you write in the parentheses to the screen. Link to comment https://forums.phpfreaks.com/topic/244855-how-to-hide-table-table_name-doesnt-exist-message/#findComment-1257837 Share on other sites More sharing options...
jcbones Posted August 15, 2011 Share Posted August 15, 2011 sounds like you have display_errors set to on..? on a live server, you will want this setting off... and can even control where the error messages are sent so only you have access to them.. just checked php.ini and yes it says on display_errors ; Default Value: On ; Development Value: On ; Production Value: Off so i tried to turn it off display_errors ; Default Value: Off ; Development Value: Off ; Production Value: Off but still it shows? i even restarted my wamp server. but this is on my laptop how will i control it on shared webhosting? You need to scroll further down the php.ini file, display_errors is set in the ERROR HANDLING section. What you are looking at is the Quick Reference section. Link to comment https://forums.phpfreaks.com/topic/244855-how-to-hide-table-table_name-doesnt-exist-message/#findComment-1257860 Share on other sites More sharing options...
AyKay47 Posted August 15, 2011 Share Posted August 15, 2011 Did you read the part where it talks about using set_error_handler? Without setting a custom error handler, trigger_error will use the default handler, and simply spit out whatever you write in the parentheses to the screen. probably should have specified that... heh Link to comment https://forums.phpfreaks.com/topic/244855-how-to-hide-table-table_name-doesnt-exist-message/#findComment-1257893 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.