Welcome Guest, Not a member yet? Register   Sign In
session userdata being reset/removed
#11

[eluser]bobbob[/eluser]
For clarity this shows the data is still good at this point:
Code:
public function t($hash)
{
  $this->load->model('event_model');
  $this->load->helper('functions');
  
  $data['all'] = $this->event_model->extract_it_all($hash);
  $this->load->view('header');
  $this->load->view('event',$data);
  $this->load->view('footer');
  print_r($this->session->all_userdata());
  
}
yet the db has been altered after the print_r has run. I think I may not understand the flow in CI.

#12

[eluser]InsiteFX[/eluser]
If your talking about the session_id being changed, CI will generate a new session_id everytime you load a new page!
#13

[eluser]bobbob[/eluser]
???
Changing
Code:
<img src="images/thinking1.gif" alt="thinking"/>
to
Code:
<img src="&lt;?php echo base_url(); ?&gt;images/thinking1.gif" alt="thinking"/>

seems to have solved my sessions being overwritten. To me this is still a bug.
I will try and make a simplified version of the issue for the bug tracker.
#14

[eluser]CroNiX[/eluser]
Not sure how that would affect sessions at all. That problem was you were using a relative path for an image, which was probably triggering a 404.
#15

[eluser]Aken[/eluser]
It's not a bug. This is a good example of why you should not autorun some things like sessions - because things like images or 404 pages will never need them, and activating them can cause conflicts that are especially hard to find.
#16

[eluser]bobbob[/eluser]
You are right in assuming I am autoloading the session class. Can you explain how that will cause issues with loading an image at
Code:
<img src="&lt;?php echo base_url();?&gt;images.image.jpg" />

I have always autoloaded sessions as most of the sites I've done need session validation on almost every page. What is the alternative? Loading in each controller action which as far as I can see will not prevent the conflict with the images?

Glad that someone has an explanation as I am still baffled.

#17

[eluser]kptengco[/eluser]
Code:
<img src="images/thinking1.gif" alt="thinking"/>

You can only use relative paths on your controller inside the
Code:
function index()

Just a thought, your page could be slowed down for calling too much sessions and using for images why not use ajax or jquery to change the "src of your image" and make php conditions.

Code:
&lt;
script&gt;
&lt;?php if($this->uri->segment(number)=='somethin') { ?&gt;
//javascript/jquery use selector then change the attribute value of the src of your image
&lt;?php } ?&gt;
<\/script>




Theme © iAndrew 2016 - Forum software by © MyBB