Jump to content

simple request form script


325252525252

Recommended Posts

Hello fellow Commanders i have a question i'm crap with php but made this request form and i have a question why the hell it still would let to send empty messages? im trying to avoid flood so I added request but even if request form completely blank it still succeeds ;( can someone explain me please thank you so much btw form itself is in html website

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email
  $email = $_REQUEST['email'];
  $phone = $_REQUEST['phone'];
  $message = $_REQUEST['message'];
  $name = $_REQUEST['name'];
  $headers = "\r Name: $name \r\n";
  $headers .= "Email: $email \r\n";
  $headers .= "Telephone: $phone \r\n";
  $headers .= "Message: $message \r\n";
  $today = date("j, n, Y");
  mail( '[email protected]', "Request from xxxx.co.uk", 'IP: '.$_SERVER['REMOTE_ADDR'] .$headers. 'Date: '.$today);
  header('Refresh: 0; URL=http://xxxx.co.uk/contacts/success.htm');
  }
else
//if "email" is not filled out, print error
  {
 print( 'error fuck off');
}
?>

Link to comment
https://forums.phpfreaks.com/topic/279638-simple-request-form-script/
Share on other sites

so that's what we have so far and it works perfect! but it will only requires for message how can i add email name and phone to be required as well? i tried all my known ways didn't work

 

<?php
if (!empty($_REQUEST['message'])) {
  $email = $_REQUEST['email'];
  $phone = $_REQUEST['phone'];
  $message = $_REQUEST['message'];
  $name = $_REQUEST['name'];
  $headers = "\r Name: $name \r\n";
  $headers .= "Email: $email \r\n";
  $headers .= "Telephone: $phone \r\n";
  $headers .= "Message: $message \r\n";
  $today = date("j, n, Y");
  mail( '[email protected]', "Request from axxxl.co.uk", 'IP: '.$_SERVER['REMOTE_ADDR'] .$headers. 'Date: '.$today);
  header('Refresh: 0; URL=http://xxx.uk/contacts/success.htm');
  } else {
   header("HTTP/1.1 404 Not Found");
   die('Please fill in all required fields.'); }
?>

 

one last thing I added this anti-flood thing 'enter 4 digits code' but I can't come up with the php script for it could you help? shouldn't be hard for you. I tried something like this but didn't work lol btw 7D6Z is the only code image i have so its not random. its 7D6Z everytime lol

if (!empty($_REQUEST['password']))

http://imageshack.us/photo/my-images/853/cnso.jpg/

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.