Limit Lines Per Page

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Limit Lines Per Page

    Hi all. I know how to limit the amount of lines per page when calling something from mysql but what about a script like this:
    Code:
    <?
    //SOURCE CODE VIEWER//
    
    header("Content-Type: text/vnd.wap.wml");
    
    echo &#39;<?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
    
    <wml>
    <head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
    <card title="Source Code Viewer">
    
    <do type="prev" label="Back"><prev/></do>&#39;;
      print "
    
    ";
    
    if ($url == "") {
         echo "ENTER URL:
    <input type=\"text\" name=\"url\" maxlength=\"999\" emptyok=\"false\" value=\"http://\"/>
    <anchor>[GO]<go href=\"$PHP_SELF?url=$url\" method=\"post\"><postfield name=\"url\" value=\"$(url)\"/></go></anchor>";
      }
    
    
    if ($url == "$url") {
    
       $udata=@file_get_contents("$url");
    
    $udata = str_replace("$","$$",$udata);
    $udata = str_replace("&","&amp;",$udata);
    $udata = str_replace("&#39;","&apos;",$udata);
    $udata = str_replace("<","&lt;",$udata);
    $udata = str_replace(">","&gt;",$udata);
    $udata = str_replace("\"","&quot;",$udata);
    
       print "$udata
    ";
      }
      
    
      print "
    <a href=\"http://LandOfWap.net\">(c) LandOfwap.net</a></p>
      </card>
      </wml>";
    
    ?>
    How would you make this display 20 lines per page?

    #2
    It&#39;s ok now. I found it.

    EDIT: It didn&#39;t work so your help would be very much appreciated. Thanks.

    Comment


      #3
      Code:
      if($action == "0") 
      { 
        addonline(getuid_sid($sid),"$library_ziuri_LT","");
      $a = glob("skaitykla/skaitiniai/$b/*.txt"); 
      $a = str_replace("skaitykla/skaitiniai/$b/","",$a); 
      $a= str_replace(".txt","",$a);
      $a2 = str_replace("_"," ",$a);
      $sk = count($a); 
      $pusl = $sk/10; 
      if(!is_int($pusl)) 
      { 
      $psl=(int)($psl+1); 
      } 
      $psl = $_GET[&#39;psl&#39;]; 
      if(empty($pusl)) 
      { 
      $pusl=1; 
      } 
      if(empty($psl)) 
      { 
      $psl=1; 
      } 
      $nuo = $psl*10-10; 
      $iki = $psl*10; 
      echo"<card id=\"index\" title=\"$sitename\">
      <p align=\"left\">
      $lin
      "; 
      for($i=$nuo; $i<$iki; $i++) 
      { 
      if(!empty($a[$i])) 
      { 
      echo"[size="1"]<a href=\"library.php?lang=$lang&amp;action=1&amp;b=$b&amp;sid=$sid&amp;failas=".base64_encode($a[$i])."\">$a2[$i]</a>[/size]
      "; 
      } 
      }
      echo"$lin
      "; 
      if($psl<$pusl) { 
      $pp = $psl+1; 
      echo"<a href=\"library.php?lang=$lang&amp;action=0&amp;b=$b&amp;psl=$pp&amp;sid=$sid\">$index_Next</a>
      "; 
      } 
      if($psl>1) 
      { 
      $hp = $psl-1;  
      echo"<a href=\"library.php?lang=$lang&amp;action=0&amp;b=$b&amp;psl=$hp&amp;sid=$sid\">$index_Prev</a>
      "; 
      }  
      echo"$lin";  
      $ct = count($a); 
      $total = ceil($ct/5); 
      echo"</p>
      
      [size="1"]$library_Page: $psl/$total
      
      $library_Total: $ct[/size]</p>
      <p align=\"center\">";
      
      
      
      
      
      
      echo "<a href=\"index.php?lang=$lang&amp;action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
      echo "$admincp_Home</a>";
      echo "</p></card>";  
      } 
      
      if($action == "1") {
      
       addvisitor();
        addonline(getuid_sid($sid),"$library_skaito_LT","");
      $fd = $_GET[&#39;failas&#39;]; 
      $psl = $_GET[&#39;psl&#39;];
      $ad = array("<",">","=","&","$","(",")","?");
      $psl = str_replace($ad,"",$psl);
      if($psl=="") { $psl=1; }
      $fd = base64_decode($fd);
      $ff = @file_get_contents("skaitykla/skaitiniai/$b/$fd.txt");
       if(!$ff) { 
      echo"<card id=\"index\" title=\"$sitename\">
      <p align=\"center\">File not found
      </p></card>"; }
      
      $hhd = strlen($ff); 
      $tot = ceil($hhd/500); 
      $ik = $hhd/$tot; 
      $tota = ceil($hhd/$ik);
       if($psl>$tota) { 
      echo"<card id=\"index\" title=\"$sitename\"><p align=\"center\">Page not found
      [size="1"]
      Native:".substr((micro()-$start),0,9)."[/size]</p>
      </card>"; 
      }
       
      $nuo = $psl*500-500; 
      $iki = $psl*500; 
      if($hhd<=500) { 
      $dd = substr($ff,0,$hhd); 
      } 
      if($psl==1) 
      { 
      $dd = substr($ff,0,$ik); 
      } 
      if($psl>1) 
      { 
      $dd = substr($ff,$ik*($psl-1),$ik); 
      }
      
      $dd = str_replace(&#39;\n&#39;,&#39;
      &#39;,$dd);
      echo "<card id=\"index\" title=\"$sitename\">
      <onevent type=\"onenterforward\"> 
      <refresh> 
      <setvar name=\"psl\" value=\"$psl\"/>  
      </refresh> 
      </onevent>
      
      
      [b]
      [size="1"]".nl2br($dd)."[/size][/b]</p>
      <p align=\"center\">"; 
      $tal = ceil($hhd/$ik); 
      if($psl<$tal) { 
      $dp=$psl+1; 
      echo"<a href=&#39;library.php?lang=$lang&amp;action=1&amp;b=$b&amp;sid=$sid&amp;failas=".base64_encode($fd)."&amp;psl=$dp&#39;>$index_Next</a>
      "; } 
      if($psl>1) { 
      $dl=$psl-1; 
      echo"<a href=&#39;library.php?lang=$lang&amp;action=1&amp;sid=$sid&amp;failas=".base64_encode($fd)."&amp;b=$b&amp;psl=$dl&#39;>$index_Prev</a>
      "; } 
      
      $total = ceil($hhd/$ik);
      echo"<input name=\"psl\" format=\"*N\" maxlength=\"3\" value=\"$psl\" size=\"2\"/>/$total
      ";  
      echo"<a href=&#39;library.php?lang=$lang&amp;action=1&amp;sid=$sid&amp;failas=".base64_encode($fd)."&amp;b=$b&amp;psl=$(psl)&amp;$nn&#39;>$library_Jump</a>
      
      ";
      
      echo "<a href=\"index.php?lang=$lang&amp;action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
      echo "$admincp_Home</a>";
      
      
      
      
      
      
      
      
      
      
      
      
      echo "</p></card>";  }

      Comment


        #4
        you have to modify sc what you want

        Comment


          #5
          i think you have modify this sc and will work
          if you have questions ask me
          Code:
          if($action == "1") {
          
          
          $fd = $_GET[&#39;failas&#39;]; 
          $psl = $_GET[&#39;psl&#39;];
          $ad = array("<",">","=","&","$","(",")","?");
          $psl = str_replace($ad,"",$psl);
          if($psl=="") { $psl=1; }
          $fd = base64_decode($fd);
          $ff = @file_get_contents("skaitykla/skaitiniai/$b/$fd.txt");
          if(!$ff) { 
          echo"<card id=\"index\" title=\"$sitename\">
          <p align=\"center\">File not found
          </p></card>"; }
          
          $hhd = strlen($ff); 
          $tot = ceil($hhd/500); 
          $ik = $hhd/$tot; 
          $tota = ceil($hhd/$ik);
          if($psl>$tota) { 
          echo"<card id=\"index\" title=\"$sitename\"><p align=\"center\">Page not found
          [size="1"]
          Native:".substr((micro()-$start),0,9)."[/size]</p>
          </card>"; 
          }
          
          $nuo = $psl*500-500; 
          $iki = $psl*500; 
          if($hhd<=500) { 
          $dd = substr($ff,0,$hhd); 
          } 
          if($psl==1) 
          { 
          $dd = substr($ff,0,$ik); 
          } 
          if($psl>1) 
          { 
          $dd = substr($ff,$ik*($psl-1),$ik); 
          }
          
          $dd = str_replace(&#39;\n&#39;,&#39;
          &#39;,$dd);
          echo "<card id=\"index\" title=\"$sitename\">
          <onevent type=\"onenterforward\"> 
          <refresh> 
          <setvar name=\"psl\" value=\"$psl\"/>  
          </refresh> 
          </onevent>
          
          
          [b]
          [size="1"]".nl2br($dd)."[/size][/b]</p>
          <p align=\"center\">"; 
          $tal = ceil($hhd/$ik); 
          if($psl<$tal) { 
          $dp=$psl+1; 
          echo"<a href=&#39;library.php?lang=$lang&amp;action=1&amp;b=$b&amp;sid=$sid&amp;failas=".base64_encode($fd)."&amp;psl=$dp&#39;>$index_Next</a>
          "; } 
          if($psl>1) { 
          $dl=$psl-1; 
          echo"<a href=&#39;library.php?lang=$lang&amp;action=1&amp;sid=$sid&amp;failas=".base64_encode($fd)."&amp;b=$b&amp;psl=$dl&#39;>$index_Prev</a>
          "; } 
          
          $total = ceil($hhd/$ik);
          echo"<input name=\"psl\" format=\"*N\" maxlength=\"3\" value=\"$psl\" size=\"2\"/>/$total
          ";  
          echo"<a href=&#39;library.php?lang=$lang&amp;action=1&amp;sid=$sid&amp;failas=".base64_encode($fd)."&amp;b=$b&amp;psl=$(psl)&amp;$nn&#39;>$library_Jump</a>
          
          ";
          
          echo "<a href=\"index.php?lang=$lang&amp;action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
          echo "$admincp_Home</a>";
          echo "</p></card>";  }

          Comment


            #6
            <?php
            header("Content-type: text/vnd.wap.wml");
            header("Cache-Control: no-store, no-cache, must-revalidate");
            print"<?xml version=\"1.0\"?>";
            echo"<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
            . " \"http://www.wapforum.org/DTD/wml_1.1.xml\">
            <wml>
            <card id=\"card\" title=\"Zambija\">";

            $id = $_GET[&#39;id&#39;];
            if($id == "")
            {
            echo"<p align=\"center\"><input type=\"text\" name=\"url\" emptyok=\"false\" value=\"http://\"/>
            ";
            echo"<anchor>Žiūrėti<go href=\"source.php?$kas&amp;id=ziureti\" method=\"post\">
            <postfield name=\"url\" value=\"$(url)\"/></go></anchor></p>";
            }

            if($id == "ziureti")
            {
            $url = $_POST[&#39;url&#39;];
            $ff = @htmlspecialchars(file_get_contents($url));
            if(!$ff)
            {
            echo"Neegzistuoja
            ";
            }
            if(ereg("^http://", $url))
            {
            echo"$ff";
            }
            else
            {
            echo"Šio failo negalite peržiūrėti!!
            ";
            }
            }
            print&#39;<p align="center"><anchor>
            Atgal
            <prev/>
            </anchor>

            Pagrindinis



            Zambija 2006
            </p>
            </card></wml>&#39;;
            ?>

            Comment


              #7
              Code:
              <?
              //SOURCE CODE VIEWER//
              
              header("Content-Type: text/vnd.wap.wml");
              
              echo &#39;<?xml version="1.0" encoding="utf-8"?>
              <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
              
              <wml>
              <head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
              <card title="Source Code Viewer">
              
              <do type="prev" label="Back"><prev/></do>&#39;;
                print "
              
              ";
              
              if ($url == "") {
                   echo "ENTER URL:
              <input type=\"text\" name=\"url\" maxlength=\"999\" emptyok=\"false\" value=\"http://\"/>
              <anchor>[GO]<go href=\"$PHP_SELF?url=$url\" method=\"post\"><postfield name=\"url\" value=\"$(url)\"/></go></anchor>";
                }
              
              
              if ($url == "$url") {
              if($page=="" || $page<=0)$page=1;
                  $items_per_page= 500;
                  $num_pages = ceil($num_items/$items_per_page);
                  if(($page>$num_pages)&&$page!=1)$page= $num_pages;
                  $limit_start = ($page-1)*$items_per_page;
              
              $udata=@file_get_contents("$url");
              $line = substr("$udata", $limit_start, $items_per_page);
              $code = htmlspecialchars("$line");
              echo "$code
              ";
                   
                    $npage = $page+1;
                    echo "<a href=\"source.php?url=$url&amp;page=$npage\">Next»</a>";
                  
              
              
               }
                
              
                print "
              <a href=\"http://LandOfWap.net\">(c) LandOfwap.net</a></p>
                </card>
                </wml>";
              
              ?>
              Try this code its not much but its all I can find that limits the line.

              Comment


                #8
                Hi all. I know how to limit the amount of lines per page when calling something from mysql but what about a script like this:
                Code:
                <?
                //SOURCE CODE VIEWER//
                
                header("Content-Type: text/vnd.wap.wml");
                
                echo &#39;<?xml version="1.0" encoding="utf-8"?>
                <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
                
                <wml>
                <head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
                <card title="Source Code Viewer">
                
                <do type="prev" label="Back"><prev/></do>&#39;;
                  print "
                
                ";
                
                if ($url == "") {
                     echo "ENTER URL:
                <input type=\"text\" name=\"url\" maxlength=\"999\" emptyok=\"false\" value=\"http://\"/>
                <anchor>[GO]<go href=\"$PHP_SELF?url=$url\" method=\"post\"><postfield name=\"url\" value=\"$(url)\"/></go></anchor>";
                  }
                
                
                if ($url == "$url") {
                
                   $udata=@file_get_contents("$url");
                
                $udata = str_replace("$","$",$udata);
                $udata = str_replace("&","&amp;",$udata);
                $udata = str_replace("&#39;","&apos;",$udata);
                $udata = str_replace("<","&lt;",$udata);
                $udata = str_replace(">","&gt;",$udata);
                $udata = str_replace("\"","&quot;",$udata);
                
                   print "$udata
                ";
                  }
                  
                
                  print "
                <a href=\"http://LandOfWap.net\">(c) LandOfwap.net</a></p>
                  </card>
                  </wml>";
                
                ?>
                How would you make this display 20 lines per page?[/b]
                Bump!

                Comment

                Working...
                X