Advertisement
Guest User

Untitled

a guest
Apr 25th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. //load wp functions to get id
  2.  
  3. define('WP_USE_THEMES', false);
  4. require('./wp-blog-header.php');
  5.  
  6. $current_user = wp_get_current_user();
  7. $current_user_id = $current_user->ID;
  8.  
  9. //save idlength to compare
  10.  
  11. $idLength=strlen($current_user_id);
  12.  
  13. if (isset($_GET['show'])) {
  14.  
  15. $img="../Subidas_cliente/{$_GET['show']}";
  16.  
  17. if (file_exists($img)){
  18.  
  19. //admin ids always get image
  20. if($current_user_id==2||$current_user_id==10||$current_user_id==12||$current_user_id==13){readfile($img);}
  21.  
  22. else{
  23.  
  24. $tmp=substr($img,0,$idLength);
  25. $r=strcmp($tmp, $current_user_id);
  26.  
  27. if ($r==0){
  28.  
  29. $mime_type = mime_content_type($img);
  30. header('Content-Type: '.$mime_type);
  31.  
  32. //readfile
  33. readfile($img);
  34. }else{
  35. exit(0);
  36. }
  37. }
  38.  
  39. }else {
  40. header('Content-Type: image/jpeg');
  41. readfile('../Subidas_cliente/default.jpg');}
  42.  
  43. }else{
  44. header('Content-Type: image/jpeg');
  45. readfile('../Subidas_cliente/default.jpg');}
  46.  
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement