Jump to content
php.lv forumi

dalishana pa lapuseem


johanes

Recommended Posts

add txt file:

<?
// by Johanes

$add = date("[H:i]", time()+(60*60));


$text = "$add::$name::$mail::$mess";
$text=strip_tags($text);

$file=file("guest.txt");
$counter=count($file);
         

if ($counter == "10") {  $fp = @fopen("guest.txt","w+"); @fclose($fp); }

$fp=@fopen("guest.txt","a"); fputs($fp,"$text \r\n"); @fclose($fp);


header("Content-type:text/vnd.wap.wml;charset=utf-8");
print "<?xml version=\"1.0\"?>
<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">
<wml>
<card id=\"tes\" title=\"Ihtis wap\">

<p>Tava zinja tika veiksmiigi pievienota. Paldies</p>
<br />                    
 <do type=\"accept\" label=\"Labi\">
                       <go href=\"guest.php?name=$(name); time=$(time); count=$(15)\" method=\"post\">
                               
                               
                       </go>
               </do>
</card>
</wml>";

?>

 

 

get post form txt file:

<?
header("Content-type:text/vnd.wap.wml;charset=utf-8");
print "<?xml version=\"1.0\"?>\n";

print "<wml>\n";

print "<card title=\"Ieraksti\">\n";

echo "<p>---</p><br/>";

$xfile = @file("guest.txt");
$cnt = count($xfile);
for ( $i=$cnt-1; $i>=0; $i-- ) {

$udata = explode("::",$xfile[$i]);

print "<p>$udata[0]<b>$udata[1]</b><br/>$udata[2]<small>$udata[3]</small></p><br/>---<br/>";
}


echo "<p>---</p><br/>";

print "</card></wml>\n";

?>

Probleema taada, ka nezinu kaa sadaliit ka vienaa lapusee izvada pa 5 ierakstiem :(

Un luudzu nesuutiet mani uz mistiskaam vietaav, kaa piem. google..................

Paldies jau tagad :ph34r:

Link to comment
Share on other sites

Nu tev tak kodā ir:

for ( $i=$cnt-1; $i>=0; $i-- ) {

kas izvada VISUS ierakstus failā. Vai tik grūti izdomāt šādu ciklu:

$min = min(0; $sakums-6);
for ( $i=$sakums-1; $i>=$min; $i-- ) {

Un to $sakums mainīgo dabū caur GET mainīgajiem. Neaizmirsti tikai lapas apakšā uzģenerēt linkus uz $sakums-5 (iepriekšējie 5) un $sakums+5 (nākamie 5) ierakstiem!

Dikti sarežģīti savas smadzenes pakustināt ;)

Link to comment
Share on other sites

×
×
  • Create New...