Jump to content
php.lv forumi

session ()


johanes

Recommended Posts

<?
session_start();
header("Content-type: text/vnd.wap.wml");
include("headerwml.php");

echo '<wml>';
if ($log=="new")
{
       // user must have nickname
if (empty($name)) {
echo '<card title="Kļūda">';
echo '<onevent type="ontimer">';
echo '<go href="index.php"/>';
echo '</onevent>';	
echo '<timer value="20"/>';	
echo '<p>tu neesi ievadļjis savu niku</p>';	
echo '</card>';
}
}

// pats chats

session_register('sesnickname');
session_register('sesrefreshtime');
session_register('sesid');
$sesid=session_id();
 $sesnickname=$name;
 $sesrefreshtime=$refresh;
                  
echo '<card id="WAPchat" title="Johanes čats">';

echo '<onevent type="ontimer">';	
echo '<go href="dispMess.php?PHPSESSID=$sesid"/>';
echo '</onevent>';
echo '<timer value="".$sesrefreshtime.""/>';
echo '<center><anchor>Parlādēt<go method="post" href="dispMess.php?PHPSESSID=$sesid" cache-control="no-cache">
      </go></anchor></center>';
echo '<center><anchor>Pievienot<go href="writeMess.php?PHPSESSID=$sesid"></go></anchor></center><br/>';


$xfile = @file("guest.txt");
$cntPerPage = count($xfile);

$cnt = count($xfile);
$cnt -= $cntPerPage * $pageNum;
for ( $i=$cnt-1; $i>=$cnt-10; $i-- ) {

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

print "<p>$udata[0]<b>$udata[1]</b><br/>$udata[2]<small>$udata[3]</small></p><br/>---<br/>";
}
echo '<do type="accept" label="Pievienot">';
echo '<go href="writeMess.php?PHPSESSID=$sesid"/>';
echo '</do>';
echo '</p>';
echo '</card>';
echo '</wml>';
?>

Itkā vis ir pareizi nu sesija ar tiek registrēta, bet šeit:

<?php 
session_start();

header("Content-type: text/vnd.wap.wml");
include("headerwml.php");

echo '<wml>';

include 'template.php';

echo '<card title="Pievienot">'; 
echo '<onevent type="onenterforward">';
echo '	<refresh>';
echo '	<setvar name="mess" value=""/>';
echo '	</refresh>';
echo '</onevent>';
echo '<p>';            
echo 'Tekst:<br/>';
echo '<center><input name="mess" type="text" maxlength="200"/></center><br/>';

echo '<do type="accept" label="Send">';
echo '<go method="post" href="dispMess.php?PHPSESSID=$sesid">'; 
echo '<postfield name="mess" value="$(mess)"/>';
echo '<postfield name="log" value="next"/>';   
echo '</go>';
echo '</do>';  

echo '<do type="prev" label="Back">';
echo '<go href="guest.php?PHPSESSID=$sesid"/>';
echo '</do>';

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

Pārejot uz šejieni rāda kļūdu:

Warning: Cannot modify header information - headers already sent by (output started at C:\writeMess.php:2) in C:\writeMess.php on line 2

Līdzīgi kā Jee problēma. Priekšaa nav nekā kā tikai <?. :o

Link to comment
Share on other sites

×
×
  • Create New...