Jump to content

drisate

Members
  • Posts

    805
  • Joined

  • Last visited

Everything posted by drisate

  1. Hey guys ... lol this is not funny ... there's a very big problem with documentation on this IMAP thing This time ia m having a bad time saving my attachment to my draft and sent inbox ... (The message is stored ... but not the attachment with it) The message is sent with no problem thought ... it's just making a copy that is not working. if ($_POST[submit]!="Save to Drafts"){$success = mail($to, $su, $Body, $Headers);}else{$success="true";} if ($success) { showBody(""); if ($_POST[submit]!="Save to Drafts"){echo "Mail is sent!";}else{echo "Mail is saved!";} if (isset($_POST['oldmessage']) && isset($_POST['oldmessage_delete']) && $_POST['oldmessage_delete'] == "true") { echo " Also deleting original message."; delete($_POST['oldmessage']); } $stream = imap_open("{mail.***.org:143/imap/notls}", "$_SESSION[session_username]", "$_SESSION[session_password]"); $check = imap_check($stream); if ($_POST[submit]=="Save to Drafts"){ imap_append($stream, "{mail.***.org:143/imap/notls}INBOX.Drafts" , "From: $_POST[fr]\r\n" . "To: $to\r\n" . "Subject: $su\r\n" . "\r\n" . html_entity_decode($ms) . "\r\n" ); }else{ imap_append($stream, "{mail.***.org:143/imap/notls}INBOX.Sent" , "From: $_POST[fr]\r\n" . "To: $to\r\n" . "Subject: $su\r\n" . "\r\n" . html_entity_decode($ms) . "\r\n" ); }
  2. Hey guys, how do you open an imap attachment for download with the message number and the part number?
  3. i just tryed this $mid = $_GET['num']; $k = $_GET['part']-1; $parttypes = array ("text", "multipart", "message", "application", "audio", "image", "video", "other"); // Load variables only if an external configuration was not selected. function returnAttachment($itemId, $attachId) { global $parttypes, $accountUser, $accountPass, $mbox; $msgStructure = imap_fetchstructure($mbox, $itemId); $part = $msgStructure->parts[$attachId-1]; $ctype = $parttypes[$part->type]."/".$part->subtype; $filename = "filename"; foreach($part->parameters as $param) { if($param->attribute=="NAME") $filename = $param->value; } header("content-type: ".$ctype); header("content-disposition: attachment; filename=".$filename); // Returned data depends on whether the attachment is binary or text if($part->type>0) { // Binary attachment - convert from base64 to binary echo base64_decode(imap_fetchbody($mbox, $itemId, $attachId)); } else { // Text attachment - just display it as-is echo imap_fetchbody($mbox, $itemId, $attachId); } } echo returnAttachment($mid, $k); It's even worse ... i don't get it ... those are codes posted everywhere as working ... This code returns an HTML file type + name of the file is by delfault in the code filename and the file returned is corrupted Sorry it's just that when the message is down the page (and has some replys to it) nobody opens it so when it's down i bump it so that somebody hopefully sees this and has the answer i am looking for.
  4. Ok i got it to work ... but now it outputs an empty file $mbox = imapOpen(); if (!$mbox){ $message = "This link is not valid anymore. Please login again."; die("<META HTTP-EQUIV='Refresh' CONTENT='0;url=?mod=mail&message=".urlencode($message)."'></META>"); }else{ $mid = $_GET['num']; $k = $_GET['part']-1; $structure = imap_fetchstructure($mbox, $mid); $encoding = $structure->parts[$k]->encoding; //extract file name from headers $fileName = strtolower($structure->parts[$k]->dparameters[0]->value); //extract attachment from email body $fileSource = base64_decode(imap_fetchbody($mbox, $mid, $k+1)); //get extension $ext = substr($fileName, strrpos($fileName, '.') + 1); //get mime file type switch ($ext) { case "asf": $type = "video/x-ms-asf"; break; case "avi": $type = "video/avi"; break; case "flv": $type = "video/x-flv"; break; case "fla": $type = "application/octet-stream"; break; case "swf": $type = "application/x-shockwave-flash"; break; case "doc": $type = "application/msword"; break; case "docx": $type = "application/msword"; break; case "zip": $type = "application/zip"; break; case "xls": $type = "application/vnd.ms-excel"; break; case "gif": $type = "image/gif"; break; case "jpg" || "jpeg": $type = "image/jpg"; break; case "png": $type = "image/png"; break; case "wav": $type = "audio/wav"; break; case "mp3": $type = "audio/mpeg3"; break; case "mpg" || "mpeg": $type = "video/mpeg"; break; case "rtf": $type = "application/rtf"; break; case "htm" || "html": $type = "text/html"; break; case "xml": $type = "text/xml"; break; case "xsl": $type = "text/xsl"; break; case "css": $type = "text/css"; break; case "php": $type = "text/php"; break; case "txt": $type = "text/txt"; break; case "asp": $type = "text/asp"; break; case "pdf": $type = "application/pdf"; break; case "psd": $type = "application/octet-stream"; break; default: $type = "application/octet-stream"; } //download file header('Content-Description: File Transfer'); header('Content-Type: ' .$type); header('Content-Disposition: attachment; filename='.$fileName); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($fileSource)); ob_clean(); flush(); echo $fileSource; } this is a print_r on imap_fetchstructure stdClass Object ( [type] => 1 [encoding] => 0 [ifsubtype] => 1 [subtype] => MIXED [ifdescription] => 0 [ifid] => 0 [ifdisposition] => 0 [ifdparameters] => 0 [ifparameters] => 1 [parameters] => Array ( [0] => stdClass Object ( [attribute] => boundary [value] => 4-1410065408-1410065408=:56890 ) ) [parts] => Array ( [0] => stdClass Object ( [type] => 1 [encoding] => 0 [ifsubtype] => 1 [subtype] => ALTERNATIVE [ifdescription] => 0 [ifid] => 0 [ifdisposition] => 0 [ifdparameters] => 0 [ifparameters] => 1 [parameters] => Array ( [0] => stdClass Object ( [attribute] => boundary [value] => 6-1410065408-1410065408=:72275 ) ) [parts] => Array ( [0] => stdClass Object ( [type] => 0 [encoding] => 4 [ifsubtype] => 1 [subtype] => PLAIN [ifdescription] => 0 [ifid] => 0 [bytes] => 52 [ifdisposition] => 0 [ifdparameters] => 0 [ifparameters] => 1 [parameters] => Array ( [0] => stdClass Object ( [attribute] => charset [value] => windows-1256 ) ) ) [1] => stdClass Object ( [type] => 0 [encoding] => 4 [ifsubtype] => 1 [subtype] => HTML [ifdescription] => 0 [ifid] => 0 [lines] => 1 [bytes] => 161 [ifdisposition] => 0 [ifdparameters] => 0 [ifparameters] => 1 [parameters] => Array ( [0] => stdClass Object ( [attribute] => charset [value] => windows-1256 ) ) ) ) ) [1] => stdClass Object ( [type] => 5 [encoding] => 3 [ifsubtype] => 1 [subtype] => PJPEG [ifdescription] => 0 [ifid] => 0 [bytes] => 17588 [ifdisposition] => 1 [disposition] => attachment [ifdparameters] => 1 [dparameters] => Array ( [0] => stdClass Object ( [attribute] => filename [value] => drisate_1.jpg ) ) [ifparameters] => 1 [parameters] => Array ( [0] => stdClass Object ( [attribute] => name [value] => ) ) ) [2] => stdClass Object ( [type] => 5 [encoding] => 3 [ifsubtype] => 1 [subtype] => PJPEG [ifdescription] => 0 [ifid] => 0 [bytes] => 10596 [ifdisposition] => 1 [disposition] => attachment [ifdparameters] => 1 [dparameters] => Array ( [0] => stdClass Object ( [attribute] => filename [value] => avatar-63671.jpg ) ) [ifparameters] => 1 [parameters] => Array ( [0] => stdClass Object ( [attribute] => name [value] => ) ) ) [3] => stdClass Object ( [type] => 5 [encoding] => 3 [ifsubtype] => 1 [subtype] => PJPEG [ifdescription] => 0 [ifid] => 0 [bytes] => 55046 [ifdisposition] => 1 [disposition] => attachment [ifdparameters] => 1 [dparameters] => Array ( [0] => stdClass Object ( [attribute] => filename [value] => moi.jpg ) ) [ifparameters] => 1 [parameters] => Array ( [0] => stdClass Object ( [attribute] => name [value] => ) ) ) ) ) The page link looks like index.php?mod=mail&CMD=Attachview&num=17&part=3 so i am trying to download part 2 (works to get it but it's empty ..)
  5. I m not sure that's the best way to fix this... what if they are sending an html file? ... i don't know, sounds buggy. But why the hell is my code returning .html stuff?
  6. Guys ... this is frustrating ... i completly remade my code ... and i have exacly the same problem ... what is it i don't get? Both of the codes are implemented in other applications and should be working ... function get_attached_file($mbox,$structure,$k,$mid) { $encoding = $structure->parts[$k]->encoding; //extract file name from headers $fileName = strtolower($structure->parts[$k]->dparameters[0]->value); //extract attachment from email body $fileSource = base64_decode(imap_fetchbody($mbox, $mid, $k+1)); //get extension $ext = substr($fileName, strrpos($fileName, '.') + 1); //die($ext); //get mime file type switch ($ext) { case "asf": $type = "video/x-ms-asf"; break; case "avi": $type = "video/avi"; break; case "flv": $type = "video/x-flv"; break; case "fla": $type = "application/octet-stream"; break; case "swf": $type = "application/x-shockwave-flash"; break; case "doc": $type = "application/msword"; break; case "docx": $type = "application/msword"; break; case "zip": $type = "application/zip"; break; case "xls": $type = "application/vnd.ms-excel"; break; case "gif": $type = "image/gif"; break; case "jpg" || "jpeg": $type = "image/jpg"; break; case "png": $type = "image/png"; break; case "wav": $type = "audio/wav"; break; case "mp3": $type = "audio/mpeg3"; break; case "mpg" || "mpeg": $type = "video/mpeg"; break; case "rtf": $type = "application/rtf"; break; case "htm" || "html": $type = "text/html"; break; case "xml": $type = "text/xml"; break; case "xsl": $type = "text/xsl"; break; case "css": $type = "text/css"; break; case "php": $type = "text/php"; break; case "txt": $type = "text/txt"; break; case "asp": $type = "text/asp"; break; case "pdf": $type = "application/pdf"; break; case "psd": $type = "application/octet-stream"; break; default: $type = "application/octet-stream"; } //download file header('Content-Description: File Transfer'); header('Content-Type: ' .$type); header('Content-Disposition: attachment; filename='.$fileName); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($fileSource)); ob_clean(); flush(); echo $fileSource; } $mbox = imapOpen(); if (!$mbox) { $message = "This link is not valid anymore. Please login again."; die("<META HTTP-EQUIV='Refresh' CONTENT='0;url=?mod=mail&message=" . urlencode($message) . "'></META>"); }else{ //$mbox = imap stream $mid = $_GET['num']; $partno = $_GET['part']-1; $structure = imap_fetchstructure($mbox, $mid); get_attached_file($mbox,$structure,$partno,$mid); }
  7. hey guys i made an attachement download code but for some reason instead of having image.jpg it gives image.jpg.html and it's invalide ... $mbox = imapOpen(); if (!$mbox) { $message = "This link is not valid anymore. Please login again."; die("<META HTTP-EQUIV='Refresh' CONTENT='0;url=?mod=mail&message=" . urlencode($message) . "'></META>"); } $msg = $_GET['num']; $bypasscheck = 0; if (!eregi("^([0-9]*)$", $msg) or !eregi("([0-9\.]*)", $_GET['part'])) exit(); $tmpa = array(); $ret = array(); if (eregi("([0-9\.]*)\.([0-9\.]*)", $_GET['part'], $ret)) { $pone = ($ret[1] - 1); $ptwo = ($ret[2] - 1); } else { $pone = ($_GET['part'] - 1); } $dpara = array(); $struct = @imap_fetchstructure($mbox, $msg); $body = @imap_fetchbody($mbox, $msg, $_GET['part']); @imap_close($mbox); $tmpa = $struct->parts; if (isset($ptwo)) { $tmpa = $tmpa[$pone]->parts; $obj = $tmpa[$ptwo]; } else { $obj = $tmpa[$pone]; } $dpara = $obj->dparameters; for ($v = 0; $v < sizeof($dpara); $v++) { if (eregi("filename", $dpara[$v]->attribute)) { $fname = $dpara[$v]->value; } } if (empty($fname)) { $para = $obj->parameters; for ($v = 0; $v < sizeof($para); $v++) { if (eregi("name", $para[$v]->attribute)) { $fname = $para[$v]->value; } } } if (empty($fname)) { $disp = $obj->description; } if (empty($fname)) { $fname = $lang_unknown; } $mime_type = mimetype($obj->type) . "/" . strtolower($obj->subtype); if ($mime_type == "message/rfc822") { $mime_type = "text/plain"; } header("Content-Type: " . $mime_type); switch ($obj->encoding) { case 4: $body = @imap_qprint($body); break; case 3: $body = @imap_base64($body); break; default: $beginning = substr($body, 0, 50); if (stristr($beginning, "BinHex") != false) $fname = $fname . ".binhex"; break; } header("Content-Disposition: attachment; filename=\"$fname\""); print $body; The link to access this looks like: index.php?mod=mail&CMD=Attachview&num=17&part=4
  8. nah it's not abbout the string it self... that was just an exemple that fits in one line hehe. Like i said i am looping the HTML page of a board. it needs to loop every message posted and extract the values... $start = '<table cellpadding="0" cellspacing="0" border="0" style="width:100%"><tr><td width="100%"><table cellpadding="4" cellspacing="1" border="0" style="width:100%" class="tableinborder">'; $end = "</table></td></tr></table>"; Is how i can seperate the page. what i need to do is loop every result of whats between
  9. umm no hehe i wana loop a board thread then extract for every messages of the page the username that posted the message and the time it was posted. What i need to do is breake the page in to a loop for every threads and load that to an array to then loop that array and extract the needed info. Where i block is extracting the threads between 2 values
  10. How abbout something like this: $command1 = mysql_query("Select * FROM $table ") or die(mysql_error()); while ($data1 = mysql_fetch_array($command1)){ echo $data1[parent]; $command2 = mysql_query("Select * FROM $table where parent='$data1[parent]'") or die(mysql_error()); while ($data2 = mysql_fetch_array($command2)){ echo " ".$data2[sub]; $command3 = mysql_query("Select * FROM $table where sub='$data2[sub]'") or die(mysql_error()); while ($data3 = mysql_fetch_array($command3)){ echo " ".$data2[child]; } } } Whats up allworknoplay :-) Nice to see your stickying arround
  11. Hey guys i would like to find and loop a string and extract the value in between the markes into an array ... ex: 1221344136613 between 1 and 13 array[0] = 22 array[1] = 44 array[2] = 66 i created this function findinside($start, $end, $string) { preg_match_all('/' . preg_quote($start, '/') . '([^\.)]+)' . preg_quote($end, '/') . '/i', $string, $m); return $m; } But i dont think it's returning an array because i am looping the result into a foreach for then extract more values in the string. and i get preg_match_all() expects parameter 2 to be string, array given this is my full code: $content = file_get_contents("$page"); function findinside($start, $end, $string) { preg_match_all('/' . preg_quote($start, '/') . '([^\.)]+)' . preg_quote($end, '/') . '/i', $string, $m); return $m; } $start = '<table cellpadding="0" cellspacing="0" border="0" style="width:100%"><tr><td width="100%"><table cellpadding="4" cellspacing="1" border="0" style="width:100%" class="tableinborder">'; $end = "</table></td></tr></table>"; $out = findinside($start, $end, $content); foreach ($out as $loop) { //////////////// // USERNAME $txt = $loop; $re = '.*?(?:[a-z][a-z0-9_]*).*?(?:[a-z][a-z0-9_]*).*?(?:[a-z][a-z0-9_]*).*?(?:[a-z][a-z0-9_]*).*?(?:[a-z][a-z0-9_]*).*?(?:[a-z][a-z0-9_]*).*?(?:[a-z][a-z0-9_]*).*?(?:[a-z][a-z0-9_]*).*?(?:[a-z][a-z0-9_]*).*?((?:[a-z][a-z0-9_]*))';# Non-greedy match on filler if ($c = preg_match_all("/".$re."/is", $txt, $matches)) { $var1 = $matches[1][0]; print "($var1) \n"; } /////////////// // TIME $re = '((?:[0]?[1-9]|[1][012])[-:\\/.](??:[0-2]?\\d{1})|(?:[3][0,1]{1}))[-:\\/.](??:[1]{1}\\d{1}\\d{1}\\d{1})|(?:[2]{1}\\d{3})))(?![\\d]).*?((??:[0-1][0-9])|(?:[2][0-3])|(?:[0-9]))?:[0-5][0-9])(?::[0-5][0-9])?(?:\\s?(?:am|AM|pm|PM))?)';# MMDDYYYY 1 if ($c = preg_match_all("/".$re."/is", $txt, $matches)) { $mmddyyyy1 = $matches[1][0]; $time1 = $matches[2][0]; print "($mmddyyyy1) ($time1) \n"; } } I am basacly looping the content of a board thread and extract the username a time the post was posted.
  12. Ok i have been able to pin point what i need ... Can you help me build the regex to load the content for the stuff betwee <table cellpadding="0" cellspacing="0" border="0" style="width:100%"><tr><td width="100%"><table cellpadding="4" cellspacing="1" border="0" style="width:100%" class="tableinborder"> and </table></td></tr></table> Then i can do a foreach loop and use my othe codes
  13. Hey guys ... i need to create a PHP scripts that literly scans a board post to extract the username and time of the post then store them to the database 1 post looks like this <table cellpadding="4" cellspacing="1" border="0" style="width:100%" class="tableinborder"> <tr align="left"> <td class="tablea" valign="top"><a name="post6794327" id="post6794327"> </a> <table style="width:100%" cellpadding="4" cellspacing="0" border="0" class="tablea_fc"> <tr> <td style="width:100%" class="smallfont"> <span class="normalfont"><b> <a href="profile.php?userid=106475" style="color: #B0C4DE; text-decoration: none"> Beaster</a></b></span> <br /> Recycler <br /> <img src="en_images_ogame/star.gif" border="0" alt="" title /><img src="en_images_ogame/star.gif" border="0" alt="" title /><img src="en_images_ogame/star.gif" border="0" alt="" title /><img src="en_images_ogame/star.gif" border="0" alt="" title /><img src="en_images_ogame/star.gif" border="0" alt="" title /> <br /> <br /> <img src="images/avatars/avatar-63671.jpg" border="0" alt="images/avatars/avatar-63671.jpg" title /><br /> <br /> Registration Date: 06-02-2008<br /> Posts: 166<br /> Location: Quebec in Canada<br /> Universe: 1<br /> Alliance: Dramis<br /> <br /> <img src="en_images_ogame/spacer.gif" width="159" height="1" border="0" alt="" title /></td> </tr> </table> </td> <td class="tablea" valign="top" style="width:100%"> <table style="width:100%" cellpadding="4" cellspacing="0" border="0" class="tablea_fc"> <tr> <td style="width:100%" class="normalfont" align="left"> <table style="width:100%" cellpadding="4" cellspacing="0" border="0" class="tablea_fc"> <tr> <td><span class="smallfont"><b>DC.UA VS Phoenix</b></span></td> <td align="right" nowrap="nowrap"> <a href="addreply.php?postid=6794327" style="color: #B0C4DE; text-decoration: none"> <img src="en_images_ogame/replypost.gif" border="0" alt="Reply to this Post" title="Reply to this Post" /></a> <a href="addreply.php?action=quote&postid=6794327" style="color: #B0C4DE; text-decoration: none"> <img src="en_images_ogame/quote.gif" border="0" alt="Post Reply with Quote" title="Post Reply with Quote" /></a> <a href="editpost.php?postid=6794327" style="color: #B0C4DE; text-decoration: none"> <img src="en_images_ogame/editpost.gif" border="0" alt="Edit/Delete Posts" title="Edit/Delete Posts" /></a> <a href="report.php?postid=6794327" style="color: #B0C4DE; text-decoration: none"> <img src="en_images_ogame/report.gif" border="0" alt="Report Post to a Moderator" title="Report Post to a Moderator" /></a> <a href="javascript:self.scrollTo(0,0);" style="color: #B0C4DE; text-decoration: none"> <img src="en_images_ogame/goup.gif" border="0" alt="Go to the top of this page" title="Go to the top of this page" /></a></td> </tr> </table> <hr size="1" class="threadline" />CRs Only <br /> <br /> __________________<br /> <span style="font-size: 10px;"> <img src="http://f-fr.com/newbk1_500.png" alt="" border="0" class="resizeImage" /></span><br /> <br /> Take a look at my Ogame Video&#39;s!<br /> DC News - <a href="http://youtube.com/user/DramisC" target="_blank" style="color: #B0C4DE; text-decoration: none"> http://youtube.com/user/DramisC</a><br /> </td> </tr> </table> </td> </tr> <tr> <td class="tablea" align="center" nowrap="nowrap"> <span class="smallfont"> <a href="thread.php?postid=6794327#post6794327" style="color: #B0C4DE; text-decoration: none"> <img src="en_images_ogame/posticon.gif" border="0" alt="" title /></a> 08-20-2008 <span class="time">19:14</span></span></td> <td class="tablea" align="left" style="width:100%" valign="middle"> <span class="smallfont"> <img src="en_images_ogame/user_online.gif" border="0" alt="Beaster is online" title="Beaster is online" /> <a href="mailto:webmaster@s-star.com" style="color: #B0C4DE; text-decoration: none"> <img src="en_images_ogame/email.gif" border="0" alt="Send an Email to Beaster" title="Send an Email to Beaster" /></a> <a href="http://f-fr.com/2" target="_blank" style="color: #B0C4DE; text-decoration: none"> <img src="en_images_ogame/www.gif" border="0" alt="Homepage of Beaster" title="Homepage of Beaster" /></a> <a href="search.php?action=user&userid=106475" style="color: #B0C4DE; text-decoration: none"> <img src="en_images_ogame/search.gif" border="0" alt="Search for Posts by Beaster" title="Search for Posts by Beaster" /></a> <a href="usercp.php?action=buddy&add=106475" style="color: #B0C4DE; text-decoration: none"> <img src="en_images_ogame/homie.gif" border="0" alt="Add Beaster to your Buddy List" title="Add Beaster to your Buddy List" /></a> <a href="pms.php?action=newpm&userid=106475" style="color: #B0C4DE; text-decoration: none"> <img src="en_images_ogame/pm.gif" border="0" alt="Send a Private Message to Beaster" title="Send a Private Message to Beaster" /></a> </span></td> </tr> </table> I gave a basic idea of what the regex code to extract the value of 1 post would look like $txt='<a href="profile.php?userid=106475">Beaster</a>'; $re1='.*?'; # Non-greedy match on filler $re2='(Beaster)'; # Variable Name 1 if ($c=preg_match_all ("/".$re1.$re2."/is", $txt, $matches)) { $var1=$matches[1][0]; print "($var1) \n"; } and $txt='08-20-2008 <span class="time">19:14</span>'; $re1='((?:[0]?[1-9]|[1][012])[-:\\/.](??:[0-2]?\\d{1})|(?:[3][0,1]{1}))[-:\\/.](??:[1]{1}\\d{1}\\d{1}\\d{1})|(?:[2]{1}\\d{3})))(?![\\d])'; # MMDDYYYY 1 $re2='.*?'; # Non-greedy match on filler $re3='((??:[0-1][0-9])|(?:[2][0-3])|(?:[0-9]))?:[0-5][0-9])(?::[0-5][0-9])?(?:\\s?(?:am|AM|pm|PM))?)'; # HourMinuteSec 1 if ($c=preg_match_all ("/".$re1.$re2.$re3."/is", $txt, $matches)) { $mmddyyyy1=$matches[1][0]; $time1=$matches[2][0]; print "($mmddyyyy1) ($time1) \n"; } But how can i make it loop every messages then perform the per thread extraction (username) then (Post time)
  14. nope that outputs a number. i need it to output the value of attname The number is not even good thought
  15. hmmm nope and this si not working to SELECT COUNT(attname) as num FROM war GROUP BY attname order by num
  16. hey guys, how can i select the username that has appeared the most in a colum? SELECT attname FROM war order by count(id) desc limit 1 Thats not working
  17. thx guys i switched it to int and now works like a charme :-)
  18. hey guys ... ia m trying to select the row with the highest td number SELECT * FROM `war` ORDER BY `war`.`td` DESC LIMIT 1 But that returns 99000 96000 952000 94000 instead of 952000 99000 96000 94000 Whats wroung? I tryed to sort them from PHPMyADMIN, same problem ...
  19. would it be possible give the option to mark a topic as solved starting from the moment you posted at least 1 message in the topic? if the topic is really not solved the guy can reopen it. this would result in a bigger amount of topics marked as solved so we can focus on the remaining ones. like i said, if the topic is not solved itcan alsways be reopened
  20. i remade my script and now it works :-) This was one big headack ... thx for your support guys ;-) working multiple attachment <form action='index.php?mod=mail&CMD=send' enctype='multipart/form-data' method='post'> <input id="file" name="userfile[]" style="background-color: rgb(221, 238, 238);" size="55" type="file"> <input id="file" name="userfile[]" style="background-color: rgb(221, 238, 238);" size="55" type="file"> <input id="file" name="userfile[]" style="background-color: rgb(221, 238, 238);" size="55" type="file"> <input id="file" name="userfile[]" style="background-color: rgb(221, 238, 238);" size="55" type="file"> <input id="file" name="userfile[]" style="background-color: rgb(221, 238, 238);" size="55" type="file"> [...] </form> $to = $_POST[to]; $su = $_POST[su]; $FromEmail = $_POST[fr]; $txt = html2text($_POST['ms']); $html = $_POST['ms']; $boundary1 =rand(0,9)."-" .rand(10000000000,9999999999)."-" .rand(10000000000,9999999999)."=:" .rand(10000,99999); $boundary2 =rand(0,9)."-".rand(10000000000,9999999999)."-" .rand(10000000000,9999999999)."=:" .rand(10000,99999); for($i=0; $i < count($_FILES['userfile']['name']); $i++){ if(is_uploaded_file($_FILES['userfile']['tmp_name'][$i]) && !empty($_FILES['userfile']['size'][$i]) && !empty($_FILES['userfile']['name'][$i])){ $attach ='yes'; $end =''; $handle =fopen($_FILES['userfile']['tmp_name'][$i], 'rb'); $f_contents =fread($handle, $_FILES['userfile']['size'][$i]); $attachment[]=chunk_split(base64_encode($f_contents)); fclose($handle); $ftype[] =$_FILES['userfile']['type'][$i]; $fname[] =$_FILES['userfile']['name'][$i]; } } /*************************************************************** Creating Email: Headers, BODY 1- HTML Email WIthout Attachment!! <<-------- H T M L --------- ***************************************************************/ #---->Headers Part $Headers =<<<AKAM From: $FromName <$FromEmail> CC: $_POST[cc] BCC: $_POST[bcc] Return-Path: <$_POST[fr]> Reply-To: $FromEmail MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="$boundary1" AKAM; #---->BODY Part $Body =<<<AKAM MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="$boundary1" This is a multi-part message in MIME format. --$boundary1 Content-Type: text/plain; charset="windows-1256" Content-Transfer-Encoding: quoted-printable $txt --$boundary1 Content-Type: text/html; charset="windows-1256" Content-Transfer-Encoding: quoted-printable $html --$boundary1-- AKAM; /*************************************************************** 2- HTML Email WIth Multiple Attachment <<----- Attachment ------ ***************************************************************/ if($attach=='yes') { $attachments=''; $Headers =<<<AKAM From: $FromName <$FromEmail> CC: $_POST[cc] BCC: $_POST[bcc] Return-Path: <$_POST[fr]> Reply-To: $FromEmail MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="$boundary1" AKAM; for($j=0;$j<count($ftype); $j++){ $attachments.=<<<ATTA --$boundary1 Content-Type: $ftype[$j]; name="$fname[$i]" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="$fname[$j]" $attachment[$j] ATTA; } $Body =<<<AKAM This is a multi-part message in MIME format. --$boundary1 Content-Type: multipart/alternative; boundary="$boundary2" --$boundary2 Content-Type: text/plain; charset="windows-1256" Content-Transfer-Encoding: quoted-printable $txt --$boundary2 Content-Type: text/html; charset="windows-1256" Content-Transfer-Encoding: quoted-printable $html --$boundary2-- $attachments --$boundary1-- AKAM; } if ($_POST[submit]!="Save to Drafts"){$success = mail($to, $su, $Body, $Headers);}else{$success="true";} if ($success) { showBody(""); if ($_POST[submit]!="Save to Drafts"){echo "Mail is sent!";}else{echo "Mail is saved!";} if (isset($_POST['oldmessage']) && isset($_POST['oldmessage_delete']) && $_POST['oldmessage_delete'] == "true") { echo " Also deleting original message."; delete($_POST['oldmessage']); } $stream = imap_open("{mail.website.org:143/imap/notls}", "$_SESSION[session_username]", "$_SESSION[session_password]"); $check = imap_check($stream); imap_append($stream, "{mail.website.org:143/imap/notls}INBOX.Sent" , "From: $_POST[fr]\r\n" . "To: $to\r\n" . "Subject: $su\r\n" . "\r\n" . html_entity_decode($ms) . "\r\n" ); if ($_POST[submit]=="Save to Drafts"){ imap_append($stream, "{mail.website.org:143/imap/notls}INBOX.Drafts" , "From: $_POST[fr]\r\n" . "To: $to\r\n" . "Subject: $su\r\n" . "\r\n" . html_entity_decode($ms) . "\r\n" ); }else{ imap_append($stream, "{mail.website.org:143/imap/notls}INBOX.Drafts" , "From: $_POST[fr]\r\n" . "To: $to\r\n" . "Subject: $su\r\n" . "\r\n" . html_entity_decode($ms) . "\r\n" ); } $check = imap_check($stream); imap_close($stream); if ($_POST[submit]=="Save to Drafts"){ echo "<META HTTP-EQUIV='Refresh' CONTENT='0;url=?mod=mail&folder=INBOX.Drafts'></META>"; }else{ echo "<META HTTP-EQUIV='Refresh' CONTENT='0;url=?mod=mail&folder="; if (isset($_GET['folder'])) echo $_GET['folder']; echo "'></META>"; } //print ("message: <br>".html_entity_decode($ms)."<br><br><hr><br>"); } else { showBody(""); echo "MAIL IS NOT SEND, error on the server. "; echo "Copy the content of your e-mail below, and try again by <A href='?mod=mail&folder="; if (isset($_GET['folder'])) echo $_GET['folder']; echo "'>continuing</a>...<pre>" . $_POST['ms'] . "</pre><br><hr><br>$success"; }
  21. Ok i tryed inserting the content of the Attache() insde the loop and i finaly got an error that could explain the problem ... I get : Could not open uploaded file on the server foreach ($_FILES["userfile"]["error"] as $key => $error) { $AttmFile = $_FILES["userfile"]["tmp_name"][$key]; $FileName = $_FILES['userfile']['name'][$key]; $Text = $ms; $Html = $ms;// html is niet meer actief want wordt niet goed weergegeven na invoer if ($Text == "") { $Text = " "; $Html = " "; } $OB = "----=_OuterBoundary_000"; $IB = "----=_InnerBoundery_001"; $Html = $Html ? $Html:preg_replace("/\n/", "{br}", $Text) or die("neither text nor html part present."); $Text = $Text ? $Text:"Sorry, but you need an html mailer to read this mail."; $headers = "MIME-Version: 1.0\r\n"; $headers .= $head;// toevoeging orginele headers (from en to enzo) $headers .= "X-Priority: 1\n"; // $headers.="X-MSMail-Priority: High\n"; // $headers.="X-Mailer: OneFile\n"; $headers .= "Content-Type: multipart/mixed;\n\tboundary=\"" . $OB . "\"\n"; //Messages start with text/html alternatives in OB $Msg = "This is a multi-part message in MIME format.\n"; $Msg .= "\n--" . $OB . "\n"; $Msg .= "Content-Type: multipart/alternative;\n\tboundary=\"" . $IB . "\"\n\n"; //plaintext section $Msg .= "\n--" . $IB . "\n"; $Msg .= "Content-Type: text/plain;\n\tcharset=\"iso-8859-1\"\n"; $Msg .= "Content-Transfer-Encoding: quoted-printable\n\n"; // plaintext goes here $Msg .= $Text . "\n\n"; /* // html section $Msg.="\n--".$IB."\n"; $Msg.="Content-Type: text/html;\n\tcharset=\"iso-8859-1\"\n"; $Msg.="Content-Transfer-Encoding: base64\n\n"; // html goes here $Msg.=chunk_split(base64_encode($Html))."\n\n"; */ // end of IB $Msg .= "\n--" . $IB . "--\n"; // attachments (dit was eerst een loop, dus dit kan voor meerdere files ook zo) // attachments (dit was eerst een loop, dus dit kan voor meerdere files ook zo) $patharray = explode("/", $AttmFile); $Msg .= "\n--" . $OB . "\n"; $Msg .= "Content-Type: application/octetstream;\n\tname=\"" . $FileName . "\"\n"; $Msg .= "Content-Transfer-Encoding: base64\n"; $Msg .= "Content-Disposition: attachment;\n\tfilename=\"" . $FileName . "\"\n\n"; //file goes here $fd = fopen($AttmFile, "r"); if (!$fd) die("Could not open uploaded file on the server"); $FileContent = fread($fd, filesize($AttmFile)); fclose($fd); $FileContent = chunk_split(base64_encode($FileContent)); $Msg .= $FileContent; $Msg .= "\n\n"; // attachments (dit was eerst een loop, dus dit kan voor meerdere files ook zo) // attachments (dit was eerst een loop, dus dit kan voor meerdere files ook zo) //message ends $Msg .= "\n--" . $OB . "--\n"; // teruggeven naar global $ms = $Msg; $head = $headers; } The reason i did'int see thate rror before was because the die() was in the function
×
×
  • 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.