1

我正在做一个login Script. 我有一个注册及其登录名,我需要提供一次访问/登录名,我在database表名中的字段qz_userauthID fname lname email username password. login一次尝试后限制。可能的 ?

这是login Form

<form action="functions.php" method="post" id="login">
                <fieldset>
                    <legend>Login </legend>
                    <ul>
                        <li>
                            <label for="username"><span class="required">Username</span></label>
                            <input id="username" name="username" class="text required" type="text" />
                            <label for="username" class="error">This field cannot be empty</label>
                        </li>

                        <li>
                        <label for="password"><span class="required">Password</span></label>
                        <input name="password" type="password" class="text required" id="password" maxlength="20" />
                    </li>
                    <?php if($_SESSION['LCNT']>=4){  ?>
                    <li>
                        <p id="p-captcha">
                            <div id="captchaImg"><img id="captcha" src="captcha/securimage_show.php" alt="CAPTCHA Image" /></div>
                            <div id="captchaInput"><input type="text" name="captcha_code" size="16" maxlength="6" value="Enter Captcha" /></div>
                            <div id="captchaRefresh"><a href="#" onclick="document.getElementById('captcha').src = 'captcha/securimage_show.php?' + Math.random(); return false"><img src="captcha/images/refresh.gif" /></a></div>
                        </p>
                    </li>
                    <?php } ?>
                    <li>
                        <label class="centered info"><a id="forgotpassword" href="fpass.php">Forgot Your password...</a></label>
                    </li>
                </ul>
            </fieldset>
            <input type="hidden" name="action" value="login" />
            <fieldset class="submit">
                <input type="submit" class="sbutton" value="Login" /> &nbsp; <input type="button" class="sbutton" value="Register"  onclick="window.location='register.php'" />
            </fieldset>


        </form>
4

2 回答 2

3

只需在表中再设置一个字段作为标志。并在一次登录尝试后将 flag 的值设置为 false。并在登录期间检查标志值。

于 2013-01-10T14:27:26.840 回答
1

如果您的意思是要求每个用户一次只允许 1 次登录,那么您可以在表中添加另一个字段,例如login_status。用户登录时设置为 1,注销时设置为 0。然后在您的登录脚本中检查这是否为 0,然后才允许登录

于 2013-01-10T14:27:14.290 回答