Welcome Guest, Not a member yet? Register   Sign In
session work in localhost but not in my online website
#1

[eluser]7amza[/eluser]
hey how are you dears? wish fine.
i used the Hybrid session library instead of the original coming with CI by default.
so it works fine with me in localhost . but when i upload it , it dosen't work .
i use it to change the style from basic style (for low connexion) to noraml(with pics).
these is my helper (autoload it)
Code:
<?php
function getCurrentStyle(){
    $wadae =& get_instance();        
    $style =  $wadae->session->userdata('currentstyle');
    if(!($style == 'basic')){
    setStyle('');
    return '';
    }
    else{
        $style = 'basic';
    }
    return $style;
}
function setStyle($mode){
    $wadae =& get_instance();    
    $wadae->session->set_userdata('currentstyle',$mode);
}

the controller method:
Code:
function index(){
        //Count Fields
        $data['categoriesField'] = $this->gadget->countField('categories');
        $data['sitesField'] = $this->gadget->countField('sites');
        $data['viewsField'] = $this->gadget->getField('views');
        //categories
        $data['categories'] = $this->category->getCategories();
        //pages
        $data['pages'] = $this->gadget->getPages();
        //adsenses
        $data['adsenses'] = $this->gadget->getAdsenses();
        //blocks
        $data['blocks'] = $this->gadget->getBlocks();
        //articles
        $data['articles'] = $this->article->getArticles(3);
        //load views
        $this->load->view('header',$data);
        $this->load->view('menu',$data);
        $this->load->view(getCurrentStyle().'home',$data);
        $this->load->view('footer',$data);
    }
the switcher method :
Code:
function SetStyle(){
        $mode  =  $this->uri->segment('3');
        if($mode == FALSE){
            redirect($_SERVER['HTTP_REFERER']);
        }elseif($mode == 'basic'){
            setStyle($mode);
        }elseif(!($mode == 'basic')){
            setStyle(NULL);
        }
        redirect($_SERVER['HTTP_REFERER']);
    }
i have to views :
home.php
basichome.php
the link : http://domain.ext/folder/home/SetStyle/basic should change the mode to the basic!
so in localhost it works fine but when i upload it to my online website it don't work !!
any solution?
#2

[eluser]7amza[/eluser]
the problem i think that when i set the mode to basic(SetStyle/basic) the session works good but when the method redirect my to the other page the site reinitialize the website so the session lose the value of the currentstyle session name and the helper set 'NULL' by default .
this is what i got in the session table .
|44a785cc71f89821dfaa80399b2c8270|81.192.238.190|Mozilla/5.0 (Windows; U; Windows NT 6.1; fr; rv:1.|1280963171|a:1:{s:12:"currentstyle";s:4:"Null";}
|a6de95471f96267d7bd7c30af5db5798|81.192.238.190|Mozilla/5.0 (Windows; U; Windows NT 6.1; fr; rv:1.|1280963216|a:1:{s:12:"currentstyle";s:5:"basic";}
so how can i solve the problem that only happens in livesite?
#3

[eluser]7amza[/eluser]
the problem was solved , thank you .




Theme © iAndrew 2016 - Forum software by © MyBB