Note that there are some explanatory texts on larger screens.

plurals
  1. PO$_POST/$_REQUEST Variables not being set in PHP/Codeigniter/Apache
    primarykey
    data
    text
    <p>First, on a local install of XAMPP, this works perfectly well. However, on an external (WAMP) server, it does not.</p> <pre><code>class Authentication extends MY_Controller { function Authentication () { parent::__construct (FALSE); $this-&gt;template-&gt;set_template('authentication'); } /** * Allows the user to log in to the system */ public function index () { $person = $this-&gt;session-&gt;userdata("person"); if (AUTHENTICATION_DISABLED || !empty($person)) { redirect(''); } // if the user isn't already logged in, then they require a login page. $this-&gt;session-&gt;set_userdata("login_attempt", $this-&gt;session-&gt;userdata("login_attempt") + 1); $this-&gt;form_validation-&gt;set_rules("username", "User name", "required"); $this-&gt;form_validation-&gt;set_rules("password", "Password", "required"); if ($this-&gt;form_validation-&gt;run() !== FALSE) { $this-&gt;load-&gt;model("person_model"); $person = $this-&gt;person_model-&gt;get_person($this-&gt;input-&gt;post("username")); if ($person) { $this-&gt;session-&gt;set_userdata("person", $person); redirect(''); } } if ($this-&gt;session-&gt;userdata("login_attempt") &gt; MAX_LOGIN_ATTEMPTS &amp;&amp; !DISABLE_LOGIN_LIMIT) { $this-&gt;log('User locked out', __FILE__, __LINE__, Array ( 'login_attempts' =&gt; $this-&gt;session-&gt;userdata('login_attempt'), 'lockout_time' =&gt; FAILED_ACCESS_LOCKOUT_TIME )); $this-&gt;session-&gt;sess_expiration = FAILED_ACCESS_LOCKOUT_TIME; // lock the user out for the amount of time specified in the config $this-&gt;data['max_login_attempts'] = MAX_LOGIN_ATTEMPTS; $this-&gt;data['lockout_time_mins'] = FAILED_ACCESS_LOCKOUT_TIME / 60; $this-&gt;data['try_again_time'] = date('H:i', strtotime('+' . ($this-&gt;data['lockout_time_mins'] + 1) . ' minutes')); $this-&gt;template-&gt;write('title', 'Connection refused'); $this-&gt;template-&gt;write_view('content', 'authentication/refused', $this-&gt;data); $this-&gt;template-&gt;render(); } else { $this-&gt;template-&gt;write('title', 'Log In'); $this-&gt;template-&gt;write_view('content', 'authentication/login'); $this-&gt;template-&gt;render(); } } /** * Allows a user to log out of the system */ public function logout () { if ($this-&gt;session-&gt;userdata('user_id') || DONT_REQUIRE_USER_ID) { $this-&gt;session-&gt;sess_destroy(); $this-&gt;template-&gt;write('title', 'Logged Out'); $this-&gt;template-&gt;write_view('content', 'authentication/logout'); $this-&gt;template-&gt;render(); } else { $this-&gt;log('Unauthorised access of logout page', __FILE__, __LINE__); show_404(); } } } </code></pre> <p>The form is simple ...</p> <pre><code>&lt;form method="post" action="&lt;?= site_url('authentication') ?&gt;"&gt; &lt;label for="username"&gt;Username:&lt;/label&gt; &lt;input type="text" name="username" value="" /&gt; &lt;label for="password"&gt;Password&lt;/label&gt; &lt;input type="password" name="password" value="" /&gt; &lt;button type="submit"&gt;Log In&lt;/button&gt; &lt;/form&gt; </code></pre> <p>The POST variables are also being sent according to Firebug, but if I should put in something like</p> <pre><code>die(print_r($_POST, TRUE)) </code></pre> <p>It just gives a blank "Array ()". Any ideas? Cos I'm fresh outta 'em :)</p> <p><strong>Additional Stuff</strong> Incidentally, on non-related pages the server has been returning the correct content, but with a 404 header for some reason. I've bodged it to work, but I dunno - maybe it's a blatantly obvious problem I'm missing. ;)</p>
    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.
    1. This table or related slice is empty.
    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