Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

oldnewbie!

Status
Not open for further replies.

coldfused

Technical User
Jan 27, 2001
2,442
US
ok man have a look..you said do this:

Change your 5th line(in red)with the green one:

<body background=&quot; bgcolor=&quot;#00A0A8&quot; text=&quot;#000000&quot; link=&quot;#0000FF&quot; vlink=&quot;#FF0000&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; topmargin=&quot;0&quot; bottommargin=&quot;0&quot; leftmargin=&quot;0&quot; rightmargin=&quot;0&quot;>
<body bgcolor=&quot;#00A0A8&quot; text=&quot;#000000&quot; link=&quot;#0000FF&quot; vlink=&quot;#FF0000&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; topmargin=&quot;0&quot; bottommargin=&quot;0&quot; leftmargin=&quot;0&quot; rightmargin=&quot;0&quot;>

...

Change your 7th line(in red)with the green one:

<table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; height=&quot;100%&quot;>

<table width=&quot;88.5%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; height=&quot;98.2%&quot;>

where do you see that in this?

# PATH INFO

if ($0=~m#^(.*)(\\|/)#) { $dir = $1; }
else { $dir = `pwd`; chomp $dir; }

$script_url = $ENV{'SCRIPT_NAME'};
$data_dir = &quot;$dir/data&quot;;
$guest_dat = &quot;$data_dir/guest.dat&quot;;
$info_dat = &quot;$data_dir/info.dat&quot;;
$header_file = &quot;$data_dir/header.html&quot;;
$footer_file = &quot;$data_dir/footer.html&quot;;
$admin_mail_file = &quot;$data_dir/adminmail.txt&quot;;
$guest_mail_file = &quot;$data_dir/guestmail.txt&quot;;
$hits_dat = &quot;$data_dir/hits.dat&quot;;
$ip_dat = &quot;$data_dir/ip.dat&quot;;
$dirty_dat = &quot;$data_dir/dirty.dat&quot;;
$emails_dat = &quot;$data_dir/emails.dat&quot;;

%in = &ReadForm;

&load_data;

&hits;


#########################################################
# ADD ENTRY

if($action eq &quot;add&quot;) {

if ($ip_banned_filter eq &quot;1&quot;) {

open (BANNED_IP, &quot;<$ip_dat&quot;);
@banned_ip = split /\s+/, <BANNED_IP>;
close(BANNED_IP);

foreach $ip (@banned_ip) {
if ($ip eq $ENV{'REMOTE_ADDR'}) {
&banned_ip_error;
}
}

}

if (!$guest_name_new && $req_name) {
$error = &quot;Name&quot;;
&required_error;
}
if (!$guest_email_new && $req_email) {
$error = &quot;Email&quot;;
&required_error;
}
if (!$guest_url_new && $req_url) {
$error = &quot;Homepage&quot;;
&required_error;
}
if (!$guest_message_new && $req_message) {
$error = &quot;Message&quot;;
&required_error;
}

if ($guest_name_new =~ /(\b\w{40,}\b)/) {
&long_word_error;
}

if ($guest_message_new =~ /(\b\w{40,}\b)/) {
&long_word_error;
}

if ($words_dirty_filter eq &quot;1&quot;) {

open (DIRTY_DAT, &quot;<$dirty_dat&quot;);
@dirty_words = split /\s+/, <DIRTY_DAT>;
close(DIRTY_DAT);

foreach $dwords (@dirty_words) {
$guest_name_new =~ s/$dwords/****/ig;
$guest_message_new =~ s/$dwords/****/ig;
}

}


if ($html_filter eq &quot;1&quot;) {

$guest_message_new =~ s/</</g;
$guest_message_new =~ s/>/>/g;
$guest_message_new =~ s/<p>/&60;p>/ig;
$guest_message_new =~ s/<br>/&60;br>/ig;
$guest_message_new =~ s/<([^>]|\n)*>//g;
$guest_message_new =~ s/&60;p>/<p>/ig;
$guest_message_new =~ s/&60;br>/<br>/ig;

}

if ($fresh_filter eq &quot;0&quot;) {

$guest_message_new =~ s/\:D/<img src=&quot;$smilies_url\/biggrin.gif&quot;>/sg;
$guest_message_new =~ s/\:confused:/<img src=&quot;$smilies_url\/confused.gif&quot;>/sg;
$guest_message_new =~ s/\:cool:/<img src=&quot;$smilies_url\/cool.gif&quot;>/sg;
$guest_message_new =~ s/\:eek:/<img src=&quot;$smilies_url\/eek.gif&quot;>/sg;
$guest_message_new =~ s/\:eek::/<img src=&quot;$smilies_url\/redface.gif&quot;>/sg;
$guest_message_new =~ s/\:\(/<img src=&quot;$smilies_url\/frown.gif&quot;>/sg;
$guest_message_new =~ s/\:mad:/<img src=&quot;$smilies_url\/mad.gif&quot;>/sg;
$guest_message_new =~ s/\:rolleyes:/<img src=&quot;$smilies_url\/rolleyes.gif&quot;>/sg;
$guest_message_new =~ s/\:\)/<img src=&quot;$smilies_url\/smile.gif&quot;>/sg;
$guest_message_new =~ s/\:p/<img src=&quot;$smilies_url\/tongue.gif&quot;>/sg;
$guest_message_new =~ s/\;\)/<img src=&quot;$smilies_url\/wink.gif&quot;>/sg;

}


if ($guest_email_new) {
$temp = $guest_email_new;
$temp =~ s/-/a/g;
$temp =~ s/_/a/g;
unless ($temp =~ /\w+@\w+\.\w\w+/) {
&format_error;
}

open(EMAILS,&quot;>>$emails_dat&quot;);
print EMAILS &quot;$guest_email_new\n&quot;;
close(EMAILS);

}

if ($guest_url_new && $req_url) {
unless ($guest_url_new =~ /^(f|ht)tp:\/\/.+\..+/) {
&format_error;
}
}
elsif($guest_url_new ne &quot; {
unless ($guest_url_new =~ /^(f|ht)tp:\/\/.+\..+/) {
&format_error;
}
}
else {$guest_url_new = &quot;&quot;;}

&sub_date;

open(GUEST_DAT,&quot;<$guest_dat&quot;);
flock(GUEST_DAT, $LOCK_EX);
@guest_content = <GUEST_DAT>;
flock(GUEST_DAT, $LOCK_UN);
close(GUEST_DAT);

$content = @guest_content[0];
($ID,$guest_date,$guest_name,$guest_email,$guest_url,$guest_
message,$ip,$browser) = split(/\|/,$content);

$new_ID = $ID +1;

open(GUEST_DAT,&quot;>$guest_dat&quot;);
flock(GUEST_DAT, $LOCK_EX);
print GUEST_DAT &quot;$new_ID|$date|$guest_name_new|$guest_email_new|$g
uest_url_new|$guest_message_new|$ENV{'REMOTE_ADDR'}|$ENV{'HTTP_USER_AGENT'}\n&quot;;
foreach $line (@guest_content) {
print GUEST_DAT $line;
}
flock(GUEST_DAT, $LOCK_UN);
close(GUEST_DAT);

if ($guest_mail eq &quot;1&quot; && $guest_email_new) {

open(GUEST_MAIL_TEXT,&quot;$guest_mail_file&quot;);
@guest_text = <GUEST_MAIL_TEXT>;
close(GUEST_MAIL_TEXT);

open(MAIL,&quot;|$sendemail -t&quot;);
print MAIL &quot;To: $guest_email_new\n&quot;;
print MAIL &quot;From: $home_addr\n&quot;;
print MAIL &quot;Subject: $guest_mail_subject\n&quot;;
foreach $line (@guest_text) {
print MAIL &quot;$line\n&quot;;
}
close MAIL;

}

if ($home_mail eq &quot;1&quot; && $home_addr) {

open(HOME_MAIL_TEXT,&quot;$admin_mail_file&quot;);
@home_text = <HOME_MAIL_TEXT>;
close(HOME_MAIL_TEXT);

open(MAIL,&quot;|$sendemail -t&quot;);
print MAIL &quot;To: $home_addr\n&quot;;
print MAIL &quot;From: $guest_email_new\n&quot;;
print MAIL &quot;Subject: $admin_mail_subject\n&quot;;
foreach $line (@home_text) {
print MAIL &quot;$line\n&quot;;
}
close MAIL;

}

if($forward_guest eq &quot;1&quot;){
print &quot;Location: $forward_url\n\n&quot;;
}

}


#########################################################
# GUESTBOOK CONTENT

&Template(&quot;$data_dir/plain.temp&quot;);

open(GUEST_DAT,&quot;<$guest_dat&quot;);
flock (GUEST_DAT, $LOCK_SH);
@guest_dat_content = <GUEST_DAT>;
flock (GUEST_DAT, $LOCK_UN);
close(GUEST_DAT);

foreach$content(@guest_dat_content) {
($ID,$guest_date,$guest_name,$guest_email,$guest_url,$guest_
message,$ip,$browser) = split(/\|/,$content);
$push = &quot;$ID\|$guest_date\|$guest_name\|$guest_email\|$guest_url\|
$guest_message|$ip|$browser\n&quot;;
push(@guest_dat,$push);
$total++;
}

open(HEADER,&quot;<$header_file&quot;);
@header = <HEADER>;
close(HEADER);

foreach $line19(@header) {
$header = $header.$line19;
}

open(FOOTER,&quot;<$footer_file&quot;);
@footer = <FOOTER>;
close(FOOTER);

foreach $line20(@footer) {
$footer = $footer.$line20;
}

#########################################################
# GUESTBOOK ADD ENTRY PAGE

if($guest eq &quot;add&quot;) {

if ($html_filter eq &quot;1&quot;) {$filter_html = &quot;not allowed&quot;;}
else {$filter_html = &quot;allowed&quot;;}
if ($fresh_filter eq &quot;1&quot;) {$filter_fresh = &quot;not allowed&quot;;}
else {$filter_fresh = &quot;allowed&quot;;}

unless (!$req_name) {$required_name = &quot;*&quot;;}
unless (!$req_email) {$required_email = &quot;*&quot;;}
unless (!$req_url) {$required_url = &quot;*&quot;;}
unless (!$req_message) {$required_message = &quot;*&quot;;}

$display_add_entry .= &Cell('add_entry');

}


#########################################################
# GENERATE GUESTBOOK

$show_max = $guest_per_page;
$fcolor_show=1;

if($guest eq &quot;&quot;) {

for($guest_content = $show; $guest_content < scalar @guest_dat;) {
($ID,$guest_date,$guest_name,$guest_email,$guest_url,$guest_
message,$ip,$browser) = split(/\|/,$guest_dat[$guest_content]);

unless (!$guest_email) {
$guest_email = &quot;<tr><td><font face=\&quot;$font\&quot; size=\&quot;$fontsize5\&quot;>[<a href=\&quot;mailto:$guest_email\&quot;>Email</a>]</font></td></tr>&quot;;
}

unless (!$guest_url) {
$guest_url = &quot;<tr><td><font face=\&quot;$font\&quot; size=\&quot;$fontsize5\&quot;>[<a href=\&quot;$guest_url\&quot;>Homepage</a>]</font></td></tr>&quot;;
}

if ($fcolor_show eq '1') {$fcolor=$fcolor1; $fcolor_show++;}
elsif ($fcolor_show eq '2') {$fcolor=$fcolor2; $fcolor_show++;}
elsif ($fcolor_show eq '3') {$fcolor=$fcolor3; $fcolor_show++;}
elsif ($fcolor_show eq '4') {$fcolor=$fcolor4; $fcolor_show=1;}
if($ID ne &quot;&quot;) {
$display_content .= &Cell('guest_content');
}
$guest_content++;
last if $guest_content-$show == $show_max;
}
$show_next = $show+$show_max;
$show_from = $total - $show_next;
$show_to = $show_from + $show_max;
$show_from = $show_from + 1;
if ($show_from <= 0) {$show_from = 1;}


if($guest_content > $show_max || $guest_content < @guest_dat) {

if($guest_content > $show_max) {
$show_back = $show-$show_max;
$back_span = &quot;<a href=\&quot;$script_url\?show=$show_back\&quot;>Back</a>&quot;;
}

if($guest_content < @guest_dat && $guest_content-$show == $show_max) {
$show_next = $show+$show_max;
$next_span = &quot;<a href=\&quot;$script_url\?show=$show_next\&quot;>Next</a>&quot;;
}

if ($back_span && $next_span) {
$display_span .= &Cell(&quot;show_span&quot;);
$display_back_span .= &Cell(&quot;show_back_span&quot;);
$display_next_span .= &Cell(&quot;show_next_span&quot;);
}

elsif ($back_span) {
$display_span .= &Cell(&quot;show_span&quot;);
$display_back_span .= &Cell(&quot;show_back_span&quot;);
}

elsif ($next_span) {
$display_span .= &Cell(&quot;show_span&quot;);
$display_next_span .= &Cell(&quot;show_next_span&quot;);
}

}

if(!$display_content) { $display_content = &quot;<tr><td><center><br><font face=\&quot;arial, verdana\&quot; size=\&quot;2\&quot;><b>There are currently no entries in my Guestbook.<P>Please be the first to contribute.<p></b></font></center></td></tr>&quot; };

}

print &Template(&quot;$data_dir/plain.temp&quot;,'temp');

exit;


sub load_data {

open(INFO,&quot;<$info_dat&quot;);
@info = <INFO>;
close(INFO);

$content_info = @info[0];
($guestbook_name,$guest_per_page,$guest_mail,$guest_mail_sub
ject,$home_mail,$admin_mail_subject,$home_addr,$sendemail,$d
atetype,$admin_pass,$fcolor1,$fcolor2,$fcolor3,$fcolor4,$hco
lor,$mcolor,$scolor,$bcolor,$bgcolor,$bgpic,$tcolor,$lcolor,
$vcolor,$font,$fontsize1,$fontsize2,$fontsize3,$fontsize4,$f
ontsize5,$table,$bordersize,$home_url,$admin_cgi,$guest_cgi,$smilies_html,$smilies_url,$data_path,$script_path,$req_name
,$req_email,$req_url,$req_message,$ip_banned_filter,$words_d
irty_filter,$html_filter,$fresh_filter,$forward_guest,$forwa
rd_url) = split(/\|/,$content_info);

}


sub hits {

open(HITSFILE, &quot;+<$hits_dat&quot;);
flock(HITSFILE, $LOCK_EX);

$hits = <HITSFILE>;

seek HITSFILE, 0, 0;
print HITSFILE ++$hits.&quot;\n&quot;;
truncate HITSFILE, tell( HITSFILE );

flock(HITSFILE, $LOCK_UN);
close(HITSFILE);

}


sub banned_ip_error {

&Template(&quot;$data_dir/plain.temp&quot;,'temp');
$display_banned_ip .= &Cell('banned_ip');
print &Template(&quot;$data_dir/plain.temp&quot;,'temp');
exit;
}

sub required_error {

&Template(&quot;$data_dir/plain.temp&quot;,'temp');
$display_required_fields .= &Cell('required_fields');
print &Template(&quot;$data_dir/plain.temp&quot;,'temp');
exit;
}

sub format_error {
&Template(&quot;$data_dir/plain.temp&quot;,'temp');
$display_format_words .= &Cell('format_words');
print &Template(&quot;$data_dir/plain.temp&quot;,'temp');
exit;
}

sub long_word_error {
&Template(&quot;$data_dir/plain.temp&quot;,'temp');
$display_too_long .= &Cell('long_words');
print &Template(&quot;$data_dir/plain.temp&quot;,'temp');
exit;
}

sub sub_date {

@days = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday'
,'Saturday');
@months = ('January','February','March','April','May','June','July','August','September','October','November','December');

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);

