/    Sign up×
Community /Pin to ProfileBookmark

chat script generates blank page

when you login to a room with this chat script I made it always gives a blank page!
also in javascrip how can i refrech the iframe used in the chat to desplay the room
all error fixes are welcome…
and needed even if minor
and i thank all the people that help me in advance
working script: [url]http://www.inixos.net/chat.php[/url] (well not relly working)

[code=php]
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<?php
function file_open($file, $type, $value = “”){
if(!file_exists($file) && $type == “a”)
{$type = “w”;}
$fh = @fopen($file, $type);
if($value != “”){
@fwrite($fh, $value);
}
if($type != ‘w’ && $type != ‘a’){
return @fread($fh, @filesize($file));
}
@fclose ($fh);
}
$act=$_POST[‘act’];
$room=$_POST[‘room’];
$name=$_POST[‘name’];
$msg=$_POST[‘text’];
$rroom=$_GET[‘room’];
$ract=$_GET[‘act’];

?>
<html>
<head>
<title>Untitled</title>
<style type=”text/css”>
<!–
.button {
background:green;
color:lime;
border:1px solid lime;
}
.text {
border:1px solid lime;
background:white;
}
.sbtn {
background:green;
color:lime;
border:0;
}
.stxt {
border:0;
}
<? if($act!=”room”) { ?>
BODY {
background:darkcyan;
color:white;
}
<? } ?>
–>
</style>
</head>
<body>
<code>
<center>
<?
if($name==”” && $ract!=”room”) {
$act=”name”;
}
if($act==””) {
$act=”name”;
}
if($act==”logout”) {
logout();
}
if($act==”name”) {
name();
}
if($act==”joinc”) {
joinc();
}
if($act==”send”) {
send();
}
if($act==”chat”) {
chat();
}
function logout() {
file_open(“all_chat.txt”,”w”,$name.” Left the “.$room.” Room<BR>n”.file_open($room.”_chat.txt”, ‘r’));
file_open($room.”_chat.txt”,”w”,$name.” Left the Room<BR>n”.file_open($room.”_chat.txt”, ‘r’));
file_open(“act_chat.txt”,”w”,”The Room “.$room.” Was Activated (by “.$name.” Leaving The Chat)<BR>n”.file_open(“act_chat.txt”, ‘r’));
$act=”name”;
}
function name() {
?>
<form action=”<? echo($PHP_SELF); ?>” method=”post”>
<input type=”hidden” name=”act” value=”joinc”>
Nick Name:<input type=”text” name=”name” class=”text”><BR>
Room Name:<input type=”text” name=”room” class=”text”><BR>
<input type=”submit” value=”Join Room” class=”button”><input type=”reset” value=”Clear” class=”button”>
</form>
<?
}
function joinc() {
file_open(“all_chat.txt”,”w”,$name.” Joined the “.$room.” Room<BR>n”.file_open($room.”_chat.txt”, ‘r’));
file_open($room.”_chat.txt”,”w”,$name.” Joined the Room<BR>n”.file_open($room.”_chat.txt”, ‘r’));
file_open(“act_chat.txt”,”w”,”The Room “.$room.” Was Activated (by “.$name.” Joining The Chat)<BR>n”.file_open(“act_chat.txt”, ‘r’));
$act=”chat”;
}
function send() {
if($msg!=””) {
file_open($room.”_chat.txt”,”w”,$name.” says: “.$msg.”<BR>n”.file_open($room.”_chat.txt”, ‘r’));
file_open(“all_chat.txt”,”w”,$name.” says in “.$room.”: “.$msg.”<BR>n”.file_open(“all_chat.txt”, ‘r’));
file_open(“act_chat.txt”,”w”,”The Room “.$room.” Was Activated (By “.$name.” Saying “.$msg.”)<BR>n”.file_open(“act_chat.txt”, ‘r’));
$msg=”;
}
$act=”chat”;
}
function del() {
file_open(“act_chat.txt”,”w”,”The Room “.$room.” Was Activated (By “.$name.” Clearing The Room)<BR>n”.file_open(“act_chat.txt”, ‘r’));
file_open($room.”_chat.txt”,”w”,””);
}
function chat() {
file_open(“act_chat.txt”,”w”,”The Room “.$room.” Was Activated (by “.$name.” Viewing The Chat)<BR>n”.file_open(“act_chat.txt”, ‘r’));
?>
<span style=”text”><iframe src=”<? echo($room); ?>_chat.txt” width=”100%” height=”90%” marginwidth=”0″ marginheight=”0″ frameborder=”0″ vspace=”0″ hspace=”0″></iframe></span><BR>
<form name=”chat” action=”<? echo($PHP_SELF); ?>” method=”post”>
<input type=”hidden” value=”send” name=”act”>
<input type=”hidden” value=”<? echo($name); ?>” name=”name”>
<input type=”hidden” value=”<? echo($room); ?>” name=”room”>
<? if($room!=”all” && $room!=”act”) { ?>
<span class=”text”><input name=”text” type=”text” size=”74″ value=”<? echo($msg); ?>” class=”stxt”>
<input type=”submit” value=”SEND !” class=”sbtn”></span><span class=”text”><button onclick=”this.form.act.value=’logout’;this.form.submit();” class=”sbtn”>Logout</button></span>
<input type=”hidden” value=”chat” name=”act”>
<input type=”hidden” value=”<? echo($room); ?>” name=”room”>
<input type=”hidden” value=”<? echo($name); ?>” name=”name”>
<? } else {?>
<button onclick=”this.form.act.value=’del’;this.form.submit()” class=”button”>Delete The Contents Of This Room</button>
<button onclick=”this.form.act.value=’logout’;this.form.submit();” class=”button”>Logout</button>
<? } ?>
</form>
<?
}
?>
</center>
</body>
</html>
[/code]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@jacen6678Mar 25.2005 — It looks like you are getting some error message now. I do not know what you changed but in general, I think you get whitescreen if you are getting an error that is below your reported error threshold. You can have php report more errors globally by changing the setting in php.ini. You can also do it locally with a ini_set().
Copy linkTweet thisAlerts:
@emblemauthorJul 23.2005 — thanks alot i fixed it.

srry for the reply time i forgot to say thanks

so thanks alot for your help
×

Success!

Help @emblem spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...