Dynamic Cookies Names with MySQL Queries.
Posted: Sat Aug 09, 2003 5:09 am
Hi, I've designed a dynamic moduler based PHP script, but I am having a problem with using dynamic cookies.
Well, what do I mean by a dynamic cookie?
Well the cookie name is dependant on what the site title is, which is looked up in a MySQL table and stored in $config_site, which is easy to understand.
To compare the infomation sent by a from (e.g when logging on) with a user within a database is quite straight-forward.
However, I am having trouble with the syntax when when checking if a user is logged on, take a look ->
Now I know I can't use this because it'll attempt to close the quotes when it reaches itle.'[use[.
So I looked in the MySQL manual and you can use double quotes to indicate the start of a new quote opening like this ->
However, you can't do that with PHP because of the way it parses strings.
I know I'm doing something wrong, can anyone help?
Well, what do I mean by a dynamic cookie?
Well the cookie name is dependant on what the site title is, which is looked up in a MySQL table and stored in $config_site, which is easy to understand.
To compare the infomation sent by a from (e.g when logging on) with a user within a database is quite straight-forward.
Code: Select all
$login_link = mysql_query("SELECT * FROM `$mysql_user` WHERE 1 AND `username` = '$_POSTїusername]' AND `password` = '$_POSTїpassword]' LIMIT 0, 1",$db);Code: Select all
$user_link = mysql_query("SELECT * FROM `$mysql_user` WHERE 1 AND `username` = '$_COOKIEї$config_title.'їusername]']' AND `password` = '$_COOKIEї$config_title.'їpassword]']' LIMIT 0, 1",$db);So I looked in the MySQL manual and you can use double quotes to indicate the start of a new quote opening like this ->
Code: Select all
$user_link = mysql_query("SELECT * FROM `$mysql_user` WHERE 1 AND `username` = '$_COOKIEї$config_title.''їusername]'']' AND `password` = '$_COOKIEї$config_title.''їpassword]'']' LIMIT 0, 1",$db);I know I'm doing something wrong, can anyone help?