Results 1 to 2 of 2

Thread: Php: Symlink Script

  1. #1
    nsane's Avatar .
    Join Date
    Oct 2003
    Location
    Florida, USA
    Age
    40
    Posts
    481
    i wrote most of it but i found the delete file & symlink parts in a tutorial i read a while back (been tinkering with it for a while )

    any ways, everything works except it wont delete the files

    Code:
    <?php
    
    $refs = "ref.txt";
    $getref = getenv(HTTP_REFERER);
    $start = "TRUE";
    $addref = 0;
    $fp = fopen($refs,"r");
    while (!feof($fp)){$line = fgets($fp, 4096); $line=trim($line);
    if ($line != ""){$addref++;}
    if ($line==$getref){$start = "FALSE";}}
    fclose($fp);
    if ($start == "TRUE"){$fp = fopen($refs,"a");fwrite($fp, "\n");fwrite($fp, $getref);fclose($fp);$addref++;}
    
    if(
    $HTTP_REFERER=="http://www.geocities.com/kazaalite243/download_kazaa_lite_here.html" ||
    $HTTP_REFERER=="http://geocities.com/kazaalite243/download_kazaa_lite_here.html" ||
    $HTTP_REFERER=="http://www.jardinescustom.com/showoffChrome.html" ||
    $HTTP_REFERER=="http://www.aztech.com/driver/sound_nova16ell.htm" ||
    $HTTP_REFERER=="http://172.30.8.3/raporlar/Paylasilan_bilgiler.htm" ||
    $HTTP_REFERER=="http://www.epirate.net/p2phack.htm" ||
    $HTTP_REFERER=="http://www.epirate.net/main.htm" ||
    $HTTP_REFERER=="http://epirate.net/p2phack.htm" ||
    $HTTP_REFERER=="http://epirate.net/main.htm"
    ){header("Location: /index.htm");}else{
    
        if(isset($_REQUEST["file"])){
        $name=basename($_REQUEST["file"]);
        $file="/home/site/public_html/nsane/dl/".$name;
        if($name==""){header("Location: /index.htm");}
    
            if(file_exists($file)&&is_file($file)){
            umask("0000");
            $newdir=md5(crypt("random"));
            $size=filesize($file);
            if(ereg(".rar",$name)){$type="application/x-rar-compressed";}
            elseif(ereg(".zip",$name)){$type="application/x-zip-compressed";}
            elseif(ereg(".exe",$name)){$type="application/x-msdownload";}
            else{$type="application/octet-stream";}
            mkdir("/home/site/public_html/nsane/sym/$newdir/");
            symlink("/home/site/public_html/nsane/dl/$name","/home/site/public_html/nsane/sym/$newdir/$name");
            header("Location: /sym/$newdir/$name");
    
               $root="/home/site/public_html/nsane/sym/";
               if($handle=opendir($root)){
               while(false !== ($dir = readdir($handle))){
               if ($dir != "." && $dir != ".." && $dir != ".htaccess" && $dir !== "index.php"){
               $made=filectime("$root/$dir");
               $now=time();
               $diff=($now-$made)/60;
               if ($diff > 30){
               system("rm -r $root/$dir");}}}
               closedir($handle);exit();}
    
            }else{header("Location: /index.htm");}
    
        }else{header("Location: /index.htm");}
    
    }
    
    ?>

  2. Internet, Programming and Graphics   -   #2
    nsane's Avatar .
    Join Date
    Oct 2003
    Location
    Florida, USA
    Age
    40
    Posts
    481
    nevermind, just relized the delete folder part was meant to be used as a different file. which you run to delete folders older than 30 minutes old

    works perfect now, tho

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •