Jump to content

Recommended Posts

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?

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?

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.. ?

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;
        }
    }

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

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?

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.

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.