CIT 252 Home

Assignment Fifteen



  1. This Assignment uses PHP to send an email when a customer fills out his profile or edits his profile and adds it to the database;
  2. This is done by adding the following code to the updatewoman.php and the addnewwoman.php files. The email message is here.
  3. Rename createprofile.php to createprofile15.php, editprofile.php to editprofile15.php, addnewwoman.php to addnewwoman15.php, and updatewoman.php to updatewoman15.php .
  4. Then have createprofile15.php call addnewwoman15.php and editprofile15.php call updatewoman15.php .
  5. Then add the following e-mail code to the woman15 files:
    <?php
    $email="profiles.email@cox.net";
    $title="This is a Test!!";
    $myemail="mysiteemai@cox.net";
    #-----------------------------------------------
      #subject of the message
      $re = "A New Test E-Mail." ;
      #set the Content-type header for HTML mail
      $headers  = "MIME-Version: 1.0\n";
      $headers .= "Content-type: text/html;";   
      $headers .= "charset=\"iso-8859-1\"\n";
      #set the From header
      $headers .= "From: $myemail \n";
     if ($email=="") $email=$myemail;
      #recipient's email address
      $to = $email;
        $msg = "<b>Attention $email: ".$title."</b><br /><br /><i>Your Test information will be review and will be included, if the whois checks with this e-mail address within 2 days.</i><br /><br />After it has been approved and showsup on our search page, please send us an e-mail if you want to change the Keywords, or Description.<br /><br /><br /><b>Thanks, <br />
    <br />The Webmaster</b>";
    
      #send the email now...
      #recipient's email address
       mail($to,$re,$msg, $headers);
    
      #copy of e-mail to webmaster
      #with a different message
      $to = $myemail;
      $msg = "<b>Attention:  ".$email."</b> has been added. <br /><br /><b>".$title." </b> and it has worked OK!<br /><br />";
    
      #send the email now...
      #to my email address
      mail($to,$re,$msg, $headers);
    #-----------------------------------------------
    ?>
    <h1>Your mail has been sent</h1>
    
  6. To get the information to send to the webmaster and a copy to the user try this type of code inplace of $title above:
    $datatosend="<table align=\"center\" cellSpacing=\"0\" cellPadding=\"5\" width=\"100%\" border=\"0\" >
    		<td align=\"center\" valign=\"top\" width=\"40%\" >
               <img width=\"300\" src=\"images/$photo\"
                alt=\"$photo\"  border=\"2\" hspace=\"3\"><br></td>
            <td width=\"60%\" align=\"left\" valign=\"top\" >
    		<font size=\"+1\"><b>Hello I am $firstname ($lastname not shown)\" !
             </b></font><br>
             ID: <b>$ID</b><br>
             Address1: <b>( $address1 not shown )<b>$ID</b><br>
             Address2: <b>( $address2 not shown )<b>$ID</b><br>
             Postcode: <b>( $postcode not shown )<b>$ID</b><br>
             Phone: <b>( $phone not shown )<b>$ID</b><br>
             E-Mail: <b>( $email not shown )<b>$ID</b><br>
             City: <b>$city<b>$ID</b><br>
             Country: <b>$country<b>$ID</b><br>
             Age: <b>b>";
             if (date("m")< substr($birthdate,5,2)) 
             {$datatosend .=  date("Y-m-d")-$birthdate-1;}
             else{$datatosend .= date("Y-m-d")-$birthdate;}
             $datatosend .="</b><br>
             Birthday: <b>$birthdate<b>$ID</b><br>
             Hair Color: <b>$hair<b>$ID</b><br>
             Eye Color: <b>$eyes<b>$ID</b><br>
             Weigh: <b>".intval($weight*2.2+.5)." lb. or ".intval($weight+.5)." kg.<b>$ID</b><br>";
    
    continue on as required
    
  7. See editprofile15.php for an example of the required assignment.
  8. You also are required to have a return link from your assignment to your index page.
  9. Link this assignment to your web site index page.
  10. Upload this assignment files (3 files) to your web space.
  11. You must also re upload your index file to your web space.