in reply to Re: Testing numeric strings
in thread Testing numeric strings
#!/usr/bin/perl ############################ # Get data from GET & POST # ############################ &parse_form; ################ # VARS defined # ################ $theDate = localtime; ################################## # Random numbers to be generated # ################################## my $range = 200; my $minimum = 1000000000; my $jobNum = int(rand($range)) + $minimum; #NEED CODE HERE TO DO SOME CHECKING AGAINST aj.db (Active Jobs) ################################## # Print out the page for editing # ################################## print "Content-type: text/html\n\n"; print " <html> <head><title>PC Job Tracker - Add Job [$input{'database'}]</title> </head> <body bgcolor='#b39f75'> <form action='editjob.cgi' method='GET'> <input type='hidden' name='action' value='add'> <input type='hidden' name='database' value='$input{'database'}'> <font face='verdana' color='#m3t789' size='2'> <h1><u>PC Job Tracker | Add PC Job</u></h1> <table> <tr><td><font size='4'>Job #:</font></td><td><input type='text' name=' +njob' value='$jobNum'></td> </tr> </table> <br> <h2><u>Client Data</u></h2> <table> <tr><td><font size='4'>First Name:</font></td><td><input type='text' n +ame='fname'></td><td> </td><td><font size='4'>Last N +ame:</td></font><td><input type='text' name='lname'></td><td> &n +bsp; </td><td><font size='4'>Phone Number:</font></td><td><input + type='text' name='nphone'></td> </tr> </table> <br> <font face='verdana' size='3' color='#m3t789'> <h2><u>Computer Info</u></h2> <table> <tr><td><font size='4' color='black'>Machine:</font></td> <td> <select name='nmachine'> <option value='none'>------------------------- <option value='homebrew'>Home Built <option value='acer'>Acer <option value='apple'>Apple <option value='compaq'>Compaq <option value='dell'>Dell <option value='emachine'>eMachine <option value='gateway'>Gateway <option value='hp'>HP <option value='ibm'>IBM <option value='lenovo'>Lenovo <option value='pb'>Packard Bell <option value='toshiba'>Toshiba </select> </td> <td> </td> <td> </td> <td><font face='verdana' size='4'>Date of Arrival: <input type='text' +name='ndoa' value='$theDate'></td> </table> <br> <font face='verdana' size='5'><u><b>Comments</b></u></font> <br> <textarea name='nnotes' wrap='physical' rows='6' cols='50'> </textarea> <table> <tr> <td> <input type='submit' value='Submit'> </form> </td> <td> </td> <td> <form action='main_view.cgi' method='GET'> <input type='submit' value='Cancel'> </form> </td> </tr> </table> </font> </body> </html> "; ######################################## # Code to get the data from GET & POST # ######################################## sub parse_form { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); if (length($buffer) < 5) { $buffer = $ENV{QUERY_STRING}; } @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; $input{$name} = $value; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Testing numeric strings
by Anonymous Monk on Jul 20, 2011 at 23:03 UTC |