Example #1
0
 function setok_f()
 {
     if (!$this->sys_config["reg_status"]) {
         $message = $this->sys_config["close_reg"] ? $this->sys_config["close_reg"] : "No register!";
         echo $message;
         exit;
     }
     if ($_SESSION["user_id"]) {
         error('', $this->url('home'));
     }
     $array = array();
     $array["username"] = $this->trans_lib->safe("name");
     $array["phone"] = $this->trans_lib->safe("phone");
     $newpass = $this->trans_lib->safe("password");
     $array["job"] = $this->trans_lib->safe("job");
     $array["company"] = $this->trans_lib->safe("company");
     if (!$newpass) {
         echo $this->lang["empty_pass"];
         exit;
     }
     $array["pass"] = sys_md5($newpass);
     $checkphone = $this->checkphone($array["phone"]);
     if ($checkphone != "0") {
         echo $chkname;
         exit;
     }
     $array["regdate"] = $this->system_time;
     $array["status"] = 1;
     //会员组
     $this->load_model("usergroup");
     $group_rs = $this->usergroup_m->get_default();
     $array["groupid"] = $group_rs["id"];
     $user_id = $this->user_m->save($array);
     //会员注册成功,模拟登录
     $_SESSION["user_id"] = $user_id;
     $_SESSION["user_name"] = $array["username"];
     $_SESSION["group_id"] = $array["groupid"];
     $tmp_array = $array;
     $tmp_array["id"] = $user_id;
     $_SESSION["user_rs"] = $tmp_array;
     //发送欢迎信息
     if ($this->sys_config["smtp_reg"]) {
         $this->load_lib("email");
         $this->email_lib->reg($user_id);
     }
     echo "1";
     exit;
 }
Example #2
0
 function ok_f()
 {
     if (!$this->sys_config["login_status"]) {
         $message = $this->sys_config["close_login"] ? $this->sys_config["close_login"] : "******";
         echo $message;
         exit;
     }
     $phone = $this->trans_lib->safe("phone");
     $password = $this->trans_lib->safe("password");
     //账号和密码为空时警告
     if (!$phone || !$password) {
         echo $this->lang["login_false_empty"];
         exit;
     }
     //检查会员不存在时的警告
     $rs = $this->user_m->user_from_phone($phone);
     if (!$rs) {
         echo $this->lang["login_false_rs"];
         exit;
     }
     //密码检测
     $password = sys_md5($password);
     if ($rs["pass"] != $password) {
         echo $this->lang["login_false_password"];
         exit;
     }
     //检查会员状态的警告
     if (!$rs["status"]) {
         echo $this->lang["login_false_check"];
         exit;
     }
     //检查会员是否被锁定
     if ($rs["status"] == 2) {
         echo $this->lang["login_false_check"];
         exit;
     }
     //将数据存到session中
     if ($rs["status"] == 1 && $rs["pass"] == $password) {
         $_SESSION["user_id"] = $rs["id"];
         $_SESSION["user_name"] = $rs["username"];
         $_SESSION["group_id"] = $rs["groupid"];
         $_SESSION["user_rs"] = $rs;
         echo "1";
         exit;
     }
 }
Example #3
0
 function login_ok_f()
 {
     $login_name = $this->trans_lib->safe("username");
     $login_pass = $this->trans_lib->safe("password");
     if (!$login_name || !$login_pass) {
         error($this->lang["login_not_user_pass"], $this->url("login"));
     }
     //判断是否需要用验证码
     if (function_exists("imagecreate") && defined("SYS_VCODE_USE") && SYS_VCODE_USE == true) {
         $chk = $this->trans_lib->safe("chk");
         if (!$chk) {
             error($this->lang["login_vcode_empty"], $this->url("login"));
         }
         $chk = md5($chk);
         if ($chk != $_SESSION[SYS_VCODE_VAR]) {
             error($this->lang["login_vcode_false"], $this->url("login"));
         }
         unset($_SESSION[SYS_VCODE_VAR]);
     }
     //判断账号或密码是否正确
     $rs = $this->admin_m->check_login($login_name, $login_pass);
     if (!$rs) {
         error($this->lang["login_false"], $this->url("login"));
     } else {
         //非系统管理员,登录时同时判断语言包权限
         if (!$rs["if_system"] && !$rs["langid"]) {
             error("当前账号尚未配置相应的语言权限", $this->url("login"));
         }
         //加载语言包
         $this->load_model("lang");
         $rs_langid = $rs["if_system"] ? "" : $rs["langid"];
         $chk_admin = $this->lang_m->get_list_chk($rs_langid);
         if (!$chk_admin) {
             error("当前账号没有找到符合要求的内容管理权限", $this->url("login"));
         }
         //取得第一个语言ID做为默认语言
         $_SESSION["sys_lang_id"] = $chk_admin[0]["langid"];
         $_SESSION["admin_id"] = $rs["id"];
         $_SESSION["admin_name"] = $rs["name"];
         $_SESSION["admin_realname"] = $rs["realname"] ? $rs["realname"] : $rs["name"];
         $_SESSION[SYS_CHECKED_SESSION_ID] = sys_md5($rs);
         $login_success = sys_eval($this->lang["login_success"], $rs["name"]);
         //格式化模板标签中的变量
         error($login_success, $this->url("index"));
     }
 }
