Jump to content


Photo

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


  • Please log in to reply
1 reply to this topic

#1 rallokkcaz

rallokkcaz
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts
  • LocationSomewhere, CA (Cactus Area)

Posted 03 September 2006 - 05:25 AM

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

#2 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 03 September 2006 - 05:50 AM

If the user is logged in, check to make sure that the user who is currently logged in matches that of the profile.

IE
<?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";
}

?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users