22.04.2017, 18:10
basically the passwords in the mysql database are hashed with sha1 and i'm trying to make an ucp but i don't know how to load the account with sha1 hashed password... can anyone help?
this is the line that has to be changed i believe
PHP код:
<?php
if(!defined('AWM'))
die('Nope.');
if(Config::isLogged()) header('Location: ' . Config::$_PAGE_URL . 'profile');
if(isset($_POST['login_submit'])) {
if(!$_POST['login_username'] || !$_POST['login_password']) {
echo '<font color="red"><b>Complete all fields.</b></font>';
} else {
$q = Config::$g_con->prepare('SELECT `reg_id` FROM `players` WHERE `name` = ? AND `pass` = ?');
$q->execute(array($_POST['login_username'], strtoupper(hash('whirlpool',$_POST['login_password']))));
if($q->rowCount()) {
$row = $q->fetch(PDO::FETCH_OBJ);
$_SESSION['awm_user'] = $row->playerID;
echo '<font color="green"><b>You have successfully logged in. You will be redirected in <b>3</b> seconds.</b></font><br><br>';
echo '<meta http-equiv="refresh" content="3;URL=\''.Config::$_PAGE_URL.'profile\'/>';
}
else echo '<font color="red"><b>Invalid username or password.</b></font>';
}
}
?>
<link href="http://redpanel.bugged.ro/css/font-awesome.min.css" media="all" type="text/css" rel="stylesheet">
<br><br>
<form action="" method="post" >
<input type="text" placeholder="Username" id="login_username" name="login_username" /> <br>
<input type="password" placeholder="Password" id="login_password" name="login_password" /> <br>
<input type="submit" value="Login" id="login_submit" name="login_submit">
</form>
PHP код:
$q->execute(array($_POST['login_username'], strtoupper(hash('whirlpool',$_POST['login_password']))));