Passing session and uid data to .php server side script?

Passing session and uid data to .php server side script?

schnibitzschnibitz Posts: 15Questions: 0Answers: 0
edited January 2012 in General
All, I currently have datatables serving up data for multiple users. The way I have it set up now is that it's basically fetching all the data, and then hiding certain columns, and filtering based on those columns field data.

Problem 1: This can become VERY bad as the database grows.
Problem 2: This is terrible security.

My script accesses a modified server_processing.php file, which talks to a database. I was thinking that it wouldn't be too much work to get that file to serve up data only to authenticated users (with a session ID I'd guess). I can also modify that same php file to craft SQL queries that only get data where it matches the uid.

I know how to get my datatables code (javascript obviously) to have access to the current user's session ID, and UID. But I want my datatables javascript to be able to pass the session ID and UID to the server_processing.php script. Now I know how to make the .php script expect it, and deal with it, but I don't know exactly how to make the javascript pass the variables. I'd assume they'd be "GET"-based in nature. I didn't immediately see an answer to this question when I first started searching, so I thought I'd ask here.

Thank you,
-S

Replies

  • allanallan Posts: 63,540Questions: 1Answers: 10,476 Site admin
    edited January 2012
    Yup - sounds like a good move that change!

    To do want you want:

    Docs: http://datatables.net/ref#fnServerParams
    Example: http://datatables.net/release-datatables/examples/server_side/custom_vars.html

    :-)

    Allan
This discussion has been closed.