STAUFFi
31st July 2013, 01:43
I create now a better website with register and loginsystem.
but i have a problem.
my pw,user and email are prodected with 512 bits.
when i use my login panel he dont read the data from mysql ( user_data)
and dont switch to index.php.
Need help.
<? session_start(); ob_start();
include_once "connect_to_mysql.php";
if(isset($_POST['login_sub'])){
$email = $_POST['email'];
$pass = hash("sha512", $_POST['pass']);
$sql = mysql_query ("SELECT + FROM userdata WHERE email = '".mysql_real_escape_string($email)."'");
$row = mysql_fetch_object($sql);
if($row->status == 0){echo "Dein Account wurde gesperrt.";}else
if($email == $row->email){
if($pass == $row->password){
if($row->status == 1){
$_SESSION["username"] = $row->id;
mysql_query("UPDATE user_data SET online= '1'");
header("Location:index.php");}}else{echo "PW";}}else{echo "email";}
}
echo "
<form action'' method='post'>
<input type='text' name'email' required='required' placeholder='Your Email'><br>
<input type='password' name'pass' required='required' placeholder='Your Password'><br>
<input type='submit' name'login_sub' value='Einloggen'>
</form>
";
?>
but i have a problem.
my pw,user and email are prodected with 512 bits.
when i use my login panel he dont read the data from mysql ( user_data)
and dont switch to index.php.
Need help.
<? session_start(); ob_start();
include_once "connect_to_mysql.php";
if(isset($_POST['login_sub'])){
$email = $_POST['email'];
$pass = hash("sha512", $_POST['pass']);
$sql = mysql_query ("SELECT + FROM userdata WHERE email = '".mysql_real_escape_string($email)."'");
$row = mysql_fetch_object($sql);
if($row->status == 0){echo "Dein Account wurde gesperrt.";}else
if($email == $row->email){
if($pass == $row->password){
if($row->status == 1){
$_SESSION["username"] = $row->id;
mysql_query("UPDATE user_data SET online= '1'");
header("Location:index.php");}}else{echo "PW";}}else{echo "email";}
}
echo "
<form action'' method='post'>
<input type='text' name'email' required='required' placeholder='Your Email'><br>
<input type='password' name'pass' required='required' placeholder='Your Password'><br>
<input type='submit' name'login_sub' value='Einloggen'>
</form>
";
?>