472,982 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,982 software developers and data experts.

Where's the problem with this code?

Hey, I've been having some trouble debuggin this...I keep getting 500
errors. Would some kind soul be willing to help me?

#!/usr/bin/local/perl

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

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;
}

if ($FORM{'subitted'} eq 'yes' )
showstats();
else
{
print <<EndOfHTML;
<html><head><title>Test Page</title></head>
<body>
<h2>Select User</h2>
<form action='./logger.cgi' method=post>
<input type=hidden name=submitted value='yes'>
<select name='userid'>

EndOfHTML

opendir(DIR, ".");
@files = readdir(DIR);
closedir(DIR);

foreach $file (@files)
{
if ($file ne "." && $file ne ".." && $file ne "logger.cgi")
{
print "<option value=";
print $file;
print ">";
print $file;
print "</option>\n";
}
}

print "</select><br><input type=submit></form>";

}

sub showstats()
{
%datahash = {};
@timeofday[96];
foreach $entry(@timeofday)
$entry=0;
@tempbuffer;
open(INFILE,$FORM{'userid'});
@data = <INFILE>
foreach $line (@data)
{
@tempbuffer = split(/=/, $line)
$datahash{@tempbuffer[0]}=@tempbuffer[1];
if ($datahash{@tempbuffer[0]}==1)
{
$numberofdays = @tempbuffer[0] % (24 * 60 * 60);
$tod = @tempbuffer[0] - $numberofdays * 24 * 60 *
60;
@timeofday[$tod/(24*4)]++;
}
}


print "<html><head></head><body>\n";
foreach $entry(@timeofday)
{
print "<img src=http://www.shehan.ws/images/red.gif width=4
height=";
print $entry;
print ">\n";
}
}
Jul 19 '05 #1
4 1632
On Sun, 21 Mar 2004 at 01:15 GMT, Sam Snead <sa******@sammy.com> wrote:
Hey, I've been having some trouble debuggin this...I keep getting 500
errors. Would some kind soul be willing to help me?

#!/usr/bin/local/perl
use strict;
use warnings;

print "Content-type: text/html\n\n"; <some code snipped> else
{

print <<EndOfHTML;
<html><head><title>Test Page</title></head>
<body>
<h2>Select User</h2>
<form action='./logger.cgi' method=post>
<input type=hidden name=submitted value='yes'>
<select name='userid'>

EndOfHTML

.. . . . ^^^^^^^^^
Hey! this is not what you said that your here document would end
with. Either move this marker to the left, or change your print
statement as follows:

print <<' EndOfHTML';

I guess that this will cure most of your problems...
Jul 19 '05 #2
In article <sl**********************@195-86-124-242.dsl.easynet.nl>,
ro*******@st2x.net says...
On Sun, 21 Mar 2004 at 01:15 GMT, Sam Snead <sa******@sammy.com> wrote:
Hey, I've been having some trouble debuggin this...I keep getting 500
errors. Would some kind soul be willing to help me?

#!/usr/bin/local/perl


use strict;
use warnings;

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

<some code snipped>
else
{

print <<EndOfHTML;
<html><head><title>Test Page</title></head>
<body>
<h2>Select User</h2>
<form action='./logger.cgi' method=post>
<input type=hidden name=submitted value='yes'>
<select name='userid'>

EndOfHTML

. . . . ^^^^^^^^^
Hey! this is not what you said that your here document would end
with. Either move this marker to the left, or change your print
statement as follows:

print <<' EndOfHTML';

I guess that this will cure most of your problems...

Oh, thank you very much!

Jul 19 '05 #3

"Sam Snead" <sa******@sammy.com> :
Hey, I've been having some trouble debuggin this...I keep getting 500
errors. Would some kind soul be willing to help me? ... if ($FORM{'subitted'} eq 'yes' )
showstats();
else
{


must be:

if ($FORM{'subitted'} eq 'yes' )
{
showstats();
}
else
{

--
Grygory Tertychny
Jul 19 '05 #4
In article <c3**********@news.kiev.sovam.com>, mi***@svitonline.com
says...

"Sam Snead" <sa******@sammy.com> :
Hey, I've been having some trouble debuggin this...I keep getting 500
errors. Would some kind soul be willing to help me?

...
if ($FORM{'subitted'} eq 'yes' )
showstats();
else
{


must be:

if ($FORM{'subitted'} eq 'yes' )
{
showstats();
}
else
{

Thanks, I thought that it would work like C where you don't need braces
for one line, but I was wrong.

Trey
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: ian justice | last post by:
Before i post actual code, as i need a speedyish reply. Can i first ask if anyone knows off the top of their head, if there is a likely obvious cause to the following problem. For the moment i've...
2
by: BoB Teijema | last post by:
Hi all, One of our companies is having problems with a query on a linked server. They have two servers, serverA and serverB. On serverA they have set up a linked server to serverB. Query:...
16
by: Dixie | last post by:
I have a problem using Dev Ashish's excellent module to concatenate the results of a field from several records into one record. I am using the code to concatenate certain awards onto a...
10
by: Ray Stevens | last post by:
I am attempting to test a VeriSign account and the setup instructions stated that the certs file needed to go into the Windows\System32 folder. I am getting an error from the code-behind assebly...
0
NeoPa
by: NeoPa | last post by:
Background Whenever code is used there must be a way to differentiate the actual code (which should be interpreted directly) with literal strings which should be interpreted as data. Numbers don't...
7
by: Swinky | last post by:
Mr. Browne's copy code on his web site has saved me. I have been struggling to copy a record with several related sub-form tables. I found code on his web site that copies a sub-form table,...
40
by: Spiros Bousbouras | last post by:
Do you have an example of an implementation where sizeof(short int) does not divide sizeof(int) or sizeof(int) does not divide sizeof(long int) or sizeof(long int) does not divide sizeof(long long...
7
by: Chris | last post by:
Hello all... I have a program with the following structure (all classes mentioned are of my own creation, and none of the classes contain try or catch blocks): - main() consists of a large...
41
by: Miroslaw Makowiecki | last post by:
Where can I download Comeau compiler as a trial version? Thanks in advice.
0
by: ssmeshack | last post by:
Hai all, I have problem here. Im using VWD with C#. Database Sql Server 2005. I have done auto rotation for staffname where autorotation = 1. It was no problem until I add a new user with...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.