$mon_num = $mon+1;
$savehour = $hour;
$hour = &quot;0$hour&quot; if ($hour < 10);
$min = &quot;0$min&quot; if ($min < 10);
$sec = &quot;0$sec&quot; if ($sec < 10);
$saveyear = ($year % 100);
$year = 1900 + $year;

if ($datetype == 1) {
$mon_num = &quot;0$mon_num&quot; if ($mon_num < 10);
$mday = &quot;0$mday&quot; if ($mday < 10);
$saveyear = &quot;200$saveyear&quot; if ($saveyear < 10);
$date = &quot;$mon_num/$mday/$saveyear&quot;;
} elsif ($datetype == 2) {
$mon_num = &quot;0$mon_num&quot; if ($mon_num < 10);
$mday = &quot;0$mday&quot; if ($mday < 10);
$saveyear = &quot;200$saveyear&quot; if ($saveyear < 10);
$date = &quot;$mday\.$mon_num\.$saveyear&quot;;
} elsif ($datetype == 3) {
$mon_num = &quot;0$mon_num&quot; if ($mon_num < 10);
$mday = &quot;0$mday&quot; if ($mday < 10);
$saveyear = &quot;200$saveyear&quot; if ($saveyear < 10);
$date = &quot;$mon_num/$mday/$saveyear-$hour\:$min&quot;;
} elsif ($datetype == 4) {
$mon_num = &quot;0$mon_num&quot; if ($mon_num < 10);
$mday = &quot;0$mday&quot; if ($mday < 10);
$saveyear = &quot;200$saveyear&quot; if ($saveyear < 10);
$date = &quot;$mday\.$mon_num\.$saveyear-$hour\:$min&quot;;
}

}

