Heya. A small release here from me. Hope you'll enjoy it.
It sure isn't advanced, but it full fills my needs perfectly. There's probably some dumb shit in it, fix it. This is programmed by me, that means no super-duper awesome code, it just works.
PS. It's made with the $_POST['name'] right now, it can easily be changed to GET or w/e you'd need. Hint: find & replace is awesome.
PSS. ERROR AND NOTICE PROOF :]. That means isset() etc is used when needed.
Pretty basic user input (forms) validation, it supports "Normal" forms (a-aA-A0-9), "Email" forms (Basically pretty good pattern for email. I haven't found any holes yet. No, no \n at the end), "Integer" and "String" should be pretty obvious.
If it finds any errors, it defines them. More to this:
If an user fails to enter the (example only) email and username form
correctly (they are named reg_username and reg_email in this example), it will add this to the $error (a & between each) variable. I.e
®_username®_email
(Why the &? GET redirect support!) It then defines the $error variable (containing all the names of the faulty entered forms) to the x928 constant. (Easy changeable as well.)
Then, you can use the defined() function to check if it's defined (user failed?), and then do a redirect back to the form if it is.
* (which should react if GET is on the form names - I have not implemented this, up to youi.e "You entered the username form incorrectly!" next to it, or just make it red. You get it.) . I.e
* register.php?step=2®_username=1®_email=1 (Do a shortcut on this, long names are ugly. Or why not POST?)
NOTES: Normal must be 3 <= characters and mail musat not be < 6 characters, it will fail the check otherwise.
Change this if it doesn't fit you.
This is obviously perfect for a user registration, and such. Why not for your personal forum? (You'd probably make your own, but at least you get some inspiration.)
Example usage files are included.
DOWNLOAD:
http://www.djs-gaming.com/priv/ValidateKit.zip
PSSS. Yes, it DOES support arrays.
There's no limit, and it's actually built for arrays.PHP Code:
$normal = array('form1', 'form2', 'form3', 'form4');
Form::Validate($normal);
~DJS-CMS