Jump to content

Remote form file submitting


PyraX

Recommended Posts

Probably some bugs in their but its a start...

 

<?php
session_start();
$md5 = md5(microtime() * mktime());
$string = substr($md5,0,5);
?> 
<form action="check.php" method="post">
<input name="code" type="text" />
<img src="captcha.php" />
</form>

 

 

 

captcha.php (the imagefile)

<?php
$captcha = imagecreatefrompng("./captcha.png");
$black = imagecolorallocate($captcha, 0, 0, 0);
$line = imagecolorallocate($captcha,233,239,239);
imageline($captcha,0,0,39,29,$line);
imageline($captcha,40,0,64,29,$line);
imagestring($captcha, 5, 20, 10, $string, $black);
$_SESSION['key'] = md5($string);
header("Content-type: image/png");
imagepng($captcha);
?> 

 

 

check.php

<?php
session_start();
if(md5($_POST['code']) != $_SESSION['key'])
{
  die("Error: You must enter the code correctly");
}else{
  echo 'You entered the code correctly';
}
?> 

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.