Welcome Guest, Not a member yet? Register   Sign In
XAMPP & CI
#1

[eluser]Kemik[/eluser]
Hello all,

I'm new to XAMPP as I usually use my shared hosting but wanted to test some stuff on my own PC. I've installed XAMPP and copied my app to the correct folder. I adjusted the database info to apply to my local settings.

When I try and login to my app it just reloads the page. I've checked to make sure the database settings are correct and the tables have info in (via a $this->db->get()) and it shows the user's info.

The password is also encoded properly. The password and username are correct. I've even added an echo to say correct when the details match, they do.

Is there any kind of cookie problems when using XAMPP & CI?

I think this is a problem with XAMPP. Please move the topic.
#2

[eluser]zdknudsen[/eluser]
Me and thepyromaniac are working on a project and we both use XAMPP for local deveopment and testing. None of us are experiencing problems. Only issue we had was with .htacces, but that was fixed by allowing mod_rewrite in the apache config. It doesn't sound like a .htaccess problem though.

Edit: My point is that XAMPP works, you have to be more specific about your problem for me to help you, though.
#3

[eluser]Kemik[/eluser]
Basically, it's not creating the cookies on the user's browser. The user has cookies enabled because they can access the site fine on a different server.
#4

[eluser]Michael Wales[/eluser]
Is it creating cookies on your browser?

XAMPP and CI, by default, have no issues cooperating. It may be an underlying issue with the machine XAMPP is being run on though.
#5

[eluser]Kemik[/eluser]
Nope it's not creating cookies. I'm running Apache, MySQL (service) with PHP5.
#6

[eluser]Michael Wales[/eluser]
Share some code with us? I just can't see this being a XAMPP issue - I've never had a problem on a default installation, it's virtually install and go.

But you said it worked on a different server (a production server, I assume)?

I'd like to look over your code and make sure everything is okay there. Have you made any changes to the default XAMPP installation (configuration, upgrading of components, etc)?
#7

[eluser]Kemik[/eluser]
I changed the config to match the url. I changed the database file for my local server info.

The app works 100% on another server.

Here's the part of the code that matters:
Code:
if ($this->validation->run() == TRUE) {
    
    $this->load->library('encrypt');

    // Check details in DB
    $this->db->where('user_name', $this->input->post('user_name'));
    $password_hash = dohash($this->input->post('passw'));
    $this->db->where("password", $password_hash);
    $this->db->where("active", "y");
    $query = $this->db->get("users", 1);
  
    // If user/pass is OK then should return 1 row containing username,fullname
    $return = $query->num_rows();
    $row = $query->row();
    
    if($return){
    
        // update last login datetime
        $this->db->set("lastlogin", date("Y-m-d H:i:s"));
        $this->db->where('user_id', $row->user_id);
        $this->db->update("users");
        
        // Set session data array
        $this->session->set_userdata('user_id', $row->user_id);
        $this->session->set_userdata('role_id', $row->role_id);
        
        redirect('home/index');
        
    } else {
        
        $data['valid'] = FALSE;
        
    }            
}

As it said, it works 100% ok production server.

For reference: $config['base_url'] = "http://localhost/tracker/";

Do I need to edit anything on the XAMPP server (running on Windows XP btw) from the default?
#8

[eluser]Michael Wales[/eluser]
Maybe it's a caching issue. After logging in and being redirected to 'home/index', refresh the page and see if you get the results you are expecting (if it asks you if you want to submit your POST variables again, cancel and manually change the URL in the address bar).
#9

[eluser]Kemik[/eluser]
I went to http://localhost/tracker/ and was redirected to http://localhost/tracker/index.php/user/login. I logged in and was redirected back to http://localhost/tracker/index.php/user/login. I pressed refresh but it didn't have the "Post variables" error.

Using Web Developer I can see no domain cookies for localhost.
#10

[eluser]Michael Wales[/eluser]
Make sure your config.php has the following settings:

Code:
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path'   =  Typically will be a forward slash
|
*/
$config['cookie_prefix']    = "";
$config['cookie_domain']    = "";
$config['cookie_path']        = "/";




Theme © iAndrew 2016 - Forum software by © MyBB