mail2rvg wrote:
> I build a web application using PHP5 and Prototype JS. When logging
> into the system, the session is filled with an user_id. In the
> application, the user_id is necessary  to determine the user
> rights....but when I use an Ajax Request the PHP session suddenly is
> empty!
>
> Does anyone know a solution for this problem?
>
> ...
>   
When using php with cookies, the session ID will automatically be sent 
in the request headers even for Ajax XMLHttpRequests.  If you use or 
allow URL-based php sessions, you'll have to add the session id to every 
Ajax request url.

untested example:

<script language="javascript" type="text/javascript">
//<![CDATA[
  var url = '/ajax_server.php?<?php echo session_name(); ?>=<?php echo 
session_id(); ?>';
  new Ajax.Request(url, { ... });
//]]>
</script>


- Ken Snyder

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to