Note that there are some explanatory texts on larger screens.

plurals
  1. POHtml form seems to be submitting to the wrong place?
    primarykey
    data
    text
    <p>Recently, for no 'apparent' reason, my login form started to redirect to my website's 404 page, and I don't see the cause anywhere.</p> <pre><code> &lt;?php echo '&lt;form action="http://' . $_SERVER['SERVER_NAME'] . '/login" method="post"&gt;'; ?&gt; &lt;li&gt;&lt;input type="text" name="username" placeholder="Username"&gt;&lt;/li&gt; &lt;li&gt;&lt;input type="password" name="password" placeholder="Password"&gt;&lt;/li&gt; &lt;li&gt;&lt;input type="submit" value="Login"&gt;&lt;/li&gt; &lt;/form&gt; </code></pre> <p>Yet for some reason, it still redirects to the 404 page, when <code>&lt;?php echo'http://' . $_SERVER['SERVER_NAME'] . '/login</code> is the exact same page. Apart from when the user is successfully logged in, there is no other redirecting, which goes to a different page. I just don't see what's causing this, can anyone else work out why?</p> <p>EDIT: My .htaccess is</p> <pre><code>RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?page=$1 </code></pre> <p>Authentication code:</p> <pre><code>&lt;?php if(empty($_POST) === false) { $username = $_POST['username']; $password = $_POST['password']; if(empty($username) === true || empty($password) === true) { $errors[] = 'You need to enter a username and password.'; } else if (user_exists($username) === false) { $errors[] = 'We can\'t find that username. Have you registered?'; } else if (user_active($username) === false) { $errors[] = 'You haven\'t activated your account!'; } else if(strlen($password) &gt; 32 ) { $errors[] = 'Password to long.'; } $login = login($username, $password); if($login === false){ $errors[] = 'That username/password combination is incorrect.'; }else{ $_SESSION['user_id'] = $login; header('Location: ' . $_SERVER['SERVER_NAME'] . '/?msg=1'); exit(); } } if(empty($errors)===false){ ?&gt; &lt;h1&gt;We tried to log you in, but....&lt;/h1&gt; &lt;?php print_r($errors); } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload