Jump to content

williamrouse

Member
  • Posts

    150
  • Joined

  • Last visited

Posts posted by williamrouse

  1. Well I got this to work.

    First this is modifying a procedural PHP script that I found some time ago with a OPPs PHP tutorial that I saw maby a week ago and stuffing the procedural script into the OOP version.

    I tested in my developing environment and I can send emails from my home machine and then the emails are redirected back to my mail box. I don?t see why it won?t work on my site but I will put it up there tomorrow and check.

    The routine required me to create an account that I left in place so that it reads better where the username email and passwords go.

    There are two files. The style sheet is not enclosed in this email but if you ignore the HTML you should be able to follow the flow of the contact form that collects the information is sent to a second file that checks some parameters and concatenates others and sends the file. It?s not a big deal if you know PHP, but I don?t.

    One more thing I just realized that I did not mention the second file needs presentation, I did not put that in yet.

    contactform.php

    
    
    
    
    
    
    
    
    
       content="software engineer, web development, graphics, website design, PHP, MySQL, Java, JavaScript, HTML, CSS," />
       content="The Home page of William Bradley Rouse. Includes software and work description." />
    
    
    
    
    
    
    
       content="Copyright ? 2008 William Bradley Rouse. All Rights Reserved." />
    
    
    
    W. Bradley Rouse - About Me 
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
       <?php include("include/branding.inc"); ?>
    
    
    
       <?php include("include/leftContent.inc"); ?>
    
    
    
     Contact Form
    
     All Fields required
    
    
    
    
    <?php
    $ipi = getenv("REMOTE_ADDR");
    $httprefi = getenv ("HTTP_REFERER");
    $httpagenti = getenv ("HTTP_USER_AGENT");
    ?>
    
    
    
    
    
    OOP Contact Form
    
    
    
    
    Name: 
    
    Email Address: 
    
    Phone: 
    
    Attention:
    
    Web Developoment 
    Web Related Assistance 
    Java Assistance 
    Technical Support 
    Employment
    Photography
    Hobbies
    
    
    Time of day to call back:
    
    Morning
    After Noon
    Evening
    
    
    Questions/Comments:     
    
    
    
    
    
    
    
    
    
    
    
    
    

     

    sendEmail02.php

    <?php
       // This won't except comments with http in it?
    if (eregi('http:', $notes)) {
       die ("Do NOT try that! ! ");
    }
    $ip = $_POST['ip'];
    $httpref = $_POST['httpref'];
    $httpagent = $_POST['httpagent'];
    $name = trim ($_POST['name']);
    $email = trim($_POST['email']);
    $phone = trim($_POST['phone']);
    $attn = trim($_POST['attn']);
    $con_time = trim($_POST['con_time']);
    $comments = trim($_POST['comments']);
    
    $site_owners_email = 'mailer@rouse.ws'; // Replace this with your own email address
    $site_owners_name = 'William Rouse'; // replace with your name
    
    // Cheap check for a vaild name
    if (strlen($name) < 2) {
       $error['name'] = 'Please enter your name';
    }
    
       // check for a valid email address [have no idea how this works
    if (!preg_match('/^[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*+[a-z]{2}/is', $email)) {
       $error['email'] = "Please enter a valid email address";
    }
    
    // check for a valid comment
    if (strlen($comments) < 3) {
       $error['comments'] = 'Please leave a comment.';
    }
    
    if (!$error) {
    
       require_once ('phpMailer/class.phpmailer.php'); // bring in the include file
       $todayis = date("l, F j, Y, g:i a") ;           //get todays date
       $myMail = new PHPMailer();     
    
       $myMail->From = $email;
       $myMmail->FromName = $name;
       $myMail->Subject = 'Website Contact Form';
       $myMail->AddAddress($site_owners_email, $site_owners_name);
       $myMail->AddAddress('mailer@rouse.ws');
       $myMail->Body = "$todayis [CST] \n
                       Attention: $attn \n
                       Contact Time: $con_time \n
                       Message: $comments \n
                       From: $name \n
                       Phone: $phone \n
                       Additional Info : IP = $ip \n
                       Browser Info: $httpagent \n
                       Referral : $httpref \n
                       From the Rouse web site.\n
                       ";
    
       $myMail->Mailer = 'smtp';
       $myMail->Host = 'mail.rouse.ws';
       $myMail->Port = 2525; //Site Ground email suggest this //587; //465 Original author suggested last 2
       $myMail->SMTPSecure = 'tls';
       $myMail->SMTPAuth = true; // turn on SMTP authentication
       $myMail->Username = 'mailer+rouse.ws'; // SMTP username
       $myMail->Password = 'pr0gramm3r'; // SMTP password -- Don't know
    
    
       $myMail->Send();
       echo " Congratulations, '.$name.'. We've received your email. We'll be in touch as soon as we possibly can! ";
    
    } # end if no error 
    else {
    
       $response = ( isset ($error['name']))?''.$error['name'].' \n':null;
       $response .= ( isset ($error['email']))?''.$error['email'].' \n':null;
       $response .= ( isset ($error['comments']))?''.$error['comments'].'':null;
    
       echo $response;
    } # end if there was an error sending 
    
    ?>
    

     

    WBR

  2. Monkeysaurus:

    I will post this soon. I am almost there. I finally got mail to come to me but the contents are not what I thought I was sending and I don't know how to work the PHP debugger in this system so it's taking a while.

    WBR

  3. Benjamin:

    Thanks for responding. You are probably correct in saying that I will not find exactly what I am looking for since I searched the web this morning for the tutorial or file that I wrote about here. I took a look at Stefan video last night. I am well experienced in the OOPs world having coded in C++ and Java for far too many years. The web is new to me and in my PHP code that I wrote to exercise my knowledge in PHP OPP still has a few glitches that I cant resolve and can?t find an answer in the PHP mail package documentation, so I thought I would give it a try here since you folks have been REALLY helpful to me. If you have any pull with Stefan ask him to stop what he is doing and jump to a tutorial on PHP OOPs contact form.

    Thanks!

    WBR

  4. I am looking for a PHP tutorial or a script to write a small email contact form in OOP not the procedural method. I would like to use the mail server connected to my hosting services as opposed to sending it through Google. As anyone seen this?

    Thanks!

    WBR

  5. In my test definition of

    tag, I placed the following code, to exagerate the effect, but nothing was visible.

        
    border-left: 5px;
    border-left-color: rgb(255,0,0);
    border-right: 5px;
    border-right-color: rgb(0,0,255);
    

    Should this not place a border on both sides of the text?

  6. I am researching with out success, to find a CSS text attribute that produces a border, a single straight line, at the end of each line that I can prescribe a color. I don?t see an attribute that allows this at the W3 site. Does anyone know if this is possible?

    Thanks!

     

    WBR

  7. Thanks Wickham!

    I was just heading off to sleep, but I will study your notes and implement later.

    I am aware that I am using a Release Canditate for IE, but I am much too impatient to work with 7 and was hoping that IE 8 was further along that it actually is. Ever the dreamer.

    WBR

  8. Thank you.

    I have another question relating to the same style. I wanted to use this description:

    text-shadow:4px 4px 8px blue;

    This works only in Safari, but not in Chrome, IE or Firefox. Does anyone know why?

    Regards!

×
×
  • Create New...