Jump to content

Bluemoon

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Bluemoon's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks! This has actually been resolved and I see that I can mark it as such to close it. I just needed to change the declaration from text to HTML and then I was able to add regular <br> breaks where I wanted it. Worked like a charm.
  2. Should \r\n be in quotes and/or parenthesis? I'm not sure how to code it properly. Would it look like this? mailMessage = __("Greetings from My Site! \r\n.." Or this: mailMessage = __("Greetings from My Site! "\r\n".." And would this look like: You received a new message from", "name" \r\n)." or this: You received a new message from", "name" "\r\n")."
  3. It's a free plugin for WordPress. I'm usually able to figure things out on my own but this has me baffled. I tried this: $mailMessage = __("Greetings from My Site! \n \n You received a new message from", "name" \n \n)." ".$sendfrom.", ".__("You can read the message at", "name").": ".$this->pageURL; That didn't work. Do you know how to code the \n \n in this context?
  4. Thanks for your quick response. That makes sense. However, I'm not sure the correct way to implement it. I tried this and it didn't work: $mailMessage = __("Greetings from name!", "scriptname")."\r\n" __("You received a new message from", "scriptname.")." ".$sendfrom.". ".__("You can read the message at this link", "scriptname").": ".$this->pageURL; This is very confusing code to me.
  5. I'm trying to edit a script's notification email because the generated email doesn't have any line breaks or paragraphs and is three sentences all squished together. I've tried numerous attempts without any success and am hoping that a guru here might save me some time and frustration. $mailMessage = __("Greetings from My Site! You received a new message from", "name")." ".$sendfrom.", ".__("You can read the message at", "name").": ".$this->pageURL; I want a line break after "Greetings from My Site!" It would be nice to have a line break after "You received a new message from ___." Right now, the email looks like this: "Greetings from My Site! You received a new message from (name). You can read the message at (link)." Anyone know the best way to achieve this? It seems so simple but alludes me. Thanks in advance!
  6. Yes, the value of $email is the same as $recipient.
  7. I guess I can't edit my post now? (I like the ability to edit posts if needed.) The email values are set in the WP admin script. See below. <?php // cform Admin Settings Page global $cform_version; load_plugin_textdomain('cform', $path = 'wp-content/plugins/contact-cform'); $location = get_option('siteurl') . '/wp-admin/admin.php?page=contact-cform/cform_options.php'; /* set default contact form options */ add_option('cform_name', __('Your Name', 'cform')); add_option('cform_website', __('Your Site', 'cform')); add_option('cform_email', __('your-email@domain.com', 'cform')); add_option('cform_offset', __('For example, +1 or -1', 'cform')); add_option('cform_subject', __('Message sent from your contact form.', 'cform')); add_option('cform_success', __('<h3 id="cform_success">Success! Your message has been sent.</h3>', 'cform')); add_option('cform_error', __('<h3 id="cform_error">Please complete the required fields.</h3>', 'cform')); add_option('cform_spam', __('<h3 id="cform_spam">Incorrect response for challenge question. Please try again.</h3>', 'cform')); add_option('cform_style', __('style="border: 1px solid #CC0000;"', 'cform')); add_option('cform_question', __('1 + 1 =', 'cform')); add_option('cform_response', __('2', 'cform')); add_option('cform_casing', __('FALSE', 'cform')); add_option('cform_carbon', __('FALSE', 'cform')); add_option('cform_credit', __('FALSE', 'cform')); add_option('cform_nametext', __('Name (Required)', 'cform')); add_option('cform_mailtext', __('Email (Required)', 'cform')); add_option('cform_sitetext', __('Website (Optional)', 'cform')); add_option('cform_subjtext', __('Subject (Optional)', 'cform')); add_option('cform_messtext', __('Message (Required)', 'cform')); add_option('cform_copytext', __('Carbon Copy?', 'cform')); /* check form submission and update options */ if ('process' == $_POST['cform_set']) { update_option('cform_name', $_POST['cform_name']); update_option('cform_website', $_POST['cform_website']); update_option('cform_email', $_POST['cform_email']); update_option('cform_offset', $_POST['cform_offset']); update_option('cform_subject', $_POST['cform_subject']); update_option('cform_success', $_POST['cform_success']); update_option('cform_error', $_POST['cform_error']); update_option('cform_spam', $_POST['cform_spam']); update_option('cform_style', $_POST['cform_style']); update_option('cform_question', $_POST['cform_question']); update_option('cform_response', $_POST['cform_response']); if ($_POST['cform_casing'] == 'TRUE') { update_option('cform_casing', 'TRUE'); } else { update_option('cform_casing', 'FALSE'); } if ($_POST['cform_carbon'] == 'TRUE') { update_option('cform_carbon', 'TRUE'); } else { update_option('cform_carbon', 'FALSE'); } update_option('cform_credit', $_POST['cform_credit']); update_option('cform_nametext', $_POST['cform_nametext']); update_option('cform_mailtext', $_POST['cform_mailtext']); update_option('cform_sitetext', $_POST['cform_sitetext']); update_option('cform_subjtext', $_POST['cform_subjtext']); update_option('cform_messtext', $_POST['cform_messtext']); update_option('cform_copytext', $_POST['cform_copytext']); } /* specify options for form fields */ $cform_name = stripslashes(get_option('cform_name')); $cform_website = stripslashes(get_option('cform_website')); $cform_email = stripslashes(get_option('cform_email')); $cform_offset = stripslashes(get_option('cform_offset')); $cform_subject = stripslashes(get_option('cform_subject')); $cform_success = stripslashes(get_option('cform_success')); $cform_error = stripslashes(get_option('cform_error')); $cform_spam = stripslashes(get_option('cform_spam')); $cform_style = stripslashes(get_option('cform_style')); $cform_question = stripslashes(get_option('cform_question')); $cform_response = stripslashes(get_option('cform_response')); $cform_casing = get_option('cform_casing'); $cform_carbon = get_option('cform_carbon'); $cform_credit = stripslashes(get_option('cform_credit')); $cform_nametext = stripslashes(get_option('cform_nametext')); $cform_mailtext = stripslashes(get_option('cform_mailtext')); $cform_sitetext = stripslashes(get_option('cform_sitetext')); $cform_subjtext = stripslashes(get_option('cform_subjtext')); $cform_messtext = stripslashes(get_option('cform_messtext')); $cform_copytext = stripslashes(get_option('cform_copytext')); ?> <div class="wrap"> <h2><?php _e('Welcome to cform <small>[v:', 'cform') ?><?php echo $cform_version." ]</small>"; ?></h2> <table width="100%" cellspacing="2" cellpadding="5" class="editform"> <tr valign="top"> <td><?php _e('<strong>To use cform, follow these three steps:</strong>', 'cform') ?><br /> <ol> <li><?php _e('Customize your preferences via this options page.', 'cform') ?></li> <li><?php _e('Insert <<code>!--cform--</code>> into any post or page.', 'cform') ?></li> <li><?php _e('Visit <a href="contact-cform/" title="">Cform.', 'cform') ?></li> </ol> </td> </tr> </table> <form name="form1" method="post" action="<?php echo $location ?>&updated=true"> <input type="hidden" name="cform_set" value="process" /> <fieldset class="options"> <legend><?php _e('General Options', 'cform') ?></legend> <table width="100%" cellspacing="2" cellpadding="5" class="editform"> <tr valign="top"> <th scope="row"><?php _e('Your Email:', 'cform') ?></th> <td><input type="text" size="55" name="cform_email" id="cform_email" value="<?php echo $cform_email; ?>" /> <br /><?php _e('Where shall cform send your messages?', 'cform') ?></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Your Name:', 'cform') ?></th> <td><input type="text" size="55" name="cform_name" id="cform_name" value="<?php echo $cform_name; ?>" /> <br /><?php _e('To whom shall cform address your messages?', 'cform') ?></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Your Website:', 'cform') ?></th> <td><input type="text" size="55" name="cform_website" id="cform_website" value="<?php echo $cform_website; ?>" /> <br /><?php _e('What is the name of your blog or website?', 'cform') ?></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Default Subject:', 'cform') ?></th> <td><input type="text" size="55" name="cform_subject" id="cform_subject" value="<?php echo $cform_subject; ?>" /> <br /><?php _e('This will be the subject of the email if none is specified.', 'cform') ?></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Challenge Question:', 'cform') ?></th> <td><input type="text" size="55" name="cform_question" id="cform_question" value="<?php echo $cform_question; ?>" /> <br /><?php _e('This question must be answered correctly before mail is sent.', 'cform') ?></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Challenge Response:', 'cform') ?></th> <td><input type="text" size="55" name="cform_response" id="cform_response" value="<?php echo $cform_response; ?>" /> <br /><?php _e('This is the only correct answer to the challenge question.', 'cform') ?></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Case Sensitivity:', 'cform') ?></th> <td><input type="checkbox" name="cform_casing" id="cform_casing" value="TRUE" <?php if ($cform_casing == "TRUE") { echo "checked=\"checked\""; } ?> /> <br /><?php _e('Check this box if the challenge response should be case-insensitive.', 'cform') ?></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Carbon Copies:', 'cform') ?></th> <td><input type="checkbox" name="cform_carbon" id="cform_carbon" value="TRUE" <?php if ($cform_carbon == "TRUE") { echo "checked=\"checked\""; } ?> /> <br /><?php _e('Check this box if you want to enable users to receive carbon copies.', 'cform') ?></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Time Offset:', 'cform') ?></th> <td><input type="text" size="55" name="cform_offset" id="cform_offset" value="<?php echo $cform_offset; ?>" /> <br /><?php _e('Please specify any time offset here. If no offset, enter "0" (zero).', 'cform') ?> <br /><?php _e('Current cform time:', 'cform') ?> <?php echo date("l, F jS, Y @ g:i a", time()+get_option('cform_offset')*60*60); ?></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Share Link:', 'cform') ?></th> <td><input type="checkbox" name="cform_credit" id="cform_credit" value="TRUE" <?php if ($cform_credit == "TRUE") { echo "checked=\"checked\""; } ?> /> <br /><?php _e('Share a link to the cform homepage?', 'cform') ?></td> </tr> </table> </fieldset> <fieldset class="options"> <legend><?php _e('Field Captions', 'cform') ?></legend> <table width="100%" cellspacing="2" cellpadding="5" class="editform"> <tr valign="top"> <th scope="row"><?php _e('Caption for Name Field:', 'cform') ?></th> <td><input type="text" size="55" name="cform_nametext" id="cform_nametext" value="<?php echo $cform_nametext; ?>" /> <br /><?php _e('This is the caption that corresponds with the Name field.', 'cform') ?></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Caption for Email Field:', 'cform') ?></th> <td><input type="text" size="55" name="cform_mailtext" id="cform_mailtext" value="<?php echo $cform_mailtext; ?>" /> <br /><?php _e('This is the caption that corresponds with the Email field.', 'cform') ?></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Caption for Website Field:', 'cform') ?></th> <td><input type="text" size="55" name="cform_sitetext" id="cform_sitetext" value="<?php echo $cform_sitetext; ?>" /> <br /><?php _e('This is the caption that corresponds with the Website field.', 'cform') ?></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Caption for Subject Field:', 'cform') ?></th> <td><input type="text" size="55" name="cform_subjtext" id="cform_subjtext" value="<?php echo $cform_subjtext; ?>" /> <br /><?php _e('This is the caption that corresponds with the Subject field.', 'cform') ?></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Caption for Message Field:', 'cform') ?></th> <td><input type="text" size="55" name="cform_messtext" id="cform_messtext" value="<?php echo $cform_messtext; ?>" /> <br /><?php _e('This is the caption that corresponds with the Message field.', 'cform') ?></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Caption for Carbon Copy:', 'cform') ?></th> <td><input type="text" size="55" name="cform_copytext" id="cform_copytext" value="<?php echo $cform_copytext; ?>" /> <br /><?php _e('This caption corresponds with the Carbon Copy checkbox.', 'cform') ?></td> </tr> </table> </fieldset> <fieldset class="options"> <legend><?php _e('Default Messages', 'cform') ?></legend> <table width="100%" cellspacing="2" cellpadding="5" class="editform"> <tr valign="top"> <th scope="row"><?php _e('Success Message:', 'cform') ?></th> <td><textarea rows="5" cols="55" name="cform_success" id="cform_success" style="width: 77%;"><?php echo $cform_success; ?></textarea> <br /><?php _e('When the form is sucessfully submitted, this message will be displayed to the sender.', 'cform') ?></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Incorrect Response:', 'cform') ?></th> <td><textarea rows="5" cols="55" name="cform_spam" id="cform_spam" style="width: 77%;"><?php echo $cform_spam; ?></textarea> <br /><?php _e('When the challenge question is answered incorrectly, this message will be displayed.', 'cform') ?></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Error Message:', 'cform') ?></th> <td><textarea rows="5" cols="55" name="cform_error" id="cform_error" style="width: 77%;"><?php echo $cform_error; ?></textarea> <br /><?php _e('If the user skips a required field, this message will be displayed.', 'cform') ?></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Error Fields', 'cform') ?></th> <td><textarea rows="5" cols="55" name="cform_style" id="cform_style" style="width: 77%;"><?php echo $cform_style; ?></textarea> <br /><?php _e('Here you may specify the default CSS for error fields, or add other attributes.', 'cform') ?></td> </tr> </table> </fieldset> <p class="submit"> <input type="submit" name="submit" value="<?php _e('Update cform Options', 'cform') ?> ยป" /> </p> </form> <table width="100%" cellspacing="2" cellpadding="5" class="editform"> <tr valign="top"> <td> <?php _e('<strong>Thanks for using cform!</strong>', 'cform') ?><br /> <?php _e('If you like this free plugin, please blog about it, link to it, or send a link so that I may see it in action! Thanks!', 'cform') ?> </td> </tr> </table> </div>
  8. I am using an email form script for WordPress. It has a lot of great features including a one-line quiz to deter spam rather than an annoying Captcha form. The code generates a confirmation on the same page. That is great. HOWEVER, it generates a duplicate code at the top of the page as well as in the body where it belongs and throws off the page's layout and formatting. Also, it sends two emails instead of one. Can anyone here figure out why this code would generate two success messages on the page and how to fix it? Or, alternatively, can someone help me change the script so that it outputs to a separate thank you page instead? Here's the code. The confirmation message that repeats is surrounded by <b> tags to indicate bolding. (There is also a separate script for the admin panel that I am not copying here.) <?php /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // NO EDITING REQUIRED - PLEASE SET PREFERENCES IN THE WORDPRESS ADMIN! $c_version = '0.88.1'; load_plugin_textdomain('cform', $path = 'wp-content/plugins/contact-c'); $c_strings = array( 'name' => '<input class="input" type="text" name="c_name" id="c_name" size="33" maxlength="99" value="' . htmlentities($_POST['c_name']) . '" />', 'email' => '<input class="input" type="text" name="c_email" id="c_email" size="33" maxlength="99" value="' . htmlentities($_POST['c_email']) . '" />', 'response' => '<input class="input" type="text" name="c_response" id="c_response" size="33" maxlength="99" value="' . htmlentities($_POST['c_response']) . '" />', 'message' => '<textarea class="input" name="c_message" id="c_message" cols="33" rows="11" >' . htmlentities($_POST['c_message']) . '</textarea>', 'error' => '' ); function malicious_input($input) { $maliciousness = false; $denied_inputs = array("\r", "\n", "mime-version", "content-type", "cc:", "to:"); foreach($denied_inputs as $denied_input) { if(strpos(strtolower($input), strtolower($denied_input)) !== false) { $maliciousness = true; break; } } return $maliciousness; } function spam_question($input) { $response = get_option('c_response'); $response = stripslashes(trim($response)); if (get_option('c_casing') == 'TRUE') { return (strtoupper($input) == strtoupper($response)); } else { return ($input == $response); } } function c_input_filter() { if(!(isset($_POST['c_key']))) { return false; } $_POST['c_name'] = stripslashes(trim($_POST['c_name'])); $_POST['c_email'] = stripslashes(trim($_POST['c_email'])); $_POST['c_topic'] = stripslashes(trim($_POST['c_topic'])); $_POST['c_website'] = stripslashes(trim($_POST['c_website'])); $_POST['c_message'] = stripslashes(trim($_POST['c_message'])); $_POST['c_response'] = stripslashes(trim($_POST['c_response'])); global $c_strings; $style = stripslashes(get_option('c_style')); $pass = true; if(empty($_POST['c_name'])) { $pass = FALSE; $fail = 'empty'; $c_strings['name'] = '<input class="input" type="text" name="c_name" id="c_name" size="33" maxlength="99" value="' . htmlentities($_POST['c_name']) . '" ' . $style . ' />'; } if(!is_email($_POST['c_email'])) { $pass = FALSE; $fail = 'empty'; $c_strings['email'] = '<input class="input" type="text" name="c_email" id="c_email" size="33" maxlength="99" value="' . htmlentities($_POST['cemail']) . '" ' . $style . ' />'; } if (empty($_POST['c_response'])) { $pass = FALSE; $fail = 'empty'; $c_strings['response'] = '<input class="input" type="text" name="c_response" id="c_response" size="33" maxlength="99" value="' . htmlentities($_POST['c_response']) . '" ' . $style . ' />'; } if (!spam_question($_POST['c_response'])) { $pass = FALSE; $fail = 'wrong'; $c_strings['response'] = '<input class="input" type="text" name="c_response" id="c_response" size="33" maxlength="99" value="' . htmlentities($_POST['c_response']) . '" ' . $style . ' />'; } if(empty($_POST['c_message'])) { $pass = FALSE; $fail = 'empty'; $c_strings['message'] = '<textarea class="input" name="c_message" id="c_message" cols="33" rows="11" ' . $style . '>' . $_POST['c_message'] . '</textarea>'; } if(malicious_input($_POST['c_name']) || malicious_input($_POST['c_email'])) { $pass = false; $fail = 'malicious'; } if($pass == true) { return true; } else { if($fail == 'malicious') { $c_strings['error'] = "<p>Please do not include any of the following in the Name or Email fields: linebreaks, or the phrases 'mime-version', 'content-type', 'cc:' or 'to:'.</p>"; } elseif($fail == 'empty') { $c_strings['error'] = stripslashes(get_option('c_error')); } elseif($fail == 'wrong') { $c_strings['error'] = stripslashes(get_option('c_spam')); } return false; } } function contact_c($content='') { global $c_strings; if(!preg_match('|<!--cform-->|', $content)) { return $content; } if(cform_input_filter()) { if(empty($_POST['c_topic'])) { $topic = get_option('c_subject'); } elseif(!empty($_POST['c_topic'])) { $topic = $_POST['c_topic']; } if(empty($_POST['c_carbon'])) { $copy = "No carbon copy sent."; } elseif(!empty($_POST['c_carbon'])) { $copy = "Copy sent to sender."; } if(empty($_POST['c_website'])) { $website = "No website specified."; } elseif(!empty($_POST['c_website'])) { $website = $_POST['c_website']; } $recipient = get_option('c_email'); $recipname = get_option('c_name'); $recipsite = get_option('c_website'); $success = get_option('c_success'); $success = stripslashes($success); $name = $_POST['c_name']; $email = $_POST['c_email']; $senderip = get_ip_address(); $offset = get_option('gmt_offset'); $agent = $_SERVER['HTTP_USER_AGENT']; $form = getenv("HTTP_REFERER"); $host = gethostbyaddr($_SERVER['REMOTE_ADDR']); $date = date("l, F jS, Y @ g:i a", time()+get_option('c_offset')*60*60); $headers = "MIME-Version: 1.0\n"; $headers .= "From: $name <$email>\n"; $headers .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n"; $message = $_POST['c_message']; $message = wordwrap($message, 77, "\n"); $fullmsg = ("Hello $recipname, You are being contacted via $recipsite: Name: $name Email: $email Carbon: $copy Website: $website Subject: $topic Message: $message ----------------------- Additional Information: IP: $senderip Site: $recipsite URL: $form Time: $date Host: $host Agent: $agent Whois: http://www.arin.net/whois/ "); $fullmsg = stripslashes(strip_tags(trim($fullmsg))); mail($recipient, $topic, $fullmsg, $headers); if($_POST['cform_carbon'] == 'TRUE') { mail($email, $topic, $fullmsg, $headers); } [b] $results = ($success . ' <p id="contact_message">Thanks for contacting me, ' . $name . '. The following information has been sent via email:</p> <pre><code>Date: ' . $date . ' Name: ' . $name . ' Email: ' . $email . ' Carbon: ' . $copy . ' Website: ' . $website . ' Subject: ' . $topic . ' Message: ' . $message . '</code></pre> <p id="contact_reset">[ <a href="'.$form.'" title="Click here to reset the form.">Click here to reset the form</a> ]</p>'); echo $results;[/b] } else { if(strstr($content, "<!--cform-->" )) { $question = stripslashes(get_option('c_question')); $nametext = stripslashes(get_option('c_nametext')); $mailtext = stripslashes(get_option('c_mailtext')); $sitetext = stripslashes(get_option('c_sitetext')); $subjtext = stripslashes(get_option('c_subjtext')); $messtext = stripslashes(get_option('c_messtext')); $copytext = stripslashes(get_option('c_copytext')); if (get_option('c_carbon') == 'TRUE') { $carbon = ('<fieldset> <legend class="hide">Send Yourself a Copy</legend> <label class="label" for="cform_carbon">' . $copytext . '</label> <input class="check" type="checkbox" id="cform_carbon" name="cform_carbon" value="TRUE" /> </fieldset>'); } else { $carbon = ''; } if (get_option('cform_credit') == 'TRUE') { $credit = ('<p><a href="cform/" title="">Cform</a></p>'); } else { $credit = ''; } $form = ( $cform_strings['error'].' <div id="cform"> <form action="' . get_permalink() . '" method="post"> <fieldset> <legend class="hide" title="Note: (X)HTML/code not allowed.">Use this form to contact us via email.</legend> <fieldset> <legend class="hide">Required: Contact Information</legend> <label class="label" for="cform_name">' . $nametext . '</label> ' . $cform_strings['name'] . ' <label class="label" for="cform_email">' . $mailtext . '</label> ' . $cform_strings['email'] . ' </fieldset> <fieldset> <legend class="hide">Optional: Website Information</legend> <label class="label" for="cform_website">' . $sitetext . '</label> <input class="input" type="text" name="cform_website" id="cform_website" size="33" maxlength="177" value="' . htmlentities($_POST['cform_website']) . '" /> </fieldset> <fieldset> <legend class="hide">Optional: Subject of Email</legend> <label class="label" for="cform_topic">' . $subjtext . '</label> <input class="input" type="text" name="cform_topic" id="cform_topic" size="33" maxlength="177" value="' . htmlentities($_POST['cform_topic']) . '" /> </fieldset> <fieldset> <legend class="hide">Required: Anti-Spam Challenge Question</legend> <label class="label" for="cform_response">' . $question . '</label> ' . $cform_strings['response'] . ' </fieldset> <fieldset> <legend class="hide">Required: Message of Email</legend> <label class="label" for="cform_message">' . $messtext . '</label> ' . $cform_strings['message'] . ' </fieldset> <fieldset> <legend class="hide">Send Message via Email</legend> <input class="submit" type="submit" name="Submit" value="Submit" id="contact" /> <input type="hidden" name="cform_key" value="process" /> </fieldset> ' . $carbon . ' </fieldset> </form> </div> ' . $credit . ' <div class="clear"> </div> '); } $content = preg_replace('/<p>\s*<!--(.*)-->\s*<\/p>/i', "<!--$1-->", $content); $content = str_replace('<!--cform-->', $form, $content); return $content; } } function get_ip_address() { if(isset($_SERVER)) { if(isset($_SERVER["HTTP_X_FORWARDED_FOR"])) { $ip_address = $_SERVER["HTTP_X_FORWARDED_FOR"]; } elseif(isset($_SERVER["HTTP_CLIENT_IP"])) { $ip_address = $_SERVER["HTTP_CLIENT_IP"]; } else { $ip_address = $_SERVER["REMOTE_ADDR"]; } } else { if(getenv('HTTP_X_FORWARDED_FOR')) { $ip_address = getenv('HTTP_X_FORWARDED_FOR'); } elseif(getenv('HTTP_CLIENT_IP')) { $ip_address = getenv('HTTP_CLIENT_IP'); } else { $ip_address = getenv('REMOTE_ADDR'); } } return $ip_address; } function cform_admin() { add_options_page('cform_Options', 'Cform', 'manage_options', 'contact-cform/cform_options.php'); } add_action('admin_menu', 'cform_admin'); add_filter('the_content', 'contact_cform'); ?> Thanks!
  9. Okay, that's what I figured but wasn't sure. Thanks! I'll consider this solved. Now I just have to find a PHP validation code and figure out how to implement the javascript in it.
  10. Thanks for the reply, mikesta. This might sound like a stupid question, but is it possible to open the error message in a new blank page without it being a javascript popup? The reason that I'm concerned about javascript is because I am currently using a javascript for form validation and getting blank responses. So, someone or people are bypassing the javascript validation. I want to avoid that and use PHP so they can't turn that off.
  11. I am currently using a GREAT, easy-to-use PHP form script. The code is below. I'd like to add a required field form validation script to it. I'd like for error messages, if any, to appear in a new window. I want to avoid javascript in case people have that turned off. That is the whole reason I'm looking for a PHP script to accomplish this task. Is this possible? If so, what code would I use? Below is my current script without any form validation: // Configuration Settings $SendFrom = "Form Feedback <email@address>"; $SendTo = "name@emailaddress"; $SubjectLine = "Subject"; $ThanksURL = "thanks.htm"; //confirmation page $Divider = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; // Build Message Body from Web Form Input $MsgBody = @gethostbyaddr($_SERVER["REMOTE_ADDR"]) . "\n$Divider\n"; foreach ($_POST as $Field=>$Value) $MsgBody .= "$Field: $Value\n"; $MsgBody .= "$Divider\n" . $_SERVER["HTTP_USER_AGENT"] . "\n"; $MsgBody = htmlspecialchars($MsgBody); //make content safe // Send E-Mail and Direct Browser to Confirmation Page mail($SendTo, $SubjectLine, $MsgBody, "From: $SendFrom"); header("Location: $ThanksURL"); ?>
  12. Thanks for the replies! This is a great forum - very helpful. I decided to go with a javascript script to generate my local time in real time. But I can use this PHP script to generate the " now open" script. (And, no, I am not worried about showing lunch breaks - just in showing that the office is open between 8-5, M-F.)
×
×
  • 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.