...

View Full Version : how do i



chaotic
06-24-2002, 02:48 AM
how do i add a image url to a cgi file as when i try i get a http 500 error :(

sir pannels
06-24-2002, 03:30 AM
you need to escape bits of it
so say you got for example
<img src="pics/pic.gif" border="0"> etc you get the idea
you need to escape the "`s so if you had that you`d need to replace it with
<imh src=\"pics/pic.gif\" boder=\"0\">
ok?
sir p

chaotic
06-24-2002, 03:34 AM
thanks dude :thumbsup:

sir pannels
06-24-2002, 03:40 AM
thats alright..anytime.:)

chaotic
06-24-2002, 04:29 AM
i still got the http 500 error :(

sir pannels
06-24-2002, 01:42 PM
ok post the bit of code that is causing the error and i`ll loook at it for ya:)

chaotic
06-24-2002, 03:00 PM
i might have got it wrong but here you go =

Software error:
syntax error at cbsboard.cgi line 62, near "<IMG SRC="http://www.chaoticrealities.com/cbs.gif" ALIGN="TOP" WIDTH="300" HEIGHT="100"><"
Execution of cbsboard.cgi aborted due to compilation errors.

sir pannels
06-24-2002, 03:37 PM
could the post the bit of code right from the code and not from the error?
thanks
sir p

chaotic
06-24-2002, 04:08 PM
well here is all the code i have to date , it works fine when i take the image out :confused:=

#!/usr/bin/perl
###########################################

###################################################

use CGI::Carp qw(fatalsToBrowser);
print "Content-type:text/html\n\n";
print "<html><head><title>CBSForums</title></head>\n\n";
print "<body>\n";
print "<p><H1><center>CBSBoard</center></H1><H4><center>Out of chaos , comes a community...</center></H4></p>\n";
$file = 'data.txt' ; # Name the file
open(INFO, "<$file" ) ; # Open the file
@lines = <INFO> ; # Read it into an array
close(INFO) ; # Close the file
print " <BODY>\n" ;
foreach $line (@lines) # assign @lines to $line, one at a time
{ # braces {} are required, bracket code
print "\n <P> $line </P>" ; # print formatted lines to screen
}
##################################################################################
$correctUsername = "*****";
$correctPassword = "*****";



#################
# Form Data Parsing

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

################
# Comparison

#Use a nested if/else statement like the one below to make debugging
#much easier
if ($FORM{'username'} eq $correctUsername) {
if($FORM{'password'} eq $correctPassword) { print "You've passed the test!\n"; }
else { print "Password Incorrect.\n"; }
}

else { print "Username Incorrect.\n"; }

######################
<P ALIGN="CENTER"><A HREF="http://www.chaoticrealities.com/cgi-bin/cbsboard/cbsboard.cgi"><IMG SRC="http://www.chaoticrealities.com/cbs.gif" ALIGN="TOP" WIDTH="300" HEIGHT="100"></A></P>

sir pannels
06-24-2002, 04:27 PM
yeh you didnt escape it...
change
<P ALIGN="CENTER"><A HREF="http://www.chaoticrealities.com/cgi-bin/cbsboard/cbsboard.cgi"><IMG SRC="http://www.chaoticrealities.com/cbs.gif" ALIGN="TOP" WIDTH="300" HEIGHT="100"></A></P>

to this
<P ALIGN=\"CENTER\"><A HREF=\"http://www.chaoticrealities.com/cgi-bin/cbsboard/cbsboard.cgi\"><IMG SRC=\"http://www.chaoticrealities.com/cbs.gif\" ALIGN=\"TOP\" WIDTH=\"300\" HEIGHT=\"100\"></A></P>
and it will work fine:)
sir p

chaotic
06-24-2002, 04:38 PM
now i get this =

syntax error at cbsboard.cgi line 60, near "center>"
(Might be a runaway multi-line "" string starting on line 56)
Unrecognized character \xA9 at cbsboard.cgi line 60.

would it be easier if i did it in php ?

sir pannels
06-24-2002, 07:24 PM
no,

i see what you done now...your not printing it your just using html...you must print html like this...

print"<P ALIGN=\"CENTER\"><A HREF=\"http://www.chaoticrealities.com/cgi-\n";
etc..make sure every line is inside print" " ;
ok?
sir p

chaotic
06-24-2002, 08:01 PM
so thats the problem i had :( whoops :D
got it working , thanks again dude :thumbsup:

sir pannels
06-24-2002, 09:56 PM
anytime:)

chrisvmarle
06-24-2002, 10:45 PM
I've been wondering what characters to escape...

Can you (SirP) or anyone tell me wich?

The ones I ALWAYS escape:
<
>
&
$
^
\
/
"
'

That's about it...

Mzzl, Chris

Feyd
06-25-2002, 12:00 AM
Unless it is a small bit of code, don't waste your time escaping...use qq instead:



print qq~
This is text<br>that does not need escaping, even if it is "quoted" or &quot;quoted&quot; or <quote>quote</quote><br><br>even email@resses~;


Note that it begins with print qq~ and ends with ~;, and will save you huge amounts of time when dealing with exceedingly large amounts of content.

chaotic
06-25-2002, 12:20 AM
is there a list of all the tags or what ever their called please ?

chaotic
06-25-2002, 12:57 AM
what do i need to put to make tables in the cgi file i am writing ?:confused:

sir pannels
06-25-2002, 11:28 AM
welll if your writing to a txt or html file just use html to make it the <table> and <tr> etc

chaotic
06-26-2002, 12:24 AM
so i put it like this ? =

<table border=1 width=100% cellspacing=1 bgcolor="#cdcdcd">
<tr>

</tr>
</table>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum