Jump to content

Archived

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

rallokkcaz

how to allow the user not another user edit there profile?

Recommended Posts

i wanna to allow only the user who's info
is on the page to edit it

example

user1 can edit there profile

and user2 can't how could i make a code to do that

Share this post


Link to post
Share on other sites
If the user is logged in, check to make sure that the user who is currently logged in matches that of the profile.

IE
[code]
<?php
$USERNAME = "SharkBait";

$USER = "SharkBait";  // Retrieved from a database

if($USERNAME == $USER) {
  // Allow user to edit profile
} else {
  // User is not allowed to edit profile
  echo "<p>You are unauthorized to do that action.</p>\n";
}

?>
[/code]

Share this post


Link to post
Share on other sites

×

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.