Example #4
0
 function setok_f()
 {
     $oldpass = $this->trans_lib->safe("oldpass");
     $newpass = $this->trans_lib->safe("newpass");
     $chkpass = $this->trans_lib->safe("chkpass");
     if (!$oldpass || !$newpass || !$chkpass) {
         error("所有加星号的文本框均必须填写!", site_url("mypass"));
     }
     if ($newpass != $chkpass) {
         error("两次输入的新密码不一致!", site_url("mypass"));
     }
     $rs = $this->admin_m->get_one($_SESSION["admin_id"]);
     if ($rs["pass"] != sys_md5($oldpass)) {
         error("旧密码输入不正确!", site_url("mypass"));
     }
     $this->admin_m->update_pass($newpass, $_SESSION["admin_id"]);
     $rs["pass"] = sys_md5($newpass);
     $_SESSION[SYS_CHECKED_SESSION_ID] = sys_md5($rs);
     error("密码修改成功,请下次登录后使用新密码登录!", site_url("mypass"));
 }
Example #5
0
 function setok_f()
 {
     $id = $this->trans_lib->int("id");
     if ($id) {
         sys_popedom("user:modify", "tpl");
     } else {
         sys_popedom("user:add", "tpl");
     }
     load_plugin("user:setok:prev");
     $array = array();
     $array["name"] = $this->trans_lib->safe("name");
     $pass = $this->trans_lib->safe("pass");
     if ($pass) {
         $array["pass"] = sys_md5($pass);
     } else {
         if (!$id) {
             $array["pass"] = sys_md5("123456");
         }
     }
     $array["email"] = $this->trans_lib->safe("email");
     //模板目录
     $regdate = $this->trans_lib->safe("regdate");
     $array["regdate"] = $regdate ? strtotime($regdate) : $this->system_time;
     $array["thumb_id"] = $this->trans_lib->int("thumb_id");
     //存储图像
     $array["groupid"] = $this->trans_lib->int("groupid");
     //存储会员组
     //存储扩展表信息
     $insert_id = $this->user_m->save($array, $id);
     $extlist = $this->usergroup_m->fields_index($array["groupid"], 1);
     if (!$extlist) {
         $extlist = array();
     }
     $ext_array = array();
     foreach ($extlist as $key => $value) {
         $array_ext = array();
         $array_ext["id"] = $insert_id;
         $array_ext["field"] = $value["identifier"];
         //扩展字段信息
         $val = $this->trans_lib->safe($value["identifier"]);
         if ($value["input"] == "time" && $val) {
             $val = strtotime($val);
         }
         if (is_array($val)) {
             $val = sys_id_string(",", $val);
         }
         $array_ext["val"] = $val;
         $this->user_model->save_ext($array_ext);
     }
     //存储分类信息
     load_plugin("user:setok:next");
     error("会员信息添加/存储成功", site_url("user"));
 }
Example #6
0
 function update_pass_f()
 {
     $username = $this->trans_lib->safe("username");
     $chkcode = $this->trans_lib->safe("chkcode");
     if (!$username || !$chkcode) {
         error($this->lang["login_not_code_user"], $this->url("login,repass"));
     }
     $rs = $this->user_m->user_from_name($username);
     if (!$rs) {
         error($this->lang["login_not_user"], $this->url("login,repass"));
     }
     if ($rs["chkcode"] != $chkcode) {
         error($this->lang["login_error_code"], $this->url("login,repass"));
     }
     if ($rs["chktime"] - 24 * 3600 > $this->system_time) {
         error($this->lang["login_code_exp"], $this->url("login,repass"));
     }
     $newpass = $this->trans_lib->safe("newpass");
     $chkpass = $this->trans_lib->safe("chkpass");
     if (!$newpass || !$chkpass) {
         error($this->lang["login_not_pass"], $this->url("login,repass"));
     }
     if ($newpass != $chkpass) {
         error($this->lang["login_error_pass"], $this->url("login,repass"));
     }
     $pass = sys_md5($newpass);
     $this->user_m->update_pass($pass, $rs["id"]);
     //直接登录
     $_SESSION["user_id"] = $rs["id"];
     $_SESSION["user_name"] = $rs["name"];
     error($this->lang["login_update"], $this->url("usercp"));
 }
Example #7
0
 function save_f()
 {
     $id = $this->trans_lib->int("id");
     if (!$id) {
         error($this->lang["error_not_id"], site_url());
     }
     $rs = $this->msg_m->get_one($id);
     if (!$rs || !$rs["status"]) {
         error($this->lang["error_not_rs"], site_url());
     }
     $username = $this->trans_lib->safe("username");
     if (!$username) {
         $username = $this->lang["guest"];
     }
     $pass = $this->trans_lib->safe("password");
     //如果非会员,尝试登录
     $array = array();
     $array["tid"] = $id;
     $array["userid"] = 0;
     if (!$_SESSION["user_id"] && $pass) {
         //判断并模拟登录
         $this->load_model("user");
         $u_rs = $this->user_m->user_from_name($username);
         if ($u_rs && $u_rs["pass"] == sys_md5($pass)) {
             //执行会员登录
             $_SESSION["user_id"] = $u_rs["id"];
             $array["userid"] = $u_rs["id"];
             $_SESSION["user_name"] = $u_rs["name"];
             $username = $u_rs["name"];
         }
         unset($u_rs);
     } elseif ($_SESSION["user_id"]) {
         $array["userid"] = $_SESSION["user_id"];
         $username = $_SESSION["user_name"];
     }
     $array["username"] = $username;
     $array["ip"] = sys_ip();
     $title = $this->trans_lib->safe("reply_subject");
     if (!$title) {
         $title = "Re:" . $rs["subject"];
     }
     $array["title"] = $title;
     $array["postdate"] = $this->system_time;
     $array["status"] = 0;
     //判断回复是否需要审核
     if ($rs["cate_id"]) {
         //[读取分类配置信息]
         $this->load_model("cate");
         $cate_rs = $this->cate_m->get_one($rs["cate_id"]);
         if ($cate_rs) {
             if (!$cate_rs["status"]) {
                 error($this->lang["reply_lock"], site_url("msg", "id=" . $id));
             }
             if (!$cate_rs["ifreply"]) {
                 error($this->lang["reply_not"], site_url("msg", "id=" . $id));
             }
             $array["status"] = $cate_rs["chk_reply"];
         }
     } else {
         $this->load_model("module");
         $module_rs = $this->module_m->get_one($rs["module_id"]);
         if ($module_rs) {
             if (!$module_rs["status"]) {
                 error($this->lang["reply_lock"], site_url("msg", "id=" . $id));
             }
             if (!$module_rs["ifreply"]) {
                 error($this->lang["reply_not"], site_url("msg", "id=" . $id));
             }
             $array["status"] = $module_rs["r_free_check"];
         }
     }
     //判断是否
     $array["content"] = $this->trans_lib->safe("reply_content");
     $array["admreply"] = "";
     //管理员回复,默认为空
     $array["star"] = $this->trans_lib->int("star");
     $this->reply_m->save($array);
     //存储评论信息
     //更新主题的最后回复时间
     $this->msg_m->update_replay_date($id, $this->system_time);
     //更新主题的星星点评
     $this->reply_m->update_star($id);
     error($this->lang["save_success"], site_url("msg", "id=" . $id));
 }
Example #8
0
 function update_pass($pass, $id)
 {
     $sql = "UPDATE " . $this->db->prefix . "admin SET pass='******' WHERE id='" . $id . "'";
     return $this->db->query($sql);
 }
Example #9
0
 function updatepw($get, $post)
 {
     if (!API_UPDATEPW) {
         return API_RETURN_FORBIDDEN;
     }
     $username = $get['username'];
     $password = sys_md5($get['password']);
     $sql = "UPDATE " . $this->db->prefix . "user SET pass='******' WHERE name='" . $username . "'";
     $this->db->query($sql);
     return API_RETURN_SUCCEED;
 }
 public function login()
 {
     if (IS_AJAX) {
         if (check_verify(I('post.verify'), 1)) {
             $Member = M('Member');
             $is_email = $Member->regex(I('post.username'), 'email');
             if ($is_email) {
                 $resuser = $Member->where('email=\'' . I('post.username') . '\'')->find();
             } else {
                 $resuser = $Member->where('username=\'' . I('post.username') . '\'')->find();
             }
             if (sys_md5(I('post.password')) == $resuser['password']) {
                 if (!$resuser['status']) {
                     $this->error(L('USER_STOP'));
                 }
                 $data = array('login_ip' => get_client_ip(), 'last_login_time' => time());
                 $saveres = $Member->where(array('id' => $resuser['id']))->save($data);
                 if ($saveres) {
                     $Member->where(array('id' => $resuser['id']))->setInc('login_count');
                 }
                 if (I('post.keep') == 'on') {
                     $crypt = new \Think\Crypt();
                     $userinfo = array('username' => $crypt->encrypt($resuser['username'], sys_md5(C('DATA_AUTH_KEY'), 'isky71'), 3600 * 24 * 15), 'password' => $crypt->encrypt($resuser['password'], sys_md5(C('DATA_AUTH_KEY'), 'CMS'), 3600 * 24 * 15));
                     $str = $crypt->encrypt(json_encode($userinfo), C('DATA_AUTH_KEY') . $__SERVER["HTTP_USER_AGENT"]);
                     cookie('member', $str, 3600 * 24 * 15);
                 }
                 session(C('USER_AUTH_KEY'), $resuser['id']);
                 session('uname', $resuser['username']);
                 $this->success(L('LOGIN_SUCCESS'), U('Index/index', $this->vl));
             } else {
                 $this->error(L('LOGIN_ERROR'));
             }
         } else {
             $this->error(L('VERIFY_ERROR'));
         }
     } else {
         if (session(C('USER_AUTH_KEY'))) {
             $this->redirect('Index/index');
         } elseif (cookie('member')) {
             $crypt = new \Think\Crypt();
             $userjson = $crypt->decrypt(cookie('member'), C('DATA_AUTH_KEY') . $__SERVER["HTTP_USER_AGENT"]);
             $userarr = json_decode($userjson, TRUE);
             foreach ($userarr as $key => $value) {
                 if ($key == 'username') {
                     $uname = $crypt->decrypt($value, sys_md5(C('DATA_AUTH_KEY'), 'isky71'));
                 }
                 if ($key == 'password') {
                     $pwd = $crypt->decrypt($value, sys_md5(C('DATA_AUTH_KEY'), 'CMS'));
                 }
             }
             $Member = M('Member');
             $ures = $Member->where('username=\'' . $uname . '\'')->find();
             if ($ures && $ures['password'] == $pwd) {
                 session(C('USER_AUTH_KEY'), $ures['id']);
                 session('uname', $ures['username']);
                 $this->redirect('Index/index');
             } else {
                 cookie(NULL);
                 $this->display();
             }
         } else {
             $this->display();
         }
     }
 }
