Jump to content

Spam preventing request data form help


Relevancy

Recommended Posts

Hello all.  I am not a php programmer at all, but I need to find a simple solution to the forms I use.  They are all way to easy to get crawled by spammers. 

 

First problem is my email address is in the form code. How do I hide it? 

 

Second how do I do a verification code?

 

Thrid: How do I require all fields to be filled in?

 

I need something easy.

 

This is the way I have it now... very basic send data php script

http://www.onlinecomputertips.com/

 

PHP Script:

<?php

 

$contents = $HTTP_SERVER_VARS['REMOTE_ADDR'] . " just entered this data into the form: " . $HTTP_POST_VARS['pageName'] . "\n\n";

 

//get the contents of the form from a post

while(list($key, $value) = each($HTTP_POST_VARS))

{

 

if($key == "sendto"){

$sendto = $value;

}

elseif($key == "redirectpage"){

$redirectpage = $value;

}

elseif($key == "subject"){

$subject = $value;

}

else

{

$contents .= "$key \t = \t $value \n";

}

}

 

//get the contents of a form from a get

while(list($key, $value) = each($HTTP_GET_VARS))

{

if($key == "sendto"){

$sendto = $value;

}

elseif($key == "redirectpage"){

$redirectpage = $value;

}

elseif($key == "subject"){

$subject = $value;

}

else

{

$contents .= "$key \t = \t $value \n";

}

 

}

 

//attach footer message

 

$from_header = "From: Online Computer Tips";

 

if($contents != "")

{

  //send mail - $subject & $contents come from surfer input

  mail($sendto, $subject, $contents, $from_header);

  // redirect back to url visitor came from

  header("Location: $redirectpage");

}

  else

{

  print($contents);

  print("<HTML><BODY>Error, no data was submitted!");

  print("</BODY></HTML>");

}

 

?>

Link to comment
https://forums.phpfreaks.com/topic/39049-spam-preventing-request-data-form-help/
Share on other sites

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.