Jump to content

Help with a parsing script.


xcalibur22

Recommended Posts

Well i've currently got this parsing script from someone ( it parses an .ini file ), my problem is that it only parses 25 of the lines and when i press go to next page it wont parse any other, someone said to make a .htaccess file... but i don't know what and how to work it.
I can provide someone who wants to help with the script itself and explain to problem more if they did not get it.Any help would be greatly appreciated.Thank you.
Link to comment
https://forums.phpfreaks.com/topic/35294-help-with-a-parsing-script/
Share on other sites

//Open and parse
$handle = @fopen("records.txt", "r");


if ($handle) {
  while (!feof($handle)) {
      $buffer = fgets($handle, 4096);
  $patterns = '/Record/';
  $replacement = '';
  $buffer = preg_replace($patterns, $replacement, $buffer);
  list($buffer2, $buffer3, $buffer4, $buffer5, $buffer6) = split("]=",$buffer);
 
  list($buffer2, $buffer3, $buffer4, $buffer5, $buffer6) = split("
",$buffer3);
  list($rec1, $rec2, $rec4, $rec14) = split("\t",$buffer2);
  list($rec5, $rec6, $rec7, $rec15) = split("\t",$buffer3);
  list($rec8, $rec9, $rec10, $rec16) = split("\t",$buffer4);
  list($rec11, $rec12, $rec13, $rec17) = split("\t",$buffer5);
  $poop = (2000-$rec2);
  $poop1 = (2000-$rec6);
  $poop2 = (2000-$rec9);
  $poop3 = (2000-$rec12);
  $time = duration($poop);
    $time1 = duration($poop1);
$time2 = duration($poop2);
  $time3 = duration($poop3);
 
  $rec4 = addslashes($rec4);
  $rec7 = addslashes($rec7);
  $rec5 = addslashes($rec5);
  $rec8 = addslashes($rec8);
  $rec11 = addslashes($rec11);
  $rec13 = addslashes($rec13);
  $rec10 = addslashes($rec10);
  //////////////////

   
  $insertBTR = "insert into information(player_name, map_name, map_time, rec_date) values ('" . $rec4 . "', '" . $rec1 . "', '" . $time . "', '" . $rec14 . "')";

  $insertBTR1 = "insert into information(player_name, map_name, map_time, rec_date) values ('" . $rec7 . "', '" . $rec5 . "', '" . $time1 . "', '" . $rec15 . "')";


  $insertBTR2 = "insert into information(player_name, map_name, map_time, rec_date) values ('" . $rec10 . "', '" . $rec8 . "', '" . $time2 . "', '" . $rec16 . "')";


  $insertBTR3 = "insert into information(player_name, map_name, map_time, rec_date) values ('" . $rec13 . "', '" . $rec11 . "', '" . $time3 . "', '" . $rec17 . "')";

if($rec4 != NULL) {
$resultBTR = mysql_query($insertBTR);
}
if($rec7 != NULL) {
$resultBTR = mysql_query($insertBTR1);
}
if($rec10 != NULL) {
$resultBTR = mysql_query($insertBTR2);
}
if($rec13 != NULL) {
$resultBTR = mysql_query($insertBTR3);
}

}

/////////////////////

This is how its displayed/
<?php
    $limit = 25;               
    $query_count = "SELECT count(*) FROM information";   
    $result_count = mysql_query($query_count);   
    $totalrows = $totalrows = mysql_result($result_count, 0); 

    if(empty($page)){
        $page = 1;
    }
       

    $limitvalue = $page * $limit - ($limit); 
    $query  = "SELECT * FROM information  ORDER BY `rec_date` DESC LIMIT $limitvalue, $limit ";       
    $resultBTR = mysql_query($query) or die("Error: " . mysql_error()); 

    if(mysql_num_rows($resultBTR) == 0){
        echo("Nothing to Display!");
    }

 
    echo "<table width='100%' border=0 cellspacing=0 cellpadding=0 class=sample>"."<tr>"."<th scope=col>"."<font size=2 color='#FFFFFF'>"."When"."</font>"."</th>"."<th scope=col>"."<font size=2 color='#FFFFFF'>"."Map"."</font>"."</th>"."<th scope=col>"."<font size=2 color='#FFFFFF'>"."Who"."</font>"."</th>"."<th scope=col>"."<font size=2 color='#FFFFFF'>"."Time"."</font>"."</th>"."</tr>";
   
while($rowBTR = mysql_fetch_array($resultBTR)){
$now = date("mdY", $rowBTR["rec_date"]);
$now2 = date("mdY");
$now4 = $now2 - $now;
if($now4 == 10000){
$now3 = "Yesterday";
}
else {
$now3 = date("m/d/Y", $rowBTR["rec_date"]);
}
if($now == $now2){
$now3 = "Today";
}


  echo "  <tr>\n";
  echo "    <td align=center>"."<font size=1 color='#FFFFFF'>" . $now3 ."</font>"."</td>\n";
  echo "    <td align=left>" ."<font size=1 color='#FFFFFF'>". "<img src='/btrecords/images/$rowBTR[map_name].jpg' width='40' alt=$rowBTR[map_name]>"."<a href=http://www.evilbunnytracks.net/downloads/maps/$rowBTR[map_name].zip>".$rowBTR["map_name"]."</font>"."</td>\n";
  echo "    <td align=left>" ."<font size=1 color='#FFFFFF'>". $rowBTR["player_name"] ."</font>"."</td>\n";
  echo "    <td>" ."<font size=1 color='#FFFFFF'>". $rowBTR["map_time"] ."</font>"."</td>\n";
  echo "  </tr>\n";
}
    echo("</table>");


    if($page != 1){ 
        $pageprev = $page - 1;
       
        echo("<a href=\"$PHP_SELF?page=$pageprev\">PREV".$limit."</a> "); 
    }else{
        echo("PREV".$limit." ");
    }

    $numofpages = $totalrows / $limit; 
   
    for($i = 1; $i <= $numofpages; $i++){
        if($i == $page){
            echo($i." ");
        }else{
            echo("<a href=\"$PHP_SELF?page=$i\">$i</a> ");
        }
    }


    if(($totalrows % $limit) != 0){
        if($i == $page){
            echo($i." ");
        }else{
            echo("<a href=\"$PHP_SELF?page=$i\">$i</a> ");
        }
    }

    if(($totalrows - ($limit * $page)) > 0){
        $pagenext = $page + 1;
         
        echo("<a href=\"$PHP_SELF?page=$pagenext\">NEXT".$limit."</a>"); 
    }else{
        echo("NEXT".$limit); 
    }
   
    mysql_free_result($resultBTR);



let me show you the problem  if it'd help anymore.
http://www.bxclan.clanservers.com/BTrecords/
this is what it should work like
http://www.fragnesscity.nl/btstats/index.php
When i asked the person what could be my problem he said that you gotta make a .htaccess file  ???

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.