if(substr($_GET['Url'],0,7)!="http://") { $_GET['Url'] = "http://".$_GET['Url']; } if($_GET['Type']=="Other") { echo('This system doesn't support that forumtype yet, but I've written the URL to a file and will look at it later to see how I can make it work.'); $file = fopen("other.txt","a"); fwrite($file,date("H:i:s d/m/Y",(mktime()+7*3600))."\n".$_GET['Url']."\n\n"); fclose($file); } else { $post_count = function_postcount($_GET['Url'],$_GET['Type']); echo('Is the post count '.$post_count.'?'); if($post_count!="0" && ($post_count/2)=="0") { echo('<br /><br />Ah... It appears it didn't return a number... I'll write that URL to a file and see what went wrong and try and fix it.'); $file = fopen("error.txt","a"); fwrite($file,date("H:i:s d/m/Y",mktime())."\n".$_GET['Url']."\n".$post_count."\n\n"); fclose($file); } else { $file = fopen("success.txt","a"); fwrite($file,date("H:i:s d/m/Y",mktime())."\n".$_GET['Url']."\n".$post_count."\n\n"); fclose($file); } }
<? include('../connect.php'); include('function.count.php'); $raw_fora = mysql_query('SELECT Forum, Type FROM '.$db_pre.'forums WHERE Forum_status = \'In use\''); $num_fora = mysql_num_rows($raw_fora); echo('<table border="1"><tr><td>ID</td><td>URL</td><td>Type</td><td>Post count?</td></tr>'); $success=0; for($a=0;$a<$num_fora;$a++) { $dat_fora = mysql_fetch_array($raw_fora); $post_count = function_postcount($dat_fora['Forum'],$dat_fora['Type']); echo('<tr> <td>'.$a.'</td> <td><a href="'.$dat_fora['Forum'].'">'.$dat_fora['Forum'].'</a></td> <td>'.$dat_fora['Type'].'</td> <td>'); print_r($post_count); echo('</td> </tr>'); if(is_numeric($post_count)) { $success++; } } echo('</table>'); echo('With '.$num_fora.' different fora in the test, this function managed to identify post counts in '.$success.' of them.. that's '.(($success/$num_fora)*100).'% of them :)?');
<? include('../../connect.php'); include('function.count.php'); $live_forums = mysql_query("SELECT ID, NatID, Forum, Type FROM ".$db_pre."forums WHERE Forum_status = 'In use' ORDER BY ID"); $forums = mysql_num_rows($live_forums); echo('<b>'.$forums.'</b> Forums to check.'); for($i=0;$i<$forums;$i++) { $live_fora = mysql_fetch_array($live_forums); echo('<tr> <td>'.$i.'</td> <td><input type="text" name="Post_count_'.$live_fora[ID].'" value="'.function_postcount($live_fora[Forum],$live_fora[Type]).'" /></td> <td>'.$live_fora[ID].'</td> <td>'.$live_fora[NatID].'</td> <td><a href="'.$live_fora[Forum].'">'.$live_fora[Forum].'</a></td> <td>'.$live_fora[Type].'</td> </tr> ');} ?> </table> <input type="submit" value="record post counts" /> </form> </body> </html>
}} closedir($handle); sort($forums_array); $num_forums_array = count($forums_array); echo('<b>'.$num_forums_array.'</b> Forums to check.'); for($a=0;$a<$num_forums_array;$a++) { $raw_forum = mysql_query('SELECT NatID, Type FROM '.$db_pre.'forums WHERE ID = \''.($forums_array[$a]/2*2).'\''); $dat_forum = mysql_fetch_array($raw_forum); $forum_address[$a] = 'http://mnforumlist.com/saved_forums/nations/'.$_GET['Y'].'-'.$_GET['M'].'-'.$_GET['D'].'/'.$forums_array[$a]; $forum_ID[$a] = substr(0,4,$forums_array[$a])*2/2; $post_count[$forums_array[$a]] = function_postcount($forum_address[$a],$dat_forum['Type']); echo('<tr> <td>'.$a.'</td> <td><input type="text" name="Post_count_'.$forums_array[$a].'" value="'.$post_count[$forums_array[$a]].'" /></td> <td>'.$forums_array[$a].'</td> <td>'.$dat_forum['NatID'].'</td> <td><a href="'.$forum_address[$a].'">'.$forum_address[$a].'</a></td> <td>'.$dat_forum[Type].'</td> </tr> '); }
<td>Number</td> <td>Post count</td> <td>Forum</td> <td>Nation</td> <td>Forum Type</td> </tr><tbody>'); $worked = 0; for($a=0;$a<$num_live_forums;$a++) { $dat_live_forums = mysql_fetch_array($raw_live_forums); $sql_nation_name = 'SELECT `Name` FROM `'.$db_pref.'data` WHERE `NatID` = \''.$raw_live_fora['NatID'].'\''; $raw_nation_name = mysql_query($sql_nation_name); $dat_nation_name = mysql_fetch_array($raw_nation_name); unset($posts); $posts = function_postcount($dat_live_forums['Forum_Link_Count'],$dat_live_forums['Forum_Type_Count']); if(is_numeric($posts)) { $worked++; } echo('<tr> <td>'.$a.'</td> <td><input type="text" name="Post_count_'.$a.'" value="'.$posts.'" /></td> <td><a href="'.$dat_live_forums['Forum_Link'].'">'.$dat_live_forums['Forum_Link'].'</a> ('.$dat_live_forums['Forum_ID'].') <input type="hidden" name="Forum_Link_'.$a.'" value="'.$dat_live_forums['Forum_Link'].'" /> <input type="hidden" name="Forum_ID_'.$a.'" value="'.$dat_live_forums['Forum_ID'].'" /></td> <td>'.$dat_live_forums['Nation_Name'].' ('.$dat_live_forums['Nation_ID'].') <input type="hidden" name="Nation_Name_'.$a.'" value="'.$dat_live_forums['Nation_Name'].'" /> <input type="hidden" name="Nation_ID_'.$a.'" value="'.$dat_live_forums['Nation_ID'].'" /></td> <td>'.$dat_live_forums['Forum_Type'].'</td> </tr> ');