Limit Lines Per Page

Started on the old forum in February 2007 · view the original in the archive · old links redirect here

7 replies · 834 views · started 19 years ago · 1 min read

clint #1

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:

<?
//SOURCE CODE VIEWER//

header("Content-Type: text/vnd.wap.wml");

echo '<?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>';
  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("&","&",$udata);
$udata = str_replace("'","'",$udata);
$udata = str_replace("<","<",$udata);
$udata = str_replace(">",">",$udata);
$udata = str_replace("\"",""",$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?

clint #2

It's ok now. I found it.

EDIT: It didn't work so your help would be very much appreciated. Thanks.

Guest #3
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['psl']; 
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&action=1&b=$b&sid=$sid&failas=".base64_encode($a[$i])."\">$a2[$i]</a>[/size]
"; 
} 
}
echo"$lin
"; 
if($psl<$pusl) { 
$pp = $psl+1; 
echo"<a href=\"library.php?lang=$lang&action=0&b=$b&psl=$pp&sid=$sid\">$index_Next</a>
"; 
} 
if($psl>1) 
{ 
$hp = $psl-1;  
echo"<a href=\"library.php?lang=$lang&action=0&b=$b&psl=$hp&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&action=main&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['failas']; 
$psl = $_GET['psl'];
$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('\n','
',$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='library.php?lang=$lang&action=1&b=$b&sid=$sid&failas=".base64_encode($fd)."&psl=$dp'>$index_Next</a>
"; } 
if($psl>1) { 
$dl=$psl-1; 
echo"<a href='library.php?lang=$lang&action=1&sid=$sid&failas=".base64_encode($fd)."&b=$b&psl=$dl'>$index_Prev</a>
"; } 

$total = ceil($hhd/$ik);
echo"<input name=\"psl\" format=\"*N\" maxlength=\"3\" value=\"$psl\" size=\"2\"/>/$total
";  
echo"<a href='library.php?lang=$lang&action=1&sid=$sid&failas=".base64_encode($fd)."&b=$b&psl=$(psl)&$nn'>$library_Jump</a>

";

echo "<a href=\"index.php?lang=$lang&action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "$admincp_Home</a>";

echo "</p></card>";  }
Guest #5

i think you have modify this sc and will work if you have questions ask me External image (may be gone)

if($action == "1") {

$fd = $_GET['failas']; 
$psl = $_GET['psl'];
$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('\n','
',$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='library.php?lang=$lang&action=1&b=$b&sid=$sid&failas=".base64_encode($fd)."&psl=$dp'>$index_Next</a>
"; } 
if($psl>1) { 
$dl=$psl-1; 
echo"<a href='library.php?lang=$lang&action=1&sid=$sid&failas=".base64_encode($fd)."&b=$b&psl=$dl'>$index_Prev</a>
"; } 

$total = ceil($hhd/$ik);
echo"<input name=\"psl\" format=\"*N\" maxlength=\"3\" value=\"$psl\" size=\"2\"/>/$total
";  
echo"<a href='library.php?lang=$lang&action=1&sid=$sid&failas=".base64_encode($fd)."&b=$b&psl=$(psl)&$nn'>$library_Jump</a>

";

echo "<a href=\"index.php?lang=$lang&action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "$admincp_Home</a>";
echo "</p></card>";  }
Guest #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['id']; if($id == "") { echo" <input type="text" name="url" emptyok="false" value="http://"/> "; echo"<anchor>Žiūrėti<go href="source.php?$kas&id=ziureti" method="post"> <postfield name="url" value="$(url)"/></go></anchor> "; }

if($id == "ziureti") { $url = $_POST['url']; $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' <anchor> Atgal <prev/> </anchor>

Pagrindinis

Zambija 2006

</card></wml>'; ?>

Guest #7
<?
//SOURCE CODE VIEWER//

header("Content-Type: text/vnd.wap.wml");

echo '<?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>';
  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&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.

clint #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:

<?
//SOURCE CODE VIEWER//

header("Content-Type: text/vnd.wap.wml");

echo '<?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>';
  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("&","&",$udata);
$udata = str_replace("'","'",$udata);
$udata = str_replace("<","<",$udata);
$udata = str_replace(">",">",$udata);
$udata = str_replace("\"",""",$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?

Bump!

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close