Notre Posted August 27, 2007 Share Posted August 27, 2007 Well, I have my form... Which uses this php code. // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=contact_error.php\">"; exit; } // prepare email body text $Body = ""; $Body .= "REMOTE_ADDR: "; $Body .= $REMOTE_ADDR; $Body .= "\n"; $Body .= "Username: "; $Body .= $Username; $Body .= "\n"; $Body .= "EmailAddress: "; $Body .= $EmailAddress; $Body .= "\n"; $Body .= "gender: "; $Body .= $gender; $Body .= "\n"; $Body .= "browser1: "; $Body .= $browser1; $Body .= "\n"; $Body .= "browser2: "; $Body .= $browser2; $Body .= "\n"; $Body .= "browser3: "; $Body .= $browser3; $Body .= "\n"; $Body .= "position: "; $Body .= $position; $Body .= "\n"; $Body .= "summary: "; $Body .= $summary; $Body .= "\n"; // validation if (!empty($Username) && !empty($EmailAddress) && !empty($summary))// etc. { //send mail $success = mail($EmailTo, $Subject, $Body, "From: <" . $EmailFrom . ">"); print "<meta http-equiv=\"refresh\" content=\"0;URL=http://notre.pakman20.com/index.php\">"; exit; } else { print "<meta http-equiv=\"refresh\" content=\"0;URL=contact_error.php\">"; exit; } ?> } ?> I would like to add this code too it, but whenever I do it doesn't work. <?php session_start(); if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) { // Insert you code for processing the form here, e.g emailing the submission, entering it into a database. unset($_SESSION['security_code']); } else { // Insert your code for showing an error message here } ?> If someone could tell me how to add it that would be great. Link to captcha. Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 27, 2007 Share Posted August 27, 2007 This should be in third party scripts. But does your form page have a session_start()? A captcha like that will probably need it. Quote Link to comment Share on other sites More sharing options...
Notre Posted August 27, 2007 Author Share Posted August 27, 2007 Nope, Do you think you could help me? Dynamic images don't work with my website. :S If only I could get it to work... Here's my form page. http://notre.pakman20.com/contact.php Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 27, 2007 Share Posted August 27, 2007 Your reply made no sense. If your no was to my first comment, yes, it should. If it was to my question, then add it to your page. If your host allows PHP, then you can have dynamic images generated by PHP. The code you posted does not show anything about the image anyway. Quote Link to comment Share on other sites More sharing options...
Notre Posted August 27, 2007 Author Share Posted August 27, 2007 No, I don't have that, and I don't know how to add it. Do you want me to add it to my php, or my form? and Yes, I can use php. Quote Link to comment Share on other sites More sharing options...
Notre Posted August 27, 2007 Author Share Posted August 27, 2007 I got the dynamic image working, all I need now is to make the php security so they can't get by if the correct number aren't entered. (Trust me i know nothing about php.) Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 27, 2007 Share Posted August 27, 2007 Best time to learn, eh. Quote Link to comment Share on other sites More sharing options...
Notre Posted August 27, 2007 Author Share Posted August 27, 2007 Well, Someone tried combining my php with the php that the installation site told me to add to it, but that didn't work. Can you take a look at his code to see if he did it correctly? <?php // get posted data into local variables $EmailFrom = "notredame000@gmail.com"; $EmailTo = "notredame000@gmail.com"; $Subject = "Contact Form Submission"; $Username = Trim(stripslashes($_POST['user'])); $EmailAddress = Trim(stripslashes($_POST['addrss'])); $gender = Trim(stripslashes($_POST['gen'])); $browser1 = Trim(stripslashes($_POST['brwsr1'])); $browser2 = Trim(stripslashes($_POST['brwsr2'])); $browser3 = Trim(stripslashes($_POST['brwsr3'])); $position = Trim(stripslashes($_POST['pos'])); $summary = Trim(stripslashes($_POST['sum'])); // validation if(!empty($Username) && !empty($EmailAddress) && !empty($summary) && ($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) { // prepare email body text $Body = " REMOTE_ADDR: {$_SERVER['REMOTE_ADDR']} Username: $Username EmailAddress: $EmailAddress gender: $gender browser1: $browser1 browser2: $browser2 browser3: $browser3 position: $position summary: $summary "; $success = mail($EmailTo, $Subject, $Body, "From: <" . $EmailFrom . ">"); if ($success) { print "<meta http-equiv=\"refresh\" content=\"0;URL=index.php\">"; } else { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.php\">"; } print "<meta http-equiv=\"refresh\" content=\"0;URL=http://notre.pakman20.com/index.php\">"; unset($_SESSION['security_code']); exit; } else { // meta refresh error print "<meta http-equiv=\"refresh\" content=\"0;URL=contact_error.php\">"; exit; } Quote Link to comment Share on other sites More sharing options...
Notre Posted August 27, 2007 Author Share Posted August 27, 2007 Solved, Thanks it works perfectly now. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.