You are here: Re: error-logs() bug ?? « PHP Programming Language « IT news, forums, messages
Re: error-logs() bug ??

Posted by Michael Fesser on 06/26/07 14:34

..oO(yaaros@gmail.com)

>Hello !! I have a problem with error_logs. The problem is in this
>code:
>
>$id_tmp = $_REQUEST["id"];
>if(!isset($id_tmp) && empty($id_tmp)){
> invalidArgs();
> echo "buug";
>}
>
>I'd like to check if the variable id is passed by GET method to the
>script.

If you're expecting a GET variable then use the $_GET array. The
$_REQUEST array contains values from three(!) different sources and
should only be used in very special cases.

Additionally you should set error_reporting to E_ALL in your php.ini.
The first line from the code above will cause a notice if no 'id'
parameter was submitted.

It should be something like:

if (!isset($_GET['id'])) {
invalidArgs();
echo "buug";
}

If you also want to check for empty parameters add an OR condition:

if (!isset($_GET['id']) || empty($_GET['id'])) {
invalidArgs();
echo "buug";
}

Micha

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация