3

Hi Friends I am struggling session in codeigniter everything working fine my system but server or sit machine not working session

public function voting() {    //like and dislike controller 

        $deal_id = $this->input->post('voteId');
        $upOrDown = $this->input->post('upOrDown');
        $session_id = $this->input->post('session_id');
       $voted_id = $this->session->userdata('voted');
        $voted_deal =$this->session->userdata('voted_deal');

        if ($voted_id == $session_id && $voted_deal == $deal_id) 
        { //defult session id voted id equla return 2

            echo 2; // it important for already voted or not checking purpose
        }
        else 
        {

            $status = "false";
            $updateRecords = 0;

            if ($upOrDown == 'upvote')
            { //like vote

                $updateRecords = $this->consumer_model->updateUpVote($deal_id);
            } 
            else 
           { //dis like vote

            $updateRecords = $this->consumer_model->updateDownVote($deal_id);
          }
          if ($updateRecords > 0) 
          { //updaterecords greaterthan zero return true and set the defult session id

             $this->session->set_userdata('voted_deal',$deal_id);
              $voted_deal=$deal_id;
              $voted_id = $session_id;
             $this->session->set_userdata('voted', $voted_id);
              $status = 1; 
          }

          echo $status;  // return status it important for voted sucessfully message
        }
    }

the above code is working to me but not working on server.you notice this i am auto load the session library

4

1 に答える 1

7

うまくいくかもしれないいくつかの代替案を試してみてください
:application/config/config.php:

$config['sess_cookie_name'] = 'cisession';     //remove(underscore)
$config['cookie_domain']    = ".example.com";  //make it site wide valid
于 2013-09-26T09:41:25.480 に答える