Question

E-Guest doesnt update the count...

Asked by: peterx

Hi,
Im a complete newbie in perl coding,
and have a problem with the eprl version of E-Guest.
http://www.hotscripts.com/Perl/Scripts_and_Programs/Guestbooks/
The config seems pretty simple,
I have checked all the paths,
and everything works ok till the E-Guest_show.cgi,
there the message is always:
"No matching entry found!"
and "There are messages".
Is this part of the script right?
----------------------------------------------------
print qq~

 <td width=50% align=center>
      <font size=$fsize face=$fface color=$fcolor>
      There are $LineCount messages
    </td>
  </tr><form>
    <tr bgcolor=#$tcolor1>
    <td width=50% align=center>
      <font size=$fsize face=$fface color=$fcolor>
      Display
      <select style=\"font-family: Arial; font-size: 10pt\" onChange=\"if(this.options[this.selectedIndex].value!=0) self.location=this.options[this.selectedIndex].value\">
~;
----------------------------------------------------
All three files, 2 perl and the db text-file
are in the cgi-bin folder.
Im running a Windows server.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2001-12-30 at 08:53:51ID20250068
Topics

Perl Programming Language

,

Server Side Includes (SSI)

Participating Experts
1
Points
50
Comments
17

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. guest book
    Does anyone know where I can find a guest book to be used on my webpage or perhaps how to constuct one.
  2. Guest Book
    I want to put Guest Book on my Page.Do you have any info or sample application.I uses winodws NT. Thanx,
  3. Guest Book without CGI
    Right now I'm on a server that doesn't allow a cgi-bin on my site or the use of cgi files. Is there any way to create a Guest Book, &/or message board without cgi? I tried mailto; however, I need the messages to be posted to the web. Can anyone help?
  4. guest book in perl
    i'm perl beginner , any reference site can help me to do the guest book , hit counter in perl ?
  5. host and guest
    Is it possible to make my system host as well as guest. I am trying to do net use lpt1 \\na\printer the printer is having a usb port and i am trying to capture lpt1 port to enable dos printing. but as my system is standalone , i need to connect to the network to pass the ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: maneshrPosted on 2001-12-30 at 09:12:06ID: 6701425

peterx,

"..All three files, 2 perl and the db text-file are in the cgi-bin folder.."

Can you post the Perl script here? Can you post theHTML file that you are using here?

Can you post the URL where one can see this HTML form & Perl script in action?

The info that you have provided is not clear. Therefore, pl. explain in plain english what exactly you are trying to do, what is happening & what you expect to happen.

This will help you get a more accurate answer, faster.

 

by: peterxPosted on 2001-12-30 at 09:55:04ID: 6701457

E-Guest consists of three files:
E-Guest_sign.cgi:
-----------------
#!F:/Savant/perl5/bin/perl.exe

$data = 'http://denniz.dyns.net:8080/cgi-bin/E-Guest_db.txt';    # path for data file

$title = 'Puszels Guestbook';    # page title
$bgcolor = '3C507D';    # background color
$display = '10';    # default # of entries to display per page

$fsize = '2';        # font size
$fface = 'Arial';    # font face
$fcolor = '000000';    # font color

$alink = '003388';    # link color
$avisited = '003388';    # visited link color
$ahover = '2255AA';    # hover link color

$twidth = '550';    # table width
$talign = 'center';    # table align (left/right/center)
$tborder = '1';        # table border size
$tbcolor = '000000';    # table orbder color
$tpadding = '5';    # table padding size
$tspacing = '5';    # table spacing size
$tcolor1 = 'dddddd';    # table color 1
$tcolor2 = '999999';    # table color 2

#========================================
# NO EDITING AFTER THIS LINE
#========================================

#========================================
# Get Form Fields Values
#----------------------------------------
# To get the values of the fields.
# Assign variables for each of the field's
# value.
#========================================

if ($ENV{"REQUEST_METHOD"} eq 'GET') {
  $buffer = $ENV{'QUERY_STRING'};
}
else {
  read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}

@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
        ($name, $value) = split(/=/, $pair);
        $value =~ tr/+/ /;
        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
        $FORM{$name} = $value;
}

$fullname = $FORM{'fullname'};
$email = $FORM{'email'};
$homepage = $FORM{'homepage'};
$uin = $FORM{'uin'};
$location = $FORM{'location'};
$comment = $FORM{'comment'};
$action = $FORM{'action'};

#========================================
# Check and Fix Homepage Content
#----------------------------------------
# To check if the user input homepage value
# and if user input "http://" at the
# beginning of the string or not,
# if not, add the "http://" to fix it.
#========================================

