0

I have written the code shown below.

<form action="login.php" method="post">
    <fieldset>
        <div class="form-group">
            <input autofocus class="form-control" name="username" placeholder="Username" type="text"/>
        </div>
        <div class="form-group">
            <input class="form-control" name="password" placeholder="Password" type="password"/>
        </div>
        <div class="form-group">
            <button type="submit" class="btn btn-default">Log In</button>
        </div>
    </fieldset>
</form>
<div>
    or <a href="register.php">register</a> for an account.
    <br>
    Have you forgotten your <a href="email.php">password</a>?
</div>

When I click on the register I am taken to register.php. When I click on password I am not taken to email.php.

email.php I copied from register.php and I made the appropriate changes. email.php I copied from register_form.php and I made the appropriate changes.

0

Maybe because the preg_match call made by config.php redirects you to login.php in case you're not logged in and you're trying to visit a page that's not login.php, logout.php, and register.php. Try adding "|email" to the first argument of pregmatch like that

preg_match("{(?:login|logout|register|email)\.php$}", $_SERVER["PHP_SELF"])

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .