function uc_api_updatepw($get, $post) { $username = $get['username']; $password = ZUser::GenPassword($get['password']); if (strtolower(UC_CHARSET) != 'utf-8') { $username = mb_convert_encoding($username, 'UTF-8', UC_CHARSET); } $u = Table::Fetch('user', $username, 'username'); if ($u && $u['password'] != $password) { Table::UpdateCache('user', $u['id'], array('password' => $password)); if ($_SESSION['user_id'] && $_SESSION['user_id'] == $u['id']) { unset($_SESSION['user_id']); } } return API_RETURN_SUCCEED; }
function zuitu_uc_login($email, $pass) { if (!function_exists('uc_user_login')) { return array(); } if (!defined('UC_API')) { return array(); } $isuid = strpos($email, '@') ? 2 : 0; if (strtolower(UC_CHARSET) != 'utf-8') { $email = mb_convert_encoding($email, UC_CHARSET, 'UTF-8'); } $ucresult = uc_user_login($email, $pass, $isuid, 0); $uckey = array('uid', 'username', 'password', 'email', 'duplicate'); $ucresult = array_combine($uckey, $ucresult); $ucresult = zuitu_encode_array($ucresult); $ucresult = zuitu_encode_detect($ucresult); DB::Query('SET NAMES UTF8;'); if ($ucresult['uid'] > 0 && $ucresult['email']) { $eu = Table::Fetch('user', $ucresult['email'], 'email'); if ($eu) { if ($eu['username'] != $ucresult['username']) { $epass = ZUser::GenPassword($ucresult['password']); Table::UpdateCache('user', $eu['id'], array('username' => $ucresult['username'], 'password' => $epass)); return Table::FetchForce('user', $eu['id']); } return $eu; } unset($ucresult['uid']); unset($ucresult['duplicate']); zuitu_encode_array($ucresult); zuitu_encode_detect($ucresult); $newuser_id = ZUser::Create($ucresult, false); if ($newuser_id) { return Table::Fetch('user', $newuser_id); } } return array(); }
if ($exist_user) { Session::Set('user_id', $exist_user['id']); Utility::Redirect(get_loginpage(WEB_ROOT . '/index.php')); } if ($_POST) { if ($_POST['sns_action'] == 'bind') { $email = $_POST['email']; if (!Utility::ValidEmail($email, true)) { Session::Set('error', 'Email地址为无效地址'); redirect(WEB_ROOT . '/account/qq_bind.php'); } if ($_POST['password'] == "") { Session::Set('error', '请输入正确密码'); redirect(WEB_ROOT . '/account/qq_bind.php'); } $encrypt_pass = ZUser::GenPassword($_POST['password']); $update = array('sns' => $sns); $sns_bind = Table::Fetch('user', $email, 'email'); if (!$sns_bind) { Session::Set('error', '邮箱输入不正确'); Utility::Redirect(WEB_ROOT . '/account/qq_bind.php'); } if ($sns_bind['password'] != $encrypt_pass) { Session::Set('error', '密码输入不正确'); Utility::Redirect(WEB_ROOT . '/account/qq_bind.php'); } if ($sns_bind['sns']) { Session::Set('error', '绑定失败,Email已绑定'); Utility::Redirect(WEB_ROOT . '/account/qq_bind.php'); } if (ZUser::Modify($sns_bind['id'], $update)) {
$table = new Table('user', $_POST); $up_array = array('username', 'realname', 'mobile', 'zipcode', 'address', 'secret', 'qq'); // unique email per user if (strpos($email, '@')) { $eu = Table::Fetch('user', $email, 'email'); if ($eu && $eu['id'] != $id) { Session::Set('notice', 'Email地址已经存在,不能修改'); redirect(WEB_ROOT . "/manage/user/index.php"); } } if ($login_user_id == 1 && $id > 1) { $up_array[] = 'manager'; } if ($id == 1 && $login_user_id > 1) { Session::Set('notice', '你无权修改超级管理员信息'); redirect(WEB_ROOT . "/manage/user/index.php"); } $table->manager = strtoupper($table->manager) == 'Y' ? 'Y' : 'N'; if ($table->password) { $table->password = ZUser::GenPassword($table->password); $up_array[] = 'password'; } $flag = $table->update($up_array); if ($flag) { Session::Set('notice', '修改用户信息成功'); redirect(WEB_ROOT . "/manage/user/edit.php?id={$id}"); } Session::Set('error', '修改用户信息失败'); $user = $_POST; } include template('manage_user_edit');
<?php require_once dirname(dirname(__FILE__)) . '/app.php'; $vid = ''; if ($login_user['passowrd']) { $vid = ZUser::GenPassword($login_user['passowrd'] . time()); Session::Set('vid', $vid); } $ramd = rand(1, 5); if ($_POST) { if ($_REQUEST['vid']) { } } include template('play_puzzle');
Session::Set('error', '每IP每手机号每小时只能找回一次密码'); redirect(WEB_ROOT . '/account/repass.php'); } else { $user = Table::Fetch('user', strval($_POST['mobile']), 'mobile'); if ($user) { //设置6位随机数字密码 $new_password = Utility::VerifyCode(); $content = $INI['system']['sitename'] . " 您的用户名:" . $user['username'] . " 新密码:" . $new_password . " 请及时修改密码。"; //长度不能超过70个字符 $ret = sms_send($_POST['mobile'], $content); if ($ret === true) { //插入获取验证码数据记录 $verifycode_data = array('mobile' => $_POST['mobile'], 'getip' => Utility::GetRemoteIp(), 'verifycode' => $new_password, 'dateline' => time(), 'reguid' => $user['id'], 'regdateline' => time(), 'status' => 3); $table = new Table('verifycode', $verifycode_data); $table->insert(array('mobile', 'getip', 'verifycode', 'dateline', 'reguid', 'regdateline', 'status')); $password = ZUser::GenPassword($new_password); Table::UpdateCache('user', $user['id'], array('password' => $password, 'recode' => '')); Session::Set('notice', '成功发送找回密码短信到手机号:' . $_POST['mobile'] . ' 请稍候查看短信及时修改密码'); redirect(WEB_ROOT . '/account/repass.php'); } else { Session::Set('error', '找回密码短信发送失败,错误码:' . $ret . ''); redirect(WEB_ROOT . '/account/repass.php'); } } Session::Set('error', '你的手机号没有在本站注册'); redirect(WEB_ROOT . '/account/repass.php'); } } } } } else {
<?php require_once dirname(dirname(__FILE__)) . '/app.php'; if (isset($_SESSION['user_id'])) { unset($_SESSION['user_id']); ZLogin::NoRemember(); $login_user = $login_user_id = $login_manager = $login_leader = null; } $code = strval($_GET['code']); if ($code == 'ok' && is_get()) { die(include template('account_reset_ok')); } $user = Table::Fetch('user', $code, 'recode'); if (!$user) { Session::Set('error', '重设密码的链接无效'); redirect(WEB_ROOT . '/index.php'); } if (is_post()) { if ($_POST['password'] == $_POST['password2']) { $password = ZUser::GenPassword($_POST['password']); Table::UpdateCache('user', $user['id'], array('password' => $password, 'recode' => '')); redirect(WEB_ROOT . '/account/reset.php?code=ok'); } Session::Set('error', '两次输入的密码不匹配,请重新设置'); } include template('account_reset');