Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/66808-solved-php-captcha-image-help/
Share on other sites

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.

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;
} 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.