Stephen Posted June 13, 2008 Share Posted June 13, 2008 Okay well I attempted to make a script that should check the links of a thread and make sure they work (like the bot on a phpbb forum). For some reason it can't do alot of threads, only like 20 or something. If you have vbulletin and a section with RS/MU etc. links you can try this and tell me what it gets to D: And if it's a programming problem can someone help me? <?php /////////////////////////////////////////////////////////// // Script created by: Stephen (aka AADude) //////////////////// // Use: Checking to see if links are dead or not ////////////////// ////////////////////////////////////////////////////////// function ss_link_check($_url,$_type="RS") { //RS = RapidShare; MU = MegaUpload; ES = EasyShare; FF = FileFactory; SS = SendSpace; $_sites=array( "RS" => "Error", "MU" => "Unfortunately, the link you have clicked is not available.", "ES" => "File not found", "FF" => "Sorry, this file is no longer available. It may have been deleted by the uploader, or has expired.", "SS" => "Sorry, the file you requested is not available.", "FFFH" => "Your requested file is not found" ); $_fgc=file_get_contents($_url); if (preg_match("/".$_sites[$_type]."/",$_fgc) or $_fgc=="") { $_correct=false; } else { $_correct=true; } return $_correct; } //Include the vBulletin configuration file include ("../config.php"); //Search the DB if ($config['MasterServer']['usepconnect']==1) { $_connection=mysql_pconnect( $config['MasterServer']['servername'].":".$config['MasterServer']['port'], $config['MasterServer']['username'], $config['MasterServer']['password']); } else { $_connection=mysql_connect( $config['MasterServer']['servername'].":".$config['MasterServer']['port'], $config['MasterServer']['username'], $config['MasterServer']['password']); } mysql_select_db( $config['Database']['dbname'], $_connection); $_boards_array=array( 1 => "16", 2 => "20", 3 => "23", 4 => "26", 5 => "28", 6 => "32", 7 => "18" ); foreach ($_boards_array as $_key => $_cboard) { echo("<b>Board ID:</b> ".$_cboard."<br />"); $_query1=mysql_query('SELECT * FROM '.$config['Database']['tableprefix'].'thread WHERE forumid="'.$_cboard.'" ORDER BY threadid DESC'); while ($_rows1=mysql_fetch_array($_query1)) { $_threadid=$_rows1["threadid"]; $_firstpostid=$_rows1["firstpostid"]; $_query2=mysql_query('SELECT * FROM '.$config['Database']['tableprefix'].'post WHERE postid="'.$_firstpostid.'"'); while ($_rows2=mysql_fetch_array($_query2)) { $_pagetext=$_rows2["pagetext"]; $_link=preg_match_all("@\[(?i)url\](.*?)\[/(?i)url\]@si",$_pagetext,$_url,PREG_SET_ORDER); $_replace=preg_replace("@\[(?i)url\](.*?)\[/(?i)url\]@si","@\[(?i)url\](.*?)\[/(?i)url\]@si",$_pagetext,-1,$_count); $_not_working=0; foreach ($_url as $_key2 => $_site) { if (preg_match("/rapidshare/",$_url[$_key2][1])) { $_type="RS"; } else if (preg_match("/megaupload/",$_url[$_key2][1])) { $_type="MU"; } else if (preg_match("/easyshare/",$_url[$_key2][1])) { $_type="ES"; } else if (preg_match("/filefactory/",$_url[$_key2][1])) { $_type="FF"; } else if (preg_match("/sendspace/",$_url[$_key2][1])) { $_type="SS"; } else if (preg_match("/fastfreefilehosting/",$_url[$_key2][1])) { $_type="FFFH"; } else { $_type=0; } $phper=error_get_last(); $message=$phper[2]; echo($_url[$_key2][1]." / ".mysql_error($_connection)." / ".$message."<br />"); if ($_type!==0) { if (ss_link_check($_url[$_key2][1],$_type)) { //blah } else { $_not_working+=1; } } } $_delete=$_not_working/$_count; $_delete=$_delete*100; if ($_delete > 60) { mysql_query('UPDATE '.$config['Database']['tableprefix'].'thread SET forumid="14" WHERE threadid="'.$_threadid.'"'); mysql_query('UPDATE '.$config['Database']['tableprefix'].'post SET pagetext="'.$_pagetext.'[quote]One or more links were found dead. If you want this moved back please report this post or PM Stephen.[/quote]" WHERE postid="'.$_firstpostid.'"'); } } } } ?> VB 3.7.x btw. I put this in includes/cron/ folder. Okay, my problem is that the script suddenly stops the loop before all of the threads in all 7 of the boards were checked. I posted this on another site too. EDIT: If you want to see a hosted example please PM me and I will give you a link. Link to comment https://forums.phpfreaks.com/topic/110131-solved-vbulletin-link-checker/ Share on other sites More sharing options...
Stephen Posted June 13, 2008 Author Share Posted June 13, 2008 Can someone help me? I think it might be an array problem :/ Link to comment https://forums.phpfreaks.com/topic/110131-solved-vbulletin-link-checker/#findComment-565251 Share on other sites More sharing options...
Stephen Posted June 13, 2008 Author Share Posted June 13, 2008 I fixed it. Link to comment https://forums.phpfreaks.com/topic/110131-solved-vbulletin-link-checker/#findComment-565283 Share on other sites More sharing options...
dcuellar Posted June 11, 2009 Share Posted June 11, 2009 Care to share your fix? Are you creating a mod for vbulletin? Link to comment https://forums.phpfreaks.com/topic/110131-solved-vbulletin-link-checker/#findComment-853522 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.