Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // (C) 2011 Bry8Star.
- // Bry8Star <at> yahoo <dot> com.
- //
- // Shuffle Photo :
- // Randomly output any image from a folder to the caller of this php
- // It should be called in this way :
- // ./shuffle_photo.php?pic=any.jpg
- // example : <img src="shuffle_photo.php?pic=any.jpg" alt="" />
- //
- $ref = strtolower($_SERVER['HTTP_REFERER']);
- $agnt = strtolower($_SERVER['HTTP_USER_AGENT']);
- $rurl = @parse_url($ref);
- $v = '0';
- $rc = '1';
- $mydom = array(
- 'exm1.com',
- 'www.exm1.com');
- $err = 'http://www.exm1.com/400.shtml';
- if(strpos($ref, 'google') != ''){ $v = '1';}
- if(strpos($agnt, 'google') != ''){ $v = '2';}
- if(strpos($ref, 'altavista') != ''){ $v = '1';}
- if(strpos($agnt, 'altavista') != ''){ $v = '2';}
- if(strpos($ref, 'yahoo') != ''){ $v = '1';}
- if(strpos($agnt, 'yahoo') != ''){ $v = '2';}
- if(strpos($agnt, 'slurp') != ''){ $v = '2';}
- if(strpos($ref, 'lycos') != ''){ $v = '1';}
- if(strpos($agnt, 'lycos') != ''){ $v = '2';}
- if(strpos($ref, 'ask') != ''){ $v = '1';}
- if(strpos($agnt, 'teoma') != ''){ $v = '2';}
- if($rc == '1') {
- if(isset($_REQUEST['pic'])) {
- while(list($k,$c)=each($mydom)) {
- if(strstr($ref,$c)) {
- $v = '3';
- }
- else {
- if(strstr($ref.$rurl[path],$c)) {
- $v = '3';
- }
- }
- }
- }
- if($v == '0') {
- header('Location: '. $err .'');
- exit;
- }
- }
- $picL2 = array( # image/pic LIST
- 'pic01.jpg', #1
- 'pic02.jpg', #2
- 'pic03.jpg'); #3
- // Add numbers inside below array , keep 1 less than the above LIST,
- // as it already starts with 0.
- $numL2 = array(0,1,2);
- $temp2 = count($numL2);
- $secssame2=8;
- $seedval2=(int)(time()/$secssame2);
- srand($seedval2);
- for ($i2=0; $i2<$temp2; ++$i2){
- $rand2=rand(0,$temp2); //$rand2=rand(0,$temp2-1);
- $temp2 =$numL2[$i2];
- $numL2[$i2]=$numL2[$rand2];
- $numL2[$rand2]=$temp2;
- }
- $temp2 = $numL2[5];
- $file2 = $picL2[$temp2];
- header('Content-Disposition: filename=any.jpg');
- header('Content-Length: ' . filesize( $file2 ) );
- header('Content-type: image/jpeg');
- readfile($file2);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment