Randomly generate a list of letters and numbers. For an example, have a look at
http://www.icthus.net/CGI-City/tut_random2.shtml. You can modify it like this:
@array = (0..9,a..z,A..Z);
srand;
foreach (1..5)
{
$rand = int(rand scalar(@array));
push (@selected, $rand);
}
I suppose you already have the necessary alphanumeric set of image files. Just use the @selected array to incorporate the images to your document, like this:
for ($i; $i<5; $i++)
{
print "<img src='image_dir/$selected[$i].jpg' border=0>";
}
Then make a variable out of @selected to check it once the form has been submitted:
$check_var = "@selected";
Pass it on to the cgi script that will do the checking and you're done.
I hope this helps as the only thing I've been doing around here is ask questions. ;-)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.