Example #11
0
 function setok_f()
 {
     //判断是否有使用验证码
     if (function_exists("imagecreate") && defined("SYS_VCODE_USE") && SYS_VCODE_USE == true) {
         $chk = $this->trans_lib->safe("sys_check");
         if (!$chk) {
             error($this->lang["login_vcode_empty"], $_SERVER["HTTP_REFERER"]);
         }
         $chk = md5($chk);
         if ($chk != $_SESSION[SYS_VCODE_VAR]) {
             error($this->lang["login_vcode_false"], $_SERVER["HTTP_REFERER"]);
         }
         unset($_SESSION[SYS_VCODE_VAR]);
     }
     $id = $this->trans_lib->int("id");
     if (!$id) {
         $module_id = $this->trans_lib->int("module_id");
         if (!$module_id) {
             error($this->lang["post_not_mid"], $this->url());
         }
     } else {
         $rs = $this->post_m->get_one($id);
         $module_id = $rs["module_id"];
     }
     $m_rs = $this->_load_moduel($module_id);
     //获取核心数据
     $array_sys = array();
     if (!$id) {
         $array_sys["module_id"] = $module_id;
     }
     $array_sys["cate_id"] = $this->trans_lib->int("cate_id");
     $cateid = $array_sys["cate_id"];
     $array_sys["title"] = $this->trans_lib->safe("subject");
     if ($_SESSION["user_id"]) {
         $array_sys["author"] = $_SESSION["user_name"];
         $array_sys["author_type"] = "user";
     } else {
         $username = $this->trans_lib->safe("username");
         $password = $this->trans_lib->safe("password");
         $_is_user = false;
         if ($password && $username) {
             //检查会员不存在时的警告
             $rs = $this->user_m->user_from_name($username);
             if ($rs && $rs["pass"] == sys_md5($password)) {
                 $array_sys["author"] = $username;
                 $array_sys["author_type"] = "user";
                 //尝试登录,下次发表留言时不用输入密码
                 if ($rs["status"] && $rs["status"] != "2") {
                     $_SESSION["user_id"] = $rs["id"];
                     $_SESSION["user_name"] = $rs["name"];
                     $_SESSION["group_id"] = $rs["groupid"];
                     $_SESSION["user_rs"] = $rs;
                     $_SESSION[SYS_CHECKED_SESSION_ID] = sys_md5($rs);
                 }
             } else {
                 $array_sys["author"] = $username;
                 $array_sys["author_type"] = "guest";
             }
         } else {
             $array_sys["author"] = $username ? $username : $this->lang["guest"];
             $array_sys["author_type"] = "guest";
         }
     }
     $array_sys["ip"] = sys_ip();
     //发布人IP
     $array_sys["post_date"] = $this->system_time;
     $array_sys["link_url"] = $this->trans_lib->safe("link_url");
     if ($id) {
         $array_sys["post_date"] = $rs["post_date"];
         $array_sys["modify_date"] = $this->system_time;
     }
     $array_sys["thumb_id"] = $this->trans_lib->int("thumb_id");
     if (!$id) {
         $array_sys["langid"] = $_SESSION["sys_lang_id"];
     }
     $array_sys["htmltype"] = "cateid";
     $array_sys["status"] = 0;
     //如果有分类
     if ($cateid) {
         //$condition = $_SESSION["user_id"] ? "c.ifuser='******'" : "c.ifguest='1'";
         $cate_rs = $this->cate_m->get_one($cateid, $condition);
         if (!$cate_rs) {
             error($this->lang["post_cate_error"], $this->url("post,set", "id=" . $id . "&module_id=" . $module_id));
         }
         $tmp_check_status = $_SESSION["user_id"] ? "chk_user" : "chk_guest";
         $array_sys["status"] = $cate_rs[$tmp_check_status];
     } else {
         $tmp_check_status = $_SESSION["user_id"] ? "u_free_check" : "g_free_check";
         $array_sys["status"] = $m_rs[$tmp_check_status];
     }
     $array_sys["qx"] = $this->trans_lib->float("qx");
     //
     $array_sys["price"] = $this->trans_lib->float("price");
     //价格
     $array_sys["price_currency"] = $this->trans_lib->safe("price_currency");
     //货币符号
     $array_sys["weight"] = $this->trans_lib->float("weight");
     //重量,系统使用Kg来计
     $array_sys["qty"] = $this->trans_lib->int("qty");
     //产品数量
     $array_sys["is_qty"] = $this->trans_lib->int("is_qty");
     //是否启用产品数量统计
     $array_sys["qty_unit"] = $this->trans_lib->safe("qty_unit");
     //产品数量
     $insert_id = $this->post_m->save_sys($array_sys, $id);
     //存储数据
     if (!$insert_id) {
         error($this->lang["error_save"], site_url("post,set", "id=" . $id . "&module_id=" . $module_id));
     }
     unset($array_sys);
     //注销存储信息
     //判断是否
     $extlist = $this->module_m->fields_index($module_id);
     foreach ($extlist ? $extlist : array() as $key => $value) {
         $array_ext = array();
         $array_ext["id"] = $insert_id;
         $array_ext["field"] = $value["identifier"];
         //扩展字段信息
         $format_type = $value["if_html"] ? "html" : "safe";
         $val = $this->trans_lib->{$format_type}($value["identifier"]);
         //如果插入的数据是时间表单
         if ($value["input"] == "time" && $val) {
             $val = strtotime($val);
         }
         if (is_array($val)) {
             $val = implode(",", $val);
         }
         $array_ext["val"] = $val;
         $this->post_m->save_ext($array_ext, $value["tbl"]);
     }
     $goback = $this->trans_lib->safe("_to_url");
     if (!$goback) {
         if ($_SESSION["user_id"]) {
             $goback = site_url("post,list", "module_id=" . $module_id . "&cate_id=" . $cateid);
         } else {
             $goback = $_SERVER["HTTP_REFERER"] ? $_SERVER["HTTP_REFERER"] : $this->url();
         }
     }
     //判断是否有邮件通知管理员
     if ($m_rs["if_email"]) {
         $this->load_lib("email");
         $this->email_lib->module_mail($insert_id);
         //通知客户订单信息
     }
     error($this->lang["save_success"], $goback);
 }
Example #12
0
 function passok_f()
 {
     if (!$_SESSION["user_id"]) {
         error($this->lang["user_not_login"], site_url("login"));
     }
     load_plugin("usercp:passok:prev");
     $rs = $this->user_m->user_from_id($_SESSION["user_id"]);
     $old = $this->trans_lib->safe("oldpass");
     $new = $this->trans_lib->safe("newpass");
     $chk = $this->trans_lib->safe("chkpass");
     $mima = $this->trans_lib->safe("newpass");
     if (!$old || sys_md5($old) != $rs["pass"]) {
         error($this->lang["usercp_not_oldpass"], site_url("usercp,pass"));
     }
     if (!$new || $new != $chk) {
         error($this->lang["usercp_not_newpass"], site_url("usercp,pass"));
     }
     if ($new == $old) {
         error($this->lang["usercp_old_new"], site_url("usercp,pass"));
     }
     //更新密码
     $this->user_m->update_pass(sys_md5($new), $_SESSION["user_id"], $mima);
     load_plugin("usercp:passok:next");
     error($this->lang["pass_save_success"], site_url("usercp,pass"));
 }
