You are here: Re: Parameters in PHP « PHP Programming Language « IT news, forums, messages
Re: Parameters in PHP

Posted by AnrDaemon on 10/24/07 14:21

Greetings, Jeff Gaines.
In reply to Your message dated Tuesday, October 23, 2007, 19:51:16,

JG> I have down-loaded several php scripts and am working my way through them
JG> as part of my learning process. I have noticed situations like this:

JG> mysql_query("DELETE FROM $table WHERE id=$id",$db);

JG> where scripts have been called from another script/page with a parameter -
JG> i.e. 'id' is a parameter that is not defined in the script before the
JG> above line is called.

JG> They don't work as they are but I can get the parameters by using
JG> $_GET['id'] or sometimes $_POST['id'].

It is bad, very bad idea to trust somethig entered by user.
Example?
You have code

"SELECT user_id FROM users WHERE user_name = '{$_POST['name']}' AND user_password = MD5('{$_POST['password']})"

Then I submit the form

name="admin' --"
password="any"

Et voila.. I'm authorized as admin of Your website.


--
Sincerely Yours, AnrDaemon <anrdaemon@freemail.ru>

 

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

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