CodeIgniter Forums
Help session grab user_id from database - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Help session grab user_id from database (/showthread.php?tid=51925)

Pages: 1 2 3 4 5


Help session grab user_id from database - El Forum - 05-23-2012

[eluser]Samus[/eluser]
[quote author="the_unforgiven" date="1337789211"]from print_r in view i get this

Code:
Array ( [id] => 14 [acc_number] => 172102 [ip_address] => 0 [name] => Test

so the id is there right?
[/quote]
Yes.

If you echo $cust_id['id'];

what do you see?


Help session grab user_id from database - El Forum - 05-23-2012

[eluser]the_unforgiven[/eluser]
Yes the echoed out
Code:
14
but now another small problem when i try to login again my check function stalls:

Code:
function check()
{
  // Check user and password
  $query = $this->user_model->checkUser();
  
  $username = $this->input->post('username');
  $password = sha1($this->input->post('password'));
  
  $this->form_validation->set_rules('username', 'required|trim|max_length[15]');
  $this->form_validation->set_rules('password', 'required|trim|sha1');
    
  if ($this->form_validation->run() === FALSE) {
  
   $data['title'] = "Customer Login";
   $this->load->view('user/logon', $data);
  }
  else {
   if($query) {
    
    $result = $this->user_model->getCustomer();
     foreach($result as $res) {
         $data = array(
           'username'    => $this->input->post('username'),
           'is_user'     => true,
           'last_login'  => time(),
           'customer_id' => $res['id'],
           'acc_number'  => $res['acc_number']
                );
      }
   }
  }
}
Not sure why....


Help session grab user_id from database - El Forum - 05-23-2012

[eluser]Samus[/eluser]
[quote author="the_unforgiven" date="1337789594"]Yes the echoed out
Code:
14
but now another small problem when i try to login again my check function stalls:

Code:
function check()
{
  // Check user and password
  $query = $this->user_model->checkUser();
  
  $username = $this->input->post('username');
  $password = sha1($this->input->post('password'));
  
  $this->form_validation->set_rules('username', 'required|trim|max_length[15]');
  $this->form_validation->set_rules('password', 'required|trim|sha1');
    
  if ($this->form_validation->run() === FALSE) {
  
   $data['title'] = "Customer Login";
   $this->load->view('user/logon', $data);
  }
  else {
   if($query) {
    
    $result = $this->user_model->getCustomer();
     foreach($result as $res) {
         $data = array(
           'username'    => $this->input->post('username'),
           'is_user'     => true,
           'last_login'  => time(),
           'customer_id' => $res['id'],
           'acc_number'  => $res['acc_number']
                );
      }
   }
  }
}
Not sure why....[/quote]
what do you mean stalls?

it doesn't work or it has become slower?


Help session grab user_id from database - El Forum - 05-23-2012

[eluser]the_unforgiven[/eluser]
Sorry, doesn't work just shows blank white page no errors no nothing, and I have error reporting on and also console open via MAMP on mac. which would show any errors so not sure why


Help session grab user_id from database - El Forum - 05-23-2012

[eluser]Samus[/eluser]
[quote author="the_unforgiven" date="1337790011"]Sorry, doesn't work just shows blank white page no errors no nothing, and I have error reporting on and also console open via MAMP on mac. which would show any errors so not sure why[/quote]
Check logs?

That's awfully weird


Help session grab user_id from database - El Forum - 05-23-2012

[eluser]the_unforgiven[/eluser]
Logs is console plus they should show on on screen if any errors. So console is live feed if you like of the php_error.log file like so: http://tinypic.com/r/2yy2v4o/6


Help session grab user_id from database - El Forum - 05-23-2012

[eluser]CroNiX[/eluser]
Check apache logs as well.


Help session grab user_id from database - El Forum - 05-23-2012

[eluser]the_unforgiven[/eluser]
Hi Chronix:

in apache logs i only have this:

Code:
[Wed May 23 18:12:08 2012] [notice] Digest: generating secret for digest authentication ...
[Wed May 23 18:12:08 2012] [notice] Digest: done
[Wed May 23 18:12:08 2012] [notice] Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r DAV/2 PHP/5.2.17 configured -- resuming normal operations
[Wed May 23 18:14:04 2012] [error] [client ::1] client denied by server configuration: /Applications/MAMP/htdocs/.DS_Store
[Wed May 23 18:14:05 2012] [error] [client ::1] File does not exist: /Applications/MAMP/htdocs/favicon.ico
[Wed May 23 18:14:05 2012] [error] [client ::1] File does not exist: /Applications/MAMP/htdocs/favicon.ico



Help session grab user_id from database - El Forum - 05-23-2012

[eluser]CroNiX[/eluser]
Looks like your apache server might be crashing and restarting (3rd line). Also, the "client denied by server configuration" doesn't look very promising.


Help session grab user_id from database - El Forum - 05-23-2012

[eluser]the_unforgiven[/eluser]
MAMP, locally always works, so what do you think I should in the case Sad