Help

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

3 replies · 539 views · started 19 years ago · 1 min read

2 participants
Guest #1

plz fix this error,when im using the index.php given below the opera 9.10 brower says

XML parsing failed: syntax error (Line: 3, Character: 0)

Reparse document as HTML Error:missing root element Specification:http://www.w3.org/TR/REC-xml/ 1: <?xml version="1.0"?> 2: <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

index.php

<?php
ini_set ('display_errors', 0);
ob_start("ob_gzhandler");
header("Content-type: text/vnd.wap.wml");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Provided-by: [email]ngeo@ngeo.ro[/email] "); 
echo "<?xml version=\"1.0\"?> 
<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
." \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n";  
session_save_path('tmp');
ini_set("session.gc_maxlifetime","300");
ini_set("session.gc_probability","1");
ini_set("session.gc_divisor","30000");
ini_set("session_cache_limiter", "nocache");
ini_set('session.name', 'sess');
session_start();
$sess=session_id();
$name = substr($sess, 29, 3);
$today = date("H:i");
$now = time();
////////////////////////////START CONFIGURAION ZONE///////////////////////////
///////////////////SET SIZE OF CHAT PAGE. SMALL SIZE MATTERS//////////////////
$content_size = "800";  
///////////////////SET TERMS AND CONDITIONS, ABOUT, EMAIL, ETC////////////////
$terms ="this is a free zone, one room is available and the nickname's are automatically generated.";  
////////////////////////////END CONFIGURAION ZONE/////////////////////////////
$adress = $_SERVER['SCRIPT_NAME'];

if(!isset($_GET['type'])) $_GET['type'] = '';

