} } else { // 如果是刚登陆 $tmpInfo = mysql_query("select * from xy_member where member_name = '" . $_SESSION['user_name'] . "'"); if (mysql_num_rows($tmpInfo)) { // 如果记录存在 $row = mysql_fetch_array($tmpInfo); foreach ($row as $key => $value) { if ($key != 'member_ID') { $devMemberInfo[$key] = $value; } } } else { // 用户在地址栏内直接输入地址试图跳转到本页 echo "<script>window.location.replace('login.php')</script>"; } } return $devMemberInfo; } } $dl_memberInfo = new MemberInfo(); // 实例化MemberInfo() // 连接数据库 $con = mysql_connect($server, $userName, $password); if (!$con) { die('数据库连接失败!' . '<br />'); } mysql_query("set names 'utf8'"); mysql_select_db("xiyoulinux", $con); $memberInfo = $dl_memberInfo->getMemberInfo(); mysql_close($con);
/** * 用户修改密码 */ public function actionPassword() { $model = MemberInfo::model()->findByPk(Yii::app()->user->getId()); $this->render('password', array('model' => $model)); }