Jump to content

JADASDesigner

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

About JADASDesigner

  • Birthday 09/30/1980

Contact Methods

  • AIM
    tsuji+omakae
  • MSN
    blacjoker@hotmail.com
  • Website URL
    http://www.jadasdesign.com
  • Yahoo
    blacjoker@yahoo.com

Profile Information

  • Gender
    Male
  • Location
    Deep within my creative process

JADASDesigner's Achievements

Member

Member (2/5)

0

Reputation

  1. Just to be safe, I tried it on another server with the same results. I am fairly certain it is the script.
  2. As a matter of fact, I am on windows, but I am pretty sure the server itself is linux/apache
  3. So I tried to get some sleep, woke up, and got at it again, to no avail. The message sends perfectly, with all of the HTML and variables intact, except the attatchment. It still sends it as som random named text document...
  4. I don't know what you mean. Forgive me. I am having a hard time with this.
  5. 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"); } ?>
  6. Well it was... Now I am getting: Parse error: syntax error, unexpected $end in /www/jamz1019.com/html/IPO3.php on line 211
  7. 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"); } ?>
  8. ??? 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"); } ?>
  9. BTW if anyone looks at this post in the future I would HIGHLY recommend making the PHP file that does it some random named document. Not something stupid like erase.php
  10. I had the nutty notion to use scheduled task on my computer to open a saved favorite that happens to be the script to wipe the log. SWEET!
  11. I have a text log that stores IP addresses for a poll, but I want to dump it everynight at midnight, and start fresh. I have been doing it manually for about two weeks. Is there a way it can be done automatically?
  12. and make sure you throw your header variable into the mail line.
  13. Haven't delved into the script but remove your time linit line, also paste your config and opendb files. there may be an issue in one of them. feel free to edit out any sensitive info (like passwords...)
  14. 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>"; } ?>
×
×
  • 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.