Example #13
0
 function setok_f()
 {
     $id = $this->trans_lib->int("id");
     if ($id) {
         sys_popedom("user:modify", "tpl");
     } else {
         sys_popedom("user:add", "tpl");
     }
     $array = array();
     $array["username"] = $this->trans_lib->safe("username");
     $pass = $this->trans_lib->safe("pass");
     if ($pass) {
         $array["pass"] = sys_md5($pass);
     } else {
         if (!$id) {
             $array["pass"] = sys_md5("123456");
         }
     }
     $array["phone"] = $this->trans_lib->safe("phone");
     //模板目录
     $array["job"] = $this->trans_lib->safe("job");
     //模板目录
     $array["company"] = $this->trans_lib->safe("company");
     //模板目录
     $regdate = $this->trans_lib->safe("regdate");
     $array["regdate"] = $regdate ? strtotime($regdate) : $this->system_time;
     $array["thumb_id"] = $this->trans_lib->int("thumb_id");
     //存储图像
     $array["groupid"] = $this->trans_lib->int("groupid");
     //存储会员组
     $array["fxstatus"] = $this->trans_lib->int("fxstatus");
     //存储会员组
     $array["bankAccount"] = $this->trans_lib->safe("bankAccount");
     //存储会员组
     $array["cardCode"] = $this->trans_lib->safe("cardCode");
     //存储会员组
     $array["bankName"] = $this->trans_lib->safe("bankName");
     //存储会员组
     //存储扩展表信息
     $insert_id = $this->user_m->save($array, $id);
     error("会员信息添加/存储成功", site_url("user"));
 }
Example #14
0
 function setok_f()
 {
     load_plugin("register:setok:prev");
     //在执行注册前的操作
     if (!$this->sys_config["reg_status"]) {
         $message = $this->sys_config["close_reg"] ? $this->sys_config["close_reg"] : "No register!";
         error($message, $this->url());
     }
     if ($_SESSION["user_id"]) {
         error($this->lang["is_logined"], $this->url());
     }
     if (function_exists("imagecreate") && defined("SYS_VCODE_USE") && SYS_VCODE_USE == true) {
         $chk = $this->trans_lib->safe("sys_check");
         if (!$chk) {
             error($this->lang["login_vcode_empty"], $_SERVER["HTTP_REFERER"]);
         }
         $chk = md5($chk);
         if ($chk != $_SESSION[SYS_VCODE_VAR]) {
             error($this->lang["login_vcode_false"], $_SERVER["HTTP_REFERER"]);
         }
         unset($_SESSION[SYS_VCODE_VAR]);
     }
     $array = array();
     $array["email"] = $this->trans_lib->safe("email");
     $array["name"] = $this->trans_lib->safe("name");
     $array["rname"] = $this->trans_lib->safe("fullname");
     $array["ygzj"] = $this->trans_lib->safe("ygzj");
     $array["mima"] = $this->trans_lib->safe("newpass");
     $newpass = $this->trans_lib->safe("newpass");
     $chkpass = $this->trans_lib->safe("chkpass");
     //echo "1".."<br />";
     //		echo "2".$this->trans_lib->safe("dianhua")."<br />";
     //		exit;
     /**
     *$to_email 发送的人
     *$title  邮箱标题
     *$content 有些内容
     */
     if (!$newpass || !$chkpass) {
         error($this->lang["empty_pass"], $this->url("register"));
     }
     if ($newpass != $chkpass) {
         error($this->lang["pass_not_right"], $this->url("register"));
     }
     $array["pass"] = sys_md5($newpass);
     if (!$array["email"]) {
         error($this->lang["empty_email"], $this->url("register"));
     }
     $chkname = $this->chkname($array["name"]);
     if ($chkname != "ok") {
         error($chkname, $this->url("register"));
     }
     $array["regdate"] = $this->system_time;
     $array["status"] = 0;
     //会员组
     $this->load_model("usergroup");
     $groupid = $this->trans_lib->int("groupid");
     if ($groupid) {
         $group_rs = $this->usergroup_m->get_one($groupid);
         if (!$group_rs || !$group_rs["status"]) {
             $group_rs = $this->usergroup_m->get_default();
         }
     } else {
         $group_rs = $this->usergroup_m->get_default();
     }
     $array["groupid"] = $group_rs["id"];
     $user_id = $this->user_m->save($array);
     if (!$user_id) {
         error("注册失败,请联系网站管理员!", $this->url("register"));
     }
     //存储用户扩展信息
     $extlist = $this->usergroup_m->fields_index($group_rs["id"], 1);
     if (!$extlist) {
         $extlist = array();
     }
     $ext_array = array();
     foreach ($extlist as $key => $value) {
         $array_ext = array();
         $array_ext["id"] = $user_id;
         $array_ext["field"] = $value["identifier"];
         //扩展字段信息
         $val = $this->trans_lib->safe($value["identifier"]);
         if ($value["input"] == "time" && $val) {
             $val = strtotime($val);
         }
         if (is_array($val)) {
             $val = sys_id_string(",", $val);
         }
         $array_ext["val"] = $val;
         $this->user_model->save_ext($array_ext);
     }
     //填写
     //会员注册成功,模拟登录
     echo "<script language=javascript>\nwindow.alert('注册成功,等待审核!');\nwindow.location.href='home.html';\n</script>";
     exit;
     $_SESSION["user_id"] = $user_id;
     $_SESSION["user_name"] = $array["name"];
     $_SESSION["group_id"] = $array["groupid"];
     $rs = $this->user_m->user_from_id($user_id);
     $_SESSION["user_rs"] = $rs;
     $_SESSION[SYS_CHECKED_SESSION_ID] = sys_md5($rs);
     //存储扩展字段
     //存储邮件到订阅信息
     $this->load_model("subscribers_model", true);
     $chk_email = $this->subscribers_model->chk_email($email);
     if (!$chk_email) {
         $array = array();
         $array["email"] = $email;
         $array["status"] = $status;
         $array["postdate"] = $this->system_time;
         $array["md5pass"] = md5($email . "_" . $this->system_time);
         $this->subscribers_model->save($array, $id);
     }
     //发送欢迎信息
     if ($this->sys_config["smtp_reg"]) {
         $this->load_lib("email");
         $this->email_lib->reg($user_id);
     }
     load_plugin("register:setok:next");
     //在执行注册后的操作
     //error($this->lang["register_ok"],$this->url("usercp"));
 }