switch($_GET['type']) {
    
case '': 
?>
<wml>
<card id="ngeo" title="ngeo chat">
<p align="center">[img]img/logo.gif[/img]

</p>
<p align="center"><big>[b]welcome to 
ngeo mobile chat

[/b]</big></p>
<p align="left">            
<a href ="index.php?type=chat&nocache_time=<?php echo $now;?>">enter</a>
</p>
<p align="center">            
<a href ="index.php?type=terms&nocache_time=<?php echo $now;?>">terms</a>
</p>
</card>
</wml>
<?php
break;
    
case 'set': 

?>
<wml>
<card id="ngeo" title="ngeo chat" newcontext="true">

<p align="left">            
           [b]message:[/b]

  
    <input name="message" size="20" maxlength="250" value="" emptyok="true"/>

    <anchor>write
            <go href="index.php?type=write&nocache_time=<?php echo $now;?>" method="post">
             <postfield name="message" value="$(message)"/>
            </go>
   </anchor>
</p>

<?php
$filename = 'chat.txt';
$somecontent  =" ";
    if (is_writable($filename)) { 
    if (!$handle = fopen($filename, 'a')) {  
         echo "<p align=\"center\"><img src=\"img/attention.gif\" alt=\"!\"/></p>";
         echo "

cannot open file chat.txt! create and set chmod: 0777</p>"; 
         exit;
    }

   
    if (!fwrite($handle, $somecontent)) {
         echo "<p align=\"center\"><img src=\"img/attention.gif\" alt=\"!\"/></p>";
         echo "

cannot write to chat.txt! create and set chmod: 0777</p>"; 
         exit;
    }        
    } 
     else {
     echo "<p align=\"center\"><img src=\"img/attention.gif\" alt=\"!\"/></p>";
     echo "

the chat.txt is not writable! set chmod: 0777</p>";
    }
?>
</card>
</wml>
<?php
break;

case 'write':
?>
<wml>
<card id="ngeo" title="ngeo chat">
<?php
$filename = 'chat.txt';

chmod("$filename", 0777);

$dataneeds ="1";
$datapost = htmlspecialchars($_POST['message']);

if ($datapost < $dataneeds)
{
echo "<p align=\"center\"><img src=\"img/attention.gif\" alt=\"!\"/></p>";
echo "

write more than one character!</p>";
echo "

<a href =\"index.php?type=set&nocache_time=$now\">return</a></p>";  
}
else
{
$somecontent  ="<img src=\"img/dot.gif\" alt=\"*\"/> user_[b]$name[/b] ($today): [b]";
$somecontent .=htmlspecialchars($_POST['message']); 
$somecontent .="[/b]"; 
$somecontent .="
";

if (is_writable($filename)) {

  
    if (!$handle = fopen($filename, 'a')) {
         echo "<p align=\"center\"><img src=\"img/attention.gif\" alt=\"!\"/></p>";
         echo "

cannot open file chat.txt! create and set chmod: 0777</p>"; 
         exit;
    }

   
    if (!fwrite($handle, $somecontent)) {
         echo "<p align=\"center\"><img src=\"img/attention.gif\" alt=\"!\"/></p>";
         echo "

cannot write to chat.txt! create and set chmod: 0777</p>";
         exit;
    }        
    } 
else {
      echo "<p align=\"center\"><img src=\"img/attention.gif\" alt=\"!\"/></p>";
      echo "

the chat.txt is not writable! set chmod: 0777</p>";
     }
header("Location: $adress?type=chat&nocache_time=$now"); 
}

?>

</card>
</wml>
<?php
break;

case 'create':
?>
<wml>
<card id="ngeo" title="ngeo chat">
<?php

function create($file="") { global $file_; if(trim($file_)=="") $file_="chat.txt";
if(trim($file)=="") $file=basename($SERVER['PHP_SELF']); if(!file_exists($file)) { if(!fopen($file_,"w")) { echo " <img src="img/attention.gif" alt="!"/> "; echo "

cannot create chat.txt! create and set chmod: 0777 "; return; } } } header("Location: $adress?type=set&nocache_time=$now"); echo create(); chmod("chat.txt", 0777); ?> </card> </wml>

<?php break; case 'delete': ?> <wml> <card id="ngeo" title="ngeo chat"> <?php $filename ="chat.txt"; if (file_exists($filename)) { unlink($filename); header("Location: $adress?type=create&nocache_time=$now"); } else { header("Location: $adress?type=set&nocache_time=$now"); } ?> </card> </wml> <?php break; case 'chat'; ?> <wml> <card id="ngeo" title="ngeo chat" ontimer="<?php echo "index.php?type=chat&amp;nocache_time=$now" ?>"> <timer value="200"/> <?php $filename = "chat.txt"; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); if (filesize($filename) > $content_size) {
      echo "

you are: user_$name

                      <a href =\"index.php?type=delete&amp;nocache_time=$now\">write</a> 
                      <a href =\"index.php?type=chat&amp;nocache_time=$now\">refresh</a>

";

} else {

 echo "

you are: user_$name

                      <a href =\"index.php?type=set&amp;nocache_time=$now\">write</a> 
                      <a href =\"index.php?type=chat&amp;nocache_time=$now\">refresh</a>

";

}

echo "

$contents ";

if (filesize($filename) > $content_size) {

      echo "

                      <a href =\"index.php?type=delete&amp;nocache_time=$now\">write</a> 
                      <a href =\"index.php?type=chat&amp;nocache_time=$now\">refresh</a>

";

} else {

    echo "

                      <a href =\"index.php?type=set&amp;nocache_time=$now\">write</a> 
                      <a href =\"index.php?type=chat&amp;nocache_time=$now\">refresh</a> 
                      <a href =\"index.php?type=out&amp;nocache_time=$now\">out</a>

";

}

fclose($handle); ?> </card> </wml>

<?php break; case 'out'; ?> <wml> <card id="ngeo" title="ngeo chat"> <?php session_destroy(); header("Location: $adress"); ?> </card> </wml> <?php break; case 'terms'; ?> <wml> <card id="ngeo" title="ngeo chat">

External image (may be gone)

<?php echo " $terms "; ?>

<a href ="index.php">back</a>

</card> </wml> <?php }

?>

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