homepage Welcome to WebmasterWorld Guest from 54.205.189.156
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Confirmation Page Will Not Show
Form works, but it will not go to Confirmation page
Preeminent




msg:3706824
 12:04 am on Jul 25, 2008 (gmt 0)

Hey all,
I found an open source contact form and it works great, except for the confirmation page. I just get the page not found error. In the config file, there is a spot to edit where customers are taken to, once the email is sent. I did that, but it does not work for some reason. By the code below, can anyone see the problem? First the actual form file and then the config file:
?>
<!-- if you want to use basic JavaScript validation, keep the JS file call below -->
<script src="../../../Local Settings/Temporary Internet Files/Content.IE5/5OVJDRVA/validation.js"></script>
<script>
// SPECIFY ALL REQUIRED FIELDS AND
// SEE validation.js for other options
required.add('fullname', 'NOT_EMPTY');
required.add('email', 'EMAIL');
required.add('comments', 'NOT_EMPTY');
required.add('answer_out', 'NUMERIC');
</script>
<link rel="stylesheet" type="text/css" href="../../../Local Settings/Temporary Internet Files/Content.IE5/5OVJDRVA/form_style.css" />

<style type="text/css">
<!--
.style1 {color: #FF0000}
.style2 {color: #707073}
.style3 {color: #6B6B6F}
.style4 {color: #6B6B70}
-->
</style>
<title>::: "" :::</title><center><form name="fcform2" method="post" action="../../../Local Settings/Temporary Internet Files/Content.IE5/5OVJDRVA/process_form.php" onsubmit="return validate.check()">
<div id="fcf2">
<h3 align="center">Contact Us Form</h3>
<p>All fields marked with <em>*</em> are required.</p>

<div class="r">
<label for="fullname" class="req">Full Name: <em>*</em></label>
<span class="f">
<input type="text" name="fullname" size="40" id="fullname" onBlur="trim('fullname')">
</span>
</div>

<div class="r">
<label for="email" class="req">Email Address: <em>*</em></label>
<span class="f">
<input type="text" name="email" size="40" id="email" onBlur="trim('email')">
</span>
</div>

<div class="r">
<label for="phone">Telephone: </label>
<span class="f">
<input type="text" name="phone" size="40" id="phone" onBlur="trim('phone')">
</span>
</div>

<div class="r">
<label for="comments" class="req">Comments: <em>*</em></label>
<span class="f">
<textarea cols="30" rows="8" name="comments" id="comments" onBlur="trim('comments')"></textarea>
</span>
</div>

<!-- the section below MUST remain for the magic to work -->
<!-- although feel free to change the style / layout -->
<div class="r">
<label for="quest" class="req"><?php echo $question; ?> <em>*</em></label>
<span class="f">
<input type="text" name="answer_out" size="6" id="answer_out" onBlur="trim('answer_out')"> &nbsp;

</span>
</div>
<!-- section above must remain -->

<div class="sp">&nbsp;</div>

<?php
if(isset($_GET['done'])) {
echo '<div align="center" style="color:red;font-weight:bold">'.$confirmation_message.'</div><br />';
}
?>
<p align="center">
<input type="submit" value="Submit">
<br />
</p>
</div>

<!-- the 2 hidden fields below must REMAIN for the magic to work -->
<input type="hidden" name="answer_p" value="<?php echo $answer_pass; ?>">
<input type="hidden" name="enc" value="<?php echo $enc; ?>">
<!-- above 2 hidden fields MUST remain -->

</form>
--------------------------------------------------------------------

// script name of your contact form
$form_page_name = "Contact Us Now";

/* where to send emails to */
$email_it_to = "";

// email subject line
$email_subject = "Contact Us Form";

// email subject line - used on suspected form hack attempts
// for example, if someone enters HTML or scripts into the form - it will be removed
// if you choose to receive these cleaned up emails, you can set the subject line
// this lets you filter them out in your email client or mail server
$email_suspected_spam = "*SUSPECT Contact Us Form";

// do you wish to receive emails which had HTML or SCRIPTS (code will be stripped)?
$accept_suspected_hack = "no"; // change to "no" to silently reject

// success page - the page the user gets when the form is successful
$success_page = "http://www.**snipped**.html";
// OR
// if you prefer to have the user sent back to the contact form (with a confirmation message shown)
$send_back_to_form = "no"; // change to "no" to redirect to above $success_page

// failure page - can be html or php (use php if you want to show actual error message, see next declaration)
$failure_page = "form_error.php";

// do you want to receive an error messaage passed into your failure page
$failure_accept_message = "yes";

// if $send_back_to_form is set to "yes", set your confirmation message bellow
$confirmation_message = "Thank you, we have received your message and will be in touch if required.";

/* your secret unique code used as part of our encryption */
// please edit the values within the double quotes.
// only use a-zA-Z0-9, other characters have been found to cause problems
// keep the string length to 3,6,9 or 12 characters long
$mkMine = "D9ot4yUjgEr3";

/* ONLY EDIT BELOW HERE IF YOU HAVE SOME PHP/PROGRAMMING EXPERIENCE */

if(phpversion() < "5.1") {
// date setting should be fine
} else {
// feel free to edit the value as desired
date_default_timezone_set('UTC');
}

/* your unique question and answer section */

// if you want to keep the default random maths questions
// just leave the next few lines as they are.
$rnumA = rand(0,49);
$rnumB = rand(0,49);

// if you want to create your own custom question and answer
// edit the two lines below.
$question = "$rnumA plus $rnumB?";
$answer = $rnumA+$rnumB;

class encdec {
// __construct
function encdec() {
$this->cseta = $this->charset_a();
$this->csetb = $this->charset_b();
}
// public
function encrypt($s) {
$s = str_replace(" ", "", $s);
$s = base64_encode(trim($s));
$a = $this->charset_a();
$b = $this->charset_b();
$len = strlen($s);
$new = "";
for($i=0; $i < $len; $i++){
$new .= $b[array_search($s[$i],$a)];
}
return $new;
}
// public
function decrypt($s) {
$a = $this->charset_a();
$b = $this->charset_b();
$len = strlen($s);
$new = "";
for($i=0; $i < $len; $i++){
$new .= $a[array_search($s[$i],$b)];
}
return trim(base64_decode($new));
}
// protected
function charset_a() {
return array("a","b","c","j","7","8","9","A","B",
"G","H","o","p","q","r","s","t","u","h","i","Q",
"R","S","C","k","l","m","n","6","T","D","E","F",
"U","V","W","X","Y","Z","v","w","x","y","z","0",
"1","2","3","4","5","I","J","K","L","M","N","O",
"P","d","e","f","g","=","*");
}
// protected
function charset_b() {
return array("G","H","o","p","z","q","r","s","t",
"1","2","3","4","5","I","J","K","L","M","N","O",
"u","h","i","Q","R","S","C","k","l","m","n","6",
"0","P","d","e","f","g","T","D","E","F","a","b",
"c","j","7","8","9","A","B","U","V","W","X","Y",
"Z","v","w","x","y","*","=");
}
}
/*
// PHP 5 version - comment out the above class and use this one if you have PHP 5

class encdec {

private $cseta;
private $csetb;

function __construct() {
$this->cseta = $this->charset_a();
$this->csetb = $this->charset_b();
}

public function encrypt($s) {
$s = str_replace(" ", "", $s);
$s = base64_encode(trim($s));
$a = $this->cseta;
$b = $this->csetb;
$len = strlen($s);
$new = "";
for($i=0; $i < $len; $i++){
$new .= $b[array_search($s[$i],$a)];
}
return $new;
}

public function decrypt($s) {
$a = $this->cseta;
$b = $this->csetb;
$len = strlen($s);
$new = "";
for($i=0; $i < $len; $i++){
$new .= $a[array_search($s[$i],$b)];
}
return trim(base64_decode($new));
}

protected function charset_a() {
return array("a","b","c","j","7","8","9","A","B",
"G","H","o","p","q","r","s","t","u","h","i","Q",
"R","S","C","k","l","m","n","6","T","D","E","F",
"U","V","W","X","Y","Z","v","w","x","y","z","0",
"1","2","3","4","5","I","J","K","L","M","N","O",
"P","d","e","f","g","=","*");
}

protected function charset_b() {
return array("G","H","o","p","z","q","r","s","t",
"1","2","3","4","5","I","J","K","L","M","N","O",
"u","h","i","Q","R","S","C","k","l","m","n","6",
"0","P","d","e","f","g","T","D","E","F","a","b",
"c","j","7","8","9","A","B","U","V","W","X","Y",
"Z","v","w","x","y","*","=");
}
}

*/
$e = new encdec;

// pass the answer into the function below
$answer_pass = $e->encrypt($answer);

$mkNow = date("YmdHi");
$enc = $e->encrypt($mkNow)."::".$e->encrypt($mkMine);

function valEncStr($s,$m) {
$sides = explode("::", $s);
$f = new encdec;
$sides[0] = $f->decrypt($sides[0]);
$sides[1] = $f->decrypt($sides[1]);
if(!count($sides) == 2) {
$error = "String invalid!";
}

// compare date/time
$plTime = date("YmdHi",mktime(date("H"),date("i")+60));
$msTime = date("YmdHi",mktime(date("H"),date("i")-60));

if($sides[0] > $plTime ¦¦ $sides[0] < $msTime) {
$error = "Date not valid!";
}

// compare custom word
if(!$m == $sides[1]) {
$error = "words do not match!";
}

if(isset($error)) {
return $error;
} else {
return true;
}

}

?>

 

MattAU




msg:3707091
 9:13 am on Jul 25, 2008 (gmt 0)

The problem is that the PHP file does nothing with the $success_page variable... I'd say you're missing some of the file (accidental deletion?) or there's another file that the script needs to work.

Preeminent




msg:3707923
 2:57 am on Jul 26, 2008 (gmt 0)

ehhhh crap! Ok, thanks for the reply MattAu! I will go back to the original source and look it over again.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved