<?php
require_once ("../check.php");
require_once ("../../config.php");
require_once ("key.php");
isset($_POST['yuanmima']) ? $yuanmima = $_POST['yuanmima'] : $yuanmima = null;
isset($_POST['xinmimaa']) ? $xinmimaa = $_POST['xinmimaa'] : $xinmimaa = null;
isset($_POST['xinmimab']) ? $xinmimab = $_POST['xinmimab'] : $xinmimab = null;
isset($_POST['adminname']) ? $adminname = $_POST['adminname'] : $adminname = null;
$yuanmima = sha1(md5($yuanmima) . md5($key));
$yuansql = "select * from dunling_admin where adminname='$adminname' and adminpass='$yuanmima'";
$yuansql = mysql_query($yuansql, $config);
$yuannum = mysql_num_rows($yuansql);
if ($yuannum != "1") {
    echo "0";
    exit;
}
if ($xinmimaa !== $xinmimab) {
    echo "1";
    exit;
}

$adminpass = sha1(md5($xinmimab) . md5($key));
$upsql = "update dunling_admin set adminpass='$adminpass' where adminname='$adminname'";
$oks = mysql_query($upsql, $config) or die("delerror");
mysql_close();
if ($oks) {
    echo "ok";
}
?>