Jump to content
php.lv forumi

Login skripts netaisa redirekt


Jackal

Recommended Posts

Nu man ir šitāds login skripts, bet viņš netaisa to otro redirekt uz login.php, ja lietotājs ir ievadijis nepareizu paroli vai lietotājvārdu. Kas tur ir nepareizi?

 

 

connect();

$username = $_POST['user'];

$ip = $_SERVER['REMOTE_ADDR'];

mysql_query("UPDATE users SET ip='$ip', online='yes' where `nickname`='$username'");{

$password=$_POST['pass'];

$nickname=$_POST['user'];

$kom=mysql_query("select `nickname`,`password` from users where `password`='$password' and `nickname`='$nickname'");

while($row=mysql_fetch_array($kom)){

if(isset($_POST['login'])){

session_start();

$username=$row['nickname'];

$password=$row['password'];

if ($_POST['user'] == $username && $_POST['pass'] == $password){

$_SESSION['logged'] = $_POST['user'];

header("Location: index.php");

} else {

$_SESSION['logged'] = false;

header("Location: login.php");

}

}

}

}

?>

Edited by Jackal
Link to comment
Share on other sites

:D

 

$kom=mysql_query("select `nickname`,`password` from users where `password`='$password' and `nickname`='$nickname'");

while($row=mysql_fetch_array($kom)){

 

ja lietotaja vards un parole buus nepareiza, mysql neatgrieziis nevienu ierakstu, taatad while neizpildiisies.

Link to comment
Share on other sites

×
×
  • Create New...