Jump to content

Stop PHP header injections


black.horizons

Recommended Posts

Hi there,

i'm making a news cms for my site, just i need to have a few specific features and stuff, and i've just a huge stumbling block. i had to delete a post, and i have that sorted ok - i mean i can delete posts...but if somebody decided to type:

www.whateverdomainitis.com/news/delete-post.php?id=1&action=delete

then the post would be deleted. does anybody know how to stop this???
Link to comment
Share on other sites

well. make an admin system. simple one would be have a file named config.php and store the real admin name and pass in there. then have a login, if it is all good then set a session. then on the delete-post.php page at the very top add an if statement to check if the session is set. if it isnt, redirect to login, if it is, delete post...

simple really...

am i talking about what your talking about? :)
Link to comment
Share on other sites

It's good practice to send sensitive data (i.e., primary keys) via POST instead of GET.  On the server side you can pull data from the $_POST array instead of the $_GET or $_REQUEST array.  This makes it a lot harder for people to mess with data coming back from the presentation layer and keeps your database structure hidden.
Link to comment
Share on other sites

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.