Advertisement
Guest User

Profile view

a guest
Nov 28th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. For example:
  2. suppose your user profile url is in the form "http://www.yoursite.com/profile.php?userid=23124"
  3. If a logged in user is visiting another user's profile
  4.  via above url the userid can be accessed using $_GET['userid'];
  5. then the code should be like this
  6.  
  7. <?php
  8. session_start();
  9. uid of visiting user. Can be retrieved from current session
  10. $logged_user=$_SESSION["current_user_id"];
  11.  
  12. //extract the user id of visiting profile
  13. $u=$_GET['userid'];
  14.  
  15. $Owner = "no";
  16. if($u == $logged_user)
  17. {
  18.     $Owner = "yes";
  19.     if($logged_user!==$isOwner)
  20.     {
  21.         $query = mysql_query("UPDATE users SET pvs = pvs + 1 WHERE username =$u'") or die(mysql_error());
  22.     }
  23. }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement