Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
  1. #1
    Junior Member sunNsmog's Avatar
    Join Date
    Apr 2013
    Location
    CA
    Posts
    6
    Member #
    36144
    Ok so I'm updating a current website using Dreamweaver CS5 and in the test view I find that my "contact" page has a part of what I believe is a php code (see 1st attached image). I didn't edit this part of the site yet when I go to the live page it's not there nor is it in the source when I view it. I found the part of the code that shows up in my php file (see 2nd attached image) but I can't figure out what's wrong with it to make it go away. I'm afraid if I delete it to match the live source code, it won't work properly.

    p.s. I'm a product designer so my knowledge of this stuff is very limited. Here's other info you might need:
    I had to define my local server as the previous file was used in another computer that no longer has Dreamweaver but the file source is located in the same shared driver. All I did was update a few images, I don't understand what happened here :/

    Any help is greatly appreciated! Thanks in advance...Screen shot of php code on site.jpgScreen shot of PHP coding problem.jpg

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    Can you show us a link to your website online?

    It seems like you might be calling your scripts something.html (.html extension).
    You need to use .php for PHP scripts. Likewise, you must upload the files to your website and view them online. PHP is a server-side scripting language. Either use your webhost/website, or create your own server (WAMP).


  4. #3
    Junior Member sunNsmog's Avatar
    Join Date
    Apr 2013
    Location
    CA
    Posts
    6
    Member #
    36144
    yes it's http://www.airlessbottles.com/

    I haven't uploaded it to website because I'm afraid that code will show up and since I didn't write it to begin with, I wouldn't know how to get it back.


    Thanks so much for your help...

  5. #4
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    Post the entire file (script) called "contact.php"

    If you have one called "contact.html", then you're already in trouble.
    I want to see "contact.php".

    EDIT:
    I just saw another problem with the "contact.php" page you have on the site now.

    This appears twice:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>

    That needs to be fixed.


  6. #5
    Junior Member sunNsmog's Avatar
    Join Date
    Apr 2013
    Location
    CA
    Posts
    6
    Member #
    36144
    It's a contact.php

    How should I post the entire php file? sorry..

    and thanks for catching that duplicate!

  7. #6
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    Put it in the edit box ... the post reply box when you reply to this post.
    Paste the whole thing. Then highlight the whole thing and click the {}# icon to wrap it in code format.

    To avoid all of the rich text colors and junk, you can first click the A icon in the upper right corner to get out of the rich text mode. You'll see this stuff I'm talking about when you reply to this post.


  8. #7
    Junior Member sunNsmog's Avatar
    Join Date
    Apr 2013
    Location
    CA
    Posts
    6
    Member #
    36144
    PHP Code:
    <!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">
    <head>
     
    <META NAME="keywords" CONTENT="airlessbottles, airless botttles, airless bottle, airlessbottle, Airless lotion bottles,
    10ml airless bottles,
    5ml airless bottles,
    15ml airless bottles,
    Metal over shell,
    Airless bottles,
    Custom decorated airless bottles,
    Spa airless bottles,
    Foundation airless bottles,
    Eye serum airless bottles,
    Cosmetic airless bottles,
    airless bottles and pumps,
    empty airless cosmetic bottles,
    airlessbottle supplier, airless bottle supplier, empty airless bottle,
     
    ">
     
     
     
    <META NAME="Description" CONTENT="Airless lotion bottles,
    packaging and cosmetic manufacturers of Airless Bottles">
     
     
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="style.css" />
     
    <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
     
    <script type="text/javascript" src="js/prototype.js"></script>
    <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
    <script type="text/javascript" src="js/lightbox.js"></script>
    <title>Airless Cosmetic Bottles</title>
    </head>
     
     
    <body>
     
    <div id="pagewrap">
     
     
     
    <div id="navigation">
    <ul>
    <li><a href="index.html">Home</a></li>
    <li><a href="contact.php">Contact Us</a></li>
    <li><a href="services2.html">Services</a></li>
    </ul>
    </div> 
     
     
    <div id="header">
    <br />
    <h1><A HREF="http://www.airlessbottles.com"><img src="airless-bottles2.png" width="900" height="150" /></A>
    </div><!--endsHeader-->
    <br />
    <br />
     
     
    <?php
            
    /****SET THE MAX CHARS FOR EACH MESSAGE***************/
               
                //it is recommended not to set the max too high, to prevent extremely long messages
                // from stalling your server
               
                
    $EMAIL_MAX 2500;
           
            
    /*****************************************************/
     
            //function for stripping whitespace and some chars
            
    function cleanUp($str_to_clean$newlines$spaces){
           
                
    //build list of whitespace chars to be removed
                
    $bad_chars = array('\r''\t'';');
           
                
    //if newlines are false, add that to the list of bad chars
                
    if(!$newlines){array_push($bad_chars'\n');}
               
                
    //if spaces are false, strip them too
                
    if(!$spaces){array_push($bad_chars' ');}
               
                
    $str_to_clean_a str_replace($bad_chars''$str_to_clean);
                
    $str_to_clean_b strip_tags($str_to_clean_a);
                return 
    $str_to_clean_b;
            }
           
            
    //function to check for valid email address pattern
            
    function checkEmail($email) {
                if(!
    eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$email)) {return false;}
                return 
    true;
            }
            
    //function to check for valid url pattern
            
    function checkURL($url) {
                if(!
    eregi("^http:\/\/"$url)) {return false;}
                return 
    true;
            }
    ?>
     
        <title>Contact Form</title>
        <style type="text/css">
            /* BASIC STYLES */
            body{font-family: 'Lucida Grande',Trebuchet, Tahoma, sans-serif;color:#222;font-size:11px;}
            fieldset{margin:0;padding:0;border:0;}
            label{width:250px; display:block;}
            .txt_input{width:250px; display:block;}
            textarea{height:80px; width:250px;}
            input{display:block;}
            .req{color:#f00;font-size:90%;}
            #form_errors{color:#f00; display:none;}
            #form_thanks{color:#000; display:none;}
        </style>
     
        <script type="text/javascript">
    v_fields = new Array('sender_name','sender_email','sender_subject','sender_url','sender_phone','sender_message');alert_on = true;thanks_on = true; thanks_message = "Thank you. Your message has been sent.";   
        function validateForm(){
           
            //alert(v_fields);
           
            //init errors
            var err = "";
           
            //start checking fields
            for(i=0;i<v_fields.length;i++){
               
                //store the field value
                var _thisfield = eval("document.contact."+v_fields[i]+".value");
               
                //check the field value
                if(v_fields[i] == "sender_name"){
                    if(!isAlpha(_thisfield)){ err += "Please enter a valid name\n";}
                }else if(v_fields[i] == "sender_subject"){
                    if(!isAlpha(_thisfield)){ err += "Please enter a valid subject\n";}
                }else if(v_fields[i] == "sender_email"){
                    if(!isEmail(_thisfield)){ err += "Please enter a valid email address\n";}
                }else if(v_fields[i] == "sender_url"){
                    if(!isURL(_thisfield)){ err += "Please enter a valid URL\n";}
                }else if(v_fields[i] == "sender_phone"){
                    if(!isPhone(_thisfield)){ err += "Please enter a valid phone number\n";}
                }else if(v_fields[i] == "sender_message"){
                    if(!isText(_thisfield)){ err += "Please enter a valid message\n";}
                }
               
            }//end for
           
            if(err != ""){
                if(alert_on){
                    alert("The following errors have occurred\n"+err);
                }else{
                    showErrors(err);
                }
               
                return false;
           
            }
           
            return true;
        }
       
        //function to show errors in HTML
        function showErrors(str){
            var err = str.replace(/\n/g,"<br />");
            document.getElementById("form_errors").innerHTML = err;
            document.getElementById("form_errors").style.display = "block";
       
        }
       
        //function to show thank you message in HTML
        function showThanks(str){
            var tym = str.replace(/\n/g,"<br />");
            document.getElementById("form_thanks").innerHTML = tym;
            document.getElementById("form_thanks").style.display = "block";
       
        }
       
        function isEmail(str){
        if(str == "") return false;
        var regex = /^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i
        return regex.test(str);
        }
       
        function isText(str){
            if(str == "") return false;
            return true;
        }
       
        function isURL(str){
            var regex = /[a-zA-Z0-9\.\/:]+/
            return regex.test(str);
        }
       
        // returns true if the number is formatted in the following ways:
        // (000)000-0000, (000) 000-0000, 000-000-0000, 000.000.0000, 000 000 0000, 0000000000
        function isPhone(str){
            var regex = /^\(?[2-9]\d{2}[\)\.-]?\s?\d{3}[\s\.-]?\d{4}$/
            return regex.test(str);
        }
       
        // returns true if the string contains A-Z, a-z or 0-9 or . or # only
        function isAddress(str){
            var regex = /[^a-zA-Z0-9\#\.]/g
            if (regex.test(str)) return true;
            return false;
        }
       
        // returns true if the string is 5 digits
        function isZip(str){
            var regex = /\d{5,}/;
            if(regex.test(str)) return true;
            return false;
        }
       
        // returns true if the string contains A-Z or a-z only
        function isAlpha(str){
            var regex = /[a-zA-Z]/g
            if (regex.test(str)) return true;
            return false;
        }
       
        // returns true if the string contains A-Z or a-z or 0-9 only
        function isAlphaNumeric(str){
            var regex = /[^a-zA-Z0-9]/g
            if (regex.test(str)) return false;
            return true;
        }
     
    </script>

  9. #8
    Junior Member sunNsmog's Avatar
    Join Date
    Apr 2013
    Location
    CA
    Posts
    6
    Member #
    36144
    PHP Code:
        <?php
        
    if(isset($_POST["submitForm"])){
     
            
    $_name cleanUp($_POST["sender_name"], falsetrue);
     
            
    $_email cleanUp($_POST["sender_email"], falsefalse);
     
            
    $_subject cleanUp($_POST["sender_subject"], falsetrue);
     
            
    $_message cleanUp($_POST["sender_message"], truetrue);
     
            
    $_url cleanUp($_POST["sender_url"], falsefalse);
     
            
    $_phone cleanUp($_POST["sender_phone"], falsetrue);
     
           
            
    $_body "You have been sent this message from your contact form\n\n";
           
            if(
    $_name){
                
    $_body .= "NAME: $_name\n\n";
            }
           
            if(
    $_email){
                
    $_body .= "EMAIL: $_email\n\n";
            }
           
            if(
    $_url){
                
    $_body .= "URL: $_url\n\n";
            }
           
            if(
    $_phone){
                
    $_body .= "PHONE: $_phone\n\n";
            }
           
            if(
    $_message){
           
                
    //check length of body, reduce to max chars
                
    if(strlen($_message) > $EMAIL_MAX){$_messagesubstr($_message0$EMAIL_MAX);}else{$_message $_message;}
                if(
    strlen($_message) > $SMS_MAX){$_message2 substr($_message0$SMS_MAX);}else{$_message2 $_message;}
            }
           
           
     
            
    //store the recipient(s)
            
    $_to = array();
     
            
    //now get the recipient(s)
            
    $_to[] = "airlessbottles@gmail.com";
           
            
    //define the subject
            
    if(!$_subject){$_subject "E-Mail from your contact form";}
     
           
            if(!
    $_name){$_name "CONTACT FORM";}
            if(!
    $_email){$_email $_name;}
           
            
    //set the headers
            
    $_header "From: $_name < $_email >" "\r\n" .
        
    "Reply-To: ".$_email."\r\n" .
        
    "Super-Simple-Mailer: supersimple.org";
           
            
    //we can send up to 2 emails (EMAIL and/or SMS)
            
    if(count($_to) > 2){ $_to array_slice($_to,0,2);}
           
            for(
    $i=0;$i<count($_to);$i++){
               
                
    //get the correct message, based on where it is delivering to
                
    if(strstr($_to[$i],"teleflip.com")){$_text $_body.$_message2;}else{$_text $_body.$_message;}
               
                
    //send the email(s)
                
    mail($_to[$i], $_subject$_text$_header);
               
            }
           
            echo 
    "<script type=\"text/javascript\">window.onload = function(){showThanks(thanks_message);}</script>";
        }
        
    ?>
     
    </head>
    <body>
    <div id="container">
    <div class="contact">
                   
            <fieldset style="float:left;">
            <p id="form_errors"></p>
            <p id="form_thanks"></p>
            <form name="contact" action="<?=$_SERVER['PHP_SELF']?>" method="post" onsubmit="return validateForm();">
     
            <label>Your Name <span class="req">*</span></label>
            <input type="text" class="txt_input" name="sender_name" />
     
            <label>Your E-Mail <span class="req">*</span></label>
            <input type="text" class="txt_input" name="sender_email" />
     
            <label>Subject <span class="req">*</span></label>
            <input type="text" class="txt_input" name="sender_subject" />
     
            <label>URL <span class="req">*</span></label>
            <input type="text" class="txt_input" name="sender_url" />
     
            <label>Telephone <span class="req">*</span></label>
            <input type="text" class="txt_input" name="sender_phone" />
     
            <label>Message <span class="req">*</span></label>
            <textarea name="sender_message"></textarea>
            <input type="submit" name="submitForm" value="Submit" />
            </form>
            </fieldset>
        </div>
       
    </div>
     
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    Telephone: (562) 434-5583<br />
    Fax: (562) 438-6466
     
    </div><!--endspagewrap-->
     
     
    <div id="footer">
    <a href="mailto:michael@thepkgco.com">Contact us<a/> &nbsp; | &nbsp; <a href="mailto:michael@thepkgco.com?subject=Quote Request Inquiry"> Quote Request</a> &nbsp;| &nbsp; 562.434.5583 <br /><br />
    Airless Bottles 2011
    </div><!--endsFooter-->
     
     
    </div>
    </body>
    </html>

  10. #9
    Junior Member sunNsmog's Avatar
    Join Date
    Apr 2013
    Location
    CA
    Posts
    6
    Member #
    36144
    I had to split it up, hopefully I did that right.

  11. #10
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    I've seen this happen when the code block begins with <? as opposed to <?php . There's a name for this, but I'm not a PHP guy by nature so I don't know what it is. So try <?php if the "php" part is missing.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:20 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com