Using Captcha within a .php file form

Hello all - I need to add a captcha to an existing php form. The form is located in a .php file. I know this issue is not a Dreamweaver problem per se, but hoping someone here has had some experience with Captcha and .php files.
when I add the following to the <form>
  require_once('recaptchalib.php');
  $publickey = "your_public_key"; // you got this from the signup page
  echo recaptcha_get_html($publickey);
I end up with a blank white page. Note: the public key has been added in my file.
There is a note in the tutorial that states:
  <html>
    <body> <!-- the body tag is required or the CAPTCHA may not show on some browsers -->
      <!-- your HTML content -->
It is my understanding that <html> and <body> cannot/should not be added to .php pages. If this is true, can captcha work within a .php file?
Thanks in advance for any and all help.
Gene

genoMU69 wrote:
Nancy - thanks.
What you're saying make sense.
When I added the code below:
  require_once('recaptchalib.php');
  $publickey = "your_public_key"; // you got this from the signup page
  echo recaptcha_get_html($publickey);
to the form with my actual public key included
and:
<?php
  require_once('recaptchalib.php');
  $privatekey = "your_private_key";
  $resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);
  if (!$resp->is_valid) {
    // What happens when the CAPTCHA was entered incorrectly
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
         "(reCAPTCHA said: " . $resp->error . ")");
  } else {
    // Your code here to handle a successful verification
  ?>
to the verify php, with the private key inserted,
I end up with a blank white page, the form dissapears. I thought maybe it was because the html and body tags were not included with the parent page (of which the form is a part of)
I will inbox you the parent form page so that you can see what I'm working with. Thanks again for you help.
G
At this stage I'd do a test.
Just include the form and captcha stuff in a page on its own and see what the results are. (obviously include the <body><html> tags.
If it works that means there is a problem with your real set up. If it doesnt it means there is certainly a problem with the way you have captcha set up.

Similar Messages

  • Using Location: to Redirect PHP on form submit

    Ok, I have this page where the user submits a form using  <form name="form1" method="post"
             action="<?php echo $_SERVER['PHP_SELF']; ?> and it runs this code below.  Basically sends and email and writes some files to the database.  I want that page to direct to a new page at the end.  I have tried using location: newpage.php in various spots but can't get it to run.  Everything else works great.  Thanks.
    below resides in HEAD
    <?php
    // our e-mail function
    function send_mail($from_name, $from_email, $message) {
        $to = $_REQUEST['to_email'];
        $subject = "sub";
        $headers .= "From: $from_name <$from_email>\n";
        $headers .= "Reply-To: $from_name <$from_email>\n";
        $send_mail = mail($to, $subject, $message, $headers);
        if ($send_mail) {
            return true;
        } else {
            return false;
    // check that the form is truly sent
    if ($_POST['send'] == 1) {
        // get data from the form
        //$from_name=$_POST['from_name'];
         $to_email=$_POST['to_email'];
         echo $to_mail;
        $from_email=$_POST['from_email'];
       $message=$_POST['fname']." ".$_POST['lname']";
    //mysql_query("INSERT INTO table (this, this and this)
    //VALUES ($_POST['id'], $_POST['field2'])");
      mysql_select_db($blah, $blah);
        $result=mysql_query("INSERT INTO blah (id, field2) values( '','$id','$field2')");
        // send e-mail
        $try_mail = send_mail($from_name, $from_email, $message);
        // output the result
        if ($try_mail) {
            echo "Your e-mail message was sent!";
        } else {
            echo "Your e-mail message was not sent!";
    ?>

    That looks like the correct answer, DW inserts the following similar code when creating an db insert or update, as one of the options to goto a page after the insert. This one uses the header function to perform the same thing.
      $insertGoTo = "some_new_file.php";
      if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    Just be sure to perform all the emailing and updating before this code.
    Watch out for header issues as explained  here
    http://php.net/manual/en/function.header.php
    -Daniel

  • Create a portlet based on php file

    Hi All..I'm a very new comer about weblogic portal..now I'm using weblogic portal 10.3..
    I have a question..Is there possible to have an portlet that can be enlarged?
    And is there possible if I have a .php file, and then I want to create a portlet based on that .php file?
    Could anyone help me to solve this problem..or is there any guidance about those questions?
    Thank's a lot before...

    Is there possible to have an portlet that can be enlarged?Yes. You can maximise a portlet
    And is there possible if I have a .php file, and then I want to create a portlet based on that .php fileNot directly.
    If you are going to run the PHP file in its own machine then you could use a browser or clipper portlet. If you want to run the PHP file on the JVM itself, I believe there are some commercial products that let you do this (then its equivalent to a JavaServlet). This could then be included by any dummy JSP and you could use a plain jsp portlet . however you wqould have to be careful how you generate links within the PHP file (because you'd have to mimic the way BEA tags behave) .
    never tried this and if you have few PHP pages then you could probably rewrite to java.

  • Unable to view php files in Design View?

    Need help! I cannot select design view when working with a PHP document, the DesignView option is disabled?
    My information.
    -          Dreamweaver CS5
    -          Mac OSX 10.6 snow Lepoard
    I have searched online and I also went through the FAQ but couldn’t find anything relating to this particular issue and my Professor at school said that I need to contact Adobe directly as design view should always be available but all that I would see in Design View are the HTML elements within the PHP file.
    The Design View button is disabled, I can not click on it all and so for my class assignments. I have to copy the PHP code into a new HTML document and only then am I able to view the html/php and edit the HTML elements, and then copy and paste it back into the PHP file once I have the html elements/design set up correctly.
    I did a similar “Set up PHP for Mac OS X – MAMP” to the version available here, could I have set this up incorrectly and that is why Design View is disabled?
    Thanks I appreciate your guys expertise and any help!

    Kanjan wrote:
    Need help! I cannot select design view when working with a PHP document, the DesignView option is disabled?
    Go to Dreamweaver > Preferences, and select File Types / Editors from the Category list on the left. Make sure that .php is NOT listed among the filename extensions in "Open in code view".
    Adding a filename extension to that list prevents files from being opened in Design view.

  • Contact Form: How do i create a link from an XML file to another domain to read a PHP File

    So i purchased a template from Template Monster and im having a little trouble with the contact form. The server that im uploading it to is a privite server that the company owns. It supports ASP and not PHP. I cant seem to get the ASP form to work so all i want to do it create a link to another one of there servers that supports PHP and have the contact form link to there and read the PHP file (that i will upload to that server) and send the email from there.
    This is the XML that i have to fill in in order to make it work
    Everything in Red is what i needed to fill out in order for the form to work.
    <?xml version="1.0" encoding="utf-8"?>
    <!--
            Please read this information to learn how to set up the contact form integrated
            into the template.
            This readme file explains in details the meaning of the settings that can be
            done in the fcContactFormConfiguration.xml configuration file.
            It is recommended for you to use an XML editor to make changes to this file
             because it’s less possible to make an error in the markup which can cause to
            a not working contact form.
      -->
    <contactFormConfiguration>
        <!--
                An e-mail address which will be used to receive messages from your contact form.
                You can specify several e-mail addresses separating them with a comma.
                For example: [email protected], [email protected], [email protected]
          -->
        <emailTo>[email protected]</emailTo>
        <!--
                A server script type which will process sending e-mails. It depends on your
                hosting and in the current version of the contact form it is allowed to use
                two types:  php (Apache, PHP Hosting); asp (IIS web server, ASP).
          -->
        <serverProcessorType>php</serverProcessorType>
        <!--
                A name of the script file which process sending e-mails on your server (without
                extension). The name contact is used by default.
          -->
        <serverProcessorFileName>contact</serverProcessorFileName>
        <!--
                Set whether to validate only required fields (true/false).  The default value is
                true which means the not required fields of your contact form will not be validated.
                For example if the e-mail field of your form is set as not required (imagine it)
                the form will be processed even if the user types in an incorrect e-mail address.
          -->
        <validateRequiredOnly>false</validateRequiredOnly>
        <!--
                Set whether to submit the form when the Enter key is pressed even if the focus is
                not on the Submit button (true/false).
          -->
        <submitFormOnEnter>false</submitFormOnEnter>
        <!--
                Text showing to the user when the form is submitted without any errors.
          -->
        <messageSentText>Thank you for your message.</messageSentText>
        <!--
                Text showing in case the form is not submitted because of a server error.
          -->
        <messageSentFailedText>Sorry, your message couldn't be sent</messageSentFailedText>
        <!--
                Text your visitor will see while waiting till the processing is over.
          -->
        <formProcessingText>processing...</formProcessingText>
        <!--
                Your SMTP server (for ASP only).
          -->
        <smtpServer>localhost</smtpServer>
        <!--
                Your SMTP port (for ASP only).
          -->
        <smtpPort>25</smtpPort>
        <!--
                Set whether to send the message as a plain text (true) or as HTML (false).
          -->
        <plainText>false</plainText>
        <!--
                ID of the input field (in the structure XML file) to use for the “from: ”
                or email to use instead (for example: [email protected]).
          -->
        <emailFromSource>2</emailFromSource>
        <!--
                Subject of the e-mails that will be sent through this contact form or ID of
                the input field (in the structure XML file) to use for the “subject: ” label
                in your e-mail client.
          -->
        <subjectSource>Contact Form from your site</subjectSource>
        <!--
                Validation error messages that are showing to the user when the form fails to
                validate. The form supports different types of validators. You can change the
                text of the error messages the validators produce here.
                You can use the {LABEL} keyword in these messages. It will replace it with the
                label value of the field where an error occurs.
          -->
        <validationErrorMessages>
            <!--
                    A required field is not filled in.
              -->
            <message type="fieldIsRequired">{LABEL} is required.</message>
            <!--   
                    The specified e-mail address is incorrect.
              -->
            <message type="emailNotValid">{LABEL} - is not valid email address.</message>
            <!--
                    The specified number of characters in a field is less than a required minimum.
              -->
            <message type="minCharsLimitError">{LABEL} - The specified number of characters in a field is less than a required minimum.</message>
            <!--
                    The specified string does not match with the regular expression.
              -->
            <message type="reqExpError">{LABEL} - The specified string does not match with the regular expression.</message>
            <!--
                    The specified number is greater than an acceptable biggest number for this field.
              -->
            <message type="biggerThanMaxError">{LABEL} - The specified number is greater than an acceptable biggest number for this field.</message>
            <!--
                    The specified number is lower than an acceptable lowest number for this field.
              -->
            <message type="lowerThanMinError">{LABEL} - The specified number is lower than an acceptable lowest number for this field.</message>
            <!--
                    The data is not a number.
              -->
            <message type="notANumberError">{LABEL} - The data is not a number.</message>
            <!--
                    The specified number must not be negative.
              -->
            <message type="negativeError">{LABEL} - The specified number must not be negative.</message>
            <!--
                    The minimum number of variants is not selected
              -->
            <message type="minRequirementError">{LABEL} - The minimum number of variants is not selected</message>
            <!--
                    The number of variants selected exceeds the maximum
              -->
            <message type="maxRequirementError">{LABEL} - The number of variants selected exceeds the maximum</message>
            <!--
                    The fields that should be equal do not match
              -->
            <message type="shouldBeEqualError">{LABEL} - values do not match</message>
            <!--
                     The date has wrong format.
              -->
            <message type="dateIsNotValidError">{LABEL} - date has wrong format</message>
        </validationErrorMessages>
    </contactFormConfiguration>
    THIS IS THE ACTUAL CONTACT.PHP Form That i would like to link to.
    <?php
    //-----------------Getting data sent by flash---------------------
    foreach ($_POST as $key => $value){
            if ($key != 'mail_to' && $key != 'smtp_server' && $key != 'smtp_port' && $key != 'mail_from' && $key != 'mail_subject' && $key != 'plain_text'){
                $mail_body .= '<b>'.str_replace('_',' ',$key).'</b>:<br/>';
                $mail_body .= ''.stripslashes($value).'<br/>';
    $message = '<html><body>'.$mail_body.'</body></html>'; //  mail body
    //------------if plain text is set to true removing html tags------
    if ($_POST['plain_text']=='true') {
        $message = str_replace('<br/>',"\r\n", $message);
        $message = strip_tags($message);
    } else {
    //----otherwise composing message headers---------------------------
        $headers  = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=windows-1251' . "\r\n";
    //------------setting conf data-------------------------------------
    $to = $_POST['mail_to'];
    $from = $_POST['mail_from'];
    $subject = $_POST['mail_subject'];
    $smtp_server = $_POST['smtp_server'];
    $smtp_port = $_POST['smtp_port'];
    //---------setting header info--------------------------------------
    $headers .= 'From:' .$from;
    if (mail($to, $subject, $message, $headers)){ // sending mail
        print('&mail=1');  //succes
    } else {
        print('&mail=0');//failure
    ?>

    You can open both Muse files at once, copy the content of a page on one site, then paste it into a new page on the other site. You might have to redo some of the page styling.

  • To have my form information mailed to me, do I need to have a php file?

    I've got an account with godaddy, and have tried to make a php document (don't understand the coding) for a simple form, but I can't get the results to show up in my email.  I just can't figure out what to put in my php.  I copied a template, but none of the data shows up in my email, only the subject. (see at end)  Isn't there a much easier way to do all this?
    -Kate
    Here's the form
    <form action="http://www.kateharperdesigns.com/sendresults.php" method="post" enctype="text/plain" id="contactform" style="font-size:.7em">
      <label>Company<br />
      <input type="text" name="company" id="company" />
      </label><br />
      <label>Products you manufacture<br />
      <input type="text" name="products" id="products" />
      </label><br />
      <label>Email Address<br />
      <input type="text" name="email" id="email" />
      </label>
      <label>
      <input type="submit" name="subscribe" id="subscribe2" value="Submit" />
      </label>
    </form>
    <?php
    //--------------------------Set these paramaters--------------------------
    // Subject of email sent to you.
    $subject = 'NEW DESIGN SUBSCRIPTION';
    // Your email address. This is where the form information will be sent.
    $emailadd = '...edited...';
    // Where to redirect after form is processed.
    $url = 'http://www.kateharperdesigns.com/redirect.html';
    // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
    $req = '1';
    // --------------------------Do not edit below this line--------------------------
    $text = "Results from form:\n\n";
    $space = ' ';
    $line = '
    foreach ($_POST as $key => $value)
    if ($req == '1')
    if ($value == '')
    {echo "$key is empty";die;}
    $j = strlen($key);
    if ($j >= 20)
    {echo "Name of form element $key cannot be longer than 20 characters";die;}
    $j = 20 - $j;
    for ($i = 1; $i <= $j; $i++)
    {$space .= ' ';}
    $value = str_replace('\n', "$line", $value);
    $conc = "{$key}:$space{$value}$line";
    $text .= $conc;
    $space = ' ';
    mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
    echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
    ?>
    Message was edited by: Murray *ACP*

    >I thought I need a 1) form in an html document
    Correct
    >2) a php document in my  dreamweaver file on the same level as my index file
    The php script (or any server side script) does not need to be in the same directory level as your index file or any other html file. You can put it anywhere in the site and provide the path in the form's action.
    >and form file 3)some  way to connect with the
    >server so it knows to process my data.
    Not sure exactly what you mean but the script can connect to your mail server to email the message or insert data to a database server - or several other possibilities.
    >Then when I hear that godaddy has it's own script. I have no clue "what  that means."
    Godaddy provides server side scripts that you can use.
    >Does that mean I don't need a php file?
    It means that you use their php ( or asp) script.
    >but I know that  seems unlikely because
    >there would be no way for godaddy server to
    >know  how I want it processed.
    Many mail form scripts can generically handle form processing. They iterate through all of the form fields and process them accordingly. You need to review the script documentation to make sure you setup your form correctly.

  • How to include .php file in .shtml using SSI

    Hi,
    I've just finished with my "Contact Us form" for my website and have some issues with running it. I have a .shtml file http://mydomain.com/contact-us.shtml in wich I'd like to include a contact us form file http://mydomain.com/includes/ContactUs.php. Now, having my web page "contact-us" as a *.shtml file with ContactUs.php file included, I can run the form but I can't send any emails.  If I would change contact-us.shtml in contact-us.php the form runs perfect but, I can't use other includes on that file as logo, header, footer etc. How could I include an .php file in a .shtml file and runing both the included .php script and includes themself?
    Thank You!

    Keep it simple.
    Your html file uses syntax like "<!--#include file=".header" -->" to include an SSI file. Your server requires either (1) that the html file have the .shtml extension or (2) you twiddle with an .htaccess file to cause the server to parse ALL html files for SSIs. The latter is generally not a good idea.
    PHP files are already processed on the server. You include SSI files the same way, but the syntax is a little different: "<?php include (".header"); ?> ".

  • Using LoadVars in SSAS to send data to a php file

    I am using FMS 4.5 and have a simple application which I want to use to send two strings to a php file. But I get a compilation error whenever I try to assign any value to these objects:
    Here is main.asc:
    <code>
    var variables = new LoadVars();
    variables.username = "uname";
    variables.send(http://url.abc.com/test.php,POST)
    </code>
    I can't compile with the second line. FMS just says: Sending error message: Compilation error
    How do I send variables to a HTTP URL?

    However that should be fine..
    This is sample way to send data using LoadVars
    var my_lv = new LoadVars();
    my_lv.name= "myname";
    my_lv.send("http://server/test.php", "_blank", "POST");
    Try keeping url and and POST method within "quotes". Also, method [POST/GET] is third parameter, second is target where results must be loaded (if any)..

  • Trying to make a php file work with my email form

    Hello,
    Going slightly mad trying to link my php file with my html and actually getting it to work.
    It (the php file) keeps coming up with a syntax error on line 37 - code hinting may not work etc etc but there is no error from what I can see - can anyone else point out the obviously to me? This is driving me around the bend!
    my code:
    <?php
    /*Subject and Email Variables */
        $emailSubject = 'Website Form';
        $webMaster = '[email protected]';
    /* Gathering Data Variables */
        $nameField = $_POST['name'];
        $addressField = $_POST['address'];
        $telephone1Field = $_POST['telephone1'];
        $telephone2Field = $_POST['telephone2'];
        $emailField = $_POST['email'];
        $name2Field = $_POST['name2'];
        $ageField = $_POST['age'];
        $dobField = $_POST['dob'];
        $commsField = $_POST['comms'];
        $messageField = $_POST['message'];
        $body = <<<EOD
    <br><hr><br>
    Name: $name <br>
    Address: $address <br>
    Telephone (daytime): $telephone1 <br>
    Telephone (mobile): $telephone2 <br>
    Email: $email <br>
    Childs Name: $name2 <br>
    Start Age: $age <br>
    Childs Date of Birth: $dob <br>
    Preferred form of communication: $comms <br>
    Message: $message <br>
    EOD;
        $headers = "From: $email\r\n";
        $headers .= "Content-type: text/html\r\n";
        $success = mail{$webMaster, $emailSubject,$body, $headers};
    /* Results rendered as HTML */
        $theResults = <<<EOD
    <html>
    <head>
    <title>Xxx</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    body {
        background-color: #f1f1f1;
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 12px;
        font-style: normal;
        line-height: normal;
        font-weight: normal;
        color: #666666;
        text-decoration: none;
    -->
    </style>
    </head>
    <div>
      <div align="left">Thank you for your message, Your email will be answered very soon!</div>
    </div>
    </body>
    </html>
    EOD;
    echo "$theResults";
    ?>

    Line 37 is this:
        $success = mail{$webMaster, $emailSubject,$body, $headers};
    It should be this:
        $success = mail($webMaster, $emailSubject, $body, $headers);
    Also the header for the From: is this:$headers = "From: $email\r\n"; but I don't see the variable defined for $email
    Also you should know about email injection. Someone could inject your headers and add additional BCC: addresses to send emails to many undisclosed recipients through your mail script. You'd be using your script to turn your server into a host for spam! Sanitize your fields to prevent injection attacks! Security should be the firt priority followed by functionality. If it's unsecure it shouldn't function

  • Editing a large PHP file, using {, }, (, ), or comma causing DW to lock-up

    I have a PHP file totalling around 7,000 lines of code. When I write { or }, ( or ), or a comma, at any point in the file, DW locks-up for a few seconds, then continues. This has been happening ever since I started using Dreamweaver CS4 - it never occurred with older versions.
    Any ideas?
    [Post moved to more appropriate forum -Forum Moderator]

    I don't have PHP files that are as long as that, so have no way of testing. However, one possibility is that Syntax Error Alerts are turned on. Dreamweaver CS4 doesn't check for PHP syntax errors; the syntax checker is for JavaScript. However, having the option turned on might cause the problem, because PHP and JavaScript both use braces and parentheses. Try turning off real-time syntax checking. It's toggled on and off by clicking the button in the Coding toolbar, as shown in the following screenshot:
    When turned on, the button looks pressed in like the two immediately above it in the screenshot.
    If that doesn't improve the situation, I suggest that you file a report to the Dreamweaver engineering team through the bug report form at http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform. Give as much detail as possible to help the engineers try to reproduce the problem.

  • How do i change the path of data ajax false from returning to homepage, when using a PHP mail form in jquery mobile?

    I have a put a php mail form in the quote page of my mobile site. However when i send the form it returns to the route page rather than the quote page, i have used the data ajax false action as i dont want to send via ajax. i have left the thanks page blank as i want it to remain on the same page showing sent or declined message.  Can someone help please? 
    <?php
    // OPTIONS - PLEASE CONFIGURE THESE BEFORE USE!
    $yourEmail = "[email protected]"; // the email address you wish to receive these mails through
    $yourWebsite = "www.firstcalltransport.co.uk"; // the name of your website
    $thanksPage = ''; // URL to 'thanks for sending mail' page; leave empty to keep message on the same page
    $maxPoints = 4; // max points a person can hit before it refuses to submit - recommend 4
    $requiredFields = "name,email,collection,delivery,comments"; // names of the fields you'd like to be required as a minimum, separate each field with a comma
    // DO NOT EDIT BELOW HERE
    $error_msg = array();
    $result = null;
    $requiredFields = explode(",", $requiredFields);
    function clean($data) {
      $data = trim(stripslashes(strip_tags($data)));
      return $data;
    function isBot() {
      $bots = array("Indy", "Blaiz", "Java", "libwww-perl", "Python", "OutfoxBot", "User-Agent", "PycURL", "AlphaServer", "T8Abot", "Syntryx", "WinHttp", "WebBandit", "nicebot", "Teoma", "alexa", "froogle", "inktomi", "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory", "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot", "crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz");
      foreach ($bots as $bot)
      if (stripos($_SERVER['HTTP_USER_AGENT'], $bot) !== false)
      return true;
      if (empty($_SERVER['HTTP_USER_AGENT']) || $_SERVER['HTTP_USER_AGENT'] == " ")
      return true;
      return false;
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
      if (isBot() !== false)
      $error_msg[] = "No bots please! UA reported as: ".$_SERVER['HTTP_USER_AGENT'];
      // lets check a few things - not enough to trigger an error on their own, but worth assigning a spam score..
      // score quickly adds up therefore allowing genuine users with 'accidental' score through but cutting out real spam
      $points = (int)0;
      foreach ($badwords as $word)
      if (
      strpos(strtolower($_POST['comments']), $word) !== false ||
      strpos(strtolower($_POST['name']), $word) !== false
      $points += 2;
      if (strpos($_POST['comments'], "http://") !== false || strpos($_POST['comments'], "www.") !== false)
      $points += 2;
      if (isset($_POST['nojs']))
      $points += 1;
      if (preg_match("/(<.*>)/i", $_POST['comments']))
      $points += 2;
      if (strlen($_POST['name']) < 3)
      $points += 1;
      if (strlen($_POST['comments']) < 15 || strlen($_POST['comments'] > 1500))
      $points += 2;
      if (preg_match("/[bcdfghjklmnpqrstvwxyz]{7,}/i", $_POST['comments']))
      $points += 1;
      // end score assignments
      foreach($requiredFields as $field) {
      trim($_POST[$field]);
      if (!isset($_POST[$field]) || empty($_POST[$field]) && array_pop($error_msg) != "Please fill in all the required fields and submit again.\r\n")
      $error_msg[] = "Please fill in all the required fields and submit again.";
      if (!empty($_POST['name']) && !preg_match("/^[a-zA-Z-'\s]*$/", stripslashes($_POST['name'])))
      $error_msg[] = "The name field must not contain special characters.\r\n";
      if (!empty($_POST['email']) && !preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])(([a-z0-9-])*([a-z0-9]))+ ' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i', strtolower($_POST['email'])))
      $error_msg[] = "That is not a valid e-mail address.\r\n";
      if (!empty($_POST['url']) && !preg_match('/^(http|https):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\ /?/i', $_POST['url']))
      $error_msg[] = "Invalid website url.\r\n";
      if ($error_msg == NULL && $points <= $maxPoints) {
      $subject = "Automatic Form Email";
      $message = "You received this e-mail message through your website: \n\n";
      foreach ($_POST as $key => $val) {
      if (is_array($val)) {
      foreach ($val as $subval) {
      $message .= ucwords($key) . ": " . clean($subval) . "\r\n";
      } else {
      $message .= ucwords($key) . ": " . clean($val) . "\r\n";
      $message .= "\r\n";
      $message .= 'IP: '.$_SERVER['REMOTE_ADDR']."\r\n";
      $message .= 'Browser: '.$_SERVER['HTTP_USER_AGENT']."\r\n";
      $message .= 'Points: '.$points;
      if (strstr($_SERVER['SERVER_SOFTWARE'], "Win")) {
      $headers   = "From: $yourEmail\r\n";
      } else {
      $headers   = "From: $yourWebsite <$yourEmail>\r\n";
      $headers  .= "Reply-To: {$_POST['email']}\r\n";
      if (mail($yourEmail,$subject,$message,$headers)) {
      if (!empty($thanksPage)) {
      header("Location: $thanksPage");
      exit;
      } else {
      $result = 'Your mail was successfully sent.';
      $disable = true;
      } else {
      $error_msg[] = 'Your mail could not be sent this time. ['.$points.']';
      } else {
      if (empty($error_msg))
      $error_msg[] = 'Your mail looks too much like spam, and could not be sent this time. ['.$points.']';
    function get_data($var) {
      if (isset($_POST[$var]))
      echo htmlspecialchars($_POST[$var]);
    ?>
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Untitled Document</title>
    <link href="CSS/stylesheetnew.css" rel="stylesheet" type="text/css">
    <link href="../jquery-mobile/jquery.mobile-1.0a3.min.css" rel="stylesheet" type="text/css">
    <script src="../jquery-mobile/jquery-1.5.min.js" type="text/javascript"></script>
    <script src="../jquery-mobile/jquery.mobile-1.0a3.min.js" type="text/javascript"></script>
    <style type="text/css">
      p.error, p.success {
      font-weight: bold;
      padding: 10px;
      border: 1px solid;
      p.error {
      background: #ffc0c0;
      color: #F00;
      p.success {
      background: #b3ff69;
      color: #4fa000;
    </style>
    </head>
    <body>
    <div data-role="page" id="home">
      <div data-role="header" data-position="fixed">
       <h1>FIRSTCALL TRANSPORT</h1>
    </div>
        <div data-role="navbar" data-position="fixed">
                                    <ul>
                                      <li><a href="#about">About</a></li>
                                      <li><a href="#services">Services</a></li>
                                      <li><a href="#contact">Contact</a></li>
                                      <li><a href="#quote">Quote</a></li>
                                    </ul>
      </div>
      <div data-role="content"> </div>
         <div data-role="footer" data-position="fixed" > </div>
    </div>
    </div>
    <div data-role="page" id="quote">
      <div data-role="header" data-position="fixed">
        <h1>GET A QUOTE</h1>
      </div>
      <div data-role="content">
       <?php
    if (!empty($error_msg)) {
      echo '<p class="error">ERROR: '. implode("<br />", $error_msg) . "</p>";
    if ($result != NULL) {
      echo '<p class="success">'. $result . "</p>";
    ?>
    <form action="<?php echo basename(__FILE__); ?>" method="post" data-ajax="false"  >
    <noscript>
      <p><input type="hidden" name="nojs" id="nojs" /></p>
    </noscript>
    <p>
      <label for="name">Name: *</label>
      <input type="text" name="name" id="name" value="<?php get_data("name"); ?>" /><br />
      <label for="email">E-mail: *</label>
      <input type="text" name="email" id="email" value="<?php get_data("email"); ?>" /><br />
            <label for="company">Company:</label>
      <input type="text" name="company" id="company" value="<?php get_data("company"); ?>" /><br />
      <label for="collection">Collection: *</label>
      <input type="text" name="collection" id="collection" value="<?php get_data("collection"); ?>" /><br />
        <label for="delivery">Delivery: *</label>
      <input type="text" name="delivery" id="delivery" value="<?php get_data("delivery"); ?>" /><br />
      <label for="comments">Message: *</label>
      <textarea name="comments" id="comments" rows="5" cols="20"><?php get_data("comments"); ?></textarea><br />
      <input type="submit" name="submit" id="submit" value="Send" <?php if (isset($disable) && $disable === true) echo ' disabled="disabled"'; ?> />
    </p>
    </form>  </div>
         <div data-role="footer" >  </div>
      </div>
      </div>           
    </body>
    </html>

    My wife has left me for four weeks, favouring to be with our son who lives 4,000 km away. I now have to cook for myself and the steaks taste horrible. What am I doing wrong?
    If you do not know what I have (not) done to make the steak taste horrible, my question is as hard to answer as your question above.
    Please give us more info like giving us the code that sends the page to the homepage rather than to the previous page.

  • Firefox keeps asking me to open/download PHP file when it used to be able to display properly.

    I use to be able to view local PHP files normally in Firefox with the PHP parts not rendered while the HTML parts are. Now all it does is ask whether I want to open or save it.
    I've tried editing FF options so that it previews in FF but it doesn't accept any changes. I've cleared my cache and all that. I've tried deleting the mimeTypes.rdf file thing but I can't even find the folder it's in. I've tried disabling/enabling "prompts.tab_modal.enabled" in about:config and restarting FF.
    All are no-go solutions.
    Web PHP pages are loading properly, this problem only comes when I'm trying to load local PHP files. I don't want to install XAMPP or PHP on my computer just to view local files as I never had this problem before.
    In the meantime, I've installed Chrome and it's loading a simple local PHP file just fine whereas FF is asking me to save/download when opening the SAME file. Thanks in advance for any help.

    Yup, deleting mimeTypes.rdf and re-starting did the trick this time. Thanks very much!
    Also, on a somewhat related note, I cannot view mozillazine.org and any sub-domains under it in any browsers. This may be happening to other users as well?
    It's always stuck at "Waiting for ..." or "Connecting to ..." and that's it. Then FF gives up with a "Server connection time-out" notice. Clearing cache and all that doesn't work because I was trying to view those pages before starting this topic.

  • 405 error loading a php file using fastCGI

    I'll start off by admitting I'm brand new to JWS. I really appreciate anyone willing to help with this configuration:
    GOAL: Install the PHP Engine as a FastCGI Server
    http://developers.sun.com/webtier/reference/techart/php2.html#4
    I've read a lot of pages on this, and "thought" I had my configuration right.
    I'm running SLES 10, and installed php fastcgi using yast2. The path to my php is /usr/bin/php-cgi5. I have copied that file to my plugins directory, as I heard it has to be in a location that web server can reach: /sun/webserver7/plugins/php/php-cgi5.
    My configs:
    obj.conf
    <Object name="default">
    AuthTrans fn="match-browser" browser="*MSIE*" ssl-unclean-shutdown="true"
    NameTrans fn="restart" from="/" uri="/admingui/"
    NameTrans fn="ntrans-j2ee" name="j2ee"
    ##Me added
    # Make everything in URI "/php" come from"/path/to/php" and
    # be executed as PHP using the directives in the Object
    # named "fastcgi" (defined below)
    NameTrans fn="pfx2dir"
    from="/php"
    dir="/path/to/php"
    name="fastcgi"
    ##End Me added
    PathCheck fn="uri-clean"
    PathCheck fn="check-acl" acl="default"
    PathCheck fn="find-pathinfo"
    PathCheck fn="find-index-j2ee"
    PathCheck fn="find-index" index-names="index.html,home.html,index.jsp"
    ObjectType fn="type-j2ee"
    ObjectType fn="type-by-extension"
    ObjectType fn="force-type" type="text/plain"
    Service method="(GET|HEAD)" type="magnus-internal/directory" fn="index-common"
    Service method="(GET|HEAD|POST)" type="*~magnus-internal/*" fn="send-file"
    Service method="TRACE" fn="service-trace"
    Error fn="error-j2ee"
    AddLog fn="flex-log"
    ##Me Added
    # Execute all things with a MIME type of
    # "magnus-internal/fastcgi" with options (this requires that
    # mime.types be updated to assign this type
    # for specified extensions - see below):
    # bind-path: localhost:8082
    # app-path: /export/my/cgi/php
    # min-procs: 1
    # PHP_FCGI_CHILDREN: 1
    # PHP_FCGI_MAX_REQUEST: 200
    # LD_LIBRARY_PATH: /usr/local/php/lib
    # PHPRC: /path/to/php/config/dir
    # The LD_LIBRARY_PATH can be used to indicate the location
    # of the local system's MySQL libraries, etc.
    # Note that the PHPRC variable points to the directory
    # containing php.ini, not to php.ini itself.
    # This can be a single line or a line continued using
    # the syntax below
    Service type="magnus-internal/fastcgi"
    fn="responder-fastcgi"
    bind-path="localhost:8082"
    app-path="/export/my/cgi/php"
    min-procs="1"
    app-env="PHP_FCGI_CHILDREN=1"
    app-env="PHP_FCGI_MAX_REQUEST=200"
    app-env="LD_LIBRARY_PATH=/usr/local/php/lib"
    app-env="PHPRC=/path/to/php/config/dir"
    ##End Me added
    </Object>
    <Object name="j2ee">
    Service fn="service-j2ee" method="*"
    </Object>
    <Object name="es-internal">
    PathCheck fn="check-acl" acl="es-internal"
    </Object>
    <Object name="cgi">
    ObjectType fn="force-type" type="magnus-internal/cgi"
    Service fn="send-cgi"
    </Object>
    <Object name="send-precompressed">
    PathCheck fn="find-compressed"
    </Object>
    <Object name="compress-on-demand">
    Output fn="insert-filter" filter="http-compression"
    </Object>
    ##Me Added
    # Object to handle assigned names from the Default object
    <Object name="fastcgi">
    # Anything that ends up here has its type forced to
    # "magnus-internal/fastcgi"
    ObjectType fn="force-type"
    type="magnus-internal/fastcgi"
    # Run the request through the FastCGI handler with
    # the following options:
    # bind-path: localhost:8082
    # app-path: /export/my/cgi/php
    # min-procs: 1
    # PHP_FCGI_CHILDREN: 1
    # PHP_FCGI_MAX_REQUEST: 200
    # LD_LIBRARY_PATH: /usr/local/php/lib
    # PHPRC: /path/to/php/config/dir
    # The LD_LIBRARY_PATH can be used to indicate the location
    # of the local system's MySQL libraries, etc.
    # Note that the PHPRC variable points to the directory
    # containing php.ini, not to the php.ini itself.
    # This can be a single line or a line continued using
    # the syntax below
    Service type="magnus-internal/fastcgi"
    fn="responder-fastcgi"
    bind-path="localhost:8082"
    app-path="/sun/webserver7/plugins/php/php-cgi5"
    min-procs="1"
    app-env="PHP_FCGI_CHILDREN=1"
    app-env="PHP_FCGI_MAX_REQUEST=200"
    app-env="LD_LIBRARY_PATH=/usr/local/php/lib"
    app-env="PHPRC=/etc/php5/fastcgi/"
    </Object>
    magnus.conf
    Init fn="load-modules" shlib="libj2eeplugin.so"
    Init fn="load-modules" shlib="libdavplugin.so" funcs="init-dav,ntrans-dav,pcheck-dav,service-dav"
    Init fn="init-dav" LateInit="yes"
    Init fn=load-modules shlib="libfastcgi.so"
    mime.types (relevant sections only)
    type=magnus-internal/parsed-html exts=shtml
    type=magnus-internal/cgi exts=cgi,exe,bat,php
    type=magnus-internal/fastcgi exts=php,php3,php4,php5
    I'm not convinced that I have specified all the php directories as requested. Perhaps something looks off there?
    I currently have nothing configured in the fastCGI section of the web admin for the server.
    The default page still loads just fine, it's only php files i'm having issue with.
    The error I'm receiving is (IP removed):
    for host X.X.X.X trying to GET /foo.php, handle-processed reports: HTTP2205: The request method is not applicable to the requested resource.
    Thanks,
    Nick

    Thank you so much for the reply. yes, that appeared to be a typo in my config. Here's the new relevant section
    <Object name="default">
    AuthTrans fn="match-browser" browser="*MSIE*" ssl-unclean-shutdown="true"
    NameTrans fn="restart" from="/" uri="/admingui/"
    NameTrans fn="ntrans-j2ee" name="j2ee"
    ##Me added
    # Make everything in URI "/php" come from"/path/to/php" and
    # be executed as PHP using the directives in the Object
    # named "fastcgi" (defined below)
    NameTrans fn="assign-name" from="/php/*" name="fastcgi"
    NameTrans fn="pfx2dir" from="/php/*" name="fastcgi"
    ##End Me added
    PathCheck fn="uri-clean"
    PathCheck fn="check-acl" acl="default"
    PathCheck fn="find-pathinfo"
    PathCheck fn="find-index-j2ee"
    PathCheck fn="find-index" index-names="index.html,home.html,index.jsp"
    ObjectType fn="type-j2ee"
    ObjectType fn="type-by-extension"
    ObjectType fn="force-type" type="text/plain"
    Service method="(GET|HEAD)" type="magnus-internal/directory" fn="index-common"
    Service method="(GET|HEAD|POST)" type="*~magnus-internal/*" fn="send-file"
    Service method="TRACE" fn="service-trace"
    Error fn="error-j2ee"
    AddLog fn="flex-log"#####################
    I wasn't sure from your prior message if both of the following lines should be in there:
    NameTrans fn="assign-name" from="/php/*" name="fastcgi"
    NameTrans fn="pfx2dir" from="/php/*" name="fastcgi"
    I tried with both, tried with just the first, and still getting a 405. Not sure if i need to, but I am restarting the instance after making changes.
    I also tried putting my test file in both the webroot directory:
    /sun/webserver7/https-myhostname/docs/foo.php
    and in a php subdir of that
    /sun/webserver7/https-myhostname/docs/php/foo.php
    Still no luck.
    Thanks,
    Nick
    Edited by: wefawefds on Oct 30, 2009 1:54 PM

  • How to use PO message type to output 'Form' as PDF file

    Dear experts,
      I am working for a topic of how to use PO message type to output 'Form' as 'PDF file', and save to external file system automatically.
      Any one familiar to this topic, please kindly give me some guide, thank you!
    Regards,
    Joyce

    Hi,
       Go through the program RSTXPDFT4 (Converting SAPscript (OTF) or ABAP List Spool Job to PDF), you will get some idea.  Using this program you can convert spool into PDF file.
    -Alpesh

  • .php files are not being opened within Mozilla FF

    Well, I'm learning PHP, and, although a file whose code is illustrated at www.w3schools.com, is being displayed within Adobe Dreamweaver, it does not seem possible to open the same file within the browsers installed on my pc, including Mozilla FF. It seems that this problem was noted by other people in the past however, I came across no solution.
    '''index.php'''
    ''<html>
    <body>
    <?php
    echo addcslashes("failure","|");
    ?>
    </body>
    </html>''
    PHP 5 is installed on my Win XP 5 laptop. Any ideas please?

    Sorry I think the problem is simply that Adobe Dreamweaver is the default .php file viewer.

Maybe you are looking for

  • How do I return a bad app and get a refund ?

    Hello, I've recently purchased the application Tagalicious from the Mac App Store. Unfortunately this app does not work as from the moment I open it a window appears telling me "Failed to load your music library". The help menu tells me I have to hav

  • ORM as a Resource in OIM

    Hi, Can we make ORM as a resource in OIM? So that we can assign ORM as an application to a user in OIM. Please tell me if you have any idea in this issue........ Thanks

  • Transport Import History save to spread sheet

    Hi, I have successfully saved the Transport import history as a spreadsheet. i.e. System > List > save > local file > Spreadsheet However, the Return code column is blank? Probably becuase the image did not convert to text? Does anyone maybe know wha

  • Beginner needs help with CMR field problem

    Hello, I have two ejbs, one called EstablishmentEJB and another called VisitorCommentsEJB. The relationship is of one EstablishmentEJB instance to many VisitorCommentsEJB instances. Here are the definitions for the tables: CREATE TABLE establishments

  • Approve critical objects in transport requests (ChaRM)

    Hi folks! When trying to create transport of copies from within a Change Document (status 'to be tested') the system checks for critical objects in transport requests and prompts a warning that critical objects are to be approved. I do not want the C