Welcome Guest, Not a member yet? Register   Sign In
Loosing POST variables
#1

I have a login in form. The POST variables are lost after submission and i can confirm with 

                
PHP Code:
$this->output->enable_profiler(TRUE); 


that the POST variables are never received by CodeIgniter.
If I switch the form to GET, I am receiving my variables.
Also, this problem only shows up on remote Amazon Web Services EC2 Ubuntu Instance, while locally on a MAMP server, all works fine

The CodeIgniter app resides in a subdirectory:

/
/.htaccess
/codeigniter/

This is the /.htaccess file:


Code:
php_flag magic_quotes_gpc off

RewriteEngine On

RewriteCond %{HTTP_HOST} ^example.com
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
RewriteRule ^sitemap.xml$ /index.php?n1=xmlsitemap [L]
RewriteRule ^images/items/item_([0-9]+)\.jpg$ /images/itemimage.php?thumb=false&iiid=$1 [QSA,L]
RewriteRule ^images/itemthumbnails/item_([0-9]+)\.jpg$ /images/itemimage.php?thumb=true&&iiid=$1 [QSA,L]
RewriteRule ^images/users/user_([0-9]+)\.jpg$ /images/userimage.php?thumb=false&uiid=$1 [QSA,L]
RewriteRule ^images/userthumbnails/user_([0-9]+)\.jpg$ /images/userimage.php?thumb=true&&uiid=$1 [QSA,L]
RewriteRule ^([a-z0-9]+)$ /$1/ [R,QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9]+)/$ /index.php?n1=$1 [QSA,L]
RewriteRule ^([a-z0-9]+)/([a-z0-9]+)$ /$1/$2/ [R,QSA,L]
RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/$ /index.php?n1=$1&n2=$2 [QSA,L]
RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)$ /$1/$2/$3/ [R,QSA,L]
RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/$ /index.php?n1=$1&n2=$2&n3=$3 [QSA,L]
RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9-]+)$ /$1/$2/$3/$4/ [R,QSA,L]
RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9-]+)/$ /index.php?n1=$1&n2=$2&n3=$3&n4=$4 [QSA,L]
RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)$ /$1/$2/$3/$4/$5/ [R,QSA,L]
RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/$ /index.php?n1=$1&n2=$2&n3=$3&n4=$4&n5=$5 [QSA,L]
RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)$ /$1/$2/$3/$4/$5/$6/ [R,QSA,L]
RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/$ /index.php?n1=$1&n2=$2&n3=$3&n4=$4&n5=$5&n6=$6 [QSA,L]
RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)$ /$1/$2/$3/$4/$5/$6/$7/ [R,QSA,L]
RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)/$ /index.php?n1=$1&n2=$2&n3=$3&n4=$4&n5=$5&n6=$6&n7=$7 [QSA,L]

<IfModule mod_expires.c>
ExpiresActive On
   ExpiresByType image/jpeg "access plus 1 weeks"
   ExpiresByType image/png "access plus 1 weeks"
   ExpiresByType image/gif "access plus 1 weeks"
   ExpiresByType text/css "access plus 1 weeks"
   ExpiresByType application/javascript "access plus 1 weeks"
</IfModule>


This is my login form (in the views directory)


PHP Code:
<form action="<?php echo base_url() ?>index.php/admin/auth/index" name="login_form" method="post" enctype="application/x-www-form-urlencoded">
 
   Email: <input name="user_email" id="user_email" value="" />
 
   <br>
 
   Password: <input type="password" name="user_password" id="user_password" value="" />
 
   <br>
 
   <input type="submit" name="login_submit" id="login_submit" />
</
form


I confirmed that base_url() returns the correct URL.

And finally, my controller's index function:

        
        
PHP Code:
// this displays the login form
 
       public function index()
 
       {
 
               $data['title'] = 'Login to DAF Dashboard';
 
               $data['message'] = '';
 
               
                $this
->form_validation->set_rules('user_email''user_email''trim|required',
 
                       array('required' => 'Bitte %s eingeben.'));
 
               $this->form_validation->set_rules('user_password''user_password''trim|required',
 
                       array('required' => 'Bitte %s eingeben.')
 
               );

 
               
                if 
($this->form_validation->run() == FALSE){
 
                   // not all fields were filled in or the form is displayed for the first time
 
                   $this->load->view('templates/header'$data);
 
                   $this->load->view('auth/login_form');
 
                   $this->load->view('templates/footer');
 
               } else {
 
                   // all fields were filled in, so we can authenticate the user
 
                   $email $this->input->post('user_email');
 
                   $password $this->input->post('user_password');
 
                   $result $this->auth_model->authenticate_by_email($email$password);
 
                   if($result){
 
                       //get the user's user_id
 
                       $user_id $this->auth_model->get_user_id_by_email($email);
 
                       // authorise the user
 
                       $group_id $this->auth_model->authorise($user_id);
 
                       //login the user (this means we store the $user_id, $group_id in the session)
 
                       $this->login($user_id$group_id);
 
                       
                        
// TODO redirect to the user's group's default controller
 
                       switch($group_id){
 
                           case 1:
 
                               // admin
 
                               redirect('/admin/admin/');
 
                               break;
 
                           case 2:
 
                               // brand
 
                               redirect('/admin/brand/');
 
                               break;
 
                           case 3:
 
                               // user
 
                               redirect('/admin/user/');
 
                               break;
 
                           default :
 
                               redirect('/common/');
 
                       }
 
                   } else {
 
                       // wrong credentials, redisplay form with login failure message
 
                       
                        $data
['title'] = 'Login to DAF';
 
                       $data['message'] = 'Login failed, try again!';
 
                       
                        $this
->load->view('templates/header'$data);
 
                       $this->load->view('auth/login_form');
 
                       $this->load->view('templates/footer');
 
                   }
 
               }
 
               
                
        

Reply




Theme © iAndrew 2016 - Forum software by © MyBB