Welcome Guest, Not a member yet? Register   Sign In
Google Chrome says no...
#1

[eluser]JasonS[/eluser]
Yeah, I am confused.

I added a currency conversion feature to a website. It works in every browser. Apart from Chrome which suddenly hits a Page not Available message.

http://collectorscurrency.com

Click on the 'Switch to..'

In every browser it works. In Chrome it doesn't. In fact the whole site becomes inoperable until you delete your cache.

This was the change I made.

Code:
public function set_curr($curr)
    {
        $valid = array('euro', 'dollar');
        if ( ! in_array($curr, $valid))
            header('location:'.$this->config->item('base_url'));
        
        // Check last time DB was updated.
        $query = $this->db->query('SELECT * FROM conversion WHERE date < DATE_ADD(NOW(), INTERVAL -1 DAY)');
        
        if ($query->num_rows() == 1)
        {
            // If Currency info is more than 24 hours old, update it.
        }
        
        $this->session->set_userdata('currency', $curr);
        
        header('location:'.$this->config->item('base_url'));
    }
#2

[eluser]JasonS[/eluser]
Quick Update

It must be a session / cookie issue. I say this because if you switch to euros the site still works if you add/remove the www.

I had a theory that I had bust the cookie maximum allowance due to my method of transfer. However I have trimmed the result of the transfer to 5 decimals and the issue still persists.

To get the updated prices I do this.

Code:
public function to_euro($value)
    {
        $this->session->unset_userdata('transfer');
    
        if (!$this->session->userdata('transfer'))
        {
            $query = $this->db->where('euro', 1)->get('conversion');
            $row = $query->row();
            
            // Work out what 1 dollar is.
            $dollar = $row->euro / $row->dollar;
            
            $this->session->set_userdata('transfer', round($dollar, 5));
        }
        return round(($value * $this->session->userdata('transfer')), 2);
    }
#3

[eluser]Mat-Moo[/eluser]
Chrome shows page not available, and more info shows "Error 325 (net::ERR_RESPONSE_HEADERS_TOO_BIG): Unknown error." - How much are you storing in the session/cookie?
#4

[eluser]BrianDHall[/eluser]
I thought codeigniter now by default stores information server-side and doesn't pack it automatically all into the cookie values (which is a terrible process anyhow) - or am I mistaken and it still does this?
#5

[eluser]InsiteFX[/eluser]
There is a 4k limit on http headers.

If you read the user guide about session library it explains it all.

Enjoy
InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB