View Single Post
  #4 (permalink)  
Old 08-29-07, 07:39 AM
Boraan's Avatar
Boraan Boraan is offline
Coding Addict
 
Join Date: Jul 2007
Location: Clayton, NC
Posts: 292
Thanks: 0
Thanked 1 Time in 1 Post
untainting is always a great idea... here we go... add this to the cgi file for not just untaint, but format the fields..

Code:
# Untaint/Format email strings
if ($FORM{'femail'} !~ /[\w\-]+\@[\w\-]+\.[\w\-]+/) {
	&dienice("You did not enter a valid email address.");
}

if ($FORM{'semail'} !~ /[\w\-]+\@[\w\-]+\.[\w\-]+/) {
	&dienice("You did not enter a valid email address.");
}

# Untaint text strings
if ($FORM{'fname'} !~ /[a-z0-9][A-Z0-9]/) {
	&dienice("Quit trying to hack my system... PHREAK!");
}

if ($FORM{'sname'} !~ /[a-z0-9][A-Z0-9]/) {
	&dienice("Quit trying to hack my system... PHREAK!");
}
You can also add maxlenth="numerical value" to limit how many characters can be entered into the text fields on the html page.
__________________
Dexter Nelson
Techdex Development & Solutions
========================
Internet Marketing For Programmers | Free Market Research in 15 Minutes or Less
My Software: Hotscripts Softpedia software.techdex.net
Reply With Quote