Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Form Mail

Status
Not open for further replies.

Andy252

Programmer
Sep 24, 2001
2
0
0
GB
I have installed a free for all links page into my website. It works like a general form mail script. The problem is that people are putting html into the text input boxes and messing up my pages with large text and images.

I would like to add a command like below that when someone tries to use html, the script stops it and uses &htmlerror;
This &htmlerror; will be simple html page to say that its not allowed.

I want a script that'll detect the use of < and, or >, then is does then &htmlerror; This script is used for detecting empty boxes on submittion. I would like someone to help me edit it so it'll look for < and, or >

if ($FORM{'url'} eq &quot;&quot; || $FORM{'title'} eq &quot;&quot; || $FORM{'description'} eq &quot;&quot;) {
&adderror;
exit;

thank you for your help.

andy
 
I think all you have to parse out of their submissions is the </ since that is the tag delimiter.

So...

while (<>)
{
if (/\</)
{&htmlerror}
}

I am new to CGI but that has worked for me in the past. Since HTML tags don't work without the pair of them all you need to do is parse out the end tag.
 
Sorry I was doing something else while I was reading your post. That code is for parsing html doc's. You can use the same code but simply do a match for the < and > respectively.

Reagrds
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top