i have the following code :
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<body>
<form name="form1" method="POST">
<table>
<tr>
<td>Username</td>
<td> <input type="text" name="text1"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="pwd"></td>
</tr>
<tr>
<td><input type="submit" name="submit1"></td>
</tr>
</table>
</form>
</body>
</html>
<?php
include 'config.php';
mysql_select_db("sess_db",$con);
?>
<?php
if(isset($_POST['submit1'])) {
$result=mysql_query("SELECT username,password FROM siteinfo ");
$result2=mysql_fetch_row($result);
$count=mysql_num_rows($result);
$nm = $_POST['text1'];
$pwd = $_POST['pwd'];
if ($result == $nm && $result == $pwd) {
$_SESSION['luser'] = $name;
$_SESSION['start'] = time();
//the expire u put it
$_SESSION['expire'] = $_SESSION['start'] + (30 * 60);
header('Location: homepage.php');
}
else {
echo "Please Enter a Correct Username & Password ! ";
}
}
?>
in the login page i must enter username : joseph and password : moon
but i want to remove this two variables $name & $password and link it to my database that contains usernames and passwords, if i enter one of them redirect me to the
homepage.php
session_start();after your<?php