Example #15
0
 function setok_f()
 {
     $id = $this->trans_lib->int("id");
     if ($id) {
         sys_popedom($this->module_sign . ":modify", "tpl");
     } else {
         sys_popedom($this->module_sign . ":add", "tpl");
     }
     $array = array();
     $array["name"] = $this->trans_lib->safe("name");
     $pass = $this->trans_lib->safe("pass");
     if ($pass) {
         $array["pass"] = sys_md5($pass);
     } else {
         if (!$id) {
             $array["pass"] = sys_md5("123456");
         }
     }
     $array["email"] = $this->trans_lib->safe("email");
     //模板目录
     $array["if_system"] = $this->trans_lib->int("if_system");
     if (!$array["if_system"]) {
         $popedom = $this->trans_lib->safe("popedom");
         $array["popedom"] = $popedom ? implode(",", $popedom) : "";
     } else {
         $array["popedom"] = "";
     }
     $mylangid = $this->trans_lib->safe("mylangid");
     $array["langid"] = sys_id_string($mylangid);
     //存储分类信息
     $this->admin_m->save($array, $id);
     error("管理员信息添加/存储成功", site_url("admin"));
 }
 public function edit()
 {
     if (!IS_AJAX) {
         $this->error(L('_ERROR_ACTION_'));
     }
     $Member = D('Member');
     if (IS_POST) {
         if ($Member->create()) {
             $data = array('username' => I('post.username'), 'realname' => I('post.realname'), 'email' => I('post.email'), 'question' => I('post.question'), 'answer' => I('post.answer'), 'status' => I('post.status') ? 1 : 0);
             if (I('post.password')) {
                 $data['password'] = sys_md5(I('post.password'));
             }
             $result = $Member->where('id=' . I('post.id'))->save($data);
             if ($result !== FALSE) {
                 $aga = array('group_id' => I('post.group'));
                 M('AuthGroupAccess')->where('uid=' . I('post.id'))->save($aga);
                 $this->success(L('SAVE_OK'), U('Member/index', $this->vl));
             } else {
                 $this->error(L('SAVE_ERROR'));
             }
         } else {
             $this->error($Member->getError());
         }
     } elseif (IS_GET) {
         $v = $Member->where('id=' . I('get.id'))->find();
         $Group = D('AuthGroup');
         $glist = $Group->where('status=1')->select();
         $vdata = $Member->where('id=' . I('get.id'))->join('__AUTH_GROUP_ACCESS__ ON __MEMBER__.id = __AUTH_GROUP_ACCESS__.uid')->find();
         $this->assign('glist', $glist);
         $this->assign('gid', $vdata['group_id']);
         $this->assign('v', $v);
         $this->display();
     }
 }
