Jump to content

Need help adding CAPTCHA


codeboy89

Recommended Posts

I am very new to PHP and having trouble understanding how to add this simple CAPTCHA to my script. I have had great help on this forum and am looking for someone nice enough to take a few minutes to check out this CAPTCHA ( http://www.gerd-tentler.de/tools/seccode/ ) and show me how to add it to my script (message page and the action page:

 

message page:

 

<?php

 

// Get the file

$file = implode('', file ("post.xml"));

 

print "

<form action=post.php method=post>

<input type=hidden name=post value=yes>

<p>

Your Name<br>

<input type=text name=name size=30>

</p>

<p>

Message<br>

<textarea name=message rows=5 cols=50></textarea>

</p>

<p>

<input type=submit value=\"Post\">

<input type=reset value=Reset>

</p>

</form>";

 

?>

 

action page:

 

<?php

 

$name=$_POST['name'];

$message=$_POST['message'];

 

// Name and Message required

if (( $name == "") || ( $message == "")) {

print "<p align=center>Please go back to complete all fields!<p>";

}

else {

 

//Get the file

$file_name = "post.xml";

$file_pointer = fopen($file_name, "r+");

$lock = flock($file_pointer, LOCK_EX);

$file_read = fread($file_pointer, filesize($file_name));

 

//$name = strip_tags($name, '');

//$message = strip_tags($message, '');

 

$date = date ("j M Y");

$post = "\n\n<ponmurt>\n<p><span class=name>$name</span><span class=date> $date</span><br>$message</p>\n</ponmurt>";

 

//Paste the updated info into the file

$post = stripslashes($post);

fwrite($file_pointer, "$post");

fclose($file_pointer);

 

print "<head><meta http-equiv=refresh content=0;URL=index.php></head>";

}

 

?>

Link to comment
https://forums.phpfreaks.com/topic/181042-need-help-adding-captcha/
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.