<?php
error_reporting(0);
isset($_POST['adminname'])?$adminname=$_POST['adminname']:$adminname=null;
isset($_POST['adminpass'])?$adminpass=$_POST['adminpass']:$adminpass=null;
ini_set("date.timezone","PRC");
$datetime = date("Y-m-d H:i:s");
$ip = $_SERVER['REMOTE_ADDR'];
require_once("../config.php");
require_once("core/key.php");
$pass = sha1(md5($adminpass).md5($key));
$loginsql = "select adminname,adminpass from dunling_admin where adminname='$adminname' and adminpass='$pass'";
$loginery = mysql_query($loginsql,$config);
$logincheck = mysql_num_rows($loginery);
if($logincheck=="1"){
    $ck1 = setcookie("adminname",$adminname,time()+3600*24,'/');
    $ck2 = setcookie("adminpass",$pass,time()+3600*24,'/');
if(($ck1=="1") and ($ck2=="1")){
    echo "ok";
}
    $logsql = "insert into dunling_admin_login_log (adminname,ip,datetime,log) values ('$adminname','$ip','$datetime','1')";
    mysql_query($logsql,$config);
    exit;
}else{
    $logsql = "insert into dunling_admin_login_log (adminname,ip,datetime,log) values ('$adminname','$ip','$datetime','0')";
    mysql_query($logsql,$config);
    exit;
}
mysql_close();
?>