Example #17
0
            $array[] = "../data/" . $myfile;
        }
    }
    closedir($handle);
    foreach ($array as $key => $value) {
        if (file_exists($value) && is_file($value)) {
            if (substr(basename($value), 0, 6) == "system") {
                $content = file_get_contents($value);
                $content = preg_replace("/[\$]_sys\\[\"siteurl\"\\]\\s*\\=\\s*[\"'].*?[\"'];/is", "\$_sys[\"siteurl\"] = \"" . $siteurl . "\";", $content);
                $content = preg_replace("/[\$]_sys\\[\"shareyeslink\"\\]\\s*\\=\\s*[\"'].*?[\"'];/is", "\$_sys[\"shareyeslink\"] = \"" . $siteurl . "\";", $content);
                $content = preg_replace("/[\$]_sys\\[\"wx_link\"\\]\\s*\\=\\s*[\"'].*?[\"'];/is", "\$_sys[\"wx_link\"] = \"" . $siteurl . "\";", $content);
                file_put_msg($value, $content);
            }
        }
    }
    //导入数据库
    $sql = file_get_contents("install.sql");
    if ($prefix != "YuanTest_") {
        $sql = str_replace("YuanTest_", $prefix, $sql);
    }
    format_sql($sql);
    //更新管理员信息
    $admin_user = safe_html($admin_user);
    $admin_pass = safe_html($admin_pass);
    $sql = "TRUNCATE TABLE `" . $prefix . "admin`";
    $db->query($sql);
    $sql = "INSERT INTO " . $prefix . "admin(name,email,pass,status,if_system,popedom) VALUES('" . $admin_user . "','*****@*****.**','" . sys_md5($admin_pass) . "','1','1','')";
    $db->query($sql);
    @touch("lock.php");
    $tpl->display("success.html");
}
Example #18
0
 function setok_f()
 {
     load_plugin("register:setok:prev");
     //在执行注册前的操作
     if (!$this->sys_config["reg_status"]) {
         $message = $this->sys_config["close_reg"] ? $this->sys_config["close_reg"] : "No register!";
         error($message, $this->url());
     }
     if ($_SESSION["user_id"]) {
         error($this->lang["is_logined"], $this->url());
     }
     if (function_exists("imagecreate") && defined("SYS_VCODE_USE") && SYS_VCODE_USE == true) {
         $chk = $this->trans_lib->safe("sys_check");
         if (!$chk) {
             error($this->lang["login_vcode_empty"], $_SERVER["HTTP_REFERER"]);
         }
         $chk = md5($chk);
         if ($chk != $_SESSION[SYS_VCODE_VAR]) {
             error($this->lang["login_vcode_false"], $_SERVER["HTTP_REFERER"]);
         }
         unset($_SESSION[SYS_VCODE_VAR]);
     }
     $array = array();
     $array["email"] = $this->trans_lib->safe("email");
     $array["name"] = $this->trans_lib->safe("name");
     $newpass = $this->trans_lib->safe("newpass");
     $chkpass = $this->trans_lib->safe("chkpass");
     if (!$newpass || !$chkpass) {
         error($this->lang["empty_pass"], $this->url("register"));
     }
     if ($newpass != $chkpass) {
         error($this->lang["pass_not_right"], $this->url("register"));
     }
     $array["pass"] = sys_md5($newpass);
     if (!$array["email"]) {
         error($this->lang["empty_email"], $this->url("register"));
     }
     $chkname = $this->chkname($array["name"]);
     if ($chkname != "ok") {
         error($chkname, $this->url("register"));
     }
     $array["regdate"] = $this->system_time;
     $array["status"] = 1;
     //会员组
     $this->load_model("usergroup");
     $group_rs = $this->usergroup_m->get_default();
     $array["groupid"] = $group_rs["id"];
     $user_id = $this->user_m->save($array);
     //会员注册成功,模拟登录
     $_SESSION["user_id"] = $user_id;
     $_SESSION["user_name"] = $array["name"];
     $_SESSION["group_id"] = $array["groupid"];
     $tmp_array = $array;
     $tmp_array["id"] = $user_id;
     $_SESSION["user_rs"] = $tmp_array;
     //存储邮件到订阅信息
     $this->load_model("subscribers_model", true);
     $chk_email = $this->subscribers_model->chk_email($email);
     if (!$chk_email) {
         $array = array();
         $array["email"] = $email;
         $array["status"] = $status;
         $array["postdate"] = $this->system_time;
         $array["md5pass"] = md5($email . "_" . $this->system_time);
         $this->subscribers_model->save($array, $id);
     }
     //发送欢迎信息
     if ($this->sys_config["smtp_reg"]) {
         $this->load_lib("email");
         $this->email_lib->reg($user_id);
     }
     load_plugin("register:setok:next");
     //在执行注册后的操作
     error($this->lang["register_ok"], $this->url("usercp"));
 }