Jump to content

Recommended Posts

I have a php application already built and I'm trying to add AJAX to it (This is mainly a php question though)

 

I need to be able to secure query information that I send between files. Can't just create a file thats like query.php?q="INSERT INTO table (Whatever you want!) VALUES ('ruin my database') and pass that info to it through GET, nor through POST.

 

I understand I could set a session variable with the query string inside it, and pass the session id through ajax, as well as the names of the session variables to call. And by calling those variables the PHP file would then do what it needed as per what variables it was provided.

 

How secure would this be? I've been reading about session hijacking, but it doesn't seem possible. There isn't much you can do with a plain text Session ID to harm my server right? Or with a plain text Session ID, and the session variable Names, but not values. There's no way for a user to set a session variable value short of hacking my server and uploading their own php right?

 

Thanks a lot in advance, I'm trying to become less of a session noob, and more of a session pro!

To solve this:

query.php?q="INSERT INTO table (Whatever you want!) VALUES ('ruin my database') and pass that info to it through GET, nor through POST.

 

I'd simply do

query.php?q=1

 

Then, in query.php do something like

 

if ($_GET['q'] == 1) {

    // Do some predefined query that others cant tamper with :P

}

 

And simply make a different # for as many queries that you need.

Thanks for the reply, the problem with that solution is that all of the queries are generated automatically on 2 seperate levels, and several of my pages have the potential to need several hundred different queries (Which is why I'm switching to ajax, to only run the ones I need)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.