Web Analytics Made Easy -
StatCounter help explain this section of code - CodingForum

Announcement

Collapse
No announcement yet.

help explain this section of code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • help explain this section of code

    Hi guys I was wondering if you could give me some insight as to what that are doing in this section of code. I am new to PHP and got list at this point. The areas I am looking to get explained are the following. I put them in bold, and one in the colour red.




    Code:
    if ( !defined('IN_PHPBB') ) //check for hacking
    {
    	die("Hacking attempt");
    }
    
    [B]error_reporting  (E_ERROR | E_WARNING | E_PARSE);[/B] // This will NOT report uninitialized variables
    [B]set_magic_quotes_runtime(0); [/B]// Disable magic_quotes_runtime
    
    //
    // addslashes to vars if magic_quotes_gpc is off
    // this is a security precaution to prevent someone
    // trying to break out of a SQL statement.
    //
    if( [COLOR=red][B]![/B][/COLOR]get_magic_quotes_gpc() )
    [B]
    {
    	if( is_array($HTTP_GET_VARS) )
    	{
    		while( list($k, $v) = each($HTTP_GET_VARS) )
    		{
    			if( is_array($HTTP_GET_VARS[$k]) )
    			{
    				while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) )
    				{
    					$HTTP_GET_VARS[$k][$k2] = addslashes($v2);
    				}
    				@reset($HTTP_GET_VARS[$k]);
    			}
    			else
    			{
    				$HTTP_GET_VARS[$k] = addslashes($v);
    			}
    		}
    		@reset($HTTP_GET_VARS);
    	}
    
    	if( is_array($HTTP_POST_VARS) )
    	{
    		while( list($k, $v) = each($HTTP_POST_VARS) )
    		{
    			if( is_array($HTTP_POST_VARS[$k]) )
    			{
    				while( list($k2, $v2) = each($HTTP_POST_VARS[$k]) )
    				{
    					$HTTP_POST_VARS[$k][$k2] = addslashes($v2);
    				}
    				@reset($HTTP_POST_VARS[$k]);
    			}
    			else
    			{
    				$HTTP_POST_VARS[$k] = addslashes($v);
    			}
    		}
    		@reset($HTTP_POST_VARS);
    	}
    
    	if( is_array($HTTP_COOKIE_VARS) )
    	{
    		while( list($k, $v) = each($HTTP_COOKIE_VARS) )
    		{
    			if( is_array($HTTP_COOKIE_VARS[$k]) )
    			{
    				while( list($k2, $v2) = each($HTTP_COOKIE_VARS[$k]) )
    				{
    					$HTTP_COOKIE_VARS[$k][$k2] = addslashes($v2);
    				}
    				@reset($HTTP_COOKIE_VARS[$k]);
    			}
    			else
    			{
    				$HTTP_COOKIE_VARS[$k] = addslashes($v);
    			}
    		}
    		@reset($HTTP_COOKIE_VARS);
    	}
    }[/B]

  • #2
    you ask to explain more a less the complete code ...
    it think it would be more efficient if you type in the keywords for each line at www.php.net and read the relevant function-pages in the manual there.
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

    Comment

    Working...
    X