ATutor

Learning Management Tools







Pages:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15


Session variables in php script


  • 2012-08-01 12:40:30

    Session variables in php script

    Hello, I'm using jquery calls (from my own custom module) to my own external php scripts for actions on a database, but how can I access session variables from the php script itself ? I don't want to pass them from javascript for security concerns.

    I did a quick attempt by including vitals.inc but my script got much slower and instead of returning just one of my custom string, it returns a whole html page ... :D

    I just need the member_id and of course to be sure that the client is logged in.

  • 2012-08-01 13:01:28

    Re: Session variables in php script

    You will need to include vitals.inc.php to maintain an ongoing session. At the top of the vitals file set AT_DEVEL to 1 to turn on debugging. You'll then get the session displayed below when you reload an ATutor page, and you can use the debug() function to output values of just about any variable.

    The the debug() details in the developer documentation.

  • 2012-08-03 11:21:53

    Re: Session variables in php script

    I'm using a php file to write to the database and I want it to use read the member_id from the session info so I'm sure the user is logged in. It also returns a single string for success or failure. (I call it with jquery's post function)

    If I include vitals.inc at the top of that php, a whole html page is returned to my jquery post command, it's 10 times slower and my mysql code isn't even run it seems. :(

    Is there a stripped down include file that only maintains the session ? (Which will be AJAX-called from javascript and not loaded with a browser.)

  • 2012-08-03 20:20:17

    Re: Session variables in php script

    Putting the command :
    $_user_location = 'users';

    on top of my script fixed my problem it seems. :D