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