Whats wrong with this script?

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
Pookie
-


Joined: 05 Jan 2005
Posts: 60
Location: Citrus Heights, CA

PostPosted: Fri Mar 03, 2006 1:41 pm    Post subject: Whats wrong with this script? Reply with quote

This script repeats itself twice for some reason. heres tthe code in bold:

<?php

/*******************************/
/*** Simple Simple Chat ***/
/*** v 1.0 ***/
/*** www.phpclub.site.ir ***/
/*******************************/

// Warning : This chat exposes chatters IP addresses

// Config : [ You can change these options ]
$refresh = 6 ; // Page refresh time in seconds
$max = 20 ; // Max. saved messages
$remain = 400 ; // Messages remaining time in seconds
$file = "msg.txt" ; // Message storing file
/*
You may need to make an empty file (use notepad) and name it "msg.txt"
($file), and send it to your server. Then CHMOD this file to 777 - e.g :
ftp> SITE CHMOD 777 msg.txt
*/
// End of config //

$user = $HTTP_SERVER_VARS['REMOTE_ADDR'] ;
$f = file($file) ;
$users = array($user) ;
header ("Content-Type: text/html; charset=utf-8") ;
$fp = fopen($file, "w") ;
if (!$fp) { die ('Can not write to file .') ; }
for ($i=0; isset($f[$i])||$i==0; $i++)
{
$e=explode('||', $f[$i]) ;
if ($e[2]=="\r\n" && !in_array($e[0], $users) && ( time() - $e[1] < $refresh*2 ) ) $users[]=$e[0] ;
if ($i==0) { fputs($fp, $user."||".time()."||\r\n") ;
if ( isset($HTTP_POST_VARS['msg']) ) fputs ($fp, $user."||".time()."||".str_replace("||", "", str_replace("\n", "", htmlspecialchars(stripslashes($HTTP_POST_VARS['msg']))))."\r\n") ; }
if ( ($e[0]!=$user && $e[2]=="\r\n") || ( $i<$max && ($e[1]+$remain)>time() && $e[2]!="\r\n") ) fputs($fp, $f[$i]) ;
}
fclose($fp) ;

if (isset($HTTP_GET_VARS['f1']))
{
$f2 = file($file) ;
echo("<html><head><title></title><meta http-equiv='Content-Type' content='text/html; charset=utf-8'></head>") ;
echo("<body text=#0000cc><meta http-equiv='refresh' content='{$refresh}; url={$HTTP_SERVER_VARS['REQUEST_URI']}'>") ;
echo("<font color=#e22200>Online Users: ") ;
foreach($users as $u) echo "<font color=#ee0099>".$u."</font> - " ;
echo "</font><hr>" ;
for($i=0; isset($f2[$i]) && $i<$max; $i++) {
$e=explode("||", $f2[$i]) ;
if ($e[2]!="\r\n") echo "<font color=green>{$e[0]}</font> <font color=red>:</font> {$e[2]}<br>\r\n" ;
}
die("</body></html>") ;
}

else
{
die("
<html><head><title>Chat</title><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<script><!--
function msg(){ document.m.msg.focus(); } // --></script>
</head>
<body align='center' onLoad='msg()'> <center>
<iframe src='?f1=1' width='95%' height='85%'></iframe><br>
<table width='95%'><tr><td align='center' width='100%'>
<form action='' method='post' name='m'>
Message : <input name='msg' size=60> <input type='submit' name='send' value='Send'>
<br />
</form>
</td></tr></table>
</body></html>
") ;
}
?>


heres the site addy where you can see exactly what its doing.
http://67.172.183.110:5190/browse.html
_________________
~TRU~
Back to top View user's profile Send private message Send e-mail
Anonymoose
-


Joined: 09 Sep 2003
Posts: 2192

PostPosted: Fri Mar 03, 2006 2:42 pm    Post subject: Reply with quote

Link tries to go to http://67.172.183.110:5190/%7B$HTTP_SERVER_VARS%5B and ends in 404.
_________________

"Invent an idiot proof webserver and they'll invent a better idiot..."
Back to top View user's profile Send private message
cmxflash
-


Joined: 11 Dec 2004
Posts: 872

PostPosted: Fri Mar 03, 2006 5:22 pm    Post subject: Reply with quote

Your server isn't running the PHP-code, since the pages file extension is .HTML and not .PHP. Change the name and try again.
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group