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!
<?
ob_start();
include("../../clanmanager/config.php");
$sql = "SELECT * FROM cm_admin WHERE name=$name and pass=$pass";
$result = mysql_query($sql) or die ("Unable to get results.");
$num = mysql_numrows($result) or die ("Your Username and/or Password are incorrect. If you feel you have recieved this message in error, please contact the <a href="mailto:website@hot.rr.com">webmaster</a>");
if ($num == 1) {
print("Welcome to ClanManager! You are logged in as $name !");
setcookie("p_user",$username,time()+1209600,"/","maxxxtorque.com","0");
ob_end_flush();
}
print("<BR><BR>Return to <a href="/prodigy">Prodigy</a>");
?>
Whats the error MySQL is sending you? Also, using the mysql_error() function is pretty descriptive about what is exactly wrong. And one other thing, try not using the die function, use:
I'm not sure hot to exactly set cookies, but I'm sure there isn't a p_user, nor a $username in that whole program. you may need to rename one of those till you get it right.
$num = mysql_numrows($result) or die ("Your Username and/or Password are incorrect. If you feel you have recieved this message in error, please contact the <a href="mailto:website@hot.rr.com">webmaster</a>");
if ($num == 1) {
print("Welcome to ClanManager! You are logged in as $name !");
I don't see where you are going with the die statement from $num = mysql_numrows($result) or die... Whats the trigger for the die statement?
I do logins like this.
if($num == 0):
echo"Your Username and/or Password are incorrect. If you feel you have recieved this message in error, please contact the <a href="mailto:website@hot.rr.com">webmaster</a>";
else:
echo"Welcome to ClanManager! You are logged in as $name !";
endif;