<?php
/* MyTickets [   by = www.phpx3.com   ]
* Faha1ad2@hotmail.com
* Writed By : Fahad S. Al-ghudaier
* All Right Reseved (C) 2010
*/
session_start();
include("Admin_Function.php");
head('','','',2);
includes();


## Languages;
$language				= array();
$language['l3']			= 'لم تقم بادخال اسم المستخدم';
$language['l4']			= 'لم تقم بإدخال كلمة المرور';
$language['l5']			= 'المعذره , ليس لديك صلاحية الدخول للوحة التحكم';
$language['l6']			= 'خطأ , اسم المستخدم او كلمة المرور خطأ';
$language['l7']			= 'اضغط هنا للرجوع';



$user = addslashes($_POST['username']);
$pass = md5($_POST['password']);
if($user == ""){
	echo '<br /><div class="error">',$language['l3'],'</div>';
	show('login.htm');
}else{
if($pass==""){
	echo '<br /><div class="error">', $language['l4'],'</div>';
	show('login.htm');
}else{
	$SQL = mysql_query("SELECT `id`,`username`,`password`,`group_id` FROM `members` WHERE `username`='".mysql_real_escape_string($user)."' AND `password`='".mysql_real_escape_string($pass)."' ") or die (" ERROR <br> خطأ ");
	if( @mysql_num_rows($SQL) == 1){
		$info 	= mysql_fetch_array($SQL);
		$group	= mysql_fetch_array(mysql_query("SELECT `top_man`,`allow_cp` FROM `groups` WHERE `id`='".$info['group_id']."'"));
		if($group['top_man'] == 1 OR $group['allow_cp'] == 1){
		
		$_SESSION['tickets_session'] 	= $info['username'];
		$_SESSION['member_username'] 	= $info['username'];
		$_SESSION['member_password'] 	= $info['password'];
		$_SESSION['member_id']			= $info['id'];
		$_SESSION['group_id']			= $info['group_id'];
	
		$EB = 1;
		ok('admin.php',0);
		}else{
			echo '<center><div id="error_msg">'.$language['l5'].'</div></center>';
		}
	}else{
		echo '<br /><div class="error">',$language['l6']," <a href='index.php'>".$language['l7']."</a></div>";
	}
}
}
down(2);
?>