<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## 注冊功能 模板所在位置: `/theme/default/reg.html` PHP頁面 `reg.php` > 需要完成的功能點: 1 對輸入項要進行魔術轉義,防止SQL注入; 2 驗證郵箱格式; 3 驗證密碼:長度,并校驗兩次輸入是否一致; 4 校驗數據庫中是否存在改用戶名; 5 校驗圖片驗證碼輸入是否正確; 6 若全部校驗通過則創建用戶,并自動登錄,登陸狀態使用`Cookie`記錄; 7 注冊成功,贈送積分; ~~~ <?php include './common/common.php'; $title = '用戶注冊 - ' . WEB_NAME; //驗證是否為提交注冊信息 if (!empty($_POST['regsubmit'])) { $uname = strMagic($_POST['username']); $upass = trim($_POST['password']); $urpass = trim($_POST['repassword']); $umail = $_POST['mail']; $pyzm = $_POST['yzm']; //錯誤跳轉頁默認值 $url = $_SERVER['HTTP_REFERER']; $style = 'alert_error'; $toTime = 3000; $alterNotice = false; //提示頁面標記位 //驗證用戶名長度 if(stringLen($uname)) { $alterNotice = true; $msgArr[] = '<font color=red><b>用戶名長度錯誤:用戶名由 3 到 12 個字符組成</b></font>'; } //判斷數據庫里是否存在這個用戶名 $exists = dbSelect('user','uid', 'username="'.$uname.'"','uid desc',1); if($exists) { $alterNotice = true; $msgArr[] = '<font color=red><b>用戶名已存在</b></font>'; } //驗證密碼長度 if(stringLen($upass)) { $alterNotice = true; $msgArr[] = '<font color=red><b>密碼長度錯誤:由 3 到 12 個字符組成</b></font>'; } //驗證兩次密碼是否一致 if(str2Equal($upass, $urpass)) { $alterNotice = true; $msgArr[] = '<font color=red><b>錯誤:兩次密碼不一致</b></font>'; } //驗證email if(checkEmail($umail)) { $alterNotice = true; $msgArr[] = '<font color=red><b>錯誤:郵箱不合法</b></font>'; } //判斷驗證碼 if(checkVerify($pyzm, $_SESSION['code'])) { $alterNotice = true; $msgArr[] = '<font color=red><b>驗證碼輸入錯誤</b></font>'; } //驗證是否需要顯示提示信息 if($alterNotice) { $msg = join('<br />', $msgArr); include 'notice.php'; exit; } //創建用戶 $money = REWARD_REG; $n = 'username, password, email, udertype, regtime, lasttime, regip, grade'; $v = "'$uname', '".md5($upass)."', '$umail', 0, ".time().", ".time().", ".ip2long($_SERVER['REMOTE_ADDR']).", ".$money; $result = dbInsert('user', $n, $v); if(!$result) { $msg = '<font color=red><b>注冊失敗,請聯系管理員</b></font>'; include 'notice.php'; }else{ //注冊成功后自動登錄 $result = dbSelect('user', 'uid,username,udertype,picture,grade', 'username="'.$uname.'" and password="'.md5($upass).'"', 'uid desc', 1); setcookie('uid',$result[0]['uid'],time()+86400); setcookie('username',$result[0]['username'],time()+2592000); setcookie('udertype',$result[0]['udertype'],time()+86400); setcookie('picture',$result[0]['picture'],time()+86400); setcookie('grade',$result[0]['grade'],time()+86400); $msg = '<font color=green><b>感謝您的注冊,現在將以會員身份登錄站點</b></font>'; $url = 'index.php'; $style = 'alert_right'; include 'notice.php'; $msg = '注冊贈送'; include 'layer.php'; } }else{ include template("reg.html"); } ?> ~~~ ## 用戶登陸 PHP頁面 `login.php` > 需要完成的功能點: 1 自動登陸功能,通過設置`Cookie`的過期時間來驗證是否使用了自動登陸,有效期為30天。若瀏覽器`Cookie`被清除則自動失效; 2 驗證登陸賬號是否被管理員從后臺鎖定; 3 記錄用戶最后登陸時間; ~~~ <?php include './common/common.php'; $username = strMagic($_POST['username']); $password = trim($_POST['password']); $cookietime = $_POST['cookietime']; $result = dbSelect('user','uid,username,udertype,picture,grade,allowlogin,lasttime', 'username="'.$username.'" and password="'.md5($password).'"'); //判斷是否使用了自動登錄 if($cookietime) { $longTime = time()+2592000; }else{ $longTime = time()+86400; } if(!$result) { $msg = '<font color=red><b>登錄失敗,用戶名或密碼錯誤</b></font>'; $url = $_SERVER['HTTP_REFERER']; $style = 'alert_error'; $toTime = 3000; include 'notice.php'; }else{ if($result[0]['allowlogin']) { $msg = '<font color=red><b>您的賬號已經被鎖定,請聯系管理員</b></font>'; $url = $_SERVER['HTTP_REFERER']; $style = 'alert_error'; $toTime = 3000; include 'notice.php'; exit; } $money = REWARD_LOGIN; if(formatTime($result[0]['lasttime'])<date('Y-m-d')) { //更新最后登錄時間,首次登陸還要加積分 $lasttime = dbUpdate('user', 'lasttime='.time().',grade=grade+'.(int)$money.'', 'uid='.$result[0]['uid'].''); $first = true; $grade = $result[0]['grade']+(int)$money; }else{ //更新最后登錄時間 $lasttime = dbUpdate('user', 'lasttime='.time().'', 'uid='.$result[0]['uid'].''); $grade = $result[0]['grade']; } setcookie('uid',$result[0]['uid'],$longTime); setcookie('username',$result[0]['username'],time()+2592000); setcookie('udertype',$result[0]['udertype'],$longTime); setcookie('picture',$result[0]['picture'],$longTime); setcookie('grade',$grade,$longTime); $msg = '<font color=green><b>登錄成功</b></font>'; $url = $_SERVER['HTTP_REFERER']; $style = 'alert_right'; $toTime = 3000; include 'notice.php'; if($first) { $msg = '每天登陸'; include 'layer.php'; } } ~~~ ## 退出登陸狀態 PHP頁面 `logout.php` > Cookie 時間設置為當前時間-1,視為立即失效; ~~~ <?php include './common/common.php'; setcookie('uid','',time()-1); setcookie('udertype','',time()-1); setcookie('picture','',time()-1); setcookie('grade','',time()-1); $msg = '<font color=green><b>您已退出站點,現在將以游客身份轉入退出前頁面</b></font>'; $url = 'index.php'; $style = 'alert_right'; $toTime = 3000; include 'notice.php'; ~~~ 退出成功后,跳轉到首頁。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看