php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19950 Really hard to explain why this is a bug, it just is. And i will prove it
Submitted: 2002-10-17 07:10 UTC Modified: 2002-10-17 07:15 UTC
From: brodylampz at hotmail dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.3.0-pre1 OS: linux
Private report: No CVE-ID: None
 [2002-10-17 07:10 UTC] brodylampz at hotmail dot com
What im trying to do, is check to see if the person is new to signing up, but the way i did it made me think its a bug.

Think about it like this
would this work, (yes)

<?
$new = 1;
if ($new = 1)
echo "it worked";
?>

Ok, so you know that works, and i know that works, but what about this.

picture a login form
 <form method=post action=login_go.php>
 <input type=test name=username>
 <input type=submit>
 </form>
You enter your username, and push submit, now you are in login_go.php with the value carryed by your username

You write
<?
$link = mysql_connect("localhost", "dbuser", "dbpass")
        or die("Could not connect");
$get = mysql_select_db("dbname",$link)
        or die("Could not select Database");

$user = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username='$username';")); //$username from the form

if ($user[new] == "1") // say there was a feild in the table users called new
 {echo "worked";}
?>
That would not work?, why its so right, theres nothing wrong with that code, but!, now if u add a w to new in the database feild, and add a w to user[new] it will work.

I have figure out how to get around it by simply added another w, or just changing the word new all together. Is new a functions of some type,  or is it a bug when you use it like that. It really doesnt make sense to me, and the people who ive ask about this.

I hope you can give me a anwser to this question, cause i am very curious, and so are my friends.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-17 07:15 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Use $user["new"] instead of $user[new], new is a keyword in PHP. Not a bug.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 06:01:29 2024 UTC