Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter Session Problems Thread
#14

[eluser]jenovachild[/eluser]
Hi,

I've also encountered session issues using CI session library, specifically when I upload to my remote host.

Details:

1. I develop the website on my localhost, everything works well - first time using CI, I fall in love. (Big MVC fan)

2. I upload the website to my remote server, everything works great, accept I am attempting to use sessions to save some data when I get a return response from Paypal, which was an attempt on its own to get working (Paypal requires you to be able to receive $_GET variables, I've finally managed to work this out but CI really could use some better documentation / variations when you are required to receive $_GET, anyway.. separate story)

3. After setting the session then redirecting to the next page (/checkout/review) I find the session is empty, only on ONE of the THREE servers I have tested. (Although I know sessions and cookies both work using native php cookies/sessions)

4. So, here is some pseudo code logic:

Code:
// cURL request to payapl, specifying a return url, dollar amount, etc.

// I am not on paypals page, user logs in/specify's credit card, and hits submit

// cURL request returns me to the returl url, with query string variables ($_GET) pertaining to information that I need. (A special token to relate to this transaction)

// From here, I send another cURL request, using the previous information sent from paypal and the redirect to a 'review payment' page, with the returned results from paypal because I need the return info, i store it into a session by doing the following:

$this->session->set_userdata('paypal_result', $result);
        redirect('./checkout/review/');

// At this point I am on the review page, and there is nothing in the session data, although $result is full of data (print_r($result), its an array..)

// here is an overview of that entire section of my code, all within the same controller - checkout.php


// AUTH REQUEST
function auth()
    {
        // do the paypal stuff, lets initialize an auth request, with an amount (everything else is static!)
        $this->paypal->init_authorization(50);
        $result = $this->paypal->request();
        
        // check for an error
        if($this->_err_check($result["ACK"], $result))
            return;
        
        // if the result is a success, redirec to paypal
        if($result["ACK"] == "Success")
            header("Location: " . $this->paypal->get_param("PAYPAL_LOGIN") . urldecode($result["TOKEN"]));

    }


// RETURN URL

    function returnurl()
    {
    
        // initialize paypal variables for the review
        $this->paypal->init_payment_review($_GET['token'], $_GET['PayerID']);
        
        // post the request to paypal and retreive the results
        $result = $this->paypal->request();
                
        // check for an error
        if($this->_err_check($result["ACK"], $result))
            return;
        
        // set the result in flash data, because we are going to redirect to a new page to remove the ugly $_GET requests from the url.
        $this->session->set_userdata('paypal_result', $result);
        redirect('./checkout/review/');
    }



// REVIEW PAYMENT BEFORE PROCEEDING

function review()
    {
        // get the flash data for the user to review.
        $data = $this->session->userdata('paypal_result');
        
        // set the flash data again, because we will need it when we process the payment.
        $this->session->set_userdata('paypal_result', $data);
        
        echo '<pre>REVIEW<br>';
        print_r($data);
        echo '<a href="/csnq/checkout/process/">Click here to make sure that you can get the most out of life!!</a>';
        echo '</pre>';
    }

Some browser fact to note:

- It fails in IE and Firefox and Chrome

So, this all works fine on my localhost AND I've also uploaded it to one other remote server, both are working. Only the server this website needs to be hosted on refuses to let the sessions work.

The phpinfo page for the server which is NOT working, can be found at http://www.darklite.com.au/phpinfo.php


These are my session settings in config

Code:
$config['sess_cookie_name']        = 'ci_session';
$config['sess_expiration']        = 7200;
$config['sess_encrypt_cookie']    = FALSE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']        = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent']    = TRUE;
$config['sess_time_to_update']     = 300;
$config['cookie_prefix']    = "";
$config['cookie_domain']    = "";
$config['cookie_path']        = "/";
Any help on this would be much appreciated! Thanks!


Messages In This Thread
CodeIgniter Session Problems Thread - by El Forum - 11-19-2009, 01:05 PM
CodeIgniter Session Problems Thread - by El Forum - 11-19-2009, 02:49 PM
CodeIgniter Session Problems Thread - by El Forum - 11-20-2009, 07:59 AM
CodeIgniter Session Problems Thread - by El Forum - 11-20-2009, 08:11 AM
CodeIgniter Session Problems Thread - by El Forum - 11-20-2009, 10:51 AM
CodeIgniter Session Problems Thread - by El Forum - 11-20-2009, 12:48 PM
CodeIgniter Session Problems Thread - by El Forum - 11-20-2009, 01:27 PM
CodeIgniter Session Problems Thread - by El Forum - 11-20-2009, 01:45 PM
CodeIgniter Session Problems Thread - by El Forum - 11-20-2009, 05:25 PM
CodeIgniter Session Problems Thread - by El Forum - 11-21-2009, 11:49 AM
CodeIgniter Session Problems Thread - by El Forum - 12-03-2009, 01:45 PM
CodeIgniter Session Problems Thread - by El Forum - 12-03-2009, 02:29 PM
CodeIgniter Session Problems Thread - by El Forum - 12-05-2009, 04:25 AM
CodeIgniter Session Problems Thread - by El Forum - 05-16-2010, 01:03 AM
CodeIgniter Session Problems Thread - by El Forum - 05-16-2010, 03:17 AM
CodeIgniter Session Problems Thread - by El Forum - 08-23-2010, 10:32 PM
CodeIgniter Session Problems Thread - by El Forum - 08-24-2010, 03:32 AM
CodeIgniter Session Problems Thread - by El Forum - 08-24-2010, 08:43 AM
CodeIgniter Session Problems Thread - by El Forum - 09-16-2010, 01:59 AM
CodeIgniter Session Problems Thread - by El Forum - 09-16-2010, 08:47 AM
CodeIgniter Session Problems Thread - by El Forum - 09-17-2010, 07:45 PM
CodeIgniter Session Problems Thread - by El Forum - 09-18-2010, 03:44 AM
CodeIgniter Session Problems Thread - by El Forum - 09-18-2010, 07:02 AM
CodeIgniter Session Problems Thread - by El Forum - 06-03-2011, 08:36 AM
CodeIgniter Session Problems Thread - by El Forum - 06-03-2011, 08:44 AM
CodeIgniter Session Problems Thread - by El Forum - 06-03-2011, 08:53 AM
CodeIgniter Session Problems Thread - by El Forum - 06-06-2011, 12:34 AM
CodeIgniter Session Problems Thread - by El Forum - 06-06-2011, 09:19 AM
CodeIgniter Session Problems Thread - by El Forum - 03-07-2012, 10:26 AM
CodeIgniter Session Problems Thread - by El Forum - 03-07-2012, 10:51 AM
CodeIgniter Session Problems Thread - by El Forum - 03-07-2012, 11:10 AM
CodeIgniter Session Problems Thread - by El Forum - 05-21-2013, 03:09 AM
CodeIgniter Session Problems Thread - by El Forum - 05-21-2013, 03:12 AM
CodeIgniter Session Problems Thread - by El Forum - 06-28-2013, 02:56 PM
CodeIgniter Session Problems Thread - by El Forum - 08-21-2013, 02:58 AM
CodeIgniter Session Problems Thread - by El Forum - 08-22-2013, 12:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB