<?php
require_once("../check.php");
require_once("../../config.php");
isset($_POST['pass1'])?$pass1 = $_POST['pass1']:$pass1=null;
isset($_POST['pass2'])?$pass2 = $_POST['pass2']:$pass2=null;
isset($_POST['pass3'])?$pass3 = $_POST['pass3']:$pass3=null;
$sql = "select * from dunling_user where username='$username'";
$ery = mysql_query($sql,$config);
$user = mysql_fetch_array($ery);
$userpass = $user['userpass'];
$userrand = $user['rand'];
$jiupass = sha1($pass1.$userrand);
if($jiupass!=$userpass){
    echo 'error';
    exit;
}else{
$newpass = sha1($pass2.$userrand);
$upsql = "update dunling_user set userpass='$newpass' where username='$username'";
mysql_query($upsql,$config);
mysql_close();
echo "ok";
    
}

?>