Closed Thread Icon

Preserved Topic: PHP: '@' before statements (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=20958" title="Pages that link to Preserved Topic: PHP: &amp;#039;@&amp;#039; before statements (Page 1 of 1)" rel="nofollow" >Preserved Topic: PHP: &#039;@&#039; before statements <span class="small">(Page 1 of 1)</span>\

 
GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 11-01-2001 19:07

in some php-sources i see an '@' before commands etc.
example:

mysql_connect($dbhost, $dbuname, $dbpass);
@mysql_select_db("$dbname") or die ("Unable to select database");

what is this for?

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 11-01-2001 19:21

Doesn't it turn off error reporting? Getting the error report on the page is useful for debugging but could have security implications so it can be handy to turn them off.

Emps


You're my wife now Dave

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 11-01-2001 20:04

As Emperor said @ is error-control operator. Sometimes it is good to disable error reporting so that malicious users can't probe your scripts and find security holes...

Also, read the following two chapters from PHP's manual:

Error Handling
Error Handling and Logging Functions


GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 11-01-2001 20:08

thanks for the quick response, guys!

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 11-01-2001 22:17

It also works well as you have it shown with "die" to give your own error messages that the user might understand, instead of the error message that PHP will generate.

-Butcher-



« BackwardsOnwards »

Show Forum Drop Down Menu