Hello, I am new to this, but here is my problem . . . . I want a password protected page and a login page. So far here is my code for the checkpassword page . . . .
<?
require ("connect.php");
mysql_select_db("mysql" ,$link);
$sql="select value from password where variable = 'password' and value = '$password' ";
$result=mysql_query($sql) or die("error");
$password_good = mysql_affected_rows($link);
if ($password_good) {
session_register("username");
session_name("$username");
session_register("loggedon");
session_name("$loggedon");
$loggedon = "false";
header("location: myproject/index.php");
}
print "Access Denied!";
?>
here is my connect.php . .. . .
<?
$DB_Host= "localhost";
$DB_User = "root";
$DB_Pass = "mayhershalahashbaaz";
$DB_database = "mysql";
$link = mysql_connect($DBHOST,$DBuser,$DBpass) or die("Unalble to connect to database");
// $link = mysql_connect ("localhost", "root") or die ("Could not connect");
mysql_select_db ("mysql" ,$link);
?>
and here is my login page . . . . .
<title>Login</title>
<center><h1>Please Login</h1></center>
<center>
<body>
<center>
<table>
<tr><td>Username</td><td>
<form action="checkpassword.php" method=get>
<input type=text name="username">
</td></tr><tr><td>Password</td><td>
<input type=password name="password">
</td></tr><tr align=center><td></td><td>
<input type=submit value=Login>
</td></tr></table></center>
please if any one can see any thing wrong or has another way please help.
thnx,
Chris