1

i am working on a login Script. I have a registration and its login, what i need to give a single access/login, i have my fields in database table name is qz_userauth as ID fname lname email username password. Restrict login after one attempt. Possible ?

Here is 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

テーブルにもう 1 つのフィールドをフラグとして設定するだけです。1 回のログイン試行の後、flag の値を false に設定します。ログイン中にフラグの値を確認します。

于 2013-01-10T14:27:26.840 に答える
1

ユーザーごとに一度に 1 つのログインのみを許可したい場合は、login_statusのような別のフィールドをテーブルに追加できます。ユーザーがログインしている場合はこれを 1 に設定し、ログアウトする場合は 0 に設定します。次に、ログイン スクリプトでこれが 0 かどうかを確認し、その場合にのみログインを許可します

于 2013-01-10T14:27:14.290 に答える