#########################################################
# TEMPLATE

sub Template {

local(*FILE);

if ($_[1] eq 'temp') { print &quot;Content-type: text/html\n\n&quot; unless ($ContentType++ > 0); }
elsif ($_[1] eq 'text') { print &quot;Content-type: text/plain\n\n&quot; unless ($ContentType++ > 0); }

if (!$_[0]) { return &quot;<br>\nTemplate : No file was specified<br>\n&quot;; }
elsif (!-e &quot;$_[0]&quot;) { return &quot;<br>\nTemplate : File '$_
[0]' does not exist<br>\n&quot;; }
else {
open(FILE, &quot;<$_[0]&quot;) || return &quot;<br>\nTemplate : Could open
$_[0]<br>\n&quot;;
while (<FILE>) { $FILE .= $_; }
close(FILE);
for ($FILE) {
s/<!-- ins : (.*?) -->/\1/gi; # show hidden inserts
s/<!-- def : (\w+) -->(?:\r\n|\n)?(.*?)<!-- \/def : \1 -->/
$CELL{$1}=$2;''/ges; # read/remove template cells
s/\%(\w+)\%/${$1}/g; # translate %%
}
}
return $FILE;

}

#########################################################
# TRANSLATE CELL

sub Cell {

my($CELL);
for (0..$#_) { if ($_[$_]) { $CELL .= $CELL{$_[$_]}; }}

if (!$_[0]) { return &quot;<br>\nCell : No cell was specified<br>\n&quot;; }
elsif (!$CELL) { return &quot;<br>\nCell : Cell '$_[0]' is not
defined<br>\n&quot;; }
else { $CELL =~ s/\%(\w+)\%/${$1}/g; } # translate %%

return $CELL;

}

#########################################################
# PARSE FORM

sub ReadForm {

my($max) = $_[1]; # Max Input Size
my($name,$value,$pair,@pairs,$buffer,%hash); # localize variables

# Check input size if max input size is defined
if ($max && ($ENV{'CONTENT_LENGTH'}||length $ENV{'QUERY_STRING'}) > $max) {
die(&quot;ReadForm : Input exceeds max input limit of $max bytes\n&quot;);
}

# Read GET or POST form into $buffer
if ($ENV{'REQUEST_METHOD'} eq 'POST') { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); }
if ($ENV{'QUERY_STRING'}) { $buffer .= $ENV{'QUERY_STRING'}; }

@pairs = split(/&/, $buffer); # Split into name/value pairs
foreach $pair (@pairs) {

($name, $value) = split(/=/, $pair); # split into $name and $value
$value =~ s/\+/ /g;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(&quot;C&quot;, hex($1))/eg;
$value =~ s/~!/ ~!/g;
$value =~ s/\n/<br>/sg;
$value =~ s/\[\]//g;
$value =~ tr/+/ /; # replace &quot;+&quot; with &quot; &quot;
$value =~ s/%([A-F0-9]{2})/pack(&quot;C&quot;, hex($1))/egi; # replace %hex with char
$$name = $value;
}

return %hash;

}








e.gif


carlsatterwhite@endangeredgraphics.com
 
i found what you meant..if you right click on the guestbook/view source it brings up the script that you were talking about..that file i'm guessing is called guest.html..unfortunatly there is no guest.html file in that cgi-script..so it has to be called something else?makes no sense!the above script is the guest.cgi.there is a file in the data folder of that script that is called the index.html..which i'm guessing is the file that is calling the guest.html..but when i click on that file it tells me that i don't have permission to view that file?is that index.html the file that i need to make the changes to?if so i will just change them and replace!but i can't view it to tell!
e.gif


carlsatterwhite@endangeredgraphics.com
 
Can't post, from this morning, with Oldnewbie's handle. Management has put me on hold! For whatever good reason...

My answer was concerning your other message board software, not this new one.
You did mention something about reading about loading images... But from what I've seen on the Discus site, I think they were talking about pictures in posts (as your E graphics gif here) and not as a background for their forum form. Unless you can point me to such an info on the Discus site, guess you'll have to try their support forum to try to get an answer on that!

You did manage to get the leftframe ok with NS, didn't you!

;-)
 
yeh i know..i'm keeping the guestbook cgi as the actual guest book now(imagine that)..take a look at the site in netscape and goto the guestbook button..when you try to sign the guest book it pulls up the sign in form..see how it disrupts the background image inside the form?
e.gif


carlsatterwhite@endangeredgraphics.com
 
Was talkin' about the crazy formating of this thread here!

So you've now moved the old message board sofware to be used with the guest book? Is that it?
My testing was done using guest.cgi and was working with IE only at that point. Just wanted to see if you could manage it with IE, before I started workin' on NS.

NS does have a mind of it's own!

;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top