Ok, my code is below... For some reason i can't figure out why this wont output anything to chat.txt. Can someone help me please?
<?php
//CHAT SCRIPT BY MICKYG
//TO USE THIS SCRIPT YOU MUST KEEP THIS HERE
//YOU MUST ALSO PUT A LINK ON YOUR CHAT TO [url]WWW.MICKYG.CO.UK[/url]
//THIS CHAT SCRIPT IS FREE AS LONG AS YOU ABIDE BY THE ABOVE CONDITIONS
//TO REMOVE THE LINK TO [url]WWW.MICKYG.CO.UK[/url] AND TO REMOVE THIS INFORMATION EMAIL ME AT [email]MICKYG@MICKYG.CO.UK[/email]
//--------------------------
//Variables
$name = $_POST['myName'];;
$tosave = $_POST['myChat'];;
$closeit = ("0");
$openit = ("1");
$closed = ("thechat=Chat is Closed, Sorry.");
$reset = ("thechat=");
$opened = ("thechat=Chat is open again");
$file = file_get_contents ("chat.txt");
$working = file_get_contents ("online.txt");
$save = ("$file<br>
<b>$name</b>:<i>$tosave</i><br>");
//Name commands
if($name == "FCC5000" ) {
$name = ("<font color=\"#FF0000\">ADMIN</font>");
} else {
$name = str_replace(" ","-", $name);
}
//output Commands
switch ($tosave) {
case "/close":
$fpclose = fopen("online.txt", "w");
if(fwrite($fpclose, $closeit)) ;
fclose($fpclose);
break;
case "/open":
$fpopen = fopen("online.txt", "w");
if(fwrite($fpopen, $openit)) ;
fclose($fpopen);
$fpo = fopen("chat.txt", "w");
if(fwrite($fpo, $opened)) ;
fclose($fpo);
break;
case "/signinad":
$fpadon = fopen("adon.txt", "w");
if(fwrite($fpadon, $openit)) ;
fclose($fpadon);
break;
case "/signoutad":
$fpadoff = fopen("adon.txt", "w");
if(fwrite($fpadoff, $closeit)) ;
fclose($fpadoff);
break;
case "XREPORTX":
$to = 'mjgriffiths@hotmail.com';
$subject = 'REPORT IN CHAT. REPORT IN CHAT';
$message = 'REOPRT IN CHAT. GO NOW';
$headers = 'From: [email]warning@mickyg.co.uk[/email]' . "\r\n" .
'Reply-To: [email]mjgriffiths@hotmail.com[/email]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
break;
default:
if($working == "0"){
$fpa = fopen("chat.txt", "w");
if(fwrite($fpa, $closed)) ;
fclose($fpa);
} else {
$replaced = str_replace("xxREDxx","<font color=\"#FF0000\">", $save);
$replaced2 = str_replace("xx:CLRxx","</font>", $replaced);
$replaced3 = str_replace("xxGRNxx","<font color=\"#00FF00\">", $replaced2);
$replaced5 = str_replace("xx:)xx","<img src='http://users.pandora.be/eforum/emoticons4u/happy/1016.gif'>", $replaced3);
$replaced6 = str_replace("xUx","</i>", $replaced5);
$replaced7 = str_replace("x:Ux","<i>", $replaced6);
$replaced8 = str_replace("x_x","<u>", $replaced7);
$replaced9 = str_replace("x:_x","</u>", $replaced8);
$replaced10 = str_replace("Xx","<b>", $replaced9);
$replaced11 = str_replace("xX","</b>", $replaced10);
$replaced12 = str_replace("xxPNKxx","<font color=\"#FF33CC\">", $replaced11);
$replaced14 = str_replace("xxGRYxx","<font color=\"#999999\">", $replaced12);
$replaced16 = str_replace("xxBLUxx","<font color=\"#0000FF\">", $replaced14);
$replaced17 = str_replace("xxYELxx","<font color=\"#FFFF00\">", $replaced16);
$replaced18 = str_replace("xxBLAxx","<font color=\"#000000\">", $replaced17);
$replaced19 = str_replace("xxIMGxx","<img src='", $replaced18);
$replaced20 = str_replace("xx:IMGxx",">", $replaced19);
$fp = fopen("chat.txt", "w");
if(fwrite($fp, $replaced20)) ;
fclose($fp);
}
}
?>