vendredi 27 février 2015

Login Form keeps coming back

This is my login page :


" This is the form , form action="" is set to none (may be the problem?)



< form action="" method="POST">

Username: < input type="text" name="user">

Password: < input type="password" name="pass">

< input type="submit" value="Login" name="submit" />

< /form>"



$query=mysql_query("SELECT * FROM login WHERE username='".$user."' AND password='".$pass."'");
$numrows=mysql_num_rows($query);
if($numrows!=0)
{
while($row=mysql_fetch_assoc($query))
{
$dbusername=$row['username'];
$dbpassword=$row['password'];
}

if($user == $dbusername && $pass == $dbpassword)
{
session_start();
$_SESSION['sess_user']=$user;

/* Redirect browser */
header("Location: member.php");
}
} else {
echo "Invalid username or password!";
}


second page



<?php
session_start();
if(!isset($_SESSION["sess_user"])){
header("location:login.php");
} else {


Whenever I click the 'log in' button , the form comes back instead of the page redirecting me .. help please ,


thanks in advance


Aucun commentaire:

Enregistrer un commentaire