Jump to content

How can I protect a page from other users


TeddyKiller

Recommended Posts

I can safely assume the user has logged in. Simply place their user name within the current session (as people do for authenticated programs) and you can easily make this:

 

//editdetails.php?id=24 An automated example

if ($_SESSION['userid'] != $_GET['id']) {
   die('You\'re not authenticated to view this page!'));
}

//Authenticated content

 

Of course that is a mockup example, and you should generate a solid system of how you handle the user's IDs appropriate for what you are doing, but authentication per user is as simple as that.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.