PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
i am working on a forum script, i want it to check the database for the user's age, the user's username is stored in a cookie when they login, i want to query the database for age where username is the cookie walue
<?php
include "db.php";
$coppa_age = "12";
$db_userage = mysql_query("SELECT age FROM users WHERE username='$_COOKIE['complexscripting']'");
$db_age = mysql_fetch_array($db_userpass);
$db_age = $db_age['age'];
if ($age > $coppa_age) {
include "forum_areas.php";
}
else{
echo "you are under 13, according to coppa guidelines you are not allowed to use the forums!";
}
?>
yeah i see my mistake now, and its a darn stupid one, i copied a majority of the code from another page of mine and i dod not correct correctly. Thanks mrvanjohnson
<?php
include "../db.php";
$coppa_age = "12";
if ($_COOKIE["complexscriptingloginvalue"] == "loggedin"){
$db_userage = mysql_query("SELECT age FROM users WHERE username='$_COOKIE[complexscriptinguser]'");
$db_age = mysql_fetch_array($db_userage);
$db_age = $db_age['age'];
if ($db_age > $coppa_age)
{
include "forum_areas.php";
}
else{
echo "you are under 13, according to coppa guidelines you are not allowed to use the forums!";
}
}
else{
echo "please login!";
}
?>