Jump to content

what's wrong?


raffinare

Recommended Posts

it's supposed to check the file, to see if it's available for download, the code below looks okay to me, what's wrong?

 

if($row[2]==2) // 4shared check
{
	$row[1]="http://www.".$row[1];
	$index=getpage($row[1]);
	preg_match("/Download ([^<]+)<\/div>/",$index,$match);
	if(strpos($index,"The file is shared for public access and download.")===false || !$match)
	{
		mysql_query("UPDATE `v2links` SET `checked`='-1',`lastcheck`=NOW() WHERE `id`=".$row[0]);
		print "bad link\n";
		logstr("log-c.txt","bad link\n");
	}
	else
	{
		$words=trim($match[1]);
		$words=preg_split("/[_\.\-\s]/",$words);
		$lastword=array_pop($words);
		$words=implode(" ",$words);
		$words=preg_replace("/\s{2,}/"," ",$words);
		$caption=mysql_real_escape_string($words);
		unset($words);
		unset($match);
		preg_match("/<td>Size\:<\/td><td>([^<]+)<\/td>/",$index,$match);
		$fsize=$match[1];
		unset($match);
		print "$caption :: $fsize\n";
		logstr("log-c.txt","$caption :: $fsize\n");
		mysql_query("UPDATE `v2links` SET `checked`='1',`lastcheck`=NOW(),`fsize`='$fsize',`caption`='$caption' WHERE `id`=".$row[0]);
		if(mysql_errno()) print mysql_error()."\n";
	}
}

 

 

I'm wondering if the sharing website has changed anything, because for rapidshare it works fine, code:

 

if($row[2]==1) // rapidshare check
{
	$index=getpage($row[1]);
	if(strpos($index,"<p><script>alert(\"File not found.\")</script>File not found.</p>")===false && strpos($index,"This file has been deleted.")===false)
	{
		preg_match("/<form action=\"([^\"]+)\" method=\"post\">/",$index,$match);
		//print $index;
		if($match[1])
		{
			$fpath=$match[1];
			$index=getpage($fpath,"dl.start=Free",$row[1]);
			preg_match("/<\/font> \(([^\(]+)\)\.<\/p>/",$index,$match);
			$fsize=0;
			if($match[1]) $fsize=mysql_real_escape_string(strip_tags($match[1]));
			print $fsize."\n";
			logstr("log-c.txt",$fsize."\n");
			mysql_query("UPDATE `v2links` SET `checked`='1',`fsize`='$fsize',`lastcheck`=NOW() WHERE `id`=".$row[0]);
			if(mysql_errno()) print mysql_error()."\n";
		}
		else
		{
			print "bad link\n";
			logstr("log-c.txt","bad link\n");
			mysql_query("UPDATE `v2links` SET `checked`='-1',`lastcheck`=NOW() WHERE `id`=".$row[0]);
			if(mysql_errno()) print mysql_error()."\n";
		}
	}
	else
	{
		print "bad link\n";
		logstr("log-c.txt","bad link\n");
		mysql_query("UPDATE `v2links` SET `checked`='-1',`lastcheck`=NOW() WHERE `id`=".$row[0]);
		if(mysql_errno()) print mysql_error()."\n";
	}
}

 

 

any help would be appreciated!

Link to comment
https://forums.phpfreaks.com/topic/209538-whats-wrong/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.