View Single Post
Old 05-07-2008, 05:31 PM   #2 (permalink)
Highway of Life
The Wanderer
 
Highway of Life's Avatar
 
Join Date: May 2008
Location: Beware of programmers carrying screwdrivers
Posts: 21
Thanks: 0
Highway of Life is on a distinguished road
Default

Anything within the $_COOKIE array can easily be spoofed and become an SQL Injection, it is still user input, so you would need to sanitise the variable before inserting it into your SQL Query.

Also, your column calls are ambiguous, you won’t need to use AS.
Example, in this query:
PHP Code:
$sql "SELECT m.mid AS mid,
        m.username AS username,
        m.email AS email 
        FROM members AS m 
        WHERE username = '" 
mysql_real_escape_string($username) . "'"
Your field names when used within mysql_fetch_assoc() are going to be:
username, email, and mid.
And they would be exactly the same if you just used the column names without the alias:
PHP Code:
$sql "SELECT m.mid, m.username, m.email 
        FROM members AS m
        WHERE username = '" 
mysql_real_escape_string($username) . "'"
They would still be: 'mid', 'username', and 'email'.
__________________
- Highway of Life
[ Software Engineer | PHP Developer | phpBB.com Team Member ]
phpBB Academy at StarTrekGuide
Send a message via AIM to Highway of Life Send a message via MSN to Highway of Life
Highway of Life is offline  
Reply With Quote