PDA

View Full Version : php script mods


Monty
10-14-2001, 10:03 AM
I would like to contract someone to make the needed changes to the

files below to prevent it from posting a \ anytime single or double

quotes are used. If you can do this, please contact me with a

price. I will be emailing the orginal author (Chris Pope) with the

changes if it can be done. This version is one version back from

what he calls the "Pro" version and my users like it better than the

latest version.

TIA,

Monty Weeks

monty@2coolfishing.com

The demo URL is http://2coolfishing.org/chatdev/

the files are as follows;

http://2coolfishing.org/msg.htm

http://2coolfishing.org/index.html

phpchat.php shown below

<?php
// myPHPwebchat
// (c) Copyright 2001 - Christopher Pope (www.seesearch.co.uk/scripts)
// This script is FREE, but you may not distribute it without the authors permission
// Please see: readme.txt for more info...

// ------------ VARIABLES ------------
$maxlines = 25; // How many lines do you want your chat to display before clearing?

// DO NOT EDIT BEYOND THIS POINT

if ($mode == 'logon'){
echo "<html><head></head>
<body bgcolor='#000080' text='#FFFFFF' vlink='#0000FF'>
<form action='phpchat.php' method='POST'>
<input type='hidden' name='mode' value='chat'><p
align='center'><font size='2' face='Verdana,Arial'>Please
enter a nickname: <input type='text' size='10'
maxlength='10' name='username'> <input type='submit' value='Enter!'></font></p>
</form>
</body>
</html>";
die("");
}

if ($mode == 'chat'){
if ($username == ''){
die("<html><head></head>
<body bgcolor='#000080' text='#FFFFFF' vlink='#0000FF'>
<form action='phpchat.php' method='POST'>
<input type='hidden' name='mode' value='chat'><p
align='center'><font size='2' face='Verdana,Arial'>You must enter a username...<br>Please
enter a nickname: <input type='text' size='20' maxlength='20'
name='username'> <input type='submit' value='Enter!'></font></p>
</form>
</body>
</html>");
}
echo "<html><head><title>FORM</title></head>
<body bgcolor='#000080' text='#FFFFFF' vlink='#0000FF'>
<form action='phpchat.php' method='POST'>
<input type='hidden' name='username' value='$username'><input type='hidden' name='mode' value='send'><p
align='center'><font size='2' face='Verdana,Arial'>You are:
$username ... Enter Message: <input type='text' size='20'
name='message' maxlength='100'> <input type='submit' value='Send'></font></p>
</form>
</body>
</html>";
die("");
}

if ($mode == 'send'){

echo "<html><head><title>FORM</title></head>
<body bgcolor='#000080' text='#FFFFFF' vlink='#0000FF'>
<form action='phpchat.php' method='POST'>
<input type='hidden' name='username' value='$username'><input type='hidden' name='mode' value='send'><p
align='center'><font size='3' face='Verdana,Arial'>You are:
$username ... Enter Message: <input type='text' size='20'
name='message' maxlength='200'> <input type='submit' value='Send'></font></p>
</form>
</body>
</html>";
if ($message == ''){
die("No message was entered...");
}


$time = date("D. g:i A", time()-3600);


$message = htmlspecialchars($message);
$message = str_replace("&gt;", ">", $message);
$message = str_replace("&lt;b>", "<b>", $message);
$message = str_replace("&lt;/b>", "</b>", $message);
$message = str_replace("&lt;i>", "<i>", $message);
$message = str_replace("&lt;/i>", "</i>", $message);
$message = str_replace("&lt;font ", "<font ", $message);
$message = str_replace("&lt;/font>", "</font>", $message);

$chatfile = "msg.htm";
$lines = file($chatfile);
$a = count($lines);
$chat_lenght = 0;
$u = $a - $chat_lenght;
$msg = "<div align='center'><center><table border='0' width='100%'><tr><td width='100'><font size='4' face='Arial'><b>$username</b></font></td><td width='10'>&gt;</td><td><font size='4' face='Arial'>$message</font></td><td width='150'>
<p align='right'><font size='4' face='Arial'>$time</font></p></td></tr></table></center></div>";

$lines = file($chatfile);
$fp=fopen("$chatfile", "r+");
flock($fp, 2);
$old_data = fread($fp, filesize($chatfile));
rewind($fp);
fwrite($fp, "$msg \n" . $old_data);
flock($fp,3);
fclose($fp);

if ($u > $maxlines){
$fp = fopen($chatfile, "w");
$fw = fwrite($fp, $msg);
fclose($fp);
}
}
?>

phproom.php listed below


<html>
<head>
<meta http-equiv='Refresh' content='7 url='>
<title>$chatname</title>
</head>

<body>
<font size='3' face='Arial'><?php include('msg.htm'); ?></font>

<p><a name='end'><font size='1' face='Arial'>© Copyright 2001 -
Christopher Pope</font></a><font size='1' face='Arial'> </font><a
href='http://www.seesearch.co.uk/scripts'><font size='1'
face='Arial'>http://www.seesearch.co.uk/scripts</font></a><font
size='1' face='Arial'> </font></p>
</body>
</html>



########################################
myPHPwebchat
v1.1 - Stable Release 18th August 2001
Author: Christopher Pope
This software is FREE for downloadffrom http://www.seesearch.co.uk/scripts.
DO NOT distribute this software without authors permission and do not remove any copyright tags...
########################################

myPHPwebchat is a simple PHP script that will enable you to add a web-based chat room to your site for free. The script is simple to set up so that absolute beginners will have no problem. If you are running a busy site with thousands of users chatting it would be better for you to use myPHPwebchat PRO which has admin, multiple rooms, images and more - it will be out in a couple of weeks...

+++++++++++++++++++++++++++++++++++++++++++++++++
Requirements:
A PHP 3+ enabled server
++++++++++++++++++++++++++++++++++++++++++++++++

CONTENTS:
Section One - Installation
Instructions on how to install myPHPwebchat
Section Two - Whats new in version 1.1
What are the new features in this version.

Section One - Installation
--------------------------------------

It couldn't be easier to install myPHPwebchat on your server. Simply extract the zip file, and upload all the files to your server. CHMOD msg.htm to 777 and thats it - ready to run!

You may want to change the height of the bottom frame of the frameset, to do this edit index.html...
Also if you want to change the number of lines displayed before clearing the screen there is a variable at the top of myPHPwebchat.php for changing this.

Section Two - What's New
-------------------------------------
The script now displays an error message if no Username is entered.
The script now clears the screen after the correct amount of lines have been added to the msg.htm, there was a bug in the last version that stoped this.

There is now HTML tag removal except for <b></b>, <i></i> and <font></font>.
Also, the user name can be no longer that 20 characters, and the message 100 characters.

The time that the message was sent is also now displayed...


Thanks for choosing PHP Multiroom by: Christopher Pope
www.seesearch.co.uk/scripts

(c) Copyright 2001 - Christopher Pope

Monty
10-14-2001, 02:36 PM
A big thanks to Arthur for the help, one .htaccess file solved the problem, and now I can move my final 2 URL's over to FQ in the morning.

[CODE]php_value magic_quotes_gpc "Off"[CODE]

That code goes in a .htaccess file in the same directory
as the scripts, and solved my problem.

Mont

---off for a boat ride on the bay....

daclown
10-22-2001, 06:13 PM
Use stripslashes( );