第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

php注冊(cè)頁(yè)面字符串練習(xí)

標(biāo)簽:
PHP
<?php
header ( 'content-type:text/html;charset=utf-8' );

$glue = range ( chr ( 65 ), chr ( 90 ), 1 );
$glue = array_merge ( $glue, range ( chr ( 97 ), chr ( 122 ), 1 ) );
$glue = array_merge ( $glue, range ( chr ( 48 ), chr ( 57 ), 1 ) );

$string = implode ( $glue, '' );
$code = null;
for($i = 0; $i < 4; $i ++) {
    $code .= '<span style="color:rgb(' . mt_rand ( 0, 255 ) . ',' . mt_rand ( 0, 255 ) . ',' . mt_rand ( 0, 255 ) . ')">' . $string {mt_rand ( 0, strlen ( $string ) - 1 )} . '</span>';
}

?>
<!DOCTYPE html>
<html>
<head>
<title>注册页面</title>
</head>
<body>

    <form action="doAction.php" method="post" name="signup" id="signup">
        <div class="lr_e">
            <label><span class="err" style="display: none" id="username_err"></span>用户名</label>
            <div class="txt">
                <input class="ef" maxlength="11" type="text" autocomplete="off" id="username" name="username" placeholder="用户名首字母必须以字母开始" value="abcdef">
            </div>
        </div>
        <div class="lr_e">
            <label> <span class="err" style="display: none" id="pwd_err"></span> 密码
            </label>
            <div class="txt">
                <input class="ef" autocomplete="off" maxlength="16" type="password" id="userpwd" name="password" placeholder="密码必须是6-10位字母/数字/符号组合" value="123456">
            </div>
        </div>
        <div class="lr_e">
            <label><span class="err" style="display: none" id="pwdcfm_err"></span>确认密码</label>
            <div class="txt">
                <input class="ef" type="password" autocomplete="off" id="password1" name="password1" maxlength="16" placeholder="请输入和上面相同的密码" value="123456">
            </div>
        </div>

        <div class="lr_e">
            <label><span class="err" style="display: none" id="email_err"></span>邮箱</label>
            <div class="txt">
                <input class="ef" type="text" autocomplete="off" id="email" name="email" maxlength="16" placeholder="请输入合法邮箱,必须包含@" value="123456@">
            </div>
        </div>
        <div class="lr_e">
            <label><span class="err" style="display: none" id="fav_err"></span>兴趣爱好</label>
            <div class="txt">
                <input class="ef" type="checkbox" autocomplete="off" id="" name="fav[]" maxlength="16" value="php">php <input class="ef" type="checkbox" autocomplete="off" id="" name="fav[]" maxlength="16" value="python">python
            </div>
        </div>
        <div class="lr_e">
            <label><span class="err" style="display: none" id="verify_err"></span>验证码</label>
            <div class="txt">
                <input class="ef" type="text" autocomplete="off" id="verify" name="verify" maxlength="16" value=""><?php echo $code;?>
                <input class="ef" type="hidden" autocomplete="off" id="verify1" name="verify1" maxlength="16" value="<?php echo strip_tags($code);?>">
            </div>
        </div>
        <div class="btnbox">
            <button type="submit" class="p_but" id="submitbtn">注 册</button>
        </div>
    </form>

</body>
</html>
<?php
header('content-type:text/html;charset=utf-8');
$username=$_POST['username'];
$password=$_POST['password'];
$password1=$_POST['password1'];
$email=$_POST['email'];
$verify=trim(strtolower($_POST['verify']));
$verify1=trim(strtolower($_POST['verify1']));
$fav=$_POST['fav'];
if(!empty($fav)){
    $favStr=join(',',$fav);
}
$char=$username{0};
$ascii=ord($char);
$redirectUrl='<br/><a href="reister.php">重写注册</a>';
if(!(($ascii>=65&&$ascii<=90)||($ascii>=97&&$ascii<=122))){
    exit('用户名首字母不是以字母开始'.$redirectUrl);
}
$userlen=strlen($username);
if ($userlen<6||$userlen>10) {
    exit('用户名长度不符合规范'.$redirectUrl);    

}
$passworlen=strlen($password);
if ($passworlen<6||$passworlen>10) {
    exit('密码长度不符合规范'.$redirectUrl);

}
if($password!==$password1){
    exit('两次密码不一致'.$redirectUrl);
}

if(strpos($email,'@')==false){
    exit('非法邮箱'.$redirectUrl);
}
if($verify!==$verify1){
    exit('验证码不正确'.$redirectUrl);
}
echo '恭喜你注册成功<br/>';
$password=md5($password);
$userInfo=<<<EOF
<table border='1' width="70%">
  <tr>
    <td>用户名</td>
    <td>密码</td>
    <td>邮箱</td>
    <td>兴趣爱好</td>
  </tr>
    <tr>
    <td>$username</td>
    <td>$password</td>
    <td>$email</td>
    <td>$favStr</td>
  </tr>
</table>
EOF;
echo $userInfo;

数组名称必须带[]

點(diǎn)擊查看更多內(nèi)容
TA 點(diǎn)贊

若覺(jué)得本文不錯(cuò),就分享一下吧!

評(píng)論

作者其他優(yōu)質(zhì)文章

正在加載中
  • 推薦
  • 評(píng)論
  • 收藏
  • 共同學(xué)習(xí),寫(xiě)下你的評(píng)論
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說(shuō)多少就多少
贊賞金額會(huì)直接到老師賬戶(hù)
支付方式
打開(kāi)微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊(cè)有機(jī)會(huì)得

100積分直接送

付費(fèi)專(zhuān)欄免費(fèi)學(xué)

大額優(yōu)惠券免費(fèi)領(lǐng)

立即參與 放棄機(jī)會(huì)
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

舉報(bào)

0/150
提交
取消