<?php
include("loginkey.php");
include("include/config.php");//引入公共变量文件
include("include/common.php");//引入公共变量文件
$uname = cinput($_POST['lm_username']);
$uoldpass = md5(cinput($_POST['lm_oldpass']));
$unewpass = md5(cinput($_POST['lm_newpass']));
$uid = cinput($_POST['lm_userid']);
$umail = cinput($_POST['lm_email']);

//查找数据库是否有同名
$sqlstr="select * from limao_admin where lm_username='".mysql_real_escape_string($loginuser)."' and lm_password='".mysql_real_escape_string($uoldpass)."' limit 1";
$rs = limaors($sqlstr);
$rows=mysql_fetch_assoc($rs);
if($rows){
//写入数据库 
$sql="update limao_admin set lm_password='".mysql_real_escape_string($unewpass)."',lm_userid='".mysql_real_escape_string($uid)."',lm_email='".mysql_real_escape_string($umail)."' where lm_username='".mysql_real_escape_string($loginuser)."'";
limaors($sql);
viewmsg('用户修息成功,请重新登陆！','loginout.php');  
exit();
}else{
	 
viewmsg('验证旧密码失败！','user_modif.php');

} 
?>