This is a simple assignment to set up link tags for 5 English words: Hello, Good-bye, Love, Cat, and Dog. Each href are completed by linking to the Spanish.pl file and passing the Spanish equivalents for each word: Hola, Adios, Amor, Gato, and Perro.
The following is the code from spanish.html:
<p><a href="cgi-bin/spanish.pl?english=Hello&spanish=Hola">Hello</a></p>
<p><a href="cgi-bin/spanish.pl?english=Good-bye&spanish=Adios">Good-bye</a></p>
<p><a href="cgi-bin/spanish.pl?english=Love&spanish=Amor">Love</a></p>
<p><a href="cgi-bin/spanish.pl?english=Cat&spanish=Gato">Cat</a></p>
<p><a href="cgi-bin/spanish.pl?english=Dog&spanish=Perro">Dog</a></p>
This is from spanish.pl:
print "The Spanish word for ", param('english'), " is ", param('spanish') "\n";
I’m not very familiar with Perl yet, but I’m not sure what to do. When you click on the link for the english word it just downloads the perl file. How do I get it to just display the spanish word in the browser?
Also, should it be simple or similar when doing the same exact assignment but in ASP and PHP? I’m not sure what they should look like…
I have this in my php file, but not sure if this is correct:
The Spanish word for <?php echo $_POST["english"]; ?> is <?php echo $_POST["spanish"]; ?>.
I just need help fixing my code and understanding how to get this to display properly.
Thank you.
Validate. Validate. Validate. That should be
&If that is being output into an HTML document, then you have an XSS problem.
You need to:
Once configured, ASP and PHP make some assumptions about what you want to do (such as “You want to output an HTML document”) that you don’t get from writing CGI from scratch (where you have to explicitly send Content-Type headers, for instance).
Links make GET requests, not POST requests.