Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //load wp functions to get id
- define('WP_USE_THEMES', false);
- require('./wp-blog-header.php');
- $current_user = wp_get_current_user();
- $current_user_id = $current_user->ID;
- //save idlength to compare
- $idLength=strlen($current_user_id);
- if (isset($_GET['show'])) {
- $img="../Subidas_cliente/{$_GET['show']}";
- if (file_exists($img)){
- //admin ids always get image
- if($current_user_id==2||$current_user_id==10||$current_user_id==12||$current_user_id==13){readfile($img);}
- else{
- $tmp=substr($img,0,$idLength);
- $r=strcmp($tmp, $current_user_id);
- if ($r==0){
- $mime_type = mime_content_type($img);
- header('Content-Type: '.$mime_type);
- //readfile
- readfile($img);
- }else{
- exit(0);
- }
- }
- }else {
- header('Content-Type: image/jpeg');
- readfile('../Subidas_cliente/default.jpg');}
- }else{
- header('Content-Type: image/jpeg');
- readfile('../Subidas_cliente/default.jpg');}
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement