<?php
error_reporting(0);
require("../config.php");
@$adminuser=$_POST['adminuser'];
@$adminpass=md5($_POST['adminpass']);
session_start();
@$yzm=$_POST['yzm'];
if($yzm<>$_SESSION["code"]){ echo "<script>alert('提示！验证码输入错误,请重新输入！');history.back();</script>";exit;}
$sql="select * from hait_admin where user='$adminuser' and password='$adminpass'";
$okis=mysql_query($sql,$conn);
$admin=mysql_fetch_array($okis);
$guanliyuanzh=$admin['user'];
$guanliyuanmm=$admin['password'];
$guanliyuanid=$admin['id'];
$wz_gl=$admin['wz_gl'];
$sql_gl=$admin['sql_gl'];
$admin_gl=$admin['admin_gl'];
$class_gl=$admin['class_gl'];
$add_class=$admin['add_class'];
$article_gl=$admin['article_gl'];
$add_article=$admin['add_article'];
$upload_gl=$admin['upload_gl'];
$hsz_gl=$admin['hsz_gl'];
$quanxian=$admin['quanxian'];
$denglu=$guanliyuanmm.$guanliyuanid;
if($adminuser==$guanliyuanzh and $adminpass==$guanliyuanmm)
{
    setcookie("login","yes",time()+10000,'/');
	setcookie("user",$denglu,time()+10000,'/');
	setcookie("username",$guanliyuanzh,time()+10000,'/');
	session_start();
	$_SESSION[''.$denglu.'-$wz_gl'] = $wz_gl;
    $_SESSION[''.$denglu.'-sql_gl'] = $sql_gl;
    $_SESSION[''.$denglu.'-admin_gl'] = $admin_gl;
    $_SESSION[''.$denglu.'-upload_gl'] = $upload_gl;
    $_SESSION[''.$denglu.'-class_gl'] = $class_gl;
    $_SESSION[''.$denglu.'-add_class'] = $add_class;
    $_SESSION[''.$denglu.'-article_gl'] = $article_gl;
    $_SESSION[''.$denglu.'-add_article'] = $add_article;
	$_SESSION[''.$denglu.'-hsz_gl'] = $hsz_gl;
    header("location:admin.html");
}
else{echo "<script>alert('Hait windows警告，管理员账号或密码出错！');history.back();</script>";}
?>