TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 07-18-2008, 03:01 AM   #1 (permalink)
how quixotic are you?
 
ETbyrne's Avatar
 
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
ETbyrne is on a distinguished road
Default @ before something...?

What exactly is the difference between this...
PHP Code:
echo @$_POST['text']; 
and this?
PHP Code:
echo $_POST['text']; 
Thanks in advance, I really have no clue.
__________________
Dingo Web Systems > http://www.dingocode.com
My Website > http://www.evanbot.com
ETbyrne is offline  
Reply With Quote
Old 07-18-2008, 05:13 AM   #2 (permalink)
The Addict
 
Enfernikus's Avatar
 
Join Date: Jun 2008
Posts: 335
Thanks: 2
Enfernikus is on a distinguished road
Default

supresses errors.
Enfernikus is offline  
Reply With Quote
The Following User Says Thank You to Enfernikus For This Useful Post:
ETbyrne (07-19-2008)
Old 07-18-2008, 01:04 PM   #3 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Its a hack 'n slash way of cutting errors. The best way to do it is to set php.ini not to show them (you can also use ini_set if you dont have access on your host)
__________________

Village Idiot is offline  
Reply With Quote
The Following User Says Thank You to Village Idiot For This Useful Post:
ETbyrne (07-19-2008)
Old 07-18-2008, 07:32 PM   #4 (permalink)
The Frequenter
 
Join Date: Dec 2007
Location: In my basement
Posts: 386
Thanks: 47
Aaron is on a distinguished road
Default

You can't always access php.ini...

Wouldn't @ cause less server overhead than ini_set?
__________________
Signatures are nothing but incriminating.
Send a message via MSN to Aaron
Aaron is offline  
Reply With Quote
The Following User Says Thank You to Aaron For This Useful Post:
ETbyrne (07-19-2008)
Old 07-18-2008, 08:06 PM   #5 (permalink)
The Contributor
 
Ross's Avatar
 
Join Date: Jan 2008
Location: England, UK
Posts: 83
Thanks: 3
Ross is on a distinguished road
Default

Quote:
Originally Posted by Aaron View Post
You can't always access php.ini...

Wouldn't @ cause less server overhead than ini_set?
It's still a poor way of doing it (and I don't think it's supported in PHP5) - no errors should be shown on a production site anyway.

Just use php.ini or error_reporting to set E_STRICT and E_ALL on.
Ross is offline  
Reply With Quote
The Following User Says Thank You to Ross For This Useful Post:
ETbyrne (07-19-2008)
Old 07-18-2008, 11:05 PM   #6 (permalink)
The Frequenter
 
Join Date: Dec 2007
Location: In my basement
Posts: 386
Thanks: 47
Aaron is on a distinguished road
Default

Isn't there some other way to intercept an error and throw your own?
__________________
Signatures are nothing but incriminating.
Send a message via MSN to Aaron
Aaron is offline  
Reply With Quote
Old 07-18-2008, 11:53 PM   #7 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

You can use exceptions, which boiled down would look something like;

PHP Code:
try
{
    
userFunc($arg);
}
catch (
$e Exception)
{
    die(
$e->getMessage());
}

function 
userFunc ($arg)
{
    if (
$arg != $met)
        throw new 
exception('Condition not met');

Alternatively you can throw the exception from within the try{} block, it just needs to be thrown from somewhere within the try to be caught. There's also trigger_error() to throw your own errors (preferably in conjunction with a custom error handler).
-m
delayedinsanity is offline  
Reply With Quote
The Following User Says Thank You to delayedinsanity For This Useful Post:
ETbyrne (07-19-2008)
Old 07-19-2008, 04:50 PM   #8 (permalink)
how quixotic are you?
 
ETbyrne's Avatar
 
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
ETbyrne is on a distinguished road
Default

Awesome, thanks for the help guys.
__________________
Dingo Web Systems > http://www.dingocode.com
My Website > http://www.evanbot.com
ETbyrne is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 07:58 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design