Контактна форма

STaNiMiR

Registered
Имам проблем с контактна форма която използвам.

ето го кода това е индеха
Код:
<?php
if($_POST['sendmail'])
{
// load the variables form address bar
$subject = $_REQUEST["subject"];
$message = $_REQUEST["message"];
$from = $_REQUEST["from"];
$verif_box = $_REQUEST["verif_box"];

// remove the backslashes that normally appears when entering " or '
$message = stripslashes($message);
$subject = stripslashes($subject);
$from = stripslashes($from);

// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
// if verification code was correct send the message and show this page
mail("ultrablue_bs@abv.bg", 'Online Form: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$message, "From: $from");
// delete the cookie so it cannot sent again by refreshing this page
setcookie('tntcon','');
} else {
// if verification code was incorrect then return to contact page and show error
header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&wrong_code=true");
exit;
}
}
?>
<script type="text/JavaScript">

</script>



<form action="<?php print $_SELF; ?>" method="post" onsubmit="MM_validateForm('from','','RisEmail','subject','','R','verif_box','','R','message','','R');return document.MM_returnValue">

Your e-mail: <input name="from" type="text" value="<?php echo $_GET['from'];?>"/>
<br />
Subject: <input name="subject" type="text" value="<?php echo $_GET['subject'];?>"/>
<br />
Type verification image:<br />
<input name="verif_box" type="text" size = "4"/>
<img src="<?php echo $comp_dir?>contactform/verificationimage.php?<?php echo rand(0,9999);?>" alt="verification image, type it in the box" width="50" height="24" align="bottom" /><br />
<br />


<?php if(isset($_GET['wrong_code'])){?>
<div >Wrong verification code</div><br />
<?php ;}?>

Message:<br />
<textarea name="message" cols="20" rows="5" id="message"><?php echo $_GET['message'];?></textarea>
<input name="sendmail" type="submit" value="Send Message"/>
</form>

а това е verificationimage.php
Код:
<?php
header('Content-type: image/jpeg');

$width = 50;
$height = 24;

$my_image = imagecreatetruecolor($width, $height);

imagefill($my_image, 0, 0, 0xFFFFFF);

// add noise
for ($c = 0; $c < 40; $c++){
	$x = rand(0,$width-1);
	$y = rand(0,$height-1);
	imagesetpixel($my_image, $x, $y, 0x000000);
	}

$x = rand(1,10);
$y = rand(1,10);

$rand_string = rand(1000,9999);
imagestring($my_image, 5, $x, $y, $rand_string, 0x000000);


setcookie('tntcon',(md5($rand_string).'a4xn'));

imagejpeg($my_image);
imagedestroy($my_image);
?>

аз разбрах какъе проблема не може да се създаде бисквитката
setcookie('tntcon',(md5($rand_string).'a4xn'));
когато двата файла са сложени поддиректория
 

Back
Горе