I am trying to make a functional skeleton of a web based chat server with php
Using a basic framework for this concept and functions. I haven’t been able to find any open source programs like this that showed the concept on how to stream real time data into the browser like the web based chat rooms on chatro, webmaze or alterrealm does
So I guess I need a login page (login.html) that passes, pushes or strings the data input or info that I would name $USER, $LOGIN, $PASSWORD, $USERPASS, $HISTORY, $NOPIC and $SAYS now this would also pass name:user ip to a file log userip.txt
<FORM METHOD="POST"
ACTION=" target=_top>
<TABLE WIDTH="550" BORDER="1" CELLSPACING="0">
<TR>
<TD ALIGN="RIGHT">Name:</TD>
<TD> <INPUT NAME="USER" VALUE="To Lazy to type" SIZE="20"></TD>
</TR>
<TR>
<TD ALIGN="CENTER" VALIGN="MIDDLE">
<TABLE WIDTH="100%" BORDER="0"
CELLSPACING="0">
<TR>
<TD ALIGN="RIGHT">Login:</TD>
<TD> <INPUT NAME="LOGIN"
SIZE="10"></TD>
</TR>
</TABLE> </TD>
<TD ALIGN="CENTER" VALIGN="MIDDLE">
<TABLE WIDTH="100%" BORDER="0"
CELLSPACING="0">
<TR>
<TD ALIGN="RIGHT">Password:</TD>
<TD> <INPUT NAME="USERPASS"
VALUE="" SIZE="10"></TD>
</TR>
</TABLE> </TD>
</TR>
<TR>
<TD ALIGN="CENTER" VALIGN="MIDDLE" COLSPAN="2">
<SELECT NAME="SAYS" SIZE="1">
<OPTION VALUE="<i>walks in....</i>">Visitors</OPTION>
<OPTION VALUE="<i>is within ....</i>">Member</OPTION>
</SELECT> </TD>
</TR>
<TR>
<TD ALIGN="CENTER" VALIGN="MIDDLE" COLSPAN="2">
<TABLE WIDTH="100%" BORDER="0"
CELLPADDING="03" CELLSPACING="0">
<TR>
<TD ALIGN="CENTER"
VALIGN="MIDDLE">History: <INPUT NAME="HISTORY" VALUE="5" SIZE="2" MAXLENGTH="2"></TD>
<TD ALIGN="CENTER" VALIGN="MIDDLE">Verbose <select name="VERBOSE" size="1"><option selected value="0">NO</option><option value="1">YES</option></select></TD>
<TD ALIGN="CENTER" VALIGN="MIDDLE"><b>Image Filtering <select
name="NOPIC" size="1">
<option selected value="0">Avatars On</option>
<option value="1">No Avatars</option>
<option value="1">No Images</option>
</select></TD>
</TR>
</TABLE> </TD>
</TR>
<TR>
<TD ALIGN="CENTER" VALIGN="MIDDLE"
COLSPAN="2"><INPUT TYPE="SUBMIT" VALUE="Chat Now"></TD>
</TR>
</TABLE> </FORM>
userip.txt
$user:$ip
myname:123.123.12.09
even if the file read from body log
room body log or body.txt
207.255.110.120Sun Sep 25 16:04:54 2005) To Lazy to type : <i>walks in....</i><BR>
or
207.255.110.120Sun Sep 25 16:05:05 2005) <img src= align=left><center></img><br><center><FONT FACE=garamond><FONT COLOR =silver><FONT SIZE=4>MY NAME<br>*some words*</font><br>*some more words*<br><FONT COLOR =silver><FONT SIZE=4><a target=_window>My site</a><br><a href= COLOR =blue><FONT SIZE=3>: <i>walks in....</i><BR>
the time and date would be nice but til I get basics
frames.pl a parser that validates the user login and enter post then parses them
also displaying banner.pl, body.txt and info.pl
<html>
<frameset rows="120,*">
<frame name=BANNER src="BANNER.pl?USER=$USER&SAYS=$SAYS$">
<frame name="BODY" src="BODY.txt?USER=$USER&SAYS=$SAYS$">
</frameset>
<frame name="INFO" src="info.pl or cgi or even html">
</frameset>
banner.pl serves parsed form and adds in current chatters name and list of other chatters a list of actions both read from a txt file or files on the server.
[MAIN]
<CENTERfont color=blueB> : $1 - $2 users</B/CENTER>
<PRE>
<B>$USER</BACTIONLISTUSERLIST>
Message: <INPUT TYPE="TEXT" NAME="SAYS" SIZE=40 VALUE=""
INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="* Submit *">
<INPUT NAME="LOGIN" TYPE="HIDDEN" VALUE="$LOGIN"
INPUT NAME="USER" TYPE="HIDDEN" VALUE="$USER"
INPUT NAME="USERPASS" TYPE="HIDDEN" VALUE="$USERPASS"
INPUT NAME="PASSWORD" TYPE="HIDDEN" VALUE="$PASSWORD"
INPUT NAME="NOPIC" TYPE="HIDDEN" VALUE="$NOPIC"
INPUT NAME="VERBOSE" TYPE="HIDDEN" VALUE="$VERBOSE"
INPUT NAME="HISTORY" TYPE="HIDDEN" VALUE="$HISTORY"
/FORMFORM ACTION="/" METHOD="POST" TARGET="_top"
INPUT NAME="LOGIN" TYPE="HIDDEN" VALUE="$LOGIN"
INPUT NAME="USER" TYPE="HIDDEN" VALUE="$USER"
INPUT NAME="USERPASS" TYPE="HIDDEN" VALUE="$USERPASS"
INPUT NAME="PASSWORD" TYPE="HIDDEN" VALUE="$PASSWORD"
INPUT NAME="NOPIC" TYPE="HIDDEN" VALUE="$NOPIC"
INPUT NAME="VERBOSE" TYPE="HIDDEN" VALUE="$VERBOSE"
INPUT NAME="HISTORY" TYPE="HIDDEN" VALUE="$HISTORY"
INPUT NAME="GOTO" TYPE="SUBMIT" VALUE="Goto"
GOTOLISTINPUT NAME="LEAVEIT" TYPE="SUBMIT" VALUE="Leave"
INPUT NAME="RELOAD" TYPE="SUBMIT" VALUE="Reload"
INPUT NAME="CONFIG" TYPE="SUBMIT" VALUE="Config">
And body is a html read out of the chat log or txt
$ VERBOSE is a line separating the posts
$ HISTORY is how many past posts the login $USER wants to see when entering room
USER and USERPASS are for members the room
LOGIN and $PASSWORD are from the administrators of the room
NOPIC turns picture display on and off on entering the room
Goto or leave redirects users to other room or url
CONFIG allows $USER to redo $USER name, pic’s on or off ,verbose
Now in most html chat the $user will input a string html code like
<img src= align=left><center></img><br><center><FONT FACE=garamond><FONT COLOR =silver><FONT SIZE=4>MY NAME<br>*some words*</font><br>*some more words*<br><FONT COLOR =silver><FONT SIZE=4><a target=_window>My site</a><br><a href= COLOR =blue><FONT SIZE=3>
$USER, , $USERPASS, $LOGIN, $PASSWORD, $HISTORY, $NOPIC, $SAYS, $AUTOSCROLL, $ACTION, $ WHOTO
these all would be user input on login or index page dropdowns or txtbox or checkboxes
So how is the best way to from these to stream real time data into the browser.
USER=Myname the one I typed in txtbox
USERPASS=Mypass the one I typed in txtbox (if one uses will not have to have a pass to enter room)
SAYS=Enters+the+room... default or typed in text box
HISTORY=20 (how many lines up on the temp log) entered in txt box
VERBOSE=1 1 = <HR> 0 = nothing or on and off
LOGIN= ( the admin name)
PASSWORD (the admin password)
ACTION here would be hidden and set to nothing, but reads off a file of actions the chatter could have in room
Like
Say to $user1 say to $user2
WHOTO=ALL is set to all for entering the room, but in room the chatter could select who they want to talk at, like MYNAME SAYS to HERNAME Hello
So I want these to write to a file (or be logged)
USER:USERPASS:LOGINASSWORD:SAYS:HISTORY:VERBOSE:ACTION: WHOTO
169.70.234.228:::<img src= align=left><center></img><br><center><FONT FACE=garamond><FONT COLOR =silver><FONT SIZE=4>WarGod of Venna<br>*Administrator*</font><br>*Never say Never*<br><FONT COLOR =silver><FONT SIZE=4><a href= target=_window>Chat Venues</a><br><a href= COLOR =blue><FONT SIZE=3><center>:::aSasaSAS:::WarGod of Venna*Administrator**Never say Never*Chat VenuesVenna:::chocolate:::10:::10:::1:::1:::1167263638:::asASasa
I sorta got a start on it in cgi
use CGI;
my $q = new CGI;
my $ip_addr = $ENV{'REMOTE_ADDR'};
my $new_text = strip_html( $old_text );
open (MSG, ">>log.txt");
print MSG "\n"
. $ip_addr . ":::" . $q->param('name') . ":::" . $q->param('password') . ":::" . strip_html($q->param('name')) . ":::" . $q->param('CHATCOLOR') . ":::" . $q->param('refresh_rate') . ":::" . $q->param('histroy') . ":::" . $q->param('nopic') . ":::" . $q->param('verbose') . ":::" . time . ":::" . $q->param('msg');
close (MSG);
open (WHO, ">>/home/chatvenu/public_html/cgi-bin/mychat/userlog.who");
print WHO "\n"
. $ip_addr . ":" . strip_html($q->param('name'));
close (WHO);
sub strip_html {
my $text = shift;
$text =~ s/<(?:[^>'"]*|(['"]).*?\1)*>//gs;
return $text;
}
but I am wondering if this done in php
Using a basic framework for this concept and functions. I haven’t been able to find any open source programs like this that showed the concept on how to stream real time data into the browser like the web based chat rooms on chatro, webmaze or alterrealm does
So I guess I need a login page (login.html) that passes, pushes or strings the data input or info that I would name $USER, $LOGIN, $PASSWORD, $USERPASS, $HISTORY, $NOPIC and $SAYS now this would also pass name:user ip to a file log userip.txt
<FORM METHOD="POST"
ACTION=" target=_top>
<TABLE WIDTH="550" BORDER="1" CELLSPACING="0">
<TR>
<TD ALIGN="RIGHT">Name:</TD>
<TD> <INPUT NAME="USER" VALUE="To Lazy to type" SIZE="20"></TD>
</TR>
<TR>
<TD ALIGN="CENTER" VALIGN="MIDDLE">
<TABLE WIDTH="100%" BORDER="0"
CELLSPACING="0">
<TR>
<TD ALIGN="RIGHT">Login:</TD>
<TD> <INPUT NAME="LOGIN"
SIZE="10"></TD>
</TR>
</TABLE> </TD>
<TD ALIGN="CENTER" VALIGN="MIDDLE">
<TABLE WIDTH="100%" BORDER="0"
CELLSPACING="0">
<TR>
<TD ALIGN="RIGHT">Password:</TD>
<TD> <INPUT NAME="USERPASS"
VALUE="" SIZE="10"></TD>
</TR>
</TABLE> </TD>
</TR>
<TR>
<TD ALIGN="CENTER" VALIGN="MIDDLE" COLSPAN="2">
<SELECT NAME="SAYS" SIZE="1">
<OPTION VALUE="<i>walks in....</i>">Visitors</OPTION>
<OPTION VALUE="<i>is within ....</i>">Member</OPTION>
</SELECT> </TD>
</TR>
<TR>
<TD ALIGN="CENTER" VALIGN="MIDDLE" COLSPAN="2">
<TABLE WIDTH="100%" BORDER="0"
CELLPADDING="03" CELLSPACING="0">
<TR>
<TD ALIGN="CENTER"
VALIGN="MIDDLE">History: <INPUT NAME="HISTORY" VALUE="5" SIZE="2" MAXLENGTH="2"></TD>
<TD ALIGN="CENTER" VALIGN="MIDDLE">Verbose <select name="VERBOSE" size="1"><option selected value="0">NO</option><option value="1">YES</option></select></TD>
<TD ALIGN="CENTER" VALIGN="MIDDLE"><b>Image Filtering <select
name="NOPIC" size="1">
<option selected value="0">Avatars On</option>
<option value="1">No Avatars</option>
<option value="1">No Images</option>
</select></TD>
</TR>
</TABLE> </TD>
</TR>
<TR>
<TD ALIGN="CENTER" VALIGN="MIDDLE"
COLSPAN="2"><INPUT TYPE="SUBMIT" VALUE="Chat Now"></TD>
</TR>
</TABLE> </FORM>
userip.txt
$user:$ip
myname:123.123.12.09
even if the file read from body log
room body log or body.txt
207.255.110.120Sun Sep 25 16:04:54 2005) To Lazy to type : <i>walks in....</i><BR>
or
207.255.110.120Sun Sep 25 16:05:05 2005) <img src= align=left><center></img><br><center><FONT FACE=garamond><FONT COLOR =silver><FONT SIZE=4>MY NAME<br>*some words*</font><br>*some more words*<br><FONT COLOR =silver><FONT SIZE=4><a target=_window>My site</a><br><a href= COLOR =blue><FONT SIZE=3>: <i>walks in....</i><BR>
the time and date would be nice but til I get basics
frames.pl a parser that validates the user login and enter post then parses them
also displaying banner.pl, body.txt and info.pl
<html>
<frameset rows="120,*">
<frame name=BANNER src="BANNER.pl?USER=$USER&SAYS=$SAYS$">
<frame name="BODY" src="BODY.txt?USER=$USER&SAYS=$SAYS$">
</frameset>
<frame name="INFO" src="info.pl or cgi or even html">
</frameset>
banner.pl serves parsed form and adds in current chatters name and list of other chatters a list of actions both read from a txt file or files on the server.
[MAIN]
<CENTERfont color=blueB> : $1 - $2 users</B/CENTER>
<PRE>
<B>$USER</BACTIONLISTUSERLIST>
Message: <INPUT TYPE="TEXT" NAME="SAYS" SIZE=40 VALUE=""
INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="* Submit *">
<INPUT NAME="LOGIN" TYPE="HIDDEN" VALUE="$LOGIN"
INPUT NAME="USER" TYPE="HIDDEN" VALUE="$USER"
INPUT NAME="USERPASS" TYPE="HIDDEN" VALUE="$USERPASS"
INPUT NAME="PASSWORD" TYPE="HIDDEN" VALUE="$PASSWORD"
INPUT NAME="NOPIC" TYPE="HIDDEN" VALUE="$NOPIC"
INPUT NAME="VERBOSE" TYPE="HIDDEN" VALUE="$VERBOSE"
INPUT NAME="HISTORY" TYPE="HIDDEN" VALUE="$HISTORY"
/FORMFORM ACTION="/" METHOD="POST" TARGET="_top"
INPUT NAME="LOGIN" TYPE="HIDDEN" VALUE="$LOGIN"
INPUT NAME="USER" TYPE="HIDDEN" VALUE="$USER"
INPUT NAME="USERPASS" TYPE="HIDDEN" VALUE="$USERPASS"
INPUT NAME="PASSWORD" TYPE="HIDDEN" VALUE="$PASSWORD"
INPUT NAME="NOPIC" TYPE="HIDDEN" VALUE="$NOPIC"
INPUT NAME="VERBOSE" TYPE="HIDDEN" VALUE="$VERBOSE"
INPUT NAME="HISTORY" TYPE="HIDDEN" VALUE="$HISTORY"
INPUT NAME="GOTO" TYPE="SUBMIT" VALUE="Goto"
GOTOLISTINPUT NAME="LEAVEIT" TYPE="SUBMIT" VALUE="Leave"
INPUT NAME="RELOAD" TYPE="SUBMIT" VALUE="Reload"
INPUT NAME="CONFIG" TYPE="SUBMIT" VALUE="Config">
And body is a html read out of the chat log or txt
$ VERBOSE is a line separating the posts
$ HISTORY is how many past posts the login $USER wants to see when entering room
USER and USERPASS are for members the room
LOGIN and $PASSWORD are from the administrators of the room
NOPIC turns picture display on and off on entering the room
Goto or leave redirects users to other room or url
CONFIG allows $USER to redo $USER name, pic’s on or off ,verbose
Now in most html chat the $user will input a string html code like
<img src= align=left><center></img><br><center><FONT FACE=garamond><FONT COLOR =silver><FONT SIZE=4>MY NAME<br>*some words*</font><br>*some more words*<br><FONT COLOR =silver><FONT SIZE=4><a target=_window>My site</a><br><a href= COLOR =blue><FONT SIZE=3>
$USER, , $USERPASS, $LOGIN, $PASSWORD, $HISTORY, $NOPIC, $SAYS, $AUTOSCROLL, $ACTION, $ WHOTO
these all would be user input on login or index page dropdowns or txtbox or checkboxes
So how is the best way to from these to stream real time data into the browser.
USER=Myname the one I typed in txtbox
USERPASS=Mypass the one I typed in txtbox (if one uses will not have to have a pass to enter room)
SAYS=Enters+the+room... default or typed in text box
HISTORY=20 (how many lines up on the temp log) entered in txt box
VERBOSE=1 1 = <HR> 0 = nothing or on and off
LOGIN= ( the admin name)
PASSWORD (the admin password)
ACTION here would be hidden and set to nothing, but reads off a file of actions the chatter could have in room
Like
Say to $user1 say to $user2
WHOTO=ALL is set to all for entering the room, but in room the chatter could select who they want to talk at, like MYNAME SAYS to HERNAME Hello
So I want these to write to a file (or be logged)
USER:USERPASS:LOGINASSWORD:SAYS:HISTORY:VERBOSE:ACTION: WHOTO
169.70.234.228:::<img src= align=left><center></img><br><center><FONT FACE=garamond><FONT COLOR =silver><FONT SIZE=4>WarGod of Venna<br>*Administrator*</font><br>*Never say Never*<br><FONT COLOR =silver><FONT SIZE=4><a href= target=_window>Chat Venues</a><br><a href= COLOR =blue><FONT SIZE=3><center>:::aSasaSAS:::WarGod of Venna*Administrator**Never say Never*Chat VenuesVenna:::chocolate:::10:::10:::1:::1:::1167263638:::asASasa
I sorta got a start on it in cgi
use CGI;
my $q = new CGI;
my $ip_addr = $ENV{'REMOTE_ADDR'};
my $new_text = strip_html( $old_text );
open (MSG, ">>log.txt");
print MSG "\n"
. $ip_addr . ":::" . $q->param('name') . ":::" . $q->param('password') . ":::" . strip_html($q->param('name')) . ":::" . $q->param('CHATCOLOR') . ":::" . $q->param('refresh_rate') . ":::" . $q->param('histroy') . ":::" . $q->param('nopic') . ":::" . $q->param('verbose') . ":::" . time . ":::" . $q->param('msg');
close (MSG);
open (WHO, ">>/home/chatvenu/public_html/cgi-bin/mychat/userlog.who");
print WHO "\n"
. $ip_addr . ":" . strip_html($q->param('name'));
close (WHO);
sub strip_html {
my $text = shift;
$text =~ s/<(?:[^>'"]*|(['"]).*?\1)*>//gs;
return $text;
}
but I am wondering if this done in php