<?php
header("content-type:text/html;charset=utf-8");
error_reporting(0);
require "../sql.php";
if(!isset($_COOKIE['yz'])){header("location:admin.php");exit;}
$password=$_POST['password'];
$password2=$_POST['password2'];
if($password===$password2){
  $xgsql="update admin set password='{$password}' where id={$_COOKIE['yz']}";
  if(mysql_query($xgsql)){echo "<script>alert('密码修改成功')</script>";
      setcookie("yz","",time()-3600,"/"); 
  }else{echo "密码修改失败";}
      echo "<script>location='admin.php'</script>";  
}else{
    echo "<script>alert('两次密码不一致请重新输入')</script>";
    echo "<script>location='upmima.php'</script>";
}



?>