CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Modifying

 



Lesia
Deleted

Feb 1, 2000, 10:42 PM

Post #1 of 16 (2956 views)
Modifying Can't Post

Hello. I have a script that I found, and want to modify it. One modification is to make what shows on the screen reversed. (ie.what's on top to show at the bottom of the page.) Is there an easy way of just turning a script upside down without messing anything up?
Thanks
Lesia


brian.hayes
User

Feb 2, 2000, 6:44 PM

Post #2 of 16 (2956 views)
Re: Modifying [In reply to] Can't Post

Can you post the code? I will need to look at how it is printing the the Browser. Or, if you know if the script is reading from a file just post that part. You may also want to look at :
http://www.perlguru.com/forum/Forum2/HTML/000075.shtml


Let us know!

Brian Hayes


Cure
User

Feb 4, 2000, 8:00 PM

Post #3 of 16 (2956 views)
Re: Modifying [In reply to] Can't Post

Lesia:: Heres a easy way to make the output of a script -> print whats a the top of a page to the bottm of the page....


open FH, "data.txt";
unshift @hi,$_ while (<FH> );
close FH;

for (@hi) {chomp, print "$_\n"}



Lesia
Deleted

Feb 4, 2000, 10:29 PM

Post #4 of 16 (2956 views)
Re: Modifying [In reply to] Can't Post

Cure, I thought I pasted the script to the last message. I'll try again. the demo of the script can be seen at http://www.aquilo.net/projects/#!/usr/local/bin/perl

# Chat program (version 2.13) #
# Copyright 1998 Michael Chavel (chavel@aquilo.net)
# You may use this program for PERSONAL, NON-PROFIT USE ONLY!
# The most recent version of this program and documentation can
# be found at http://www.aquilo.netuse 5.004;
use strict; # enforce declarations and quoting
use CGI qw(:standard); # import shortcuts
use Fcntl qw(:flock); # imports LOCK_EX, LOCK_SH, LOCK_NBmy (
$URL, $CHATFILE, $USERS, $MAXSAVE, $MAXDISPLAY, $MAXUSERS, $ACTIVETIME,
$SHOW_DATE, $SHOW_EMAIL, $CAPITALIZE, $HOURADJUST, $TZONE,
$TITLE, $WELCOME, $RETURN, $INFOCOLOR, $BGCOLOR, $FORMCOLOR,
$PUBLICCOLOR, $PRIVATECOLOR, $SENTPUBCOLOR, $SENTPVTCOLOR, $TEXTCOLOR,
$LINKCOLOR, $ALINKCOLOR, $VLINKCOLOR,
$msgcolor, # current message color
$from, $to, # current message from, to
$timestamp, # time stamp to track active users
$date, # date and time (adjustable for different timezones)
$link, # email or URL of guest
$cur, # new entry in the guestbook
@entries, # holds all entries
$entry, # one particular entry
%times, # hash of users last access times
%hosts, # hash of users IP address or DNS name
@users, # all active users
$user, # current user
$remote_host, # IP address or DNS name of current user
$sorry, # string to inform user of an error
$line, $key, $value1, $value2, $beg, # misc variables
$taken, $display, $dsplycnt );
### SITE DEFAULTS - CHANGE THESE AS NECESSARY ###############################
$CHATFILE = 'chatfile'; # name of chat file
$USERS = 'chatusers'; # file storing active user info
$RETURN = 'http://www.aquilo.net/projects'; # refer visitors back to this URL
$MAXUSERS = 20; # max number of users
$MAXSAVE = 100; # how many messages to save to disk
$MAXDISPLAY= 25; # max number of messages to display
$ACTIVETIME = 5*60; # time a user stays active (in seconds)
$SHOW_DATE = 0; # show date/time of messages
$SHOW_EMAIL = 0; # enable email link at users name
$CAPITALIZE = 0; # capitalize names
$TITLE = "CHAT"; # page title
$WELCOME = "CHAT"; # <H1>$WELCOME</H1>
$INFOCOLOR = 'red'; # color of welcome and other text
$BGCOLOR = 'black'; # overall background color
$FORMCOLOR = 'black'; # bgcolor for form, if table is used
$TEXTCOLOR = 'red'; # text color
$LINKCOLOR = 'red'; # link color
$ALINKCOLOR = 'red'; # active link color
$VLINKCOLOR = 'red'; # visited link color
$PUBLICCOLOR = 'red'; # color for PUBLIC messages
$PRIVATECOLOR = 'yellow'; # color for PRIVATE messages
$SENTPUBCOLOR = 'red'; # color for SENT PUBLIC messages
$SENTPVTCOLOR = 'silver'; # color for SENT PRIVATE messages
$HOURADJUST = 0; # add this to local hour
$TZONE = 'EST'; # to display this time zone
# # automatically adjusts for
# # daylight savings (EST -> EDT, etc)
#############################################################################
$timestamp = time(); # get time stamp
$sorry = 0; # no error yet
print <<End_of_Text; # start HTML
Content-type: text/html<HTML><HEAD><TITLE> $TITLE</TITLE> </HEAD>
<BODY BGCOLOR="$BGCOLOR" TEXT="$TEXTCOLOR" LINK="$LINKCOLOR"
ALINK="$ALINKCOLOR" VLINK="$VLINKCOLOR"><A NAME="BOTTOM"></A>
<FONT COLOR="$INFOCOLOR"><CENTER><H1>$WELCOME</H1></CENTER><CENTER>
<b>Earliest Comments at <A HREF="#BOTTOM">Bottom</a> of Page</b></CENTER>
</FONT>End_of_Text
if (-e $USERS) { # update users
open(UHANDLE, "+< $USERS") &#0124; &#0124; bail("cannot open $USERS: $!"); } else {
open(UHANDLE, "+> $USERS") &#0124; &#0124; bail("cannot open $USERS: $!"); }
flock(UHANDLE, LOCK_EX) &#0124; &#0124; bail("cannot flock $USERS: $!");
while (!eof(UHANDLE) && (%times < $MAXUSERS) ) { chomp($line = <UHANDLE> );
($key, $value1, $value2) = split(/:/, $line);
if ($timestamp-$value1 < $ACTIVETIME) { # check if still active
$times{$key} = $value1; $hosts{$key} = $value2; };};
$remote_host = $ENV{'REMOTE_HOST'};
$cur = CGI->new(); # current request
$URL = $cur->script_name(); # URL of this script
$user = $cur->param("name"); # get user name
$user =~ tr/ \n\r\t\f/ /s; # remove consequtive spaces
chop($user) if ($user =~ m/ $/); # remove any trailing junk
$user = substr($user, 1) if ($user =~ m/^ /); # remove any leading junk
$user =~ s/(\w+)/\u$1/g if ($CAPITALIZE); # capatalize (if enabled)
$cur->param("name", $user);
foreach (keys %times) { # check active user names
$taken=$_ if (m/^$user$/i);};
if (length($taken)) { # is name already active###
# one method of verifying users is to check the previous $user value
# saved in a hidden field in the HTML form. If they don't match
# this person is trying to use someone else's name
if (lc($user) ne $cur->param("save")) { ###
# another way to verify users is to check the remote users ip address.
# if it is not the same as before assume this is a different person
# and prompt for a different user name
# if (!($remote_host =~ m/$hosts{$taken}/i)) {#
$sorry ="The name $taken is already active. "
.'Please choose another name.'; };
# otherwise, assume this is the same active user###
} elsif (length($user)) { # new user
$times{$user} = $timestamp; $hosts{$user} = $remote_host;};
seek(UHANDLE, 0, 0) &#0124; &#0124; bail("cannot rewind $USERS: !"); foreach (keys %times) {
print UHANDLE "$_:$times{$_}:$hosts{$_}\n"; # save updated user info
push (@users, $_); # record active user names }
truncate(UHANDLE, tell(UHANDLE)) &#0124; &#0124; bail("cannot truncate $USERS: $!");
close(UHANDLE) &#0124; &#0124; bail("cannot close $USERS: $!");
if ((!$sorry) && $cur->param("message") =~ m/\S/) { # new message
# check for image tags
if ($cur->param("message") =~ m/<\s*IMG\s*.*SRC\s*=/i) {
$sorry = 'Sorry, you can not include images in messages.'; } else {
if (length($user)) {
$cur->param("timestamp", $timestamp); # get timestamp
$cur->param("date", get_time($timestamp)); # get pretty date/time
@entries = ($cur); # save message to array } else {
$sorry ='You must enter a <b>name</b> to send a message!'; }; };};
if (-e $CHATFILE) {
open(CHANDLE, "+< $CHATFILE") &#0124; &#0124; bail("cannot open $CHATFILE: $!");} else {
open(CHANDLE, "+> $CHATFILE") &#0124; &#0124; bail("cannot open $CHATFILE: $!");}
flock(CHANDLE, LOCK_EX) &#0124; &#0124; bail("cannot flock $CHATFILE: $!");
while (!eof(CHANDLE) && @entries < $MAXSAVE) {
$entry = CGI->new(\*CHANDLE); push @entries, $entry;}
seek(CHANDLE, 0, 0) &#0124; &#0124; bail("cannot rewind $CHATFILE: !");
foreach $entry (@entries) { $entry->save(\*CHANDLE); }
truncate(CHANDLE, tell(CHANDLE)) &#0124; &#0124; bail("cannot truncate $CHATFILE: $!");
close(CHANDLE) &#0124; &#0124; bail("cannot close $CHATFILE: $!");
push (@users, 'Everyone');#print hr;
#print "<TABLE BGCOLOR=\"$FORMCOLOR\" # put a table around form, if you like
# BORDER =\"1\" CELLPADDING =\"10\"><TR><TD>\n";
print start_form; # HTML form
if ( length($user) && !$sorry ) { # save user name
print '<input type=hidden name="save" value="'.lc($user).'">',"\n";
} else { # save previous user name
print '<input type=hidden name="save" value="'
.$cur->param("save").'">',"\n"; };
print "<B>Name:</B> ", $cur->textfield( # sticky "name" field
-NAME => "name", -SIZE => 30); print " <B>To:</B> ",
$cur->popup_menu(-NAME => 'to', # "to" field
-VALUES => \@users, -DEFAULT => 'Everyone',
-OVERRIDE => 1) # set to 0 to make sticky
, "\n";if ($SHOW_EMAIL) {
print "<BR><B>Email or URL:</B>\n",
$cur->textfield( # sticky email/URL field
-NAME => "email", -SIZE => 40), " (optional)<BR>\n";};
print "<BR><B>Message:</B><BR>\n",
$cur->textfield( # message field -NAME => "message",
-SIZE => 68, -OVERRIDE => 1); # clears previous message
### if you prefer a textarea for messages # $cur->textarea(
# -NAME => "message",
# -OVERRIDE => 1, # clears previous message from textarea
# -ROWS => 3,# -COLUMNS => 68,# -WRAP => "hard"), "<BR>\n";
###print $cur->submit( -VALUE => "send / refresh"), " ";
#print $cur->reset( -VALUE => "clear"); # clear button, if you like
print end_form, "\n";#print "</TD></TR></TABLE>\n";print hr;
print "<CENTER><FONT SIZE=\"5\" COLOR=\"$PRIVATECOLOR\"> $sorry
</FONT></CENTER>\n<HR>" if ($sorry);$dsplycnt=0;
while (@entries && ($dsplycnt < $MAXDISPLAY)) { # display messages
$entry = shift(@entries);
$link = $entry->param("email") if ($SHOW_EMAIL);
$from = $entry->param("name"); $from =~ s/(\w+)/\u$1/g if ($CAPITALIZE);
$to = $entry->param("to"); $to =~ s/\s+/ /g;
$to =~ s/(\w+)/\u$1/g if ($CAPITALIZE);
$date = $entry->param("date") if ($SHOW_DATE);
if ( length($user) && (lc($to) eq lc($user)) ) { $msgcolor = $PRIVATECOLOR;
$display = 1 if (!$sorry);
} elsif (length($user) && (lc($from) eq lc($user))) {
if (lc($to) eq 'everyone') { $msgcolor = $SENTPUBCOLOR; $display = 1;
} else { $msgcolor = $SENTPVTCOLOR; $display = 1 if (!$sorry); };
} elsif (lc($to) eq 'everyone') { $msgcolor = $PUBLICCOLOR; $display = 1;
}; if ($display) { $display = 0; $dsplycnt++; if ($link) {
if ($link =~ m/@/) { printf ("<FONT COLOR=\"$msgcolor\"><B>
<a href=\"mailto:%s\">%s</a> to %s</B> %s</FONT>\n",
$link, $from, $to, $date); } else { $link =~ s/^http:\/\///;
printf ("<FONT COLOR=\"$msgcolor\"><B>
<a href=\"http:\/\/%s\">%s</a> to %s</B> %s</FONT>\n",
$link, $from, $to, $date); }; } else {
printf ("<FONT COLOR=\"$msgcolor\"><B>%s to %s</B> %s</FONT>\n",
"$from", "$to", $date); };
printf ("<BR><FONT COLOR=\"$msgcolor\">%s</FONT>\n",
$entry->param("message")); print hr; };};
print <<End_of_Text; # finish HTML
<FONT COLOR="$INFOCOLOR"><CENTER>
<b>Latest Comments at <A NAME="BOTTOM" HREF="#TOP">Top</a> of Page</b></CENTER>
<p><CENTER><A HREF="$RETURN">Return to Home Page</a></b></CENTER></FONT></BODY>
</HTML>End_of_Textsub get_time {my (
$sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$dst, @months );
@months = ("January","February","March","April","May","June","July",
"August","September","October","November","December");
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$dst)
= localtime(time()+$HOURADJUST*3600);
if ($hour < 10) { $hour = '0'.$hour; } if ($min < 10) {
$min = '0'.$min; } if ($sec < 10) { $sec = '0'.$sec; }
$year += 1900; # Y2K OK!
$TZONE =~ tr/S/D/ if ($dst); # fix time zone string for daylight savings
return $timestamp = "$months[$mon] $mday, $year $hour:$min:$sec ($TZONE)";}
sub bail { # print errors directly to browser my $error = "@_";
print h1("Error:"), p($error), end_html; die $error;}


Lesia
Deleted

Feb 5, 2000, 9:10 AM

Post #5 of 16 (2956 views)
Re: Modifying [In reply to] Can't Post

Brian and Cure, here is the script. I need the name and text field to show at the bottom of the page and the pull down menu deleted. Also I wanted to intergrate images into the messages when posted with some of symbol such as for a smiley face _smile_ and have the image appear.
Thanks,
Lesia


Cure
User

Feb 5, 2000, 9:24 AM

Post #6 of 16 (2956 views)
Re: Modifying [In reply to] Can't Post

Lesia:: Can I see the script you are talking about-> so, I can help you with it.

Thanks:
Cure


brian.hayes
User

Feb 5, 2000, 11:00 AM

Post #7 of 16 (2956 views)
Re: Modifying [In reply to] Can't Post

Wow! Look for :

$entry = shift(@entries);

in all this and change it to

$entry = unshift(@entries);

I belive this will reverse what is displayed.

Brian Hayes


brian.hayes
User

Feb 5, 2000, 11:05 AM

Post #8 of 16 (2956 views)
Re: Modifying [In reply to] Can't Post

Also,
http://www.perlguru.com/forum/Forum2/HTML/000075.shtml

This post will explain this in more detail.

Brian Hayes


Lesia
Deleted

Feb 5, 2000, 1:43 PM

Post #9 of 16 (2956 views)
Re: Modifying [In reply to] Can't Post

Thanks, Brian. I'll change that and see what happens. My server is having problems with it's cgi-bin so it make take a couple of days.
Lesia


Cure
User

Feb 5, 2000, 4:19 PM

Post #10 of 16 (2956 views)
Re: Modifying [In reply to] Can't Post

Hi Lesia:

I made the chat script,so the name and text field shows up at the bottom of the page, the pull down menu deleted and the info for each entry to appear at the bottom of the list instead of the top of the list.

Cure
################

#!/usr/bin/perl

# Chat program (version 2.13)
#
# Copyright 1998 Michael Chavel (chavel@aquilo.net)
# You may use this program for PERSONAL, NON-PROFIT USE ONLY!
# The most recent version of this program and documentation can
# be found at http://www.aquilo.net


use 5.004;
use strict; # enforce declarations and quoting
use CGI qw(:standard); # import shortcuts
use Fcntl qw(:flock); # imports LOCK_EX, LOCK_SH, LOCK_NB

my (
$URL, $CHATFILE, $USERS, $MAXSAVE, $MAXDISPLAY, $MAXUSERS, $ACTIVETIME,
$SHOW_DATE, $SHOW_EMAIL, $CAPITALIZE, $HOURADJUST, $TZONE,
$TITLE, $WELCOME, $RETURN, $INFOCOLOR, $BGCOLOR, $FORMCOLOR,
$PUBLICCOLOR, $PRIVATECOLOR, $SENTPUBCOLOR, $SENTPVTCOLOR, $TEXTCOLOR,
$LINKCOLOR, $ALINKCOLOR, $VLINKCOLOR,
$msgcolor, # current message color
$from, $to, # current message from, to
$timestamp, # time stamp to track active users
$date, # date and time (adjustable for different timezones)
$link, # email or URL of guest
$cur, # new entry in the guestbook
@entries, # holds all entries
$entry, # one particular entry
%times, # hash of users last access times
%hosts, # hash of users IP address or DNS name
@users, # all active users
$user, # current user
$remote_host, # IP address or DNS name of current user
$sorry, # string to inform user of an error
$line, $key, $value1, $value2, $beg, # misc variables
$taken, $display, $dsplycnt
);


### SITE DEFAULTS - CHANGE THESE AS NECESSARY ###############################
$CHATFILE = 'chatfile'; # name of chat file
$USERS = 'chatusers'; # file storing active user info
$RETURN = 'http://www.cureable.com'; # refer visitors back to this URL
$MAXUSERS = 20; # max number of users
$MAXSAVE = 100; # how many messages to save to disk
$MAXDISPLAY= 25; # max number of messages to display
$ACTIVETIME = 5*60; # time a user stays active (in seconds)
$SHOW_DATE = 0; # show date/time of messages
$SHOW_EMAIL = 0; # enable email link at users name
$CAPITALIZE = 0; # capitalize names
$TITLE = "CHAT"; # page title
$WELCOME = "CHAT"; # <H1>$WELCOME</H1>
$INFOCOLOR = 'red'; # color of welcome and other text
$BGCOLOR = 'black'; # overall background color
$FORMCOLOR = 'black'; # bgcolor for form, if table is used
$TEXTCOLOR = 'red'; # text color
$LINKCOLOR = 'red'; # link color
$ALINKCOLOR = 'red'; # active link color
$VLINKCOLOR = 'red'; # visited link color
$PUBLICCOLOR = 'red'; # color for PUBLIC messages
$PRIVATECOLOR = 'yellow'; # color for PRIVATE messages
$SENTPUBCOLOR = 'red'; # color for SENT PUBLIC messages
$SENTPVTCOLOR = 'silver'; # color for SENT PRIVATE messages
$HOURADJUST = 0; # add this to local hour
$TZONE = 'EST'; # to display this time zone
# # automatically adjusts for
# # daylight savings (EST -> EDT, etc)
#############################################################################


$timestamp = time(); # get time stamp
$sorry = 0; # no error yet

print <<End_of_Text; # start HTML
Content-type: text/html

<HTML>
<HEAD>
<TITLE> $TITLE</TITLE>
</HEAD>
<BODY BGCOLOR="$BGCOLOR"
TEXT="$TEXTCOLOR"
LINK="$LINKCOLOR"
ALINK="$ALINKCOLOR"
VLINK="$VLINKCOLOR"
>
<A NAME="TOP"></A>
<FONT COLOR="$INFOCOLOR">
<CENTER>
<H1>$WELCOME</H1></CENTER>
<CENTER>
<b>Earliest Comments at <A HREF="#BOTTOM">Bottom</a> of Page</b>
</CENTER>
</FONT>

End_of_Text

if (-e $USERS) { # update users
open(UHANDLE, "+< $USERS") &#0124; &#0124; bail("cannot open $USERS: $!");
} else {
open(UHANDLE, "+> $USERS") &#0124; &#0124; bail("cannot open $USERS: $!");
}
flock(UHANDLE, LOCK_EX) &#0124; &#0124; bail("cannot flock $USERS: $!");
while (!eof(UHANDLE) && (%times < $MAXUSERS) ) {
chomp($line = <UHANDLE> );
($key, $value1, $value2) = split(/:/, $line);
if ($timestamp-$value1 < $ACTIVETIME) { # check if still active
$times{$key} = $value1;
$hosts{$key} = $value2;
};
};

$remote_host = $ENV{'REMOTE_HOST'};
$cur = CGI->new(); # current request
$URL = $cur->script_name(); # URL of this script

$user = $cur->param("name"); # get user name
$user =~ tr/ \n\r\t\f/ /s; # remove consequtive spaces
chop($user) if ($user =~ m/ $/); # remove any trailing junk
$user = substr($user, 1) if ($user =~ m/^ /); # remove any leading junk
$user =~ s/(\w+)/\u$1/g if ($CAPITALIZE); # capatalize (if enabled)
$cur->param("name", $user);

foreach (keys %times) { # check active user names
$taken=$_ if (m/^$user$/i);
};
if (length($taken)) { # is name already active
###
# one method of verifying users is to check the previous $user value
# saved in a hidden field in the HTML form. If they don't match
# this person is trying to use someone else's name
if (lc($user) ne $cur->param("save")) {
###
# another way to verify users is to check the remote users ip address.
# if it is not the same as before assume this is a different person
# and prompt for a different user name
# if (!($remote_host =~ m/$hosts{$taken}/i)) {
#
$sorry ="The name $taken is already active. "
.'Please choose another name.';
};
# otherwise, assume this is the same active user
###
} elsif (length($user)) { # new user
$times{$user} = $timestamp;
$hosts{$user} = $remote_host;
};

seek(UHANDLE, 0, 0) &#0124; &#0124; bail("cannot rewind $USERS: !");
foreach (keys %times) {
print UHANDLE "$_:$times{$_}:$hosts{$_}\n"; # save updated user info
push (@users, $_); # record active user names
}

truncate(UHANDLE, tell(UHANDLE)) &#0124; &#0124; bail("cannot truncate $USERS: $!");
close(UHANDLE) &#0124; &#0124; bail("cannot close $USERS: $!");


if ((!$sorry) && $cur->param("message") =~ m/\S/) { # new message
# check for image tags
if ($cur->param("message") =~ m/<\s*IMG\s*.*SRC\s*=/i) {
$sorry = 'Sorry, you can not include images in messages.';
} else {
if (length($user)) {
$cur->param("timestamp", $timestamp); # get timestamp
$cur->param("date", get_time($timestamp)); # get pretty date/time
@entries = ($cur); # save message to array
} else {
$sorry ='You must enter a <b>name</b> to send a message!';
};
};
};
if (-e $CHATFILE) {
open(CHANDLE, "+< $CHATFILE") &#0124; &#0124; bail("cannot open $CHATFILE: $!");
} else {
open(CHANDLE, "+> $CHATFILE") &#0124; &#0124; bail("cannot open $CHATFILE: $!");
}
flock(CHANDLE, LOCK_EX) &#0124; &#0124; bail("cannot flock $CHATFILE: $!");
while (!eof(CHANDLE) && @entries < $MAXSAVE) {
$entry = CGI->new(\*CHANDLE);
push @entries, $entry;
}
seek(CHANDLE, 0, 0) &#0124; &#0124; bail("cannot rewind $CHATFILE: !");
foreach $entry (@entries) {
$entry->save(\*CHANDLE);
}
truncate(CHANDLE, tell(CHANDLE)) &#0124; &#0124; bail("cannot truncate $CHATFILE: $!");
close(CHANDLE) &#0124; &#0124; bail("cannot close $CHATFILE: $!");


push (@users, 'Everyone');
#print hr;
#print "<TABLE BGCOLOR=\"$FORMCOLOR\" # put a table around form, if you like
# BORDER =\"1\" CELLPADDING =\"10\"><TR><TD>\n";

$dsplycnt=0;
while (@entries && ($dsplycnt < $MAXDISPLAY)) { # display messages
$entry = pop(@entries);
$link = $entry->param("email") if ($SHOW_EMAIL);
$from = $entry->param("name");
$from =~ s/(\w+)/\u$1/g if ($CAPITALIZE);
# $to = $entry->param("to");
$to =~ s/\s+/ /g;
$to =~ s/(\w+)/\u$1/g if ($CAPITALIZE);
$date = $entry->param("date") if ($SHOW_DATE);
if ( length($user) && (lc($to) eq lc($user)) ) {
$msgcolor = $PRIVATECOLOR;
$display = 1 if (!$sorry);
} elsif (length($user) && (lc($from) eq lc($user))) {
if (lc($to) eq 'everyone') {
$msgcolor = $SENTPUBCOLOR;
$display = 1;
} else {
$msgcolor = $SENTPVTCOLOR;
$display = 1 if (!$sorry);
};
} elsif (lc($to) eq 'everyone') {
$msgcolor = $PUBLICCOLOR;
$display = 1;
};
if ($display) {
$display = 0;
$dsplycnt++;
if ($link) {
if ($link =~ m/@/) {
printf ("<FONT COLOR=\"$msgcolor\"><B>
<a href=\"mailto:%s\">%s</a> to %s</B> %s</FONT>\n",
$link, $from, $to, $date);
} else {
$link =~ s/^http:\/\///;
printf ("<FONT COLOR=\"$msgcolor\"><B>
<a href=\"http:\/\/%s\">%s</a> to %s</B> %s</FONT>\n",
$link, $from, $to, $date);
};
} else {
printf ("<FONT COLOR=\"$msgcolor\"><B>%s to %s</B> %s</FONT>\n",
"$from", "$to", $date);
};
printf ("<BR><FONT COLOR=\"$msgcolor\">%s</FONT>\n",
$entry->param("message"));
print hr;
};
};

print start_form; # HTML form
if ( length($user) && !$sorry ) { # save user name
print '<input type=hidden name="save" value="'.lc($user).'">',"\n";
} else { # save previous user name
print '<input type=hidden name="save" value="'
.$cur->param("save").'">',"\n";
};
print "<B><font color=red>Name:</B></font> ", $cur->textfield( # sticky "name" field
-NAME => "name",
-SIZE => 30);

"\n";
if ($SHOW_EMAIL) {
print "<BR><B>Email or URL:</B>\n",
$cur->textfield( # sticky email/URL field
-NAME => "email",
-SIZE => 40), " (optional)<BR>\n";
};
print "<BR><B>Message:</B><BR>\n",
$cur->textfield( # message field
-NAME => "message",
-SIZE => 68,
-OVERRIDE => 1); # clears previous message
### if you prefer a textarea for messages
# $cur->textarea(
# -NAME => "message",
# -OVERRIDE => 1, # clears previous message from textarea
# -ROWS => 3,
# -COLUMNS => 68,
# -WRAP => "hard"), "<BR>\n";
###
print $cur->submit( -VALUE => "send / refresh"), " ";
#print $cur->reset( -VALUE => "clear"); # clear button, if you like
print end_form, "\n";
#print "</TD></TR></TABLE>\n";
print hr;

print "<CENTER><FONT SIZE=\"5\" COLOR=\"$PRIVATECOLOR\">
$sorry
</FONT></CENTER>\n<HR>" if ($sorry);

print <<End_of_Text; # finish HTML
<FONT COLOR="$INFOCOLOR">
<CENTER>
<b>Latest Comments at <A NAME="BOTTOM" HREF="#TOP">Top</a> of Page</b>
</CENTER>
<p>
<CENTER>
<A HREF="$RETURN">Return to Home Page</a></b>
</CENTER>
</FONT>

</BODY>
</HTML>
End_of_Text


sub get_time {

my (
$sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$dst,
@months
);

@months = ("January","February","March","April","May","June","July",
"August","September","October","November","December");
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$dst)
= localtime(time()+$HOURADJUST*3600);
if ($hour < 10) {
$hour = '0'.$hour;
}
if ($min < 10) {
$min = '0'.$min;
}
if ($sec < 10) {
$sec = '0'.$sec;
}
$year += 1900; # Y2K OK!
$TZONE =~ tr/S/D/ if ($dst); # fix time zone string for daylight savings
return $timestamp = "$months[$mon] $mday, $year $hour:$min:$sec ($TZONE)";

}


