This script previously worked on a different host before I moved here. I just had to change the db name, but now I get an Internal Server Error and I just don't know why. Any help would be appreciated.
My login form:
Validate.php
Thank you.
Have a nice day.
My login form:
PHP Code:
<form method=post action="validate.php">
Username:<BR>
<input type="text" name="username" class="iboxes"><BR>
Password:<BR>
<input type="password" name="password" class="iboxes"><BR>
<input type="submit" name="submit" class="sbutton" value="Log In">
</form>
PHP Code:
/* Check User Script */
session_start(); // Start Session
// Convert to simple variables
$username = $_POST['username'];
$password = $_POST['password'];
if((!$username) || (!$password)){
header("Location: relogin.php");
exit();
}
if ($submit) {
$db = mysql_connect(localhost,<username>,<pass>) or die("Unable to connect to database");
mysql_select_db ("<dbname>");
$result=mysql_query("select * from users where name='$username' && password='$password'") or die ("Username and password combination not found.");
while ($row=mysql_fetch_array($result)) {
if ($row["password"]==$password && $row["name"]==$username) {
header($row["url"]);
// Register some session variables!
session_register('username');
$_SESSION['username'] = $username;
exit();
}
}
header("Location: relogin.php");
}
Have a nice day.
Comment