Something is wrong in the below code. Normally when I get an Internal 500 error
it just means I missed a ";" or a "}" / "{" somewhere. My edited code is listed below:
<?php
//Create game account
$mysqli = new mysqli("localhost", "root", "root", "realdb_table_data");
if (mysqli_connect_errno()) {
echo("Sorry, the server is 'Under Maintainance'");
exit();
}
$name = $_COOKIE['name'];
$email = $mysqli->real_escape_string($_POST['email']));
$password = $mysqli->real_escape_string($_POST['password']);
$hash = sha1(strtolower($name) . $password);
if($password == null || $password == "" || (strlen($password)) < 4){
header("Location:thegoods.php?error=7");//Invalid password
} else if($email == null || $email == "" || (strlen($email) <= 6)){
header("Location:thegoods.php?error=8");//Invalid Email address
} else{
$result=$mysqli->query("SELECT * FROM userstable WHERE name='$name'");
/* fetch associative array */
while ($row = $result->fetch_assoc()) {
$pass = $row['pass'];
}
/* free result set */
$result->free();
if($hash != $pass){
header("Location:thegoods.php?error=6");//Invalid Password Match
} else {
$mysqli->query("UPDATE userstable SET email='$email' WHERE name='$name'");
}
}
$mysqli->close();
?>