Portal Home > Knowledgebase > Articles Database > PHP Contact US script fail?
PHP Contact US script fail?
Posted by SpaciousHost, 07-11-2009, 08:56 AM |
Hi all. Got a problem on my mail contact us script.
http://spacioushost.com/cliff/?p=reserve
The problem is if you submit the form without entering any info, it gives you an error but screws up that entire site. *see for yourself.
Thats the file any ideas?
|
Posted by Matt R, 07-11-2009, 10:42 AM |
There are a lot of problems with the way that form is written which make it highly prone to multiple forms of attack.
The issue that's causing our issue, though, is the "die();" commands issued within the script. Simple error handling methods would be much better in this case.
Running DIE will terminate the processing of the rest of the file, including any and all HTML following the PHP script as the PHP processor will ultimately "give up" on the rest and spit out what it has prepared for you already.
Feel free to get in touch with me for some help if you'd like, although I do tend to sleep during the day so tonight would be the best time to contact me.
Matt
|
Posted by KreativJustin, 07-12-2009, 06:20 PM |
I agree with HostTDS, for many reasons, this script needs to be re-evaluated before even attempting to fix it.
You are very prone to attacks, so that would be defenitly something I would implement before continueing.
The 'error' system is a bit off, I always prefer to use custom built erroring systems.
To top it off, you should turn this into a class (or you can get away with a function.)
|
Posted by SpaciousHost, 07-13-2009, 02:56 AM |
Hi, anyone got a fully working script that I could have?
Cheers
|
Posted by reKo, 07-16-2009, 11:55 PM |
form.php
send.php
|
Posted by PeakVPN-KH, 07-17-2009, 01:32 AM |
Much better but still open to possible bot attack.
|
Posted by SpaciousHost, 07-17-2009, 02:15 AM |
Nice been fiddling with it for a while doesn't seem to email the Day and Month. It sends everything else example:
First Name: Tarleton
Last Name: Dewe
Email Address: ******@hotmail.com //edited out.
Telephone Number: 97222749
Date of Reservation: / / 2011
Time of Reservation: 7:0 pm
Number of People: 345
Special Requests:
IP: 58.164.102.36
|
Posted by SpaciousHost, 07-17-2009, 03:51 AM |
Manged to get date working i changed variables incorrectly but Month ain't working.
|
Posted by reKo, 07-22-2009, 08:51 PM |
It is, however you can't complain about something free. Besides, where's the fun in not doing your own customizations?
That could work.
|
Posted by okhud, 07-23-2009, 03:36 PM |
Free or not, its still prone to attacks.
http://www.thewebhelp.com/php/php_co...ge_validation/
Has Captcha, doesn't have exactly what you need, but I think you have the experience to modify it and add the fields you need.
http://www.addressmunger.com/contact_form_generator/
The above has a little bit more customization, but still no date.
|
Add to Favourites Print this Article
Also Read