FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Help with User Form Validation





smartbei
I am having some issues with validating data from user inputs. The main problem is the if a user posts
Code:
<script>[Whatever]</script>
The result is:
Quote:
500 Internal Server Error

Quote:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

No matter what I do. Any ideas?

I am also looking for a function that returns true or false depending on whether the user has any 'bad' characters for the database to handle or that may create problems later. Characters such as: " ' ; ) ( [ ] } { + * & $ % # ^and characters in languages besides english.
DanielXP
This is the Bad characters thing

Code:
        }
        if(strstr($HTTP_POST_VARS['FIELD NAME'],"BAD CHARACTER")) {
            echo "ERROR MESSAGE TO SHOW";
            exit;
        }
smartbei
This I can do, and it works but it is messy if you have many different characters. I would like it done with a regular expression, with the preg_match function or something of the sort.
DanielXP
Eg.

Code:
        }
        if(strstr($HTTP_POST_VARS['name'],"#")) {
            echo "Your name must not contain #";
            exit;
        }
        if(strstr($HTTP_POST_VARS['age'],"@")) {
            echo "Your age must not contain @";
            exit;
        }


Hope this helped

Ps. you can have as many as you need for this

Or maybe you could put the validation on a different page eg validation.php and then just inclused it?



mathiaus wrote:
Please do not double post. Use the edit button!
Related topics
check box validation
How did you come up with your username?
Form validation
Java tutorials
A very good PHP MySQL Tutorial
Please Help? CGI form mail on my site... only 2 questions!
mysql querries and subquerries problem..
Form validation, seperate file, or same as form?
help getting form info into mysql db
please please beta test it (PHP coders)
How to get keyboard cursor position i a field....
Where to Put Validation and Update Logic? PHP or MySQL
Simple Form Validation [solved]
Need Help-- Order Form in Flash
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.