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( 'xxx@gmail.com', "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
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( 'roxxx@gmail.com', "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.'); }
?>

 

Edited by 325252525252
Link to comment
Share on other sites

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/

Edited by 325252525252
Link to comment
Share on other sites

 

I don't know what you called your 4 digit code, but assuming its 'code' then try this:

if(count(array_filter($_REQUEST)) == count($_REQUEST) && strtoupper($_REQUEST['code']) == '7D6Z') {

 

guess what it works dam you good. :pirate:

Edited by 325252525252
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.