if ($homepage && $homepage =~ /^http:\/\//){
$homepage = "$homepage";
} elsif ($homepage) {
$homepage = "http://$homepage";
}

#========================================
# Construct Date String
#----------------------------------------
# Standard construction for the date and
# time variable.
#========================================

@days = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
@months = ('January','Feburary','March','April','May','June','July','August','September',
            'October','November','December');
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = gmtime(time);
    if($hour < 10) { $hour = "0$hour"; }
    if ($min < 10) { $min = "0$min"; }
    if ($sec < 10) { $sec = "0$sec"; }
        $saveyear = ($year % 100);
    $year = 1900 + $year;

    $date = "$days[$wday], $months[$mon] $mday, $year";

#========================================
# Check for Required Fields
#----------------------------------------
# Checking for the values for Full name, Email
# and Comment. If it's empty, add warning
# message in the variable $msg. Check for
# value UIN, homepage and email address format.
#========================================

if ($action eq add && $fullname eq '') {
$msg .= "Please fill in the \"Full name\" field!<br>";
}

if ($action eq add && $email eq '') {
$msg .= "Please fill in the \"Email\" field!<br>";
}

if ($action eq add && $comment eq '') {
$msg .= "Please fill in the \"Comment\" field!<br>";
}

if ($action ne add || $email eq '' || $email =~ /\@/i) {
} else {
$msg .= "Invalid address in \"Email\" field!<br>";
$format = Bad;
}

if ($action ne add || $homepage eq '' || $homepage =~ /\./i) {
} else {
$msg .= "Invalid address in \"Homepage\" field!<br>";
$format = Bad;
}

if ($action eq add && $uin ne '' && $uin =~ /[A-Z]/i) {
$msg .= "Invalid address in \"UIN\" field!<br>";
$format = Bad;
}

#========================================
# Print Page Header
#----------------------------------------
# This is the coding for the heading of
# the page.
#========================================

print "Content-Type: text/html\n\n";

print qq~
<!-- E-Guest guestbook system 1.1 -->
<!-- powered by leungeric.com -->

