<?php
$username = addslashes($_POST['user']);
$username = htmlspecialchars($username);
$password = addslashes($_POST['pass']);
$password = htmlspecialchars($password);
$passwordm = md5($password);
$passwordmd5xx = "hpl]hgadjd".$passwordm;

if(!empty($username) AND !empty($password))
{
include('../includes/config.php');
$query = mysql_query ("SELECT * FROM `user` WHERE username='$username' AND password='$passwordm' AND active='1'") or die ("Query failed");
$counts = mysql_num_rows($query);

if($counts == 0){
include('index.php');
}else{
$rows = mysql_fetch_array($query);

setcookie("useridq",$rows['id'],time()+2592000);
setcookie("passq",$passwordmd5xx,time()+2592000);
echo "<META HTTP-EQUIV='refresh' CONTENT='1; URL=stats.php' />";
mysql_close($connectdb);
}

}else{
include('index.php');
}
?>