login not working
Posted: Thu Sep 18, 2008 1:47 pm
Code: Select all
<?php
include("session.php");
include("connect.php");
if (isset($_POST['txtName']) && isset($_POST['txtPass'])){
$uname = strip_tags($_POST['txtName']);
$upass = strip_tags($_POST['txtPass']);
if(!is_resource($dbc)) {
header ("Location: login.php?e=1");
echo "Failed to connect to the server\n";
}
else {
$queryL = sprintf("SELECT * FROM users WHERE username='$uname' AND password='$upass'", mysql_real_escape_string($uname, $dbc), mysql_real_escape_string($upass, $dbc));
$resultL = mysql_query ($queryL);
while($row = mysql_fetch_array($resultL,MYSQL_ASSOC))
if (mysql_affected_rows($dbc) > 0) {
setcookie ('username', $uname );
setcookie ('userType', $row[userType] );
header ("Location: default.php");
//echo "do all the login stuff here now";
}
else {
header ("Location: login.php?e=2");
//echo "the user has input incorrect details";
}
}
}
?>
any ideas guys