<html><head><title>$title</title></head>
<style>
A:link {text-decoration: none; color: #$alink}
A:visited {text-decoration: none; color: #$avisited}
A:hover {text-decoration: underline; color: #$ahover}
</style>
<body bgcolor=#$bgcolor>

<table width=$twidth bgcolor=#$tcolor2 align=$talign cellpadding=$tpadding cellspacing=$tspacing border=$tborder bordercolor=#$tbcolor>
  <tr bgcolor=#$tcolor1 align=center>
    <td>
      <font face=$fface color=$fcolor><b>$title
      <p align=right><font size=1>powered by <a href=http://leungeric.com target=_blank>leungeric.com</a>

    </td>
  </tr>
</table>
<p>
<table width=$twidth bgcolor=#$tcolor2 align=$talign cellpadding=$tpadding cellspacing=$tspacing border=$tborder bordercolor=#$tbcolor>
  <tr bgcolor=#$tcolor1>
    <td colspan=2 align=center>
      <font size=$fsize face=$fface color=$fcolor>
      <b><a href=E-Guest_show.cgi>View Guestbook</a></b>
    </td>
  </tr>
  <tr></tr><tr></tr>
~;

#========================================
# Check and Display Warning Message
#----------------------------------------
# If the required fields are missing,
# display the warning message in order to
# submit the entry.
#========================================

if ($msg) {
print qq~
  <tr bgcolor=#$tcolor1>
    <td colspan=2><font size=$fsize face=$fface color=#ff0000>$msg</td>
  </tr>
  <tr></tr><tr></tr>
~;
}

#========================================
# Displaying Sign Form
#----------------------------------------
# Display the signning form if all required
# fields are empty.
#========================================

if ($fullname eq '' || $email eq '' || $comment eq '' || $format eq Bad) {
print qq~
  <form action="E-Guest_sign.cgi" method=post>
  <tr bgcolor=#$tcolor1>
    <td><font size=$fsize face=$fface color=$fcolor>Full Name :</td>
    <td><input type=text name="fullname" value="$fullname" style="font-family: Arial; font-size: 10pt"> <font color=#$alink><b>*</b></td>
  </tr>
  <tr bgcolor=#$tcolor1>
      <td><font size=$fsize face=$fface color=$fcolor>Email :</td>
      <td><input type=text name="email" value="$email" style="font-family: Arial; font-size: 10pt"> <font color=#$alink><b>*</b> <font color=#$alink><b>#</b></td>
  </tr>
  <tr bgcolor=#$tcolor1>
      <td><font size=$fsize face=$fface color=$fcolor>Homepage :</td>
      <td><input type=text name="homepage" value="$homepage" style="font-family: Arial; font-size: 10pt"> <font color=#$alink><b>#</b></td>
  </tr>
  <tr bgcolor=#$tcolor1>
      <td><font size=$fsize face=$fface color=$fcolor>UIN :</td>
      <td><input type=text name="uin" value="$uin" style="font-family: Arial; font-size: 10pt"> <font color=#$alink><b>#</b></td>
  </tr>
  <tr bgcolor=#$tcolor1>
      <td><font size=$fsize face=$fface color=$fcolor>Location :</td>
      <td><input type=text name="location" value="$location" style="font-family: Arial; font-size: 10pt"></td>
  </tr>
  <tr bgcolor=#$tcolor1>
    <td><font size=$fsize face=$fface color=$fcolor>Comment :</td>
    <td>
      <textarea name="comment" cols=47 rows=5 wrap=on style="font-family: Arial; font-size: 10pt">$comment</textarea> <font color=#$alink><b>*</b> <font color=#$alink><b>!</b>
    </td>
  </tr>
  <tr></tr><tr></tr>
  <tr bgcolor=#$tcolor1>
  <td colspan=2 align=center>
    <input type=submit value=" Sign Guestbook " style="font-family: Arial; font-size: 10pt">
    <input type=reset value=" Reset " style="font-family: Arial; font-size: 10pt">
    <input type=hidden name="action" value="add">
  </td>
  </tr></form>
  <tr></tr><tr></tr>
  <tr bgcolor=#$tcolor1>
    <td colspan=2>
    <font color=#$alink><b>*</b> <font size=1 face=$fface color=$fcolor>Required field</font>
    <font color=#$alink><b>!</b> <font size=1 face=$fface color=$fcolor>Multiple line support, HTML tag filtering</font>
    <font color=#$alink><b>#</b> <font size=1 face=$fface color=$fcolor>Valid format checking</font>
    </td>
  </tr>
~;
} else {

#========================================
# Check and Fix Comment Content
#----------------------------------------
# To check for any < and > and change them
# to special HTML tag to prevent harm to
# the guestbook. And change newline to <BR>
# which is to support for multiple lines.
#========================================

$comment =~ s/</&lt;/g;
$comment =~ s/>/&gt;/g;
$comment =~ s/\n/<br>/g;

#========================================
# Confirm Signned and Preview
#----------------------------------------
# If passed all checking, add the entry into
# database and display message and preview.
#========================================

open(datas,">>$data");
flock(datas, 2);
print datas "$fullname||$email||$uin||$homepage||$location||$comment||$date\n";
close(datas);

print qq~
<tr bgcolor=#$tcolor1>
  <td colspan=2>
    <font size=$fsize face=$fface color=$fcolor>
    The following is what you submitted.<br> You can follow the above link to view the guestbook entries.
  </td>
</tr>
<tr></tr><tr></tr>
<tr bgcolor=#$tcolor1>
  <td colspan=2>
    <font size=$fsize face=$fface color=$fcolor>
    <font color=#$alink><b>$fullname</b></font> <a href=\"mailto:$email\"><img src=http://denniz.dyns.net:8080/images/email.gif border=0></a>
~;

print " <a href=\"$homepage\" target=\"_blank\"><img src=http://denniz.dyns.net:8080/images/home.gif border=0></a>\n" if($homepage);
print " <a href=\"$uin\"><img src=http://denniz.dyns.net:8080/images/icq.gif border=0></a>\n" if($uin);
print "<br>$location\n" if($location);

print qq~

<br>$comment
<br>Date: $date
</td>
</tr>
~;
}

#========================================
# Print Page Footer & Demo ADV
#----------------------------------------
# This is the coding for the page footer.
# And there is a place for you to place your own ADV,
# change the ADV coding to anything you want.
#========================================

print "</table>";

print qq~

<p><table width=$twidth bgcolor=#$tcolor2 align=$talign cellpadding=$tpadding cellspacing=$tspacing border=$tborder bordercolor=#$tbcolor>
  <tr bgcolor=#$tcolor1 align=center>
    <td align=center>
      <font face=$fface color=$fcolor size=$fsize><b>Learn more about Perl</b></font>
      <br>
<A HREF="http://www.amazon.com/exec/obidos/ASIN/0596000278/leungericcom-20" target=_blank>
<IMG SRC="http://leungeric.com/eric/book/0596000278.01.TZZZZZZZ.jpg" border="0" alt="cover" hspace="3" vspace="3"></A>

<A HREF="http://www.amazon.com/exec/obidos/ASIN/0201615711/leungericcom-20" target=_blank>
<IMG SRC="http://leungeric.com/eric/book/0201615711.01.TZZZZZZZ.jpg" border="0" alt="cover" hspace="3" vspace="3"></A>

<A HREF="http://www.amazon.com/exec/obidos/ASIN/020135358X/leungericcom-20" target=_blank>
<IMG SRC="http://leungeric.com/eric/book/020135358X.01.TZZZZZZZ.gif" border="0" alt="cover" hspace="3" vspace="3"></A>

<A HREF="http://www.amazon.com/exec/obidos/ASIN/0966942604/leungericcom-20" target=_blank>
<IMG SRC="http://leungeric.com/eric/book/0966942604.01.TZZZZZZZ.jpg" border="0" alt="cover" hspace="3" vspace="3"></A>

<A HREF="http://www.amazon.com/exec/obidos/ASIN/0201700549/leungericcom-20"  target=_blank>
<IMG SRC="http://leungeric.com/eric/book/0201700549.01.TZZZZZZZ.jpg" border="0" alt="cover" hspace="3" vspace="3"></A>

<A HREF="http://www.amazon.com/exec/obidos/ASIN/0764507761/leungericcom-20"  target=_blank>
<IMG SRC="http://leungeric.com/eric/book/0764507761.01.TZZZZZZZ.jpg" border="0" alt="cover" hspace="3" vspace="3"></A>

    </td>
  </tr>
</table>

~;


print "</body></html>";

#========================================
# End of File
#========================================


E-Guest_show.cgi:
-----------------
#!F:/Savant/perl5/bin/perl.exe

$data = 'http://denniz.dyns.net:8080/cgi-bin/E-Guest_db.txt';    # path for data file

$title = 'Puszels Guestbook';    # page title
$bgcolor = '3C507D';    # background color
$display = '10';    # default # of entries to display per page

$fsize = '2';        # font size
$fface = 'Arial';    # font face
$fcolor = '000000';    # font color

$alink = '003388';    # link color
$avisited = '003388';    # visited link color
$ahover = '2255AA';    # hover link color

$twidth = '550';    # table width
$talign = 'center';    # table align (left/right/center)
$tborder = '1';        # table border size
$tbcolor = '000000';    # table border color
$tpadding = '5';    # table padding size
$tspacing = '5';    # table spacing size
$tcolor1 = 'dddddd';    # table color 1
$tcolor2 = '999999';    # table color 2

#========================================
# NO EDITING AFTER THIS LINE
#========================================

#========================================
# Solve and Set Query String
#----------------------------------------
# Check if query string. If yes, split
# the string and set them to different
# variables.
#========================================

if ($ENV{'QUERY_STRING'}) {
  ($s1,$s2,$s3,$s4) = split(/\&/,$ENV{'QUERY_STRING'});
  ($type1,$value1) = split(/\=/,$s1);
  ($type2,$value2) = split(/\=/,$s2);
  ($type3,$value3) = split(/\=/,$s3);
  ($type4,$value4) = split(/\=/,$s4);
  $start = $value1;
  $sort = $value2;
  $display = $value3;
  $search = $value4;
} else {
  $start = 0;
  $sort = lifo;
}

$stop = $start + $display;

#========================================
# Open Data File and Sort
#----------------------------------------
# Open the data file and according to the
# query string, sort the data in different
# ways
#========================================

open(temp,"$data");
  flock(temp, 2);
  @indata = <temp>;
  if ($sort eq lifo) { @datass = reverse(@indata); }
  elsif ($sort eq lilo) { @datass = @indata; }
  elsif ($sort eq name) { @datass = sort(@indata); }
close(temp);

#========================================
# Count Total
#----------------------------------------
# Open the data file and count how many
# entries are in the database.
#========================================

open(file,"$data");
  while(<file>) {
    $TheLine = $_;
    chomp($TheLine);
    $LineCount = $LineCount + 1;
  }
close(file);

#========================================
# Print Page Header
#----------------------------------------
# This is the coding for the heading of
# the page.
#========================================

print "Content-Type: text/html\n\n";

print qq~
<!-- E-Guest guestbook system 1.1 -->
<!-- powered by leungeric.com -->

<html><head><title>$title</title></head>
<style>
A:link {text-decoration: none; color: #$alink}
A:visited {text-decoration: none; color: #$avisited}
A:hover {text-decoration: underline; color: #$ahover}
</style>
<body bgcolor=#$bgcolor>

<table width=$twidth bgcolor=#$tcolor2 align=$talign cellpadding=$tpadding cellspacing=$tspacing border=$tborder bordercolor=#$tbcolor>
  <tr bgcolor=#$tcolor1 align=center>
    <td>
      <font face=$fface color=$fcolor><b>$title
      <p align=right><font size=1>powered by <a href=http://leungeric.com target=_blank>leungeric.com</a>

    </td>
  </tr>
</table>

<p>
<table width=$twidth bgcolor=#$tcolor2 align=$talign cellpadding=$tpadding cellspacing=$tspacing border=$tborder bordercolor=#$tbcolor>
  <tr bgcolor=#$tcolor1>
    <td colspan=2 align=center>
      <font size=$fsize face=$fface color=$fcolor>
      <b><a href=E-Guest_sign.cgi>Sign Guestbook</a></b>
    </td>
  </tr>
~;

#========================================
# Search and Submit
#----------------------------------------
# This is the coding for the searching
# feature. Included an text input field
# and a submit button.
#========================================

print qq~

  <tr bgcolor=#$tcolor1>
    <td width=50% align=center>
      <font size=$fsize face=$fface color=$fcolor>
      <form name=form1>
      <input type=hidden name=display value=0>
      <input type=hidden name=sort value=$sort>
      <input type=hidden name=entry value=$display>
      <input type=text name=search size=10 style="font-family: Arial; font-size: 10pt" value=$search>
      <input type=submit value=Search style="font-family: Arial; font-size: 10pt" onSubmit="self.location=document.form1.display.value+document.form1.sort.value+document.form1.entry.value+document.form1.search.value">
      <input type=button value="Reset" style="font-family: Arial; font-size: 10pt" onClick="self.location='E-Guest_show.cgi'">
    </td></form>
~;

#========================================
# Total Entries Message
#----------------------------------------
# This is the coding for the message
# which displays the total number of
# messages
#========================================

print qq~

 <td width=50% align=center>
      <font size=$fsize face=$fface color=$fcolor>
      There are $LineCount messages
    </td>
  </tr><form>
    <tr bgcolor=#$tcolor1>
    <td width=50% align=center>
      <font size=$fsize face=$fface color=$fcolor>
      Display
      <select style=\"font-family: Arial; font-size: 10pt\" onChange=\"if(this.options[this.selectedIndex].value!=0) self.location=this.options[this.selectedIndex].value\">
~;

#========================================
# Entry Number Menu
#----------------------------------------
# The drop down menu which control how many
# entries to be displayed per page.
# and If the option is using already, set
# it as selected.
#========================================

if ($display eq 5) {
  print "<option selected value=E-Guest_show.cgi?display=$start&sort=$sort&entry=5&search=$search>5";
} else {
  print "<option value=E-Guest_show.cgi?display=$start&sort=$sort&entry=5&search=$search>5";
}

if ($display eq 10) {
  print "<option selected value=E-Guest_show.cgi?display=$start&sort=$sort&entry=10&search=$search>10";
} else {
  print "<option value=E-Guest_show.cgi?display=$start&sort=$sort&entry=10&search=$search>10";
}

if ($display eq 15) {
  print "<option selected value=E-Guest_show.cgi?display=$start&sort=$sort&entry=15&search=$search>15";
} else {
  print "<option value=E-Guest_show.cgi?display=$start&sort=$sort&entry=15&search=$search>15";
}

if ($display eq 20) {
  print "<option selected value=E-Guest_show.cgi?display=$start&sort=$sort&entry=20&search=$search>20";
} else {
  print "<option value=E-Guest_show.cgi?display=$start&sort=$sort&entry=20&search=$search>20";
}

print qq~

    </select>
    per page
  </td></form><form>
  <td width=50% align=center>
    <font size=$fsize face=$fface color=$fcolor>
    Sort by
    <select style=\"font-family: Arial; font-size: 10pt\" onChange=\"if(this.options[this.selectedIndex].value!=0) self.location=this.options[this.selectedIndex].value\">
~;

#========================================
# Sort List Menu
#----------------------------------------
# The drop down menu which control how
# to sort the entries. Like LIFO, LILO
# or in alphabetical.
# and If the option is using already, set
# it as selected.
#========================================

if ($sort eq lifo) {
  print "<option selected value=E-Guest_show.cgi?display=$start&sort=lifo&entry=$display&search=$search>Last entry first";
} else {
  print "<option value=E-Guest_show.cgi?display=$start&sort=lifo&entry=$display&search=$search>Last entry first";
}

if ($sort eq lilo) {
  print "<option selected value=E-Guest_show.cgi?display=$start&sort=lilo&entry=$display&search=$search>First entry first";
} else {
  print "<option value=E-Guest_show.cgi?display=$start&sort=lilo&entry=$display&search=$search>First entry first";
}

if ($sort eq name) {
  print "<option selected value=E-Guest_show.cgi?display=$start&sort=name&entry=$display&search=$search>Name alphabetically";
} else {
  print "<option value=E-Guest_show.cgi?display=$start&sort=name&entry=$display&search=$search>Name alphabetically";
}

print "</select></td></form></tr><tr></tr><tr></tr>";

#========================================
# Format and Display Entries
#----------------------------------------
# With a FOR loop and condition, display
# the corresponding entries.
# Becos not all fields are required,
# Set if field value is here, display the
# corresponding code.
#========================================

$match = $start;
$matchcount = 0;

for($i = $start; $match < $stop && $i < $LineCount; $i++) {

$newdata = $datass[$i];
($name,$email,$UIN,$url,$place,$comment,$date) = split(/\|\|/,$newdata);

  if ($name =~ /$search/i) {
    $match++;
    $lastmatch = $i;
    $matchcount++;
    print "<tr bgcolor=#$tcolor1><td colspan=2>" if ($name);
    print "<font size=$fsize face=$fface color=$fcolor>" if ($name);
    print "<font color=#$alink><b>$name</b></font> <a href=\"mailto:$email\"><img src=http://denniz.dyns.net:8080/images/email.gif border=0></a>\n" if ($name);
    print " <a href=\"$url\" target=\"_blank\"><img src=http://denniz.dyns.net:8080/images/home.gif border=0></a>\n" if($url);
    print " <a href=http://wwp.icq.com/scripts/search.dll?to=$UIN><img src=http://denniz.dyns.net:8080/images/icq.gif border=0></a>\n" if($UIN);
    print "<br>$place\n" if($place);
    print "<br>$comment\n" if($comment);
    print "<br>Date: $date\n" if ($name);
    print "</td></tr>" if ($name);
  }
}

#========================================
# No Matching Entry
#----------------------------------------
# If no matching entry is found in
# database, then display a message about
# it.
#========================================

if ($matchcount == 0) {

  print qq~
    <tr bgcolor=#$tcolor1><td colspan=2 align=center>
    <font size=$fsize face=$fface color=$fcolor>
    No matching entry found!
    </td></tr>
  ~;

}

#========================================
# Check for Next Matches
#----------------------------------------
# With a FOR loop, check if there are
# more matching entries.
# If yes, we'll display a NEXT link for
# going to the next page.
#========================================

$morematch = 0;
$findstart = $lastmatch + 1;

for($i = $findstart; $i < $LineCount; $i++) {
  $newdata = $datass[$i];
  ($name,$email,$UIN,$url,$place,$comment,$date) = split(/\|\|/,$newdata);

  if ($name =~ /$search/i) {
    $morematch++;
  }

}

#========================================
# Check for Prev Matches
#----------------------------------------
# With a FOR loop, check back the index
# number for the last page.
# Becos, number of entry to display and
# the search condition can be changed
# anytime, so we have to check the index
# number for the PREV link.
#========================================

$prevmatch = 0;
$prevstart = $start - 1;

for($i = $prevstart; $i >= 0 && $prevmatch < $display; $i--) {
  $newdata = $datass[$i];
  ($name,$email,$UIN,$url,$place,$comment,$date) = split(/\|\|/,$newdata);

  if ($name =~ /$search/i) {
    $prevmatch++;
    $previndex = $i;
  }

}

#========================================
# Display Next and Prev Links
#----------------------------------------
# After the checking, then we can decide
# if it'll display a NEXT and PREV links
# for going to the next or prev page.
#========================================

print "<tr></tr><tr></tr><tr>";
print "<td bgcolor=#$tcolor1 align=center><b><font size=$fsize face=$fface color=$fcolor><a href=\"E-Guest_show.cgi?display=$previndex&sort=$sort&entry=$display&search=$search\">Prev $display</a></td>" if ($start > 0 && $prevmatch > 0);
print "<td bgcolor=#$tcolor1 align=center><b><font size=$fsize face=$fface color=$fcolor><a href=\"E-Guest_show.cgi?display=$findstart&sort=$sort&entry=$display&search=$search\">Next $display</a></td>" if ($morematch > 0);

#========================================
# Print Page Footer & Demo ADV
#----------------------------------------
# This is the coding for the page footer.
# And there is a place for you to place your own ADV,
# change the ADV coding to anything you want.
#========================================

print "</tr></table>";

print qq~

<p><table width=$twidth bgcolor=#$tcolor2 align=$talign cellpadding=$tpadding cellspacing=$tspacing border=$tborder bordercolor=#$tbcolor>
  <tr bgcolor=#$tcolor1 align=center>
    <td align=center>
      <font face=$fface color=$fcolor size=$fsize><b>Learn more about Perl</b></font>
      <br>
<A HREF="http://www.amazon.com/exec/obidos/ASIN/0596000278/leungericcom-20" target=_blank>
<IMG SRC="http://leungeric.com/eric/book/0596000278.01.TZZZZZZZ.jpg" border="0" alt="cover" hspace="3" vspace="3"></A>

<A HREF="http://www.amazon.com/exec/obidos/ASIN/0201615711/leungericcom-20" target=_blank>
<IMG SRC="http://leungeric.com/eric/book/0201615711.01.TZZZZZZZ.jpg" border="0" alt="cover" hspace="3" vspace="3"></A>

<A HREF="http://www.amazon.com/exec/obidos/ASIN/020135358X/leungericcom-20" target=_blank>
<IMG SRC="http://leungeric.com/eric/book/020135358X.01.TZZZZZZZ.gif" border="0" alt="cover" hspace="3" vspace="3"></A>

<A HREF="http://www.amazon.com/exec/obidos/ASIN/0966942604/leungericcom-20" target=_blank>
<IMG SRC="http://leungeric.com/eric/book/0966942604.01.TZZZZZZZ.jpg" border="0" alt="cover" hspace="3" vspace="3"></A>

<A HREF="http://www.amazon.com/exec/obidos/ASIN/0201700549/leungericcom-20"  target=_blank>
<IMG SRC="http://leungeric.com/eric/book/0201700549.01.TZZZZZZZ.jpg" border="0" alt="cover" hspace="3" vspace="3"></A>

<A HREF="http://www.amazon.com/exec/obidos/ASIN/0764507761/leungericcom-20"  target=_blank>
<IMG SRC="http://leungeric.com/eric/book/0764507761.01.TZZZZZZZ.jpg" border="0" alt="cover" hspace="3" vspace="3"></A>

    </td>
  </tr>
</table>

~;


print "</body></html>";

#========================================
# End of File
#========================================

and
E-Guest_db.txt:
-----------------
a plain empty text file.

The problem is that nothing is written in
the E-Guest_db.txt file, even if the scripts
seem to work...until you click on the link
"View Guestbook".

The url is:
http://denniz.dyns.net:8080/cgi-bin/E-Guest_sign.cgi






 

by: maneshrPosted on 2001-12-30 at 10:29:53ID: 6701482

peterx,

Thanks for posting both the files & the URL.

"..I have checked all the paths, and everything works ok till the E-Guest_show.cgi,.."

Does E-Guest_sign.cgi work fine? I can see a very big mistake in the code.

This mistake is also repeated in E-Guest_show.cgi & might be the cause of your error.

Here is what i would like to know.

When a user enters his/her full name & other details, where is that information stored?
Is it stored in a text file? Is the name of that text file E-Guest_db.txt?

Do you have that text file on your server? Can you confirm the presence of that file?

Please let me know.

 

by: peterxPosted on 2001-12-30 at 10:39:55ID: 6701495

maneshr,

the file E-Guest_db.txt is also in the cgi-bin folder,
and as I have understood, that should be the file
where the visitors details are saved.

 

by: maneshrPosted on 2001-12-30 at 10:45:01ID: 6701503

maneshr,

"..the file E-Guest_db.txt is also in the cgi-bin folder,
                     and as I have understood, that should be the file
                     where the visitors details are saved. .."

Excellent!! Your understanding is correct.

Now can you try this?

* Make a backup of E-Guest_db.txt
* Create an empty file called E-Guest_db.txt (i.e. delete all lines in the original file, after making the backup)
* Go to the URL that you have posted above, & enter some dummy information.
* Click on the "Sign Guestbook" button.
* Verify if your information has been stored inside E-Guest_db.txt.

Let me know how this test goes.

 

by: peterxPosted on 2001-12-30 at 10:56:51ID: 6701520

No, nothing was stored in the E-Guest_db.txt file,
its still completely empty.

 

by: maneshrPosted on 2001-12-30 at 11:19:08ID: 6701548

peterx,

"..No, nothing was stored in the E-Guest_db.txt file, its still completely empty. ."

Exactly as i expected!! This is the error that i was referring to earlier.

No matter what info you submit, nothing will ever be written to that text file.

To fix this error, you need to REPLACE...

$data = 'http://denniz.dyns.net:8080/cgi-bin/E-Guest_db.txt';    # path for data file

WITH...

$data = '/placeholder_root_directory/placeholder_sub_directory/cgi-bin/E-Guest_db.txt';    # path for data file

NOTE: You CANNOT use a URL as a parameter to the open() function.
You must use an absolute or relative directory path.

Pl. relaplace the placeholders that i have put above with the actual & exact directory path as it exists on your server.

Let me know what happens after you have made this change.

 

by: peterxPosted on 2001-12-30 at 12:19:14ID: 6701621

I had tried to use the absolute path before...
Tried it now again, but when using it, after pressing "Sign the Guestbook", the browser doesnt even show the message:
"The following is what you submitted.
You can follow the above link to view the guestbook entries." and then my entry under it.
When using the relative path:
$data = '/cgi-bin/E-Guest_db.txt';    # path for data file
the window updates, but there is still nothing written in the E-Guest_db.txt file...

 

by: maneshrPosted on 2001-12-30 at 12:57:07ID: 6701660

peterx,

"..$data = '/cgi-bin/E-Guest_db.txt';  ..."

The above is not relative path, but absolute path.

Do you have telnet access to this server? Is it possible for you to temporarily provide me with access to this server? That way i can get the full path, add it to the script & also fix your original problem. Right now we are fixing a problem which had not mentioned earlier, but which will affect the original problem.

If you can provide me with that access, pl. post your email id here & i will reply back.

Let me know.

 

by: peterxPosted on 2001-12-30 at 13:16:24ID: 6701682

:-) tried
"..$data = 'cgi-bin/E-Guest_db.txt';  ..." too.
My e-mail is:
taichip@chello.se

 

by: maneshrPosted on 2001-12-30 at 13:27:25ID: 6701695

peterx ,

"..My e-mail is:
                     taichip@chello.se .."

I have emailed you. Please reply with the appropriate details.

 

by: maneshrPosted on 2001-12-30 at 16:13:02ID: 6701806

peterx,

"...$data = 'cgi-bin/E-Guest_db.txt';  ..." too...."

In E-Guest_sign.cgi, i would suggest you REPLACE...

$data = 'http://denniz.dyns.net:8080/cgi-bin/E-Guest_db.txt';    # path for data file

WITH...

$data='F:/Savant/Root/cgi-bin/E-Guest_db.txt';

Pl. make this change & let me know what happens next.

 

by: peterxPosted on 2001-12-30 at 16:45:19ID: 6701830

When I use:
$data='F:/Savant/Root/cgi-bin/E-Guest_db.txt';
the browser doesnt even show the message:
"The following is what you submitted."
after pressing "Sign the Guestbook".

If I use:
$data='/cgi-bin/E-Guest_db.txt';
the windows gets updated and shows the text:
"The following is what you submitted."
and my entry below it,
but the E-Guest_db.txt doesnt get updated,
its empty.

 

by: maneshrPosted on 2001-12-30 at 16:54:39ID: 6701835

peterx,

"..When I use:
                     $data='F:/Savant/Root/cgi-bin/E-Guest_db.txt';
                     the browser doesnt even show the message:
                     "The following is what you submitted."..."


Hmmm!!

Change E-Guest_sign.cgi: as follows.

REPLACE....

$data = 'http://denniz.dyns.net:8080/cgi-bin/E-Guest_db.txt';    # path for data file

WITH...

$|++;

print "Content-type: text/html\n\n";


Also, REPLACE...

open(datas,">>$data");

WITH..

open(datas,">>$data") || die $!

Let me know what happens after you make this change.
$data='F:/Savant/Root/cgi-bin/E-Guest_db.txt';

 

by: peterxPosted on 2001-12-31 at 02:51:36ID: 6702167

Manesh,
after I made the changes I get only:
"Cannot find server"
when trying to access the page.

 

by: peterxPosted on 2001-12-31 at 03:12:42ID: 6702184

Thanks Manesh for your help,
but I give up with this script,
found another one, and it worked right away.

Regards
peterX
Happy New Year!!!!

 

by: maneshrPosted on 2001-12-31 at 09:01:30ID: 6702623

peterx,

"..Thanks Manesh for your help,
                     but I give up with this script,
                     found another one, and it worked right away..."

You're welcome. I have mixed emotions about this question. on the one hand i am happy that you got the solution & found my suggestions useful. On the other hand i am disappointed that i could not provide you with the solution.

Here is what i would suggest for the future. In case you find the solution on your own please delete the question & do not award the points to any user. That way you will free up your points.

Wish you a very Happy & safe new Year

Looking forward to providing you with solutions in the future.

Rgds.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...