<?php
	//引入语言包
	$u_langpackage=new userslp;

	//变量获得
	$user_id = get_sess_userid();
	$formerly_pw = short_check(get_argp('formerly_pw'));
	$new_pw = short_check(get_argp('new_pw'));
	$new_pw_repeat = short_check(get_argp('new_pw_repeat'));

	//数据表定义区
	$t_users = $tablePreStr."users";

	if($new_pw == $new_pw_repeat){
		$dbo = new dbex;
		//读写分离定义函数
		dbtarget('r',$dbServs);

		$sql = "select user_pws from $t_users where user_id = $user_id";
		$user_row = $dbo->getRow($sql);
		$formerly_pw=md5($formerly_pw);
		if($user_row['user_pws']==$formerly_pw){
			$new_pw = md5($new_pw);
			//读写分离定义函数
			dbtarget('w',$dbServs);

			$sql = "update $t_users set user_pws ='$new_pw' where user_id = $user_id;";
			$dbo ->exeUpdate($sql);
			action_return(1,$u_langpackage->u_pw_chg_suc,"modules.php?app=user_pw_change");
		}else{
			action_return(0,$u_langpackage->u_pw_err,"modules.php?app=user_pw_change");
		}
	}else{
		action_return(0,$u_langpackage->u_pw2_err,"modules.php?app=user_pw_change");
	}
?>