Buenas aquí te pongo todo el código con el query:
Código PHP:
<?php
if(!$in) exit();
if($_POST['login']){
$p_user = sqlv($_POST['user']);
$p_pass = sqlv($_POST['pass']);
if(varlen($p_user, 3, 32) && varlen($p_pass, 3, 32)){
$sha_pass = SHA1(strtoupper($p_user.':'.$p_pass));
$checkuser = $db->fetch_assoc($db->query('SELECT COUNT(*) AS count, IFNULL(gmlevel, 0) AS gmlevel, a.id AS aid FROM
account a LEFT JOIN account_access ac ON a.id = ac.id WHERE sha_pass_hash = "'.$sha_pass.'" GROUP BY gmlevel'));
if($checkuser['count'] != 0 && $checkuser['gmlevel'] >= REQUEST_RANK){
$_SESSION['login'] = $checkuser['aid'];
newpage('index.php?logged');
}
else
jsalert('Datos incorrectos, o su rango no es lo suficientemente alto');
}
}
?>
<form action="index.php" method="post">
<table cellpadding="5" cellspacing="0" width="80%">
<tr>
<td align="right">User:</td>
<td><input name="user" type="text" /></td>
</tr>
<tr>
<td align="right">Password:</td>
<td><input name="pass" type="password" /></td>
</tr>
<tr>
<td></td>
<td><input name="login" type="submit" value="login" /></td>
</tr>
</table>
</form>
Y gracias por toda la ayuda de ante mano