26.03.2016, 10:20
Try this code:
PHP код:
<?php
session_start();
include "koneksi.php";
if(isset($_SESSION['playername']))
{
go('index.php', 'You already logged in.');
}
if(!isset($_POST['username'], $_POST['password']))
{
go('index.php', 'Please fillout all required forms.');
}
else
{
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);
$hashedpw = strtoupper(hash("whirlpool", $_POST['password']));
$check = get_row("SELECT `playerLevel`,`playerName` from `playerdata` where `name` = '$username' and password = '$hashedpw'");
if(isset($check['playerLevel']))
{
go('index.php', 'Succesfully logged in.');
$_SESSION['playername'] = $check['name'];
$_SESSION['playerlevel'] = $check['level'];
}
else
{
go('index.php', 'Wrong username or password.');
}
}
?>