sub bail { # print errors directly to browser
my $error = "@_";
print h1("Error:"), p($error), end_html;
die $error;
}


[This message has been edited by Cure (edited 02-05-2000).]


brian.hayes
User

Feb 5, 2000, 5:43 PM

Post #11 of 16 (2956 views)
Re: Modifying [In reply to] Can't Post

Thanks Cure.. I see what you did here.


Cure
User

Feb 5, 2000, 7:32 PM

Post #12 of 16 (2956 views)
Re: Modifying [In reply to] Can't Post

Your welcome Brian.

Cure


Lesia
Deleted

Feb 6, 2000, 2:29 PM

Post #13 of 16 (2956 views)
Re: Modifying [In reply to] Can't Post

Cure, THANK YOU very much for this script!!! You're a doll. Now all I need to know is how to intergrate pictures into the messages that people post. The person posting the message needs to be able to put in a code like -smile- and have a smiley face show where it's placed in the message. Such as:
Hello Everyone -smile-
Thanks Again,
Lesia


Lesia
Deleted

Feb 6, 2000, 9:52 PM

Post #14 of 16 (2956 views)
Re: Modifying [In reply to] Can't Post

Cure and Brian, can you tell me what this means and how to fix it?
Microsoft VBScript runtime error '800a01a8'

Object required: 'HttpObj'

/site_mgmt/cleanpls.asp, line 200

Thanks
Lesia


brian.hayes
User

Feb 7, 2000, 4:32 AM

Post #15 of 16 (2956 views)
Re: Modifying [In reply to] Can't Post

There is VB script error on that line. What does the line say?

Brian Hayes


Lesia
Deleted

Feb 7, 2000, 5:16 AM

Post #16 of 16 (2956 views)
Re: Modifying [In reply to] Can't Post

Brian, this is what Line 200 says:
$link = $entry->param("email") if ($SHOW_EMAIL);

Lesia

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives