Hi
could anyone please help me to sort out this proble, when I try to execute
the error query not excuted, i know that the proble is the sekect command
but no clue what is it!!
PHP Code:<?php // script to check if the user stored in the MySQL database previously
session_start();
include "conn.inc.php";
if(isset($_POST['submit']))
{
$query = "select username, password from user" .
"where username = '" . $_POST['username'] . "' " . "ADN password = (PASSWORD('" . $_POST['password'] . " '))";
// excute the query
$result = mysql_query($query)
or die("query not excuted!");
if(mysql_num_rows($result) == 1)
{
$_SESSION['user_logged'] = $_SESSION['username'];
$_SESSION['user_password'] = $_SESSION['password'];
header("Refresh: 5; URL=" . $_POST['redirect'] . "");
echo " you being redirected to your original page reques<br>";
echo "(if your browser not support this, " .
"<a href =\"" . $_POST['redirect'] . "\"> Click here</a>)";
}
else
{
?>
<html>
<head><title> user_login</title></head>
<body>
<p>
invalid and /or password<br>
Not registered?
<a href="register.php">Click here</a> to register.<br>
<form action="user_login.php" method="POST">
<input type="hidden" name="redirect" value="<?php echo $_POST ['redirect']; ?>">
Username : <input type="text" name="username"><br>
Password : <input type="password" name="password"><br><br>
<input type="submit" name="submit" value="Login">
</form>
</p>
</body>
</html>
<?php
}
}
else
{
if(isset($_GET['redirect']))
{
$redirect = $_GET['redirect'];
}else
{
$redirect ="index1.php";
}
?>
<html>
<head><title>Management system </title></head>
<body>
<p>
login below by supplying your username/password..<br>
or<a href="register.php"> Click here</a> to register.<br><br>
<form action="user_login.php" method="POST">
<input type="hidden" name="redirect" value="<?php echo $redirect; ?>">
Username : <input type="text" name="username"><br>
Password : <input type="password" name="password"><br><br>
<input type="submit" name="submit" value="Login">
</form>
</p>
</body>
</html>
<?php
}
?>




Reply With Quote