Jump to content

kcelsi

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by kcelsi

  1. I'm afraid that my desired answer to you is not appropriate to post in a forum so I'll offer the subdued version. Why don't you stick to writing your own code and stay out of volunteer jobs designed to help people. You are obviously not cut out for it and your pompous attitude could use some checking. I'm sorry I wasted so many minutes of my day even discussing this with you.
  2. Isn't that what you are supposed to do? Help beginners with php? All I want to do is find out how to validate a phone number in a certain format. After all of this, you still haven't suggested to me one line of code that could accomplish that. Why are you judging the method that I use to learn? If someone else writes good code, why can't I use it for my own projects? How can I start to write my own code, if I don't learn from seeing other examples first?
  3. I understand about good posting and I only want to put up what is useful. The problem with learning programming is that there's so much code whether in the head, body, external files, etc that I have a hard time figuring out what is relevant. If you had instructed me about which part I should have used, then in future posts I would have known what to do. There's a big learning curve here. In my opinion, you should have taken a little extra time to read the code I posted this time, answered my question with some suggested solutions and then stated that in future posts, I should try not to put in things that are not necessary if possible. It just would have been a nice courtesy. Sorry, I'm just frustrated that I haven't figured this out yet.
  4. I have found a beginner php forum that will answer my questions without getting annoyed. Sorry to have bothered you.
  5. It's difficult for me to dig out exactly which parts need to be changed, but I'm guessing that I have to modify one of these to pertain to phone instead of email...and maybe set a $phone variable??? function validate_email_address($email = FALSE) { return (preg_match('/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i', $email))? TRUE : FALSE; ) function remove_email_injection($field = FALSE) { return (str_ireplace(array("\r", "\n", "%0a", "%0d", "Content-Type:", "bcc:","to:","cc:"), '', $field)); }
  6. One more question about this... How can I edit this code so that the phone number field will only be validated if it is in the form of "000-000-0000"? <?php // Set email variables $email_to = 'kcelsi@littlechisel.com'; $email_subject = 'Form submission'; // Set required fields $required_fields = array('fullname','phone','email','comment'); // set error messages $error_messages = array( 'fullname' => 'Please enter a Name to proceed.', 'phone' => 'Please enter a Phone Number to proceed.', 'email' => 'Please enter a valid Email Address to continue.', 'comment' => 'Please enter your Message to continue.' ); // Set form status $form_complete = FALSE; // configure validation array $validation = array(); // check form submittal if(!empty($_POST)) { // Sanitise POST array foreach($_POST as $key => $value) $_POST[$key] = remove_email_injection(trim($value)); // Loop into required fields and make sure they match our needs foreach($required_fields as $field) { // the field has been submitted? if(!array_key_exists($field, $_POST)) array_push($validation, $field); // check there is information in the field? if($_POST[$field] == '') array_push($validation, $field); // validate the email address supplied if($field == 'email') if(!validate_email_address($_POST[$field])) array_push($validation, $field); } // basic validation result if(count($validation) == 0) { // Prepare our content string $email_content = 'New Website Comment: ' . "\n\n"; // simple email content foreach($_POST as $key => $value) { if($key != 'submit') $email_content .= $key . ': ' . $value . "\n"; } // if validation passed ok then send the email mail($email_to, $email_subject, $email_content); // Update form switch $form_complete = TRUE; } } function validate_email_address($email = FALSE) { return (preg_match('/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i', $email))? TRUE : FALSE; } function remove_email_injection($field = FALSE) { return (str_ireplace(array("\r", "\n", "%0a", "%0d", "Content-Type:", "bcc:","to:","cc:"), '', $field)); } ?>
  7. I figured out the problem. There was an external php include that I forgot to update. The field is validating fine now. Thanks for your help and patience.
  8. I need to have the field display an error if the field is not filled out. If you go to the link I included, you will see that if you hit Send Message without filling in the form, the name, email and message fields will display the error, but not the phone field. Please be patient with me. I really need to learn this.
  9. Yes, I've looked at the code thoroughly and I'm trying to decipher it. I thought this part did the validation: if (phone.get('value').length === 0) { isValid = false; addError(phone, phoneError); } else { isValid = true; removeError(phone); }
  10. Sorry, I'm new to php and am learning as I go. Can you tell me exactly which part you need? I'm not sure what "attempt at validation" means.
  11. Hello, I'm creating a form using code I obtained from an online tutorial. It works perfectly and validates as it should. I would like to add a "phone" field which would also need validation. So far I have not been able to get the field to validate. What am I missing?? I've included the parts of the php that I changed and also attached my javascript validation file as a text file. Here is a link to the page the form is on: http://www.idealwindow.com/Contact_Marketing.php Thanks for any help you can offer. In the head tag: <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.0/mootools-yui-compressed.js"></script> <script type="text/javascript" src="js/validation.js"></script> <script type="text/javascript"> var nameError = '<?php echo $error_messages['fullname']; ?>'; var phoneError = '<?php echo $error_messages['phone']; ?>'; var emailError = '<?php echo $error_messages['email']; ?>'; var commentError = '<?php echo $error_messages['comment']; ?>'; function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}} } </script> In the body tag: <div class="row"> <div class="label">Full Name</div><!-- end .label --> <div class="input"> <input type="text" id="fullname" class="detail" name="fullname" value="<?php echo isset($_POST['fullname'])? $_POST['fullname'] : ''; ?>" /><?php if(in_array('fullname', $validation)): ?><span class="error"><?php echo $error_messages['fullname']; ?></span><?php endif; ?> </div><!-- end .input --> <div class="context">e.g. John Smith or Jane Doe</div><!-- end .context --> </div><!-- end .row --> <div class="row"> <div class="label">Phone</div><!-- end .label --> <div class="input"> <input type="text" id="phone" class="detail" name="phone" value="<?php echo isset($_POST['phone'])? $_POST['phone'] : ''; ?>" /><?php if(in_array('phone', $validation)): ?><span class="error"><?php echo $error_messages['phone']; ?></span><?php endif; ?> </div><!-- end .input --> <div class="context">e.g. 000-000-0000</div><!-- end .context --> </div><!-- end .row --> validation.txt
  12. Sorry, I have since scrapped this code. I found it from a website tutorial that was outdated and too complicated. I've found an amazing php form tutorial here: http://www.dreamweavertutorial.co.uk/dreamweaver/video/contact-form-php-validation.htm an I'm using that as my base form now. Thanks for your input.
  13. Hello, I obtained this code for a php form including a Captcha that I have modified. My question is, how do I make a field "not required", but if filled out, the entry will also be sent with the form? I'm planning to add fields for fax, address, etc that won't be necessary, but helpful if entered. Thank you. Here is my code: <?php if(isset($_POST['submitted'])) { require_once('captcha/recaptchalib.php'); $privatekey = "6Ldke-wSAAAAAPrYCfs4gR28Y10hEttom0ax-nKD"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if(trim($_POST['checking']) !== '') { $blindError = true; } else { $authorName = (filter_var($_POST['formAuthor'], FILTER_SANITIZE_STRING)); if ($authorName == ""){ $authorError = true; $hasError = true; }else{ $formAuthor = $authorName; }; $authorEmail = (filter_var($_POST['formEmail'], FILTER_SANITIZE_EMAIL)); if (!(filter_var($authorEmail, FILTER_VALIDATE_EMAIL))){ $emailError = true; $hasError = true; } else{ $formEmail = $authorEmail; }; $msgSubject = (filter_var($_POST['formSubject'], FILTER_SANITIZE_STRING)); if ($msgSubject == ""){ $subjectError = true; $hasError = true; }else{ $formSubject = $msgSubject; }; //Check to make sure content has been entered $msgContent = (filter_var($_POST['formContent'], FILTER_SANITIZE_STRING)); if ($msgContent == ""){ $commentError = true; $hasError = true; }else{ $formContent = $msgContent; }; if (($resp->is_valid) && (!isset($hasError))) { $emailTo = 'kcelsi@littlechisel.com'; // here you must enter the email address you want the email sent to $subject = 'Marketing Inquiry From: ' . $formAuthor . ' | ' . $formSubject; // This is how the subject of the email will look like $body = "Email: $formEmail \n\nContent: $formContent \n\n$formAuthor"; // This is the body of the email $headers = 'From: <'.$formEmail.'>' . "\r\n" . 'Reply-To: ' . $formEmail . "\r\n" . 'Return-Path: ' . $formEmail; // Email headers mail($emailTo, $subject, $body, $headers); $emailSent = true; } if (!($resp->is_valid)){ $captchaErrorMsg = true; } } } ?> <?php // if the page the variable "email sent" is set to true show confirmation instead of the form ?> <?php if(isset($emailSent) && $emailSent == true) { ?> <style type="text/css"> #wrapper { width: 960px; margin-right: auto; margin-left: auto; } #content { font-family: Verdana, Geneva, sans-serif; text-align: center; } .thankyou { font-size: 24px; font-weight: bold; } .text { margin-top: -5px; padding-top: 0px; font-size: 16px; } a { color: #900; text-decoration: none; font-size: 14px; } </style> </head> <body> <div id="wrapper"> <div id="content"> <p class="thankyou">Thank You</p> <p class="text">Your form has been submitted and someone from Ideal Window will contact you shortly.</p> <a href="http://www.idealwindow.com/">Back to Ideal Window Home Page</a> </div> </div> <?php } else { ?> <?php // if there are errors in the form show a message ?> <?php if(isset($hasError) || isset($blindError)) { ?> <p>There was an error submitting the form. Please check all the marked fields.</p> <?php } ?> <?php // if there are recaptcha errors show a message ?> <?php if ($captchaErrorMsg){ ?> <p>Captcha error. Please, type the check-words again.</p> <?php } ?> <?php ?> <script type="text/javascript"> var RecaptchaOptions = { theme : 'clean' }; </script> <?php ?> <form id="contactForm" action="" method="post"> <div id="singleParagraphInputs"> <div> <label for="formAuthor"> Full Name </label> <input class="requiredField <?php if($authorError) { echo 'formError'; } ?>" type="text" name="formAuthor" id="formAuthor" value="<?php if(isset($_POST['formAuthor'])) echo $_POST['formAuthor'];?>" size="40" /> </div> <div> <label for="formEmail"> Email </label> <input class="requiredField <?php if($emailError) { echo 'formError'; } ?>" type="text" name="formEmail" id="formEmail" value="<?php if(isset($_POST['formEmail'])) echo $_POST['formEmail'];?>" size="40" /> </div> <div> <label for="formSubject"> Subject </label> <input class="requiredField <?php if($subjectError) { echo 'formError'; } ?>" type="text" name="formSubject" id="formSubject" value="<?php if(isset($_POST['formSubject'])) echo $_POST['formSubject'];?>" size="40" /> </div> </div> <div id="commentTxt"> <label for="formContent"> Message </label> <textarea class="requiredField <?php if($commentError) { echo 'formError'; } ?>" id="formContent" name="formContent" cols="40" rows="5"><?php if(isset($_POST['formContent'])) { if(function_exists('stripslashes')) { echo stripslashes($_POST['formContent']); } else { echo $_POST['formContent']; } } ?></textarea> <?php ?> <div id="screenReader"> <label for="checking"> If you want to submit this form, do not enter anything in this field </label> <input type="text" name="checking" id="checking" value="<?php if(isset($_POST['checking'])) echo $_POST['checking'];?>" /> </div> </div> <?php require_once('captcha/recaptchalib.php'); $publickey = "6Ldke-wSAAAAAE7yRt4cUb3G6hYU__6JIwsc6lwL"; echo recaptcha_get_html($publickey); ?> <input type="hidden" name="submitted" id="submitted" value="true" /> <?php // submit button ?> <input type="submit" value="Send Message" tabindex="5" id="submit" name="submit"> </form> <?php } // yay! that's all folks! ?> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.js"> </script> <script src="js/custom.js" type="text/javascript"> </script> CSS: body{ font: 14px/1.5em sans-serif; margin: 0; padding: 0; } label { display: block; padding: 1px 7px 0; position: absolute; top: 0; z-index: 1; } input[type=text], textarea { display: block; background: none; font: inherit; padding: 0 7px; position: relative; z-index: 10; overflow: auto; } label, input[type=text], #singleParagraphInputs div{ line-height: 1.5em; height: 1.5em; } #singleParagraphInputs div, #commentTxt, #recaptcha_widget_div{ margin-bottom: 1.5em; } input, textarea, #recaptcha_table{ border: 1px solid #ccc; } .formError { border: 1px solid red; } #contactForm, #recaptcha_table{ width: 600px; margin: 0 auto; margin-top: 50px; } #singleParagraphInputs div, #commentTxt { position: relative; } #singleParagraphInputs input { width: 584px; /* 16px less than form width } #commentTxt textarea { min-height: 9em; min-width: 584px; /* 16px less than form width font: 14px/1.5em sans-seif; } #screenReader, #checking { float: left; display: none; } #recaptcha_response_field { width: 286px !important; } input[type=submit]{ } javascript: $(function(){ $formItems = $("input:text, textarea"); $formItems // fires after the page has loaded // if the field has already some value the label becomes invisible .each(function(){ if ($(this).val() !== '') { $(this).prev().css({ opacity: '0' }); }; }) .focus(function(){ if ($(this).val() == '') { $(this).prev().stop().animate({ opacity: '0' }, 200); } }) .blur(function(){ if ($(this).val() == '') { $(this).prev().stop().animate({ opacity: '1' }, 200); } }) });
  14. I found this possible explanation here: http://stackoverflow.com/questions/8028957/headers-already-sent-by-php To understand why headers must be sent before output it's necessary to look at a typical HTTP*response. PHP scripts mainly generate HTML content, but also pass a set of HTTP/CGI headers to the webserver: HTTP/1.1 200 OK Powered-By: PHP/5.3.7 Vary: Accept-Encoding Content-Type: text/html; charset=utf-8 <html><head><title>PHP page output page</title></head> <body><h1>Content</h1> <p>Some more output follows...</p> and <a href="/"> <img src=about:note> ... The page/output always follows the headers. PHP is required to pass the headers to the webserver first. It can only do that once. And after the double linebreak it can't ever append to them again. When PHP receives the first output (print, echo, <html>) it will "flush" the collected headers. Afterwards it can send all the output bits it wants. But sending further headers is impossible from then. How can you find out where the premature output occured?The header() warning contains all relevant information to locate the problem source: Here "line 100" refers to the script where the header() invocation failed. Warning: Cannot modify header information - headers already sent by (output started at/www/usr2345/htdocs/auth.php:52) in /www/usr2345/htdocs/index.php on line 100 The message in the inner parenthesis is more crucial. It mentions auth.php and line 52 as the source of premature output. One of the typical problem causes will be there: Print, echoIntentional output from print and echo statements will terminate the opportunity to send HTTP headers. The application flow must be restructured to avoid that. Use functions and templating schemes. Ensure header() calls occur before messages are written out. Functions that can write output include print, echo, printf, trigger_error, vprintf,ob_flush, var_dump, readfile, passthru among others and user-defined functions. My code: <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="Marketing_Contact" id="Marketing_Contact"> FORM HTML <?php ob_start(); require_once('recaptchalib.php'); // Get a key from http://recaptcha.net/api/getkey $publickey = "6Ldke-wSAAAAAE7yRt4cUb3G6hYU__6JIwsc6lwL"; $privatekey = "6Ldke-wSAAAAAPrYCfs4gR28Y10hEttom0ax-nKD"; # the response from reCAPTCHA $resp = null; # the error code from reCAPTCHA, if any $error = null; # was there a reCAPTCHA response? if ($_POST["recaptcha_response_field"]) { $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if ($resp->is_valid) { $company = $_POST['company']; $fullname = $_POST['fullname']; $address = $_POST['address']; $address2 = $_POST['address2']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $phone = $_POST['phone']; $fax = $_POST['fax']; $email = $_POST['email']; $category = $_POST['category']; $message = $_POST['message']; $subject = "Marketing Inquiry"; $company = stripslashes($company); $fullname = stripslashes($fullname); $address = stripslashes($address); $city = stripslashes($city); $state = stripslashes($state); $zip = stripslashes($zip); $phone = stripslashes($phone); $fax = stripslashes($fax); $email = stripslashes($email); $category = stripslashes($category); $message = stripslashes($message); $subject = stripslashes($subject); $final_message = "You have a marketing inquiry\n\n"; $final_message .= "From: " . $fullname . "\n"; $final_message .= "Address: " . $address . "\n"; $final_message .= "Address 2: " . $address2 . "\n"; $final_message .= "City: " . $city . "\n"; $final_message .= "State: " . $state . "\n"; $final_message .= "Zip Code: " . $zip . "\n"; $final_message .= "Phone: " . $phone . "\n"; $final_message .= "Fax: " . $fax . "\n"; $final_message .= "Email: " . $email . "\n"; $final_message .= "Category: " . $category . "\n"; $final_message .= "Message: " . $message . "\n"; mail("graphics_Beth@idealwindow.com", 'Online Form: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$final_message, "From: ".$fullname); exit(header('location:http://www.idealwindow.com/Thank_You.html')); } else { # set the error code so that we can display it $error = $resp->error; echo $error; } } echo recaptcha_get_html($publickey, $error); ?><input type="submit" name="Submit" id="Submit" /></form> Here is the error message: Warning: Cannot modify header information - headers already sent by (output started at /home/ideal/public_html/Contact_Marketing.php:160) in/home/ideal/public_html/Contact_Marketing.php on line 303 The red highlighted lines are 160 and 303. Can anyone explain how I can modify these lines to prevent the error?
  15. Thank you. This does work, but the issue I have is that it appears at the bottom of the page. So after the form is submitted, the top of the same page shows up and it appears that nothing has happened and you have to scroll down. I like it better when a new page comes up with the message at the top so there's no scrolling necessary to see the result. If anyone knows another way to redirect to a new page, please let me know.
  16. I tried the javascript method, but that also gave me errors. How would I incorporate the html into the php? Can you give an example? Thanks.
  17. Thanks. Now I'm getting this error message after I submit the form: Warning: Cannot modify header information - headers already sent by (output started at /home/ideal/public_html/Contact_Marketing.php:160) in/home/ideal/public_html/Contact_Marketing.php on line 312 <?php require_once('recaptchalib.php'); // Get a key from http://recaptcha.net/api/getkey $publickey = "6Ldke-wSAAAAAE7yRt4cUb3G6hYU__6JIwsc6lwL"; $privatekey = "6Ldke-wSAAAAAPrYCfs4gR28Y10hEttom0ax-nKD"; # the response from reCAPTCHA $resp = null; # the error code from reCAPTCHA, if any $error = null; # was there a reCAPTCHA response? if ($_POST["recaptcha_response_field"]) { $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if ($resp->is_valid) { $company = $_POST['company']; $fullname = $_POST['fullname']; $address = $_POST['address']; $address2 = $_POST['address2']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $phone = $_POST['phone']; $fax = $_POST['fax']; $email = $_POST['email']; $category = $_POST['category']; $message = $_POST['message']; $subject = "Marketing Inquiry"; $company = stripslashes($company); $fullname = stripslashes($fullname); $address = stripslashes($address); $city = stripslashes($city); $state = stripslashes($state); $zip = stripslashes($zip); $phone = stripslashes($phone); $fax = stripslashes($fax); $email = stripslashes($email); $category = stripslashes($category); $message = stripslashes($message); $subject = stripslashes($subject); $final_message = "You have a marketing inquiry\n\n"; $final_message .= "From: " . $fullname . "\n"; $final_message .= "Address: " . $address . "\n"; $final_message .= "Address 2: " . $address2 . "\n"; $final_message .= "City: " . $city . "\n"; $final_message .= "State: " . $state . "\n"; $final_message .= "Zip Code: " . $zip . "\n"; $final_message .= "Phone: " . $phone . "\n"; $final_message .= "Fax: " . $fax . "\n"; $final_message .= "Email: " . $email . "\n"; $final_message .= "Category: " . $category . "\n"; $final_message .= "Message: " . $message . "\n"; mail("graphics_Beth@idealwindow.com", 'Online Form: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$final_message, "From: ".$fullname); exit(header('location:http://www.idealwindow.com/Thank_You.html')); } else { # set the error code so that we can display it $error = $resp->error; echo $error; } } echo recaptcha_get_html($publickey, $error); ?>
  18. I tried this and the page gives me this syntax error: Parse error: syntax error, unexpected ':' in /home/ideal/public_html/Contact_Marketing.php on line 312 <?php require_once('recaptchalib.php'); // Get a key from http://recaptcha.net/api/getkey $publickey = "6Ldke-wSAAAAAE7yRt4cUb3G6hYU__6JIwsc6lwL"; $privatekey = "6Ldke-wSAAAAAPrYCfs4gR28Y10hEttom0ax-nKD"; # the response from reCAPTCHA $resp = null; # the error code from reCAPTCHA, if any $error = null; # was there a reCAPTCHA response? if ($_POST["recaptcha_response_field"]) { $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if ($resp->is_valid) { $company = $_POST['company']; $fullname = $_POST['fullname']; $address = $_POST['address']; $address2 = $_POST['address2']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $phone = $_POST['phone']; $fax = $_POST['fax']; $email = $_POST['email']; $category = $_POST['category']; $message = $_POST['message']; $subject = "Marketing Inquiry"; $company = stripslashes($company); $fullname = stripslashes($fullname); $address = stripslashes($address); $city = stripslashes($city); $state = stripslashes($state); $zip = stripslashes($zip); $phone = stripslashes($phone); $fax = stripslashes($fax); $email = stripslashes($email); $category = stripslashes($category); $message = stripslashes($message); $subject = stripslashes($subject); $final_message = "You have a marketing inquiry\n\n"; $final_message .= "From: " . $fullname . "\n"; $final_message .= "Address: " . $address . "\n"; $final_message .= "Address 2: " . $address2 . "\n"; $final_message .= "City: " . $city . "\n"; $final_message .= "State: " . $state . "\n"; $final_message .= "Zip Code: " . $zip . "\n"; $final_message .= "Phone: " . $phone . "\n"; $final_message .= "Fax: " . $fax . "\n"; $final_message .= "Email: " . $email . "\n"; $final_message .= "Category: " . $category . "\n"; $final_message .= "Message: " . $message . "\n"; mail("graphics_Beth@idealwindow.com", 'Online Form: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$final_message, "From: ".$fullname); exit(header(location:http://www.idealwindow.com/Thank_You.html)); } else { # set the error code so that we can display it $error = $resp->error; echo $error; } } echo recaptcha_get_html($publickey, $error); ?>
  19. Hello, I have some basic php knowledge and have a page set up to use a Captcha in a form. Using this code that I obtained, everything works fine, but after the form is submitted, instead of the page displaying text on the same page that says "Email Sent", I want a new page (which I have already created) to come up that displays a Thank You message. Thanks for any help! Here is the code: <?php require_once('recaptchalib.php'); // Get a key from http://recaptcha.net/api/getkey $publickey = "6Ldke-wSAAAAAE7yRt4cUb3G6hYU__6JIwsc6lwL"; $privatekey = "6Ldke-wSAAAAAPrYCfs4gR28Y10hEttom0ax-nKD"; # the response from reCAPTCHA $resp = null; # the error code from reCAPTCHA, if any $error = null; # was there a reCAPTCHA response? if ($_POST["recaptcha_response_field"]) { $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if ($resp->is_valid) { $company = $_POST['company']; $fullname = $_POST['fullname']; $address = $_POST['address']; $address2 = $_POST['address2']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $phone = $_POST['phone']; $fax = $_POST['fax']; $email = $_POST['email']; $category = $_POST['category']; $message = $_POST['message']; $subject = "Marketing Inquiry"; $company = stripslashes($company); $fullname = stripslashes($fullname); $address = stripslashes($address); $city = stripslashes($city); $state = stripslashes($state); $zip = stripslashes($zip); $phone = stripslashes($phone); $fax = stripslashes($fax); $email = stripslashes($email); $category = stripslashes($category); $message = stripslashes($message); $subject = stripslashes($subject); $final_message = "You have a marketing inquiry\n\n"; $final_message .= "From: " . $fullname . "\n"; $final_message .= "Address: " . $address . "\n"; $final_message .= "Address 2: " . $address2 . "\n"; $final_message .= "City: " . $city . "\n"; $final_message .= "State: " . $state . "\n"; $final_message .= "Zip Code: " . $zip . "\n"; $final_message .= "Phone: " . $phone . "\n"; $final_message .= "Fax: " . $fax . "\n"; $final_message .= "Email: " . $email . "\n"; $final_message .= "Category: " . $category . "\n"; $final_message .= "Message: " . $message . "\n"; mail("email@samplepage.com", 'Online Form: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$final_message, "From: ".$fullname); echo "Email sent"; } else { # set the error code so that we can display it $error = $resp->error; echo $error; } } echo recaptcha_get_html($publickey, $error); ?>
  20. Okay, so I found out the problem, but don't know a fix. Safari by default blocks iframes with different hosts (so, the main frame is newjerseyrates.com but the iframe is http://www.guaranteedrate.com), so safari is blocking the tracking cookies. Now knowing this, does anyone have a workaround that can fix this problem? Should I re-post this as a new discussion? Thanks.
  21. Thank you for the reply. I will try what you suggested. As for my Safari problem, it seems to by a mystery. Do you think it could be an issue with the www.guaranteedrate.com site? Could they somehow be redirecting the page on their end? I tried the Apple Safari forum also, but have not received any responses yet.
  22. I have been working on this and fixed some of the problems. Now I only have two issues. 1. The iframes are changing daily, but not at 12:00 am. It seems that they changed sometime in the middle of the day today. Should this be happening and how could I get them to change at 12 am? 2. I discovered that in the Safari browser only, the iframe source page is not the right one. For example, for the home page, I have www.guaranteedrate.com/loanoptions/vpname/leezacharczyk set to appear, but www.guaranteedrate.com/loanoptions is appearing instead. Must be something with Safari, but is this related to the php code or could it be something else? Thanks again for any help. Kathy
  23. No, I don't have 7 brokers only two. There are 7 pages that each have different iframes to rotate between the two brokers daily. So each of the 7 (NewJerseyRates) pages should have Lee's (Guaranteed Rate) pages one day and all 7 should have Marks (Guaranteed Rate) pages the next day. Sorry so confusing.
  24. Hello, I'm having problems with this again. Here some issues I'm having: 1. I have 7 pages with iframes that are supposed to rotate daily between two web pages from GuaranteedRate.com. They are: http://www.newjerseyrates.com/ http://www.newjerseyrates.com/Buying-a-Home.php http://www.newjerseyrates.com/Refinance.php http://www.newjerseyrates.com/Loan-Options.php http://www.newjerseyrates.com/Mortgage-Rates.php http://www.newjerseyrates.com/Calculators-GuaranteedRate.php http://www.newjerseyrates.com/About-GuaranteedRate.php For some reason, the pages are not changing any more. I know it was working when I first uploaded the site, but now, only one link shows up and it stays on that one all the time. 2. When you type the url directly to go to the home page, a different page comes up than if you click on any link within the site to get to the home page. Entering the site externally will produce a different home page than getting to the home page internally. I only have one index.php file so this is a mystery to me. 3. When I "view source" in the browser, the code that shows up is completely wrong on all the pages. I checked the file manager from my hosting provider and there, the code for each page is correct. The browser view source is showing the old javascript that I replaced with the php. I thought this could be why it's not working, but I have uploaded the pages several times and the browser is still showing the incorrect code. I have tried clearing the browser cache. 4. I did a test and about 30% of the people I tested that go to the home page, have the main site www.guaranteedrate.com show up in the iframe instead of the link I have in the php code. I'm not sure if this is a problem with my code, an issue with the hosting provider or something related to the Guaranteed Rate site on their end. I am in a rush to get all this ironed out because my client is pausing their pay per click campaign until it's resolved. Anyone who could shed light on any of these issues, please let me know. Code samples are below. Thank you. For example, the index.php page should be (this is what shows up in my hosting file manager): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/Main.dwt" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- InstanceBeginEditable name="doctitle" --> <title>New Jersey (NJ) Mortgage Lender, Mortgage Rates, Fha, Refinance & Home Loans</title> <meta name="description" content="Get real time, accurate New Jersey (NJ) mortgage rates, refinancing and home loans." /> <meta name="keywords" content="new jersey, nj, new jersey refinance, new jersey refinancing, FHA mortgage, jumbo mortgage, mortgage interest rate, mortgage, mortgage rates, mortgage broker, refinance, home loan, mortgage company, mortgage lender, mortgage refinancing, new jersey refinancing, home mortgage, mortgage interest rate" /> <meta name="nibbler-site-verification" content="3a321e0559840ef51087c274ba6f8be369e42dbf" /> <link rel="shortcut icon" href="favicon.ico" /> <?php date_default_timezone_set('America/New_York'); $brokers = array ( 'www.guaranteedrate.com/loanoptions/vpname/leezacharczyk', 'www.guaranteedrate.com/loanoptions/vpname/markzacharczyk' ); $numbrokers = count($brokers); $dayofyear = date('z'); $todaysURL = 'http://'.$brokers[$dayofyear%$numbrokers]; ?> <!-- InstanceEndEditable --> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> <link href="css/GRateStyles.css" rel="stylesheet" type="text/css" /> <style> @media print { body { color: #000; background: #fff; } h1, h3 { color: #000; background: none; } #header, #footer, #leftNav, #right { display: none; } @page { margin: 2cm; } img { max-width: 100% !important; } ul, img { page-break-inside: avoid; } a { font-weight: bolder; text-decoration: none; } a[href^=http]:after { content:" <" attr(href) "> "; } } </style> <style type="text/css"> body { background-image: url(images/BkrdTexture.jpg); background-repeat: repeat; } </style> </head> <body> <div id="wrapper"> <div id="header"> <div id="headerBox"> <div id="logo"><a href="index.php"><img src="images/Logo.jpg" width="200" height="129" alt="Logo" /></a> </div> <div id="headerRight"> <div class="headerRightContactText" id="headerRightContact"><a href="contact.html">Contact</a> NewJerseyRates.com</div> <div id="headerRightTagline">Customized, Automated NJ Mortgage Rate Quotes <span class="redText">Accurate and Up-to-the-Minute</span> </div> </div> </div> </div> <div id="navBar"> <ul class="navBar"> <li class="home"><a href="index.php">Home</a></li> <li class="faq"><a href="faq.html">FAQ</a></li> <li class="aboutCredit"><a href="About-Credit.html">About Credit</a></li> <li class="loanProg"><a href="Loan-Programs.html">Loan Programs</a></li> <li class="survey"><a href="Survey.html">Survey</a></li> <li class="homeInspec"><a href="Home-Buyers-Info.html">Home Buyers Info</a></li> <li class="about"><a href="about_us.html">About NewJerseyRates.com</a></li> <li class="partnerLinks"><a href="links.html">Partner Links</a></li> <li class="glossary"><a href="gloss.html">Glossary</a></li> </ul> </div> <div id="content"> <div id="leftNav"> <ul class="leftNav"> <li class="leftNavBuyHome"><a href="Buying-a-Home.php">Buying a Home<img class="navArrowHome" src="images/navArrow.gif" alt="Nav Arrow" width="11" height="11"/></a></li> <li class="leftNavRefi"><a href="Refinance.php">Refinance<img class="navArrowRefi" src="images/navArrow.gif" alt="Nav Arrow" width="11" height="11"/></a></li> <li class="leftNavRefi"><a href="Loan-Options.php">Loan Options<img class="navArrowLoanOpt" src="images/navArrow.gif" alt="Nav Arrow" width="11" height="11"/></a></li> <li class="leftNavRefi"><a href="Mortgage-Rates.php">Mortgage Rates<img class="navArrowMort" src="images/navArrow.gif" alt="Nav Arrow" width="11" height="11"/></a></li> <li class="leftNavRefi"><a href="Calculators-GuaranteedRate.php">Calculators<img class="navArrowCalc" src="images/navArrow.gif" alt="Nav Arrow" width="11" height="11"/></a></li> <li class="leftNavAbout"><a href="About-GuaranteedRate.php">About Us<img class="navArrowAbout" src="images/navArrow.gif" alt="Nav Arrow" width="11" height="11"/></a></li> <li class="leftNavPreApp"><a href="Pre-Approval.html">Instant Pre-Approval</a></li> <li class="leftNavCustomRates"><a href="index.php">Customized <br /> Mortgage Rates</a></li></ul> </div> <!-- InstanceBeginEditable name="Edit1" --> <div id="editArea"> <div id="iframe"><iframe id="iframeHome" src="<?php echo $todaysURL ?>" frameborder="0">Browser Not Compatible</iframe></div> </div> <!-- InstanceEndEditable --> </div> <div id="footer"> <div id="template-footer"> 500 State Rt. 35 Middletown, New Jersey 07701 | <script type="text/javascript"> <!-- var linkText = "Email Us " var preName = "lee.zacharczyk" var postName = "guaranteedrate.com" document.write("<a href=" + "mail" + "to:" + preName + "@" + postName + ">" + linkText + "</a>") //--> </script> | Web Design by <a href="http://www.littlechisel.com" target="new">Little Chisel Design</a> ©2013 All Rights Reserved</div> </div> </div> </body> <!-- InstanceEnd --></html> and the view source of Chrome and IE shows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/Main.dwt" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- InstanceBeginEditable name="doctitle" --> <title>New Jersey (NJ) Mortgage Lender, Mortgage Rates, Fha, Refinance & Home Loans</title> <meta name="description" content="Get real time, accurate New Jersey (NJ) mortgage rates, refinancing and home loans." /> <meta name="keywords" content="new jersey, nj, new jersey refinance, new jersey refinancing, FHA mortgage, jumbo mortgage, mortgage interest rate, mortgage, mortgage rates, mortgage broker, refinance, home loan, mortgage company, mortgage lender, mortgage refinancing, new jersey refinancing, home mortgage, mortgage interest rate" /> <meta name="nibbler-site-verification" content="3a321e0559840ef51087c274ba6f8be369e42dbf" /> <link rel="shortcut icon" href="http://www.littlechisel.com/clients/GuaranteedRate/favicon.ico"/> <script type="text/javascript"> var frames = Array('https://www.guaranteedrate.com/loanoptions/vpname/markzacharczyk' 86.4*1000, 'https://www.guaranteedrate.com/loanoptions/vpname/leezacharczyk' 86.4*1000); var i = 0, len = frames.length; function ChangeSrc() { if (i >= len) { i = 0; } // start over document.getElementById('iframeHome').src = frames[i++]; setTimeout('ChangeSrc()', (frames[i++]*1000)); } window.onload = ChangeSrc; </script> <!-- InstanceEndEditable --> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> <link href="css/GRateStyles.css" rel="stylesheet" type="text/css" /> <style> @media print { body { color: #000; background: #fff; } h1, h3 { color: #000; background: none; } #header, #footer, #leftNav, #right { display: none; } @page { margin: 2cm; } img { max-width: 100% !important; } ul, img { page-break-inside: avoid; } a { font-weight: bolder; text-decoration: none; } a[href^=http]:after { content:" <" attr(href) "> "; } } </style> <style type="text/css"> body { background-image: url(images/BkrdTexture.jpg); background-repeat: repeat; } </style> </head> <body> <div id="wrapper"> <div id="header"> <div id="headerBox"> <div id="logo"><a href="index.php"><img src="images/Logo.jpg" width="200" height="129" alt="Logo" /></a> </div> <div id="headerRight"> <div class="headerRightContactText" id="headerRightContact"><a href="contact.html">Contact</a> NewJerseyRates.com</div> <div id="headerRightTagline">Customized, Automated NJ Mortgage Rate Quotes <span class="redText">Accurate and Up-to-the-Minute</span> </div> </div> </div> </div> <div id="navBar"> <ul class="navBar"> <li class="home"><a href="index.php">Home</a></li> <li class="faq"><a href="faq.html">FAQ</a></li> <li class="aboutCredit"><a href="About-Credit.html">About Credit</a></li> <li class="loanProg"><a href="Loan-Programs.html">Loan Programs</a></li> <li class="survey"><a href="Survey.html">Survey</a></li> <li class="homeInspec"><a href="Home-Buyers-Info.html">Home Buyers Info</a></li> <li class="about"><a href="about_us.html">About NewJerseyRates.com</a></li> <li class="partnerLinks"><a href="links.html">Partner Links</a></li> <li class="glossary"><a href="gloss.html">Glossary</a></li> </ul> </div> <div id="content"> <div id="leftNav"> <ul class="leftNav"> <li class="leftNavBuyHome"><a href="Buying-a-Home.php">Buying a Home<img class="navArrowHome" src="images/navArrow.gif" alt="Nav Arrow" width="11" height="11"/></a></li> <li class="leftNavRefi"><a href="Refinance.php">Refinance<img class="navArrowRefi" src="images/navArrow.gif" alt="Nav Arrow" width="11" height="11"/></a></li> <li class="leftNavRefi"><a href="Loan-Options.php">Loan Options<img class="navArrowLoanOpt" src="images/navArrow.gif" alt="Nav Arrow" width="11" height="11"/></a></li> <li class="leftNavRefi"><a href="Mortgage-Rates.php">Mortgage Rates<img class="navArrowMort" src="images/navArrow.gif" alt="Nav Arrow" width="11" height="11"/></a></li> <li class="leftNavRefi"><a href="Calculators-GuaranteedRate.php">Calculators<img class="navArrowCalc" src="images/navArrow.gif" alt="Nav Arrow" width="11" height="11"/></a></li> <li class="leftNavAbout"><a href="About-GuaranteedRate.php">About Us<img class="navArrowAbout" src="images/navArrow.gif" alt="Nav Arrow" width="11" height="11"/></a></li> <li class="leftNavPreApp"><a href="Pre-Approval.html">Instant Pre-Approval</a></li> <li class="leftNavCustomRates"><a href="index.php">Customized <br /> Mortgage Rates</a></li></ul> </div> <!-- InstanceBeginEditable name="Edit1" --> <div id="editArea"> <div id="iframe"><iframe name="iframeHome" id="iframeHome" src="" frameborder="0">Browser Not Compatible</iframe></div> </div> <!-- InstanceEndEditable --> </div> <div id="footer"> <div id="template-footer"> 500 State Rt. 35 Middletown, New Jersey 07701 | <script type="text/javascript"> <!-- var linkText = "Email Us " var preName = "lee.zacharczyk" var postName = "guaranteedrate.com" document.write("<a href=" + "mail" + "to:" + preName + "@" + postName + ">" + linkText + "</a>") //--> </script> | Web Design by <a href="http://www.littlechisel.com" target="new">Little Chisel Design</a> ©2013 All Rights Reserved</div> </div> </div> </body> <!-- InstanceEnd --></html>
  25. I added the code to update the time zone. Thank you all for the help!
×
×
  • 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.