Jump to content

JADASDesigner

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Posts posted by JADASDesigner

  1. So I was missing a bracket.  Now I just need to figure out how to receive this as an image, instead of a text document with a generic "att123456.txt" filename.  ANy ideas?

     

    <?php
    
    
    // Read POST request params into global vars
    $Station = Trim(stripslashes($_POST['Station'])); 
    $AE = Trim(stripslashes($_POST['AE'])); 
    $Client = Trim(stripslashes($_POST['Client'])); 
    $Start = Trim(stripslashes($_POST['Start'])); 
    $End = Trim(stripslashes($_POST['End'])); 
    $Date_Submitted = Trim(stripslashes($_POST['Date_Submitted'])); 
    $ROS = Trim(stripslashes($_POST['ROS'])); 
    $Sponser = Trim(stripslashes($_POST['Sponser'])); 
    $Which_Page = Trim(stripslashes($_POST['Which_Page'])); 
    $Banner_Type = Trim(stripslashes($_POST['Banner_Type'])); 
    $Link = Trim(stripslashes($_POST['Link'])); 
    $Artwork = Trim(stripslashes($_POST['Artwork'])); 
    $Instructions = Trim(stripslashes($_POST['Instructions'])); 
    $redirectpage = "thanks_submit.php";
    $errorpage = "error.php";
    $to = "devyn.bellamy@jadasdesign.com";
    $replyTo = $_POST['email'];
    $from = $_POST['email'];
    $subject = "Internet Production Order";
    $message .= "<table width=\"810\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"5\">";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td width=\"325\"><img src=\"http://www.jamz1019.com/images/WGFT_LOGO_HiRes_y08m04d01_copy.jpg\" alt=\"1330 Logo\" width=\"325\" height=\"130\" /></td>";
    $message .= "\n";
    $message .= "    <td width=\"157\"> </td>";
    $message .= "\n";
    $message .= "    <td width=\"308\"><img src=\"http://www.jamz1019.com/images/Logo.jpg\" width=\"308\" height=\"167\" /></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= " <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><h2 align=\"center\">The Y-Town Radio Stations</h2>";
    $message .= "\n";
    $message .= "      <h1 align=\"center\">INTERNET PRODUCTION ORDER</h1></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td>Account Manager: <b>";
    $message .= $AE;
    $message .= " </b>   <td> </td>";
    $message .= "\n";
    $message .= "    <td>Email Address: <b>";
    $message .= $email;
    $message .= "</b>  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td><p></td>";
    $message .= "\n";
    $message .= "    <td> Station: <b>";
    $message .= $Station;
    $message .= "</b>\n";
    $message .= "</td>";
    $message .= "\n";
    $message .= "    <td> </td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><div align=\"center\">";
    $message .= "\n";
    $message .= "      <h3>CLIENT: <b>";
    $message .= $Client;
    $message .= "</b>\n";
    $message .= "        </h3>";
    $message .= "\n";
    $message .= "    </div></td>";
    $message .= "\n";
    $message .= "    </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><div align=\"center\">Start Date: <b>";
    $message .= $Start;
    $message .= "</b>       End Date: <b>";
    $message .= $End;
    $message .= "</b>       Date Submitted: <b>";
    $message .= $Date_Submitted;
    $message .= "</b>\n";
    $message .= "    </div></td>";
    $message .= "\n";
    $message .= "    </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><hr /></td>";
    $message .= "\n";
    $message .= "    </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td><strong>Display</strong></td>";
    $message .= "\n";
    $message .= "    <td> </td>";
    $message .= "\n";
    $message .= "    <td> </td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><div align=\"center\">ROS: <b>";
    $message .= $ROS;
    $message .= "</b>\n";
    $message .= "       ";
    $message .= "\n";
    $message .= "      Page Sponsor: <b>";
    $message .= $Sponser;
    $message .= "</b>\n";
    $message .= "           If So, Which Page: <b>";
    $message .= $Which_Page;
    $message .= "</b>\n";
    $message .= "    </div></td>";
    $message .= "\n";
    $message .= "    </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><hr /></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><strong> Banner Information</strong></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><div align=\"center\"> <b>";
    $message .= $Banner_Type;
    $message .= "</b> \n";
    $message .= "        Link URL: ";
    $message .= $Link;
    $message .= "</b> \n";
    $message .= "    </div></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "  <td>";
    $message .= "\n Completed Artwork: ";
    $message .= $Artwork;
    $message .= "\n";
    $message .= "    </div></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\">Custom Artwork Request and/or Copy: (Please include URL artwork needs to be downloaded from, if Applicable)</td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><div align=\"center\"><h3>";
    $message .= $Instructions;
    $message .= "</h3>\n";
    $message .= "    </div></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "</table>";
    $message .= "\n";
    
    $mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x";
    
    // Obtain file upload vars
    $tmp_name = $_FILES['fileatt']['tmp_name'];
    $type = $_FILES['fileatt']['type'];
    $name = $_FILES['fileatt']['name'];
    $size = $_FILES['fileatt']['size'];
    
    // if the upload succeeded, the file will exist
    if (file_exists($tmp_name)){
    
    // check to make sure that it is an uploaded file and not a system file
    if(is_uploaded_file($tmp_name)){
    
    // open the file for a binary read
    $file = fopen($tmp_name,'rb');
    
    // read the file content into a variable
    $data = fread($file,filesize($tmp_name));
    
    // close the file
    fclose($file);
    
    // now we encode it and split it into acceptable length lines
    $data = chunk_split(base64_encode($data));
    }
    }
    
    // now we'll build the message headers
    $headers = "From: " . $from . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n" . " boundary=\"{" . $mime_boundary . "}\"";
    
    $message = "This is a multi-part message in MIME format.\n\n" . "--{" . $mime_boundary . "}\n" . "Content-Type: text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n";
    
    $message .= "--{" . $mime_boundary . "}\n" .
    "Content-Type:" . $type . ";\n" .
    " name=\"{" . $name . "}\"\n" .
    "Content-Transfer-Encoding: base64\n\n" .
    $data . "\n\n" .
    "--{" . $mime_boundary . "}--\n";
    
    // Send the message
    $ok = @mail($to, $subject, $message, $headers);
    if ($ok) {
    header("Location: $redirectpage");
    } else {
    header("Location: $errorpage");
    }
    ?>

  2. Tried this, too...  No luck...

     

    <?php
    
    
    // Read POST request params into global vars
    $redirectpage = "thanks_submit.php";
    $errorpage = "error.php";
    $to = "devyn.bellamy@jadasdesign.com";
    $replyTo = $_POST['email'];
    $from = $_POST['AE'];
    $subject = "Internet Production Order";
    $message .= "<table width=\"810\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"5\">";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td width=\"325\"><img src=\"images/WGFT_LOGO_HiRes_y08m04d01_copy.jpg\" alt=\"1330 Logo\" width=\"325\" height=\"130\" /></td>";
    $message .= "\n";
    $message .= "    <td width=\"157\"> </td>";
    $message .= "\n";
    $message .= "    <td width=\"308\"><img src=\"images/Logo.jpg\" width=\"308\" height=\"167\" /></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= " <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><h2 align=\"center\">The Y-Town Radio Stations</h2>";
    $message .= "\n";
    $message .= "      <h1 align=\"center\">INTERNET PRODUCTION ORDER</h1></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td>Account Manager: ";
    $message .= $AE;
    $message .= "    <td> </td>";
    $message .= "\n";
    $message .= "    <td>Email Address: ";
    $message .= $email;
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td><p></td>";
    $message .= "\n";
    $message .= "    <td>";
    $message .= $Station;
    $message .= "\n";
    $message .= "</td>";
    $message .= "\n";
    $message .= "    <td> </td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><div align=\"center\">";
    $message .= "\n";
    $message .= "      <h3>CLIENT: ";
    $message .= $Client;
    $message .= "\n";
    $message .= "        </h3>";
    $message .= "\n";
    $message .= "    </div></td>";
    $message .= "\n";
    $message .= "    </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><div align=\"center\">Start Date:";
    $message .= $start;
    $message .= "       End Date:";
    $message .= $End;
    $message .= "       Date Submitted:";
    $message .= $Date_Submitted;
    $message .= "\n";
    $message .= "    </div></td>";
    $message .= "\n";
    $message .= "    </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><hr /></td>";
    $message .= "\n";
    $message .= "    </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td><strong>Display</strong></td>";
    $message .= "\n";
    $message .= "    <td> </td>";
    $message .= "\n";
    $message .= "    <td> </td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><div align=\"center\">ROS: ";
    $message .= $ROS;
    $message .= "\n";
    $message .= "       ";
    $message .= "\n";
    $message .= "      Page Sponsor:";
    $message .= $Sponser;
    $message .= "\n";
    $message .= "           If So, Which Page:";
    $message .= $Which_Page;
    $message .= "\n";
    $message .= "    </div></td>";
    $message .= "\n";
    $message .= "    </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><hr /></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><strong> Banner Information</strong></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><div align=\"center\">";
    $message .= $Banner_Type;
    $message .= "\n";
    $message .= "        Link URL:";
    $message .= $Link;
    $message .= "\n";
    $message .= "    </div></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "  <td>";
    $message .= "\n";
    $message .= $Artwork;
    $message .= "\n";
    $message .= "    </div></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\">Custom Artwork Request and/or Copy: (Please include URL artwork needs to be downloaded from, if Applicable)</td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><div align=\"center\">";
    $message .= $Instructions;
    $message .= "\n";
    $message .= "    </div></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "</table>";
    $message .= "\n";
    
    $mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x";
    
    // Obtain file upload vars
    $tmp_name = $_FILES['fileatt']['tmp_name'];
    $type = $_FILES['fileatt']['type'];
    $name = $_FILES['fileatt']['name'];
    $size = $_FILES['fileatt']['size'];
    
    // if the upload succeeded, the file will exist
    if (file_exists($tmp_name)){
    
    // check to make sure that it is an uploaded file and not a system file
    if(is_uploaded_file($tmp_name)){
    
    // open the file for a binary read
    $file = fopen($tmp_name,'rb');
    
    // read the file content into a variable
    $data = fread($file,filesize($tmp_name));
    
    // close the file
    fclose($file);
    
    // now we encode it and split it into acceptable length lines
    $data = chunk_split(base64_encode($data));
    }
    
    // now we'll build the message headers
    $headers = "From: $from\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n" . " boundary=\"{$mime_boundary}\"";
    
    $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n";
    
    $message .= "--{$mime_boundary}\n" .
    "Content-Type: {$type};\n" .
    " name=\"{$name}\"\n" .
    "Content-Transfer-Encoding: base64\n\n" .
    $data . "\n\n" .
    "--{$mime_boundary}--\n";
    
    // Send the message
    $ok = @mail($to, $subject, $message, $headers);
    if ($ok) {
    header("Location: $redirectpage");
    } else {
    header("Location: $errorpage");
    }
    ?>

  3. ??? I have no idea what I am doing.  I get an 500 error with this when I submit.  I am trying to give the user the ability to attatch files...

     

    Input Form:

    <!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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <META NAME="keywords" CONTENT="WRBP, Jamz 101.9, Hip Hop, R&B, Youngstown, Hubbard, Bernard Radio, Lucky Penny, Steve Harvey, T-Luv, Family Reunion">
    <META NAME="description" CONTENT="JAMZ 101.9, The Valley's Home for all the JAMZ">
    <title>Internet Production Order</title>
    <style type="text/css">
    <!--
    body,td,th {
    font-family: Arial, Helvetica, sans-serif;
    }
    -->
    </style></head>
    
    <body>
    <form method="POST" action="PO3.php">
      <table width="810" border="0" align="center" cellpadding="0" cellspacing="5">
      <tr>
        <td width="325"><img src="images/WGFT_LOGO_HiRes_y08m04d01_copy.jpg" alt="1330 Logo" width="325" height="130" /></td>
        <td width="157"> </td>
        <td width="308"><img src="images/Logo.jpg" width="308" height="167" /></td>
      </tr>
      <tr>
        <td colspan="3"><h2 align="center">The Y-Town Radio Stations</h2>
          <h1 align="center">INTERNET PRODUCTION ORDER</h1></td>
      </tr>
      <tr>
        <td>Account Manager: 
          <input type="text" name="AE" id="AE" /></td>
        <td> </td>
        <td>Email Address: 
          <input type="text" name="email" id="email" /></td>
      </tr>
      <tr>
        <td><p></td>
        <td><input type="checkbox" name="Station" value="WGFT" />
    WGFT
      <input type="checkbox" name="Station" value="WRBP" checked="checked" />
    WRBP</td>
        <td> </td>
      </tr>
      <tr>
        <td colspan="3"><div align="center">
          <h3>CLIENT: 
            <input name="Client" type="text" id="Client" size="125" />
            </h3>
        </div></td>
        </tr>
      <tr>
        <td colspan="3"><div align="center">Start Date:
          <input type="text" name="Start" id="Start" />
           End Date:
          <input type="text" name="End" id="End" />
           Date Submitted:
      <input type="text" name="Date_Submitted" id="Date_Submitted" />
        </div></td>
        </tr>
      <tr>
        <td colspan="3"><hr /></td>
        </tr>
      <tr>
        <td><strong>Display</strong></td>
        <td> </td>
        <td> </td>
      </tr>
      <tr>
        <td colspan="3"><div align="center">ROS: 
          <input type="text" name="ROS" id="ROS" />
           
          Page Sponsor:
      <input type="Radio" name="Sponser" value="Yes" />
          Yes
      <input type="Radio" name="Sponser" value="No" checked="checked" />
          No     If So, Which Page:
      <input type="text" name="Which_Page" id="Which_Page" />
        </div></td>
        </tr>
      <tr>
        <td colspan="3"><hr /></td>
      </tr>
      <tr>
        <td colspan="3"><strong> Banner Information</strong></td>
      </tr>
      <tr>
        <td colspan="3"><div align="center">
              <input name="Banner_Type" type="radio" value="Wide Skyscraper 160 x 600" checked="checked" />
          Wide Skyscraper (160 x 600) 
            <input name="Banner_Type" type="radio" value="Wide Skyscraper 160 x 600" />
            Medium Rectangle(180 x 150)
            Link URL:
      <input name="Link" type="text" id="Link" value="http://" size="35" />
        </div></td>
      </tr>
      <tr>
        <td colspan="3"><div align="center">Completed Artwork: 
          <input type="radio" name="Artwork" value="Yes" />
          Yes
      <input type="radio" name="Artwork" value="No" checked="CHECKED" />
          No
               
          If Artwork is Available Please Attatch Here.: 
          <input type="file" name="fileatt" maxlength="50" allow="image/*" id="fileatt" />
        </div></td>
      </tr>
      <tr>
        <td colspan="3">Custom Artwork Request and/or Copy: (Please include URL artwork needs to be downloaded from, if Applicable)</td>
      </tr>
      <tr>
        <td colspan="3"><div align="center">
          <textarea name="Instructions" id="Instructions" cols="150" rows="5"></textarea>
        </div></td>
      </tr>
      <tr>
        <td colspan="3"><input type="reset" name="Reset" value="Clear" id="Reset" />
               
          <input type="submit" name="submit" value="Submit Your Order" /></td>
      </tr>
    </table>
    </form>
    </body>
    </html>
    

     

    Mailing form:

    <?php
    
    
    // Read POST request params into global vars
    $redirectpage = "thanks_submit.php";
    $errorpage = "error.php";
    $to = "devyn.bellamy@jadasdesign.com";
    $replyTo = $_POST['email'];
    $from = $_POST['AE'];
    $subject = "Internet Production Order";
    $message .= "<table width=\"810\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"5\">";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td width=\"325\"><img src=\"images/WGFT_LOGO_HiRes_y08m04d01_copy.jpg\" alt=\"1330 Logo\" width=\"325\" height=\"130\" /></td>";
    $message .= "\n";
    $message .= "    <td width=\"157\"> </td>";
    $message .= "\n";
    $message .= "    <td width=\"308\"><img src=\"images/Logo.jpg\" width=\"308\" height=\"167\" /></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= " <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><h2 align=\"center\">The Y-Town Radio Stations</h2>";
    $message .= "\n";
    $message .= "      <h1 align=\"center\">INTERNET PRODUCTION ORDER</h1></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td>Account Manager: ";
    $message .= $AE;
    $message .= "    <td> </td>";
    $message .= "\n";
    $message .= "    <td>Email Address: ";
    $message .= $email;
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td><p></td>";
    $message .= "\n";
    $message .= "    <td>";
    $message .= $Station;
    $message .= "\n";
    $message .= "</td>";
    $message .= "\n";
    $message .= "    <td> </td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><div align=\"center\">";
    $message .= "\n";
    $message .= "      <h3>CLIENT: ";
    $message .= $Client;
    $message .= "\n";
    $message .= "        </h3>";
    $message .= "\n";
    $message .= "    </div></td>";
    $message .= "\n";
    $message .= "    </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><div align=\"center\">Start Date:";
    $message .= $start;
    $message .= "       End Date:";
    $message .= $End;
    $message .= "       Date Submitted:";
    $message .= $Date_Submitted;
    $message .= "\n";
    $message .= "    </div></td>";
    $message .= "\n";
    $message .= "    </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><hr /></td>";
    $message .= "\n";
    $message .= "    </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td><strong>Display</strong></td>";
    $message .= "\n";
    $message .= "    <td> </td>";
    $message .= "\n";
    $message .= "    <td> </td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><div align=\"center\">ROS: ";
    $message .= $ROS;
    $message .= "\n";
    $message .= "       ";
    $message .= "\n";
    $message .= "      Page Sponsor:";
    $message .= $Sponser;
    $message .= "\n";
    $message .= "           If So, Which Page:";
    $message .= $Which_Page;
    $message .= "\n";
    $message .= "    </div></td>";
    $message .= "\n";
    $message .= "    </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><hr /></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><strong> Banner Information</strong></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><div align=\"center\">";
    $message .= $Banner_Type;
    $message .= "\n";
    $message .= "        Link URL:";
    $message .= $Link;
    $message .= "\n";
    $message .= "    </div></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "  <td>";
    $message .= "\n";
    $message .= $Artwork;
    $message .= "\n";
    $message .= "    </div></td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\">Custom Artwork Request and/or Copy: (Please include URL artwork needs to be downloaded from, if Applicable)</td>";
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "  <tr>";
    $message .= "\n";
    $message .= "    <td colspan=\"3\"><div align=\"center\">";
    $message .= $Instructions;
    $message .= "\n";
    $message .= "    </div></td>";<br />
    $message .= "\n";
    $message .= "  </tr>";
    $message .= "\n";
    $message .= "</table>";
    $message .= "\n";
    // Obtain file upload vars
    $fileatt = $_FILES['fileatt']['tmp_name'];
    $fileatt_type = $_FILES['fileatt']['type'];
    $fileatt_name = $_FILES['fileatt']['name'];
    
    $headers = "From: " . $from . "\r\nReply-To: " . $replyTo; 
    
    if (is_uploaded_file($fileatt)) {
    // Read the file to be attached ('rb' = read binary)
    $file = fopen($fileatt,'rb');
    $data = fread($file,filesize($fileatt));
    fclose($file);
    
    // Generate a boundary string
    $semi_rand = md5(time());
    $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
    
    // Add the headers for a file attachment
    $headers .= "\nMIME-Version: 1.0\n" .
    "Content-Type: multipart/mixed;\n" .
    " boundary=\"{$mime_boundary}\"";
    
    // Add a multipart boundary above the plain message
    $message = "This is a multi-part message in MIME format.\n\n" .
    "--{$mime_boundary}\n" .
    "Content-Type: text/html; charset=\"iso-8859-1\"\n" .
    "Content-Transfer-Encoding: 7bit\n\n" .
    $message . "\n\n";
    
    // Base64 encode the file data
    $data = chunk_split(base64_encode($data));
    
    // Add file attachment to the message
    $message .= "--{$mime_boundary}\n" .
    "Content-Type: {$fileatt_type};\n" .
    " name=\"{$fileatt_name}\"\n" .
    //"Content-Disposition: attachment;\n" .
    //" filename=\"{$fileatt_name}\"\n" .
    "Content-Transfer-Encoding: base64\n\n" .
    $data . "\n\n" .
    "--{$mime_boundary}--\n";
    }
    
    // Send the message
    $ok = @mail($to, $subject, $message, $headers);
    if ($ok) {
    header("Location: $redirectpage");
    } else {
    header("Location: $errorpage");
    }
    ?>

  4. So I have a poll that does exactly what I want it to, but it is either reading, or writing incorrectly to the poll_data.txt file.  People can vote for the number 8 slot, but the vote counts to the 5 slot, then counts to the 5 6 and 7 slots, then eventually counts to just the 8 slot, again.  Other than that, it does EVERY thing I need it to.  Here is the code.  Send me a message if you want to see the site in action, but regardless of the case, I need this to work desperately.

     

    <?php
    
    /************************************************
    *************************************************
    **                                             **
    ** Simple PHP Poll by X-Fi6 and Scriptsez Inc. **
    **                                             **
    *************************************************
    *************************************************
    
         <Licensed with the General GNU License>
    
    *************************************************
    ** File:  poll.php                             **
    ************************************************/
    
    ///////////////////////////////////////////
    //Specify Variables And Such
    ///////////////////////////////////////////
    if(!isset($v_path)) //do some checking for $v_path
    {
    $v_path = "|"; //check the GET and POST and see if it's defined there
    $v_path = (isset($_GET['v_path'])) ? $_GET['v_path'] : $v_path;
    $v_path = (isset($_POST['v_path'])) ? $_POST['v_path'] : $v_path;
    //if it's not there, consider this shorthand and default to "vote/"
    $v_path = ($v_path == "|") ? "vote/" : $v_path = $v_path;
    }
    
    //whether voting multiple times is enabled or not,
    //the IP address will still be logged for security purposes
    $ip = getenv(REMOTE_ADDR);
    
    $plsr = file($v_path . "logger.txt");
    $c_pl = file_get_contents($v_path . "logger.txt");
    
    ///////////////////////////////////////////
    //Check if the user has voted or not.
    ///////////////////////////////////////////
    if(preg_match("/$ip/", $c_pl))
    {
    $ipf = "1";
    $disb = " disabled='disabled'";
    }
    else
    {
    $ipf = "0";
    $disb = "";
    }
    ///////////////////////////////////////////
    //Specify more variables (for filenames)
    ///////////////////////////////////////////
    $RESULT_FILE_NAME = $v_path . "poll_data.txt";
    $que = $v_path . "question.txt";
    $ans = $v_path . "ans.txt";
    $fn = fopen ($que, "r");
    $puff = fread ($fn, filesize($que));
    fclose ($fn);
    $QUESTION = $puff;
    $lis = 0;
    $plsr = file($ans);
    
    for($x=0;$x<sizeof($plsr);$x++)
    {
    $temp = explode("|",$plsr[$x]);
    $list[$lis] = $temp[0];
    $lis++;
    }
    $ANSWER = $list;
    
    if (!isset($_GET['answer']) && !$_POST['vresult'])
    {
    if($submit)
    {
    	echo "<h2><b>Error!</b></h2>\nYou voted but didn't pick anything! If you want to vote, check the option you want and click Vote.";
    }
    else
    {
    	echo "<FORM METHOD=\"GET\" ACTION=\"" . $v_path . "poll.php\" TARGET=\"_self\" NAME=\"vform\"><input type=hidden name=v_path value=\"" . $v_path . "\" />\n";
    	echo "<TABLE align=center border=1 borderColor=#000000 cellPadding=2 class=normaltext style=\"BORDER-BOTTOM-COLOR: #000000; BORDER-COLLAPSE: collapse; BORDER-LEFT-COLOR: #000000; BORDER-RIGHT-COLOR: #000000; BORDER-TOP-COLOR: #000000;\" >\n";
    	echo "<TR><TH>$QUESTION</TH></TR>\n";
    	while (list($key, $val) = each($ANSWER))
    	{
    		echo "<TR><TD align=\"left\"><INPUT TYPE=\"radio\" NAME=\"answer\"$disb VALUE=\"$key\"> $val</TD></TR>\n";
    	}
    	echo "<TR><TD align=\"center\"><INPUT TYPE=\"submit\" NAME=\"vote\" onClick=\"voteForm()\" VALUE=\" Vote \"" . $disb . "></TD></TR>\n";
    	echo "<TR><TD align=\"center\"></form><form method=post action=\"" . $v_path . "poll.php\" target=_self name=vformb><input type=hidden name=v_path value=\"" . $v_path . "\" /><input type=hidden name=vresult value=1><INPUT TYPE=\"Submit\" NAME=\"submit\" VALUE=\"Current Results\" onClick=\"voteFormb();\">\n";
    	echo "</TABLE></form>";
    }
    }
    
    if (strlen($_GET['answer'])>0 || $_POST['vresult'])
    {
    echo "<body>";
    if($ipf || $_POST['vresult'])
    {
    	$file_array = file($RESULT_FILE_NAME);
    	$old_answer = $file_array[$_GET['answer']];
    	$old_answer = preg_replace("/\n\r*/", "", $old_answer);
    	$file_array[$_GET['answer']] = $old_answer . "\n";
    	if($_POST['vresult'])
    	{
    		echo "<div align=center><b>Here are the current results:</b></div>";
    	}
    	else
    	{
    		echo "<font color=red><div align=center><b>Sorry, you have already voted.</b></div></font>";
    	}
    }
    else
    {
    	if ($_GET['answer'] < count($ANSWER))
    	{
    		$file_array = file($RESULT_FILE_NAME);
    		$old_answer = $file_array[$_GET['answer']];
    		$old_answer = preg_replace("/\n\r*/", "", $old_answer);
    		$file_array[$_GET['answer']] = ($old_answer + 1)."\n";
    		$fname=$v_path . "logger.txt";
    		$fq = fopen($fname, "a++");
    		fwrite($fq, "\n");
    		fwrite($fq, $ip);
    		fclose($fq);
    		$file = join('', $file_array);
    		$fp = fopen($RESULT_FILE_NAME, "w");
    		fwrite($fp, $file);
    		fclose($fp);
    		echo "<div align=center>Vote saved.</div>";
    	}
    	else
    	{
    		$file_array = file($RESULT_FILE_NAME);
    		$old_answer = $file_array[$_GET['answer']];
    		$old_answer = preg_replace("/\n\r*/", "", $old_answer);
    		$file_array[$_GET['answer']] = ($old_answer + 1)."\n";
    		echo "<font color=red><div align=center><b>The poll has been updated. Vote again.</b></div></font>";
    	}
    }
    while(list($key, $val) = each($file_array))
    {
    	$total += $val;
    }
    echo "<TABLE align=center border=1 borderColor=#000000 cellPadding=2 class=normaltext style=\"BORDER-BOTTOM-COLOR: #000000; BORDER-COLLAPSE: collapse; BORDER-LEFT-COLOR: #000000; BORDER-RIGHT-COLOR: #000000; BORDER-TOP-COLOR: #000000;\" width=95%>\n";
    echo "<tr><th>Options</th><th>Percentage</th></tr>";
    while(list($key, $val) = each($ANSWER))
    {
    	$percent = ($file_array[$key] > 0) ? $file_array[$key] * 100 / $total : 0;
    	//avoid divisions by zero, especially for the PHP5 crowd
    	$percent_int = floor($percent);
    	$percent_float = number_format($percent);
    	$tp += $percent_float;
    	if($percent_int>=40)
    	{
    		$color="blue";
    	}
    	elseif($percent_int>=30)
    	{
    		$color="green";
    	}
    	elseif($percent_int>=20)
    	{
    		$color="orange";
    	}
    	elseif($percent_int>=1)
    	{
    		$color="red";
    	}
    	elseif($percent_int=0)
    	{
    		$color="white";
    	}
    	echo "<tr><td> $ANSWER[$key] </td><td><table cellpadding=1 cellspacing=0 width=100% border=0 background='" . $v_path . "images/white.gif'><tr><td><table cellpadding=0 cellspacing=0 border=0 width=100%>
    <tr>
    <td background='" . $v_path . "images/$color.gif' width=$percent_int% height=10 style=border:0 >
    <spacer type=block width=2 height=8>
    </td>
    <td class=white width=91% height=10 style=border:0>
    <spacer type=block width=2 height=8>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>$percent_float%</td></tr>";
    }
    echo "</TABLE></body>";
    }
    
    ?>
    

  5. It was working.  then it stopped.  Any ideas?

     

    <?php
    $EmailTo = "person@example.com";
    $EmailFrom = "webmaster@example.com";
    $Subject = "Online Applicant";
    $Name = Trim(stripslashes($_POST['Name'])); 
    $Address = Trim(stripslashes($_POST['Address'])); 
    $City = Trim(stripslashes($_POST['City'])); 
    $State = Trim(stripslashes($_POST['State'])); 
    $PostCode = Trim(stripslashes($_POST['PostCode'])); 
    $HomeTel = Trim(stripslashes($_POST['HomeTel'])); 
    $Mobile = Trim(stripslashes($_POST['Mobile'])); 
    $DateEligible = Trim(stripslashes($_POST['DateEligible'])); 
    $Position = Trim(stripslashes($_POST['Position'])); 
    $SSN = Trim(stripslashes($_POST['SSN'])); 
    $DL = Trim(stripslashes($_POST['DL'])); 
    $Salary = Trim(stripslashes($_POST['Salary'])); 
    $ProfessionalLiscense = Trim(stripslashes($_POST['ProfessionalLiscense'])); 
    $MaritalStatus = Trim(stripslashes($_POST['MaritalStatus'])); 
    $Health = Trim(stripslashes($_POST['Health'])); 
    $Prior = Trim(stripslashes($_POST['Prior'])); 
    $TypeOfEmployment = Trim(stripslashes($_POST['TypeOfEmployment'])); 
    $Criminal = Trim(stripslashes($_POST['Criminal'])); 
    $typeofcriminal = Trim(stripslashes($_POST['typeofcriminal'])); 
    $Highschool = Trim(stripslashes($_POST['Highschool'])); 
    $HSGradYear = Trim(stripslashes($_POST['HSGradYear'])); 
    $HSAddress = Trim(stripslashes($_POST['HSAddress'])); 
    $HSDegree = Trim(stripslashes($_POST['HSDegree'])); 
    $HSYearsCompleted = Trim(stripslashes($_POST['HSYearsCompleted'])); 
    $College1 = Trim(stripslashes($_POST['College1'])); 
    $C1GradYear = Trim(stripslashes($_POST['C1GradYear'])); 
    $C1Address = Trim(stripslashes($_POST['C1Address'])); 
    $C1Degree = Trim(stripslashes($_POST['C1Degree'])); 
    $C1YearsCompleted = Trim(stripslashes($_POST['C1YearsCompleted'])); 
    $College2 = Trim(stripslashes($_POST['College2'])); 
    $C2GradYear = Trim(stripslashes($_POST['C2GradYear'])); 
    $C2Address = Trim(stripslashes($_POST['C2Address'])); 
    $C2Degree = Trim(stripslashes($_POST['C2Degree'])); 
    $C2YearsCompleted = Trim(stripslashes($_POST['C2YearsCompleted'])); 
    $employmentdates1 = Trim(stripslashes($_POST['employmentdates1'])); 
    $position1 = Trim(stripslashes($_POST['position1'])); 
    $company1 = Trim(stripslashes($_POST['company1'])); 
    $address1 = Trim(stripslashes($_POST['address1'])); 
    $telephone1 = Trim(stripslashes($_POST['telephone1'])); 
    $superviser1 = Trim(stripslashes($_POST['superviser1'])); 
    $reason1 = Trim(stripslashes($_POST['reason1'])); 
    $endingsalary1 = Trim(stripslashes($_POST['endingsalary1'])); 
    $responsibilities1 = Trim(stripslashes($_POST['responsibilities1'])); 
    $contact1 = Trim(stripslashes($_POST['contact1'])); 
    $employmentdates2 = Trim(stripslashes($_POST['employmentdates2'])); 
    $position2 = Trim(stripslashes($_POST['position2'])); 
    $company2 = Trim(stripslashes($_POST['company2'])); 
    $address2 = Trim(stripslashes($_POST['address2'])); 
    $telephone2 = Trim(stripslashes($_POST['telephone2'])); 
    $superviser2 = Trim(stripslashes($_POST['superviser2'])); 
    $reason2 = Trim(stripslashes($_POST['reason2'])); 
    $endingsalary2 = Trim(stripslashes($_POST['endingsalary2'])); 
    $responsibilities2 = Trim(stripslashes($_POST['responsibilities2'])); 
    $contact2 = Trim(stripslashes($_POST['contact2'])); 
    $employmentdates3 = Trim(stripslashes($_POST['employmentdates3'])); 
    $position3 = Trim(stripslashes($_POST['position3'])); 
    $company3 = Trim(stripslashes($_POST['company3'])); 
    $address3 = Trim(stripslashes($_POST['address3'])); 
    $telephone3 = Trim(stripslashes($_POST['telephone3'])); 
    $superviser3 = Trim(stripslashes($_POST['superviser3'])); 
    $reason3 = Trim(stripslashes($_POST['reason3'])); 
    $endingsalary3 = Trim(stripslashes($_POST['endingsalary3'])); 
    $responsibilities3 = Trim(stripslashes($_POST['responsibilities3'])); 
    $contact3 = Trim(stripslashes($_POST['contact3'])); 
    $skills = Trim(stripslashes($_POST['skills'])); 
    $refname1 = Trim(stripslashes($_POST['refname1'])); 
    $refphone1 = Trim(stripslashes($_POST['refphone1'])); 
    $refaddress1 = Trim(stripslashes($_POST['refaddress1'])); 
    $refcity1 = Trim(stripslashes($_POST['refcity1'])); 
    $refstate1 = Trim(stripslashes($_POST['refstate1'])); 
    $refzip1 = Trim(stripslashes($_POST['refzip1'])); 
    $refname2 = Trim(stripslashes($_POST['refname2'])); 
    $refphone2 = Trim(stripslashes($_POST['refphone2'])); 
    $refaddress2 = Trim(stripslashes($_POST['refaddress2'])); 
    $refcity2 = Trim(stripslashes($_POST['refcity2'])); 
    $refstate2 = Trim(stripslashes($_POST['refstate2'])); 
    $refzip2 = Trim(stripslashes($_POST['refzip2'])); 
    $refname3 = Trim(stripslashes($_POST['refname3'])); 
    $refphone3 = Trim(stripslashes($_POST['refphone3'])); 
    $refaddress3 = Trim(stripslashes($_POST['refaddress3'])); 
    $refcity3 = Trim(stripslashes($_POST['refcity3'])); 
    $refstate3 = Trim(stripslashes($_POST['refstate3'])); 
    $refzip3 = Trim(stripslashes($_POST['refzip3'])); 
    $signature = Trim(stripslashes($_POST['signature'])); 
    
    
    // validation
    $validationOK=true;
    if (Trim($Name)=="") $validationOK=false;
    if (Trim($Address)=="") $validationOK=false;
    if (Trim($City)=="") $validationOK=false;
    if (Trim($State)=="") $validationOK=false;
    if (Trim($PostCode)=="") $validationOK=false;
    if (Trim($HomeTel)=="") $validationOK=false;
    if (Trim($SSN)=="") $validationOK=false;
    if (Trim($DL)=="") $validationOK=false;
    if (Trim($signature)=="") $validationOK=false;
    if (!$validationOK) {
      print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
      exit;
    
    // prepare email body text
    $Body = "";
    $Body .= $Name."\n";
    $Body .= $Address."\n";
    $Body .= $City;
    $Body .= ", ";
    $Body .= $State;
    $Body .= " ";
    $Body .= $PostCode."\n";
    $Body .= "------------------------------------------------------------\n";
    $Body .= "SSN: ";
    $Body .= $SSN;
    $Body .= "DL: ";
    $Body .= " - ";
    $Body .= $DL;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Home: ";
    $Body .= $HomeTel;
    $Body .= " - ";
    $Body .= "Mobile: ";
    $Body .= $Mobile;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Eligible for Employment: ";
    $Body .= $DateEligible;
    $Body .= " - ";
    $Body .= "Position Desired: ";
    $Body .= $Position;
    $Body .= " - ";
    $Body .= "Salary Desired: ";
    $Body .= $Salary;
    $Body .= "\n";
    $Body .= "Type of Employment: ";
    $Body .= $TypeOfEmployment;
    $Body .= " - ";
    $Body .= "Professional Liscense: ";
    $Body .= $ProfessionalLiscense;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Marital Status: ";
    $Body .= $MaritalStatus;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Have you ever pled \"Guilty/No Contest\" to, or been convicted of a crime? ";
    $Body .= $Criminal;
    $Body .= "\n";
    $Body .= $typeofcriminal;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Education-";
    $Body .= "\n";
    $Body .= "Highschool: \n";
    $Body .= $Highschool;
    $Body .= " - Graduated: ";
    $Body .= $HSGradYear;
    $Body .= "\n";
    $Body .= $HSAddress;
    $Body .= "\n";
    $Body .= "Diploma: ";
    $Body .= $HSDegree;
    $Body .= " - Years Completed: ";
    $Body .= $HSYearsCompleted;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "College: \n";
    $Body .= $College1;
    $Body .= " - Graduated: ";
    $Body .= $C1GradYear;
    $Body .= "\n";
    $Body .= $C1Address;
    $Body .= "\n";
    $Body .= "Degree: ";
    $Body .= $C1Degree;
    $Body .= " - Years Completed: ";
    $Body .= $C1YearsCompleted;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "College: \n";
    $Body .= $College2;
    $Body .= " - Graduated: ";
    $Body .= $C2GradYear;
    $Body .= "\n";
    $Body .= $C2Address;
    $Body .= "\n";
    $Body .= "Degree: ";
    $Body .= $C2Degree;
    $Body .= " - Years Completed: ";
    $Body .= $C2YearsCompleted;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Previous Employment-";
    $Body .= "\n";
    $Body .= "Dates of Employment: ";
    $Body .= $employmentdates1;
    $Body .= " - Comapny: ";
    $Body .= $company1;
    $Body .= " - Position: ";
    $Body .= $position1;
    $Body .= "\n";
    $Body .= "Address: ";
    $Body .= $address1;
    $Body .= " - Telephone: ";
    $Body .= $telephone1;
    $Body .= "\n";
    $Body .= "Supervisor: ";
    $Body .= $superviser1;
    $Body .= "\n";
    $Body .= "Reason for Leaving: ";
    $Body .= $reason1;
    $Body .= "\n";
    $Body .= "Ending Salary: ";
    $Body .= $endingsalary1;
    $Body .= "\n";
    $Body .= "Responsibilities: ";
    $Body .= $responsibilities1;
    $Body .= "\n";
    $Body .= "Can we contact this employer?: ";
    $Body .= $contact1;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Dates of Employment: ";
    $Body .= $employmentdates2;
    $Body .= " - Comapny: ";
    $Body .= $company2;
    $Body .= " - Position: ";
    $Body .= $position2;
    $Body .= "\n";
    $Body .= "Address: ";
    $Body .= $address2;
    $Body .= " - Telephone: ";
    $Body .= $telephone2;
    $Body .= "\n";
    $Body .= "Supervisor: ";
    $Body .= $superviser2;
    $Body .= "\n";
    $Body .= "Reason for Leaving: ";
    $Body .= $reason2;
    $Body .= "\n";
    $Body .= "Ending Salary: ";
    $Body .= $endingsalary2;
    $Body .= "\n";
    $Body .= "Responsibilities: ";
    $Body .= $responsibilities2;
    $Body .= "\n";
    $Body .= "Can we contact this employer?: ";
    $Body .= $contact2;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Dates of Employment: ";
    $Body .= $employmentdates3;
    $Body .= " - Comapny: ";
    $Body .= $company3;
    $Body .= " - Position: ";
    $Body .= $position3;
    $Body .= "\n";
    $Body .= "Address: ";
    $Body .= $address3;
    $Body .= " - Telephone: ";
    $Body .= $telephone3;
    $Body .= "\n";
    $Body .= "Supervisor: ";
    $Body .= $superviser3;
    $Body .= "\n";
    $Body .= "Reason for Leaving: ";
    $Body .= $reason3;
    $Body .= "\n";
    $Body .= "Ending Salary: ";
    $Body .= $endingsalary3;
    $Body .= "\n";
    $Body .= "Responsibilities: ";
    $Body .= $responsibilities3;
    $Body .= "\n";
    $Body .= "Can we contact this employer?: ";
    $Body .= $contact3;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Skills: ";
    $Body .= $skills;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Refferals-";
    $Body .= "\n";
    $Body .= $refname1;
    $Body .= "\n";
    $Body .= $refphone1;
    $Body .= "\n";
    $Body .= $refaddress1;
    $Body .= "\n";
    $Body .= $refcity1;
    $Body .= ", ";
    $Body .= $refstate1;
    $Body .= " ";
    $Body .= $refzip1;
    $Body .= "\n";
    $Body .= "\n";
    $Body .= "Digital Signature: ";
    $Body .= $signature;
    $Body .= "\n";
    
    // send email 
    $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
    
    // redirect to success page 
    if ($success){
      print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
    }
    else{
      print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
    }
    ?>

  6. Line 45 checks to see if the user has voted or not.  I want to give the user the ability to vote once per day.  Any suggestions on how I can do that, or if there is an existing voting script that gives me that option?  You can see the script in action at http://www.jamz1019.com/homejamz.php

     

    <?php
    
    /************************************************
    *************************************************
    **                                             **
    ** Simple PHP Poll by X-Fi6 and Scriptsez Inc. **
    **                                             **
    *************************************************
    *************************************************
    
         <Licensed with the General GNU License>
    
    *************************************************
    ** File:  poll.php                             **
    ************************************************/
    
    ///////////////////////////////////////////
    //Specify Variables And Such
    ///////////////////////////////////////////
    if(!isset($v_path)) //do some checking for $v_path
    {
       $v_path = "|"; //check the GET and POST and see if it's defined there
       $v_path = (isset($_GET['v_path'])) ? $_GET['v_path'] : $v_path;
       $v_path = (isset($_POST['v_path'])) ? $_POST['v_path'] : $v_path;
       //if it's not there, consider this shorthand and default to "vote/"
       $v_path = ($v_path == "|") ? "vote/" : $v_path = $v_path;
    }
    
    //whether voting multiple times is enabled or not,
    //the IP address will still be logged for security purposes
    $ip = getenv(REMOTE_ADDR);
    
    $plsr = file($v_path . "logger.txt");
    $c_pl = file_get_contents($v_path . "logger.txt");
    
    ///////////////////////////////////////////
    //Check if the user has voted or not.
    ///////////////////////////////////////////
    if(preg_match("/$ip/", $c_pl))
    {
       $ipf = "1";
       $disb = " disabled='disabled'";
    }
    else
    {
       $ipf = "0";
       $disb = "";
    }
    ///////////////////////////////////////////
    //Specify more variables (for filenames)
    ///////////////////////////////////////////
    $RESULT_FILE_NAME = $v_path . "poll_data.txt";
    $que = $v_path . "question.txt";
    $ans = $v_path . "ans.txt";
    $fn = fopen ($que, "r");
    $puff = fread ($fn, filesize($que));
    fclose ($fn);
    $QUESTION = $puff;
    $lis = 0;
    $plsr = file($ans);
    
    for($x=0;$x<sizeof($plsr);$x++)
    {
       $temp = explode("|",$plsr[$x]);
       $list[$lis] = $temp[0];
       $lis++;
    }
    $ANSWER = $list;
    
    if (!isset($_GET['answer']) && !$_POST['vresult'])
    {
       if($submit)
       {
          echo "<h2><b>Error!</b></h2>\nYou voted but didn't pick anything! If you want to vote, check the option you want and click Vote.";
       }
       else
       {
          echo "<FORM METHOD=\"GET\" ACTION=\"" . $v_path . "poll.php\" TARGET=\"_self\" NAME=\"vform\"><input type=hidden name=v_path value=\"" . $v_path . "\" />\n";
          echo "<TABLE align=center border=1 borderColor=#000000 cellPadding=2 class=normaltext style=\"BORDER-BOTTOM-COLOR: #000000; BORDER-COLLAPSE: collapse; BORDER-LEFT-COLOR: #000000; BORDER-RIGHT-COLOR: #000000; BORDER-TOP-COLOR: #000000;\" >\n";
          echo "<TR><TH>$QUESTION</TH></TR>\n";
          while (list($key, $val) = each($ANSWER))
          {
             echo "<TR><TD align=\"left\"><INPUT TYPE=\"radio\" NAME=\"answer\"$disb VALUE=\"$key\"> $val</TD></TR>\n";
          }
          echo "<TR><TD align=\"center\"><INPUT TYPE=\"submit\" NAME=\"vote\" onClick=\"voteForm()\" VALUE=\" Vote \"" . $disb . "></TD></TR>\n";
          echo "<TR><TD align=\"center\"></form><form method=post action=\"" . $v_path . "poll.php\" target=_self name=vformb><input type=hidden name=v_path value=\"" . $v_path . "\" /><input type=hidden name=vresult value=1><INPUT TYPE=\"Submit\" NAME=\"submit\" VALUE=\"Current Results\" onClick=\"voteFormb();\">\n";
          echo "</TABLE></form>";
       }
    }
    
    if (strlen($_GET['answer'])>0 || $_POST['vresult'])
    {
       echo "<body>";
       if($ipf || $_POST['vresult'])
       {
          $file_array = file($RESULT_FILE_NAME);
          $old_answer = $file_array[$_GET['answer']];
          $old_answer = preg_replace("/\n\r*/", "", $old_answer);
          $file_array[$_GET['answer']] = $old_answer . "\n";
          if($_POST['vresult'])
          {
             echo "<div align=center><b>Here are the current results:</b></div>";
          }
          else
          {
             echo "<font color=red><div align=center><b>Sorry, you have already voted.</b></div></font>";
          }
       }
       else
       {
          if ($_GET['answer'] < count($ANSWER))
          {
             $file_array = file($RESULT_FILE_NAME);
             $old_answer = $file_array[$_GET['answer']];
             $old_answer = preg_replace("/\n\r*/", "", $old_answer);
             $file_array[$_GET['answer']] = ($old_answer + 1)."\n";
             $fname=$v_path . "logger.txt";
             $fq = fopen($fname, "a++");
             fwrite($fq, "\n");
             fwrite($fq, $ip);
             fclose($fq);
             $file = join('', $file_array);
             $fp = fopen($RESULT_FILE_NAME, "w");
             fwrite($fp, $file);
             fclose($fp);
             echo "<div align=center>Vote saved.</div>";
          }
          else
          {
             $file_array = file($RESULT_FILE_NAME);
             $old_answer = $file_array[$_GET['answer']];
             $old_answer = preg_replace("/\n\r*/", "", $old_answer);
             $file_array[$_GET['answer']] = ($old_answer + 1)."\n";
             echo "<font color=red><div align=center><b>The poll has been updated. Vote again.</b></div></font>";
          }
       }
       while(list($key, $val) = each($file_array))
       {
          $total += $val;
       }
       echo "<TABLE align=center border=1 borderColor=#000000 cellPadding=2 class=normaltext style=\"BORDER-BOTTOM-COLOR: #000000; BORDER-COLLAPSE: collapse; BORDER-LEFT-COLOR: #000000; BORDER-RIGHT-COLOR: #000000; BORDER-TOP-COLOR: #000000;\" width=95%>\n";
       echo "<tr><th>Options</th><th>Percentage</th></tr>";
       while(list($key, $val) = each($ANSWER))
       {
          $percent = ($file_array[$key] > 0) ? $file_array[$key] * 100 / $total : 0;
          //avoid divisions by zero, especially for the PHP5 crowd
          $percent_int = floor($percent);
          $percent_float = number_format($percent, 1);
          $tp += $percent_float;
          if($percent_int>=75)
          {
             $color="blue";
          }
          elseif($percent_int>=50)
          {
             $color="green";
          }
          elseif($percent_int>=25)
          {
             $color="orange";
          }
          elseif($percent_int<25)
          {
             $color="red";
          }
          echo "<tr><td> $ANSWER[$key] </td><td><table cellpadding=1 cellspacing=0 width=100% border=0 background='" . $v_path . "images/white.gif'><tr><td><table cellpadding=0 cellspacing=0 border=0 width=100%>
    <tr>
    <td background='" . $v_path . "images/$color.gif' width=$percent_int% height=10 style=border:0 >
    <spacer type=block width=2 height=8>
    </td>
    <td class=white width=91% height=10 style=border:0>
    <spacer type=block width=2 height=8>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>$percent_float%</td></tr>";
       }
       echo "</TABLE></body>";
    }
    
    ?>

     

  7. Line 45 checks to see if the user has voted or not.  I want to give the user the ability to vote once per day.  Any suggestions on how I can do that, or if there is an existing voting script that gives me that option?  You can see the script in action at http://www.jamz1019.com/homejamz.php

     

    <?php
    
    /************************************************
    *************************************************
    **                                             **
    ** Simple PHP Poll by X-Fi6 and Scriptsez Inc. **
    **                                             **
    *************************************************
    *************************************************
    
         <Licensed with the General GNU License>
    
    *************************************************
    ** File:  poll.php                             **
    ************************************************/
    
    ///////////////////////////////////////////
    //Specify Variables And Such
    ///////////////////////////////////////////
    if(!isset($v_path)) //do some checking for $v_path
    {
    $v_path = "|"; //check the GET and POST and see if it's defined there
    $v_path = (isset($_GET['v_path'])) ? $_GET['v_path'] : $v_path;
    $v_path = (isset($_POST['v_path'])) ? $_POST['v_path'] : $v_path;
    //if it's not there, consider this shorthand and default to "vote/"
    $v_path = ($v_path == "|") ? "vote/" : $v_path = $v_path;
    }
    
    //whether voting multiple times is enabled or not,
    //the IP address will still be logged for security purposes
    $ip = getenv(REMOTE_ADDR);
    
    $plsr = file($v_path . "logger.txt");
    $c_pl = file_get_contents($v_path . "logger.txt");
    
    ///////////////////////////////////////////
    //Check if the user has voted or not.
    ///////////////////////////////////////////
    if(preg_match("/$ip/", $c_pl))
    {
    $ipf = "1";
    $disb = " disabled='disabled'";
    }
    else
    {
    $ipf = "0";
    $disb = "";
    }
    ///////////////////////////////////////////
    //Specify more variables (for filenames)
    ///////////////////////////////////////////
    $RESULT_FILE_NAME = $v_path . "poll_data.txt";
    $que = $v_path . "question.txt";
    $ans = $v_path . "ans.txt";
    $fn = fopen ($que, "r");
    $puff = fread ($fn, filesize($que));
    fclose ($fn);
    $QUESTION = $puff;
    $lis = 0;
    $plsr = file($ans);
    
    for($x=0;$x<sizeof($plsr);$x++)
    {
    $temp = explode("|",$plsr[$x]);
    $list[$lis] = $temp[0];
    $lis++;
    }
    $ANSWER = $list;
    
    if (!isset($_GET['answer']) && !$_POST['vresult'])
    {
    if($submit)
    {
    	echo "<h2><b>Error!</b></h2>\nYou voted but didn't pick anything! If you want to vote, check the option you want and click Vote.";
    }
    else
    {
    	echo "<FORM METHOD=\"GET\" ACTION=\"" . $v_path . "poll.php\" TARGET=\"_self\" NAME=\"vform\"><input type=hidden name=v_path value=\"" . $v_path . "\" />\n";
    	echo "<TABLE align=center border=1 borderColor=#000000 cellPadding=2 class=normaltext style=\"BORDER-BOTTOM-COLOR: #000000; BORDER-COLLAPSE: collapse; BORDER-LEFT-COLOR: #000000; BORDER-RIGHT-COLOR: #000000; BORDER-TOP-COLOR: #000000;\" >\n";
    	echo "<TR><TH>$QUESTION</TH></TR>\n";
    	while (list($key, $val) = each($ANSWER))
    	{
    		echo "<TR><TD align=\"left\"><INPUT TYPE=\"radio\" NAME=\"answer\"$disb VALUE=\"$key\"> $val</TD></TR>\n";
    	}
    	echo "<TR><TD align=\"center\"><INPUT TYPE=\"submit\" NAME=\"vote\" onClick=\"voteForm()\" VALUE=\" Vote \"" . $disb . "></TD></TR>\n";
    	echo "<TR><TD align=\"center\"></form><form method=post action=\"" . $v_path . "poll.php\" target=_self name=vformb><input type=hidden name=v_path value=\"" . $v_path . "\" /><input type=hidden name=vresult value=1><INPUT TYPE=\"Submit\" NAME=\"submit\" VALUE=\"Current Results\" onClick=\"voteFormb();\">\n";
    	echo "</TABLE></form>";
    }
    }
    
    if (strlen($_GET['answer'])>0 || $_POST['vresult'])
    {
    echo "<body>";
    if($ipf || $_POST['vresult'])
    {
    	$file_array = file($RESULT_FILE_NAME);
    	$old_answer = $file_array[$_GET['answer']];
    	$old_answer = preg_replace("/\n\r*/", "", $old_answer);
    	$file_array[$_GET['answer']] = $old_answer . "\n";
    	if($_POST['vresult'])
    	{
    		echo "<div align=center><b>Here are the current results:</b></div>";
    	}
    	else
    	{
    		echo "<font color=red><div align=center><b>Sorry, you have already voted.</b></div></font>";
    	}
    }
    else
    {
    	if ($_GET['answer'] < count($ANSWER))
    	{
    		$file_array = file($RESULT_FILE_NAME);
    		$old_answer = $file_array[$_GET['answer']];
    		$old_answer = preg_replace("/\n\r*/", "", $old_answer);
    		$file_array[$_GET['answer']] = ($old_answer + 1)."\n";
    		$fname=$v_path . "logger.txt";
    		$fq = fopen($fname, "a++");
    		fwrite($fq, "\n");
    		fwrite($fq, $ip);
    		fclose($fq);
    		$file = join('', $file_array);
    		$fp = fopen($RESULT_FILE_NAME, "w");
    		fwrite($fp, $file);
    		fclose($fp);
    		echo "<div align=center>Vote saved.</div>";
    	}
    	else
    	{
    		$file_array = file($RESULT_FILE_NAME);
    		$old_answer = $file_array[$_GET['answer']];
    		$old_answer = preg_replace("/\n\r*/", "", $old_answer);
    		$file_array[$_GET['answer']] = ($old_answer + 1)."\n";
    		echo "<font color=red><div align=center><b>The poll has been updated. Vote again.</b></div></font>";
    	}
    }
    while(list($key, $val) = each($file_array))
    {
    	$total += $val;
    }
    echo "<TABLE align=center border=1 borderColor=#000000 cellPadding=2 class=normaltext style=\"BORDER-BOTTOM-COLOR: #000000; BORDER-COLLAPSE: collapse; BORDER-LEFT-COLOR: #000000; BORDER-RIGHT-COLOR: #000000; BORDER-TOP-COLOR: #000000;\" width=95%>\n";
    echo "<tr><th>Options</th><th>Percentage</th></tr>";
    while(list($key, $val) = each($ANSWER))
    {
    	$percent = ($file_array[$key] > 0) ? $file_array[$key] * 100 / $total : 0;
    	//avoid divisions by zero, especially for the PHP5 crowd
    	$percent_int = floor($percent);
    	$percent_float = number_format($percent, 1);
    	$tp += $percent_float;
    	if($percent_int>=75)
    	{
    		$color="blue";
    	}
    	elseif($percent_int>=50)
    	{
    		$color="green";
    	}
    	elseif($percent_int>=25)
    	{
    		$color="orange";
    	}
    	elseif($percent_int<25)
    	{
    		$color="red";
    	}
    	echo "<tr><td> $ANSWER[$key] </td><td><table cellpadding=1 cellspacing=0 width=100% border=0 background='" . $v_path . "images/white.gif'><tr><td><table cellpadding=0 cellspacing=0 border=0 width=100%>
    <tr>
    <td background='" . $v_path . "images/$color.gif' width=$percent_int% height=10 style=border:0 >
    <spacer type=block width=2 height=8>
    </td>
    <td class=white width=91% height=10 style=border:0>
    <spacer type=block width=2 height=8>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>$percent_float%</td></tr>";
    }
    echo "</TABLE></body>";
    }
    
    ?>
    

  8. So I am using the poll from http://www.dbscripts.net/poll/ andit is perfect for what I need.  I just want to configure it, so the values that people choose can also be clickable links.  I.E.

    // Twelfth poll definition
    $p = new Poll;
    $p->question = "Does Race Matter when it comes to electing the president? ";				// Question displayed to the user
    $p->returnToURL = "../main.php";				// Specify the URL to return to for this poll; may be relative or absolute
    $p->legend = "Cast Your Vote!";						// Form legend; leave empty for none
    $p->control_type =$CONTROL_RADIOBUTTONS;			// Control type; $CONTROL_RADIOBUTTONS or $CONTROL_COMBOBOX
    $p->add_value("1", "Yes");				// Poll value ID and a display string
    $p->add_value("2", "No");
    $VALID_POLLS["12"] = $p;							// "12" is the poll ID

     

    could be turned into

     

    // Twelfth poll definition
    $p = new Poll;
    $p->question = "Does Race Matter when it comes to electing the president? ";				// Question displayed to the user
    $p->returnToURL = "../main.php";				// Specify the URL to return to for this poll; may be relative or absolute
    $p->legend = "Cast Your Vote!";						// Form legend; leave empty for none
    $p->control_type =$CONTROL_RADIOBUTTONS;			// Control type; $CONTROL_RADIOBUTTONS or $CONTROL_COMBOBOX
    $p->add_value("1", "<a href = "test.html">Yes</a>");				// Poll value ID and a display string$p->add_value("2", "No");
    $VALID_POLLS["12"] = $p;							// "12" is the poll ID

     

    When I try to do that, or do

    $p->add_value("1", "<a href = \"test.html\">Yes</a>"); // Poll value ID and a display string

     

    It prints the text verbatim, and doesn't make it code.  Any ideas?

  9. I was missing a \" on line 17. html error.  yay.  TGFRB  (THANK GOD FOR RED BULL)

    <div class="productbox">
    <?php
    $product=SW45;
    //connect to MySQL
    $connect = mysql_connect("localhost", "jadasdes", "meaka003")
    or die("Hey loser, check your server connection.");
    //make sure we’re using the right database
    mysql_select_db("jadasdes_ppproducts");
    $query = "SELECT * FROM products WHERE productid LIKE '$product'";
    $results = mysql_query($query)
    or die(mysql_error());
    while ($row = mysql_fetch_array($results)) {
    extract($row);
    echo  $producttitle;
    echo "<img src=\"http://www.jadasdesign.com/pp/images/".$productid."-largeimage.jpg\" align = \"left\">";
    echo " <br> ";
    echo "<a href = \"http://www.jadasdesign.com/pp/Disguised_Pepper_Spray/index.php?=".$productid."\">".$producttitle."</a>";
    echo "<p>";
    }
    ?>
    
    </div>

  10. It brings up the picture, but not the title...  Where might the error be? It is probably staring me in the face, but I am going on 72 hours of no sleep, now.

    <div class="productbox">
    <?php
    $product=SW45;
    //connect to MySQL
    $connect = mysql_connect("localhost", "jadasdes", "notreallymypassword")
    or die("Hey loser, check your server connection.");
    //make sure we’re using the right database
    mysql_select_db("jadasdes_ppproducts");
    $query = "SELECT * FROM products WHERE productid LIKE '$product'";
    $results = mysql_query($query)
    or die(mysql_error());
    while ($row = mysql_fetch_array($results)) {
    extract($row);
    echo "<img src=\"http://www.example.com/pp/images/".$productid."-largeimage.jpg\" align = \"left\">";
    echo " <br> ";
    echo "<a href = \"http://www.example.com/pp/Disguised_Pepper_Spray/index.php?=".$productid.">".$producttitle."</a>";
    echo "<p>";
    }
    ?>
    
    </div>

×
×
  • 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.