TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Rapidshare link checker (http://www.talkphp.com/general/3607-rapidshare-link-checker.html)

h0ly lag 11-14-2008 09:35 PM

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">';
    }

?>


h0ly lag 11-18-2008 07:18 PM

Nobody has anything to say?


All times are GMT. The time now is 11:39 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0