View Single Post
Old 11-14-2008, 08:35 PM   #1 (permalink)
h0ly lag
The Contributor
 
Join Date: Apr 2008
Location: Nevada, USA
Posts: 52
Thanks: 10
h0ly lag is on a distinguished road
Default Rapidshare link checker

I've made a RS link checker, but I feel it's very inefficient in the way it checks the links. It uses get_file_contents to visit the page of every link, then using some (albeit very terrible or misused) regex. I am posting my code for some input from anyone who is willing to give it. As far as making it more efficient, adding more features or anything else. Yes, it is trusting user input as of right now. I suppose this was just prof of concept. Please only constructive criticism.

PHP Code:
<?php

if (!isset($_POST['link_set']))
    {
    echo 
'
    <form action="" method="post">
    <textarea name="link_set" rows="15" cols="80"></textarea><br /><br />
    <input type="submit" value="Submit" />
    </form>'
;
    }
elseif (empty(
$_POST['link_set']))
    {
    echo 
'ERROR: No links entered.';
    }
else
    {
    
$link_set explode("\n",$_POST['link_set']);
    foreach (
$link_set as $link)
        {
        
$link_str file_get_contents($link);
        
$pattern '<input type="hidden" name="dl.start" value="PREMIUM" />';
        
        
preg_match($pattern,$link_str,$match);
        
        if (
$match[0] != null)
            {
            echo 
'<span style="color: green">'.$link.'</span><br />';
            }
        else
            {
            echo 
'<span style="color: red">'.$link.'</span><br />';
            }
        }
    echo 
'<br /><input type="button" value="Check More Links" onClick="window.location.href=window.location.href">';
    }

?>
__________________

Last edited by h0ly lag : 11-15-2008 at 06:19 AM.
Send a message via AIM to h0ly lag Send a message via MSN to h0ly lag
h0ly lag is offline  
Reply With Quote