Einzelnen Beitrag anzeigen

EDatabaseError

Registriert seit: 11. Mai 2005
Ort: Göppingen
1.238 Beiträge
 
Delphi 2007 Professional
 
#11

Re: [php] microtime funktioniert nicht korrekt bei PHP 4.3.1

  Alt 13. Jan 2007, 20:03
Zitat von Matze:
Ich verwende auf meiner Webseite ebenfalls den Code von php.net und hatte damit nie Probleme. Kannst du evtl. mal den PHP-Code der Seite posten, die die falsche Ausgabe verursacht?
Ich hab nun mal die Variablen analysiert...

Code:
->
->1168718572.64

->1168718572.64
an erster stelle "sollte" die $time_start stehen...diese "verschwindet" aber so wies aussieht irgentwo im nirvana...

hier mal der Code der seite:
Code:
<?php
include 'config.inc.php';

echo $time_start;

//----------------------------------------------------------------------------------------------
//  please type below your pop servername, username, password and email address
//----------------------------------------------------------------------------------------------

$servername = $mail_servername;
$username = $mail_username;
$password = $mail_password;
$emailaddress = $mail_emailaddress;

//----------------------------------------------------------------------------------------------
//  that's it ! no more editing necessary
//----------------------------------------------------------------------------------------------

if($_POST) { extract($_POST, EXTR_PREFIX_SAME, "post_"); }
if($_GET) { extract($_GET, EXTR_PREFIX_SAME, "get_"); }

function getImap() {
        global $servername;
        global $username;
        global $password;
        $mbox = imap_open("{".$servername.":110/pop3/notls}INBOX", $username, $password);
        return $mbox; }
function givehead() { include("header.php"); }

function givefoot() { include("footer.php");

echo "->".$time_start."

";
echo "->".$time_end."

";
echo "->".$time."

"; }

function getheadervalueO($fieldname, $header)
{
        $head="\n".$header."\n";
        $begin = strpos($head,"\n".$fieldname);
        if ($begin==false) return "";
        $end= strpos($head,"\n",$begin+1);
        $result=substr($head,$begin+1+strlen($fieldname),$end-$begin-strlen($fieldname));
        return $result;
}

function getheadervalue($fieldname, $header)
{
                $header = eregi_replace("\t", " ", $header);
                $results = array();
                if (eregi("$fieldname (.*)", $header, $results))
                        {
                        $fieldval = $results[1];
                        for ($b=0;$b<=strlen($fieldval);$b++) {
                                $curr = substr($fieldval, $b, 1);
                                $next = substr($fieldval, $b + 1, 1);
                                if ($curr == "\n" && $next != " ") {break;}
                                if ($curr == "\t") { $curr = " "; }
                                if ($curr == "\n") { $curr = ""; }
                                $resu .= $curr;
                        }
                }
                $resu = eregi_replace("\([^\)]*\)", "", $resu);
                return $resu;
}

function parse_text($text) {
                $text = eregi_replace("\"", "&quot;", $text);
                $text = eregi_replace("'", "&#039;", $text);
                $text = eregi_replace("<", "&lt;", $text);
                $text = eregi_replace(">", "&gt;", $text);
                $text = eregi_replace("([:; \(\n])(([-&\._a-z0-9]*)@([a-z0-9-]*)\.([-\.a-z0-9]*))", "\\1<a href=\"email.php?act=compose&to=\\2\">\\2</a>", $text);
                $text = eregi_replace("([[:alnum:]]+)://([a-z0-9/=?%#&_\.-]*)", "<a href=\"\\1://\\2\" target=\"_blank\">\\1://\\2</a>", $text);
                $text = eregi_replace("([^[:alnum:]\"/])(www\.)([a-z0-9/=?%#&_\.-]*)", "\\1<a href=\"http://\\2\\3\" target=\"_blank\" target=\"_new\">\\2\\3</a>", $text);
                $text = eregi_replace("([^[:alnum:]\"/>])(ftp\.)([a-z0-9/=?%#&_\.-]*)", "\\1<a href=\"ftp://\\2\\3\" target=\"_blank\" target=\"_new\">\\2\\3</a>", $text);
                $text = eregi_replace(" ", "", $text);
                return nl2br($text);
        }

function mimetype($mime) {
                switch ($mime) {
                        case 6:
                                return "video";
                                break;
                        case 5:
                                return "image";
                                break;
                        case 4:
                                return "audio";
                                break;
                        case 3:
                                return "application";
                                break;
                        case 2:
                                return "message";
                                break;
                        default:
                                return "text";
                                break;
        }
}

function convsize ($size) {
        if ($size > 1048576) {
                return sprintf("(%.1fMB)", $size / 1048576);
        }        else {
                return sprintf("(%.1fkB)", $size / 1024);
        }
}

function parse_html($text) {
        $text = eregi_replace("<a ([^>]*)>", "<a target=\"_blank\" \\1>", $text);
        return $text;
}

// Deze functie voegt bij de gegeven message en headers de file toe
function Attach($AttmFile,$FileName)
        {
        global $ms,$head;
         $Text=$ms;
        $Html=$ms;
        if ($Text=="") {$Text=" ";$Html=" ";}

        $OB="----=_OuterBoundary_000";
        $IB="----=_InnerBoundery_001";
        $Html=$Html?$Html:preg_replace("/\n/","{br}",$Text)
         or die("weder text noch html präsent.");
        $Text=$Text?$Text:"Leider kann dieses Script keine HTML - Mails anzeigen. Weichen Sie bitte auf entsprechende Clients aus.";
        $headers ="MIME-Version: 1.0\r\n";
        $headers.=$head;
        $headers.="X-Priority: 0\n";
        $headers.="Content-Type: multipart/mixed;\n\tboundary=\"".$OB."\"\n";
        $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";
        $Msg.="\n--".$IB."\n";
        $Msg.="Content-Type: text/plain;\n\tcharset=\"iso-8859-1\"\n";
        $Msg.="Content-Transfer-Encoding: quoted-printable\n\n";
        $Msg.=$Text."\n";
        $Msg.="\n--".$IB."--\n";
        $patharray = explode ("/", $AttmFile);
        $Msg.= "\n--".$OB."\n";
        $Msg.="Content-Type: application/zip;\n\tname=\"".$FileName."\"\n";
        $Msg.="Content-Transfer-Encoding: base64\n";
        $Msg.="Content-Disposition: attachment;\n\tfilename=\"".$FileName."\"\n\n";

        $fd=fopen ($AttmFile, "r");
        $FileContent=fread($fd,filesize($AttmFile));
        fclose ($fd);
        $FileContent=chunk_split(base64_encode($FileContent));
        $Msg.=$FileContent;
        $Msg.="\n\n";
        $Msg.="\n--".$OB."--\n";

        $ms=$Msg;
        $head=$headers;
}


function parseStructure($mbox,$num)
{
        global $attachments,$html_entity;

        # Parse structure
        $struct = imap_fetchstructure($mbox,$num);
        $parts = $struct->parts;
        if ($struct->type) {
                for ($x=0;$x<sizeof($parts);$x++) {
                        $ttype = $parts[$x]->type;
                        if ($ttype == 1) {
                                # Multipart in multipart
                                $sparts = $parts[$x]->parts;
                                for ($c=0;$c<sizeof($sparts);$c++) {
                                        if (!$sparts[$c]->type && empty($sparts[$c]->disposition)) {
                                                if (eregi("html", $sparts[$c]->subtype)) {
                                                        # HTML message
                                                        $part_needed = ($x + 1) . "." . ($c + 1);
                                                        $part_encoding = $sparts[$c]->encoding;
                                                        $html_entity = 1;
                                                }
                                                elseif (eregi("plain", $sparts[$c]->subtype)) {
                                                        # Plain text
                                                        $part_needed = ($x + 1) . "." . ($c + 1);
                                                        $part_encoding = $sparts[$c]->encoding;
                                                }
                                        }
                                        else {
                                                $dpara = $sparts[$c]->dparameters;
                                                for ($v=0;$v<sizeof($dpara);$v++) {
                                                        if (eregi("filename", $dpara[$v]->attribute)) {
                                                                $fname = $dpara[$v]->value;
                                                        }
                                                }
                                                if (empty($fname)) {
                                                        $para = $sparts[$c]->parameters;
                                                        for ($v=0;$v<sizeof($para);$v++) {
                                                                if (eregi("name", $para[$v]->attribute)) {
                                                                        $fname = $para[$v]->value;
                                                                }
                                                        }
                                                }
                                                if (empty($fname)) {
                                                        $disp = $sparts[$c]->description;
                                                }
                                                $an = sizeof($attachments);
                                                $attachments[$an]->part = ($x + 1) . "." . ($c + 1);
                                                $attachments[$an]->filename = $fname;
                                                $attachments[$an]->size = $sparts[$c]->bytes;
                                                $attachments[$an]->mime = mimetype($sparts[$c]->type) . "/" . strtolower($sparts[$c]->subtype);
                                                $fname = "";
                                        }
                                }
                        }
                        else {
                                if (!$parts[$x]->type && empty($parts[$x]->disposition)) {
                                        if (eregi("html", $parts[$x]->subtype)) {
                                                # HTML message
                                                $part_needed = ($x + 1);
                                                $part_encoding = $parts[$x]->encoding;
                                                $html_entity = 1;
                                        }
                                        elseif (eregi("plain", $parts[$x]->subtype)) {
                                                # Plain text
                                                $part_needed = ($x + 1);
                                                $part_encoding = $parts[$x]->encoding;
                                        }
                                }
                                else {
                                        $dpara = $parts[$x]->dparameters;
                                        for ($v=0;$v<sizeof($dpara);$v++) {
                                                if (eregi("filename", $dpara[$v]->attribute)) {
                                                        $fname = $dpara[$v]->value;
                                                }
                                        }
                                        if (empty($fname)) {
                                                $para = $parts[$x]->parameters;
                                                for ($v=0;$v<sizeof($para);$v++) {
                                                        if (eregi("name", $para[$v]->attribute)) {
                                                                $fname = $para[$v]->value;
                                                        }
                                                }
                                        }
                                        if (empty($fname)) {
                                                $fname = $parts[$x]->description;
                                        }
                                        $an = sizeof($attachments);
                                        $attachments[$an]->part = ($x + 1);
                                        $attachments[$an]->filename = $fname;
                                        $attachments[$an]->size = $parts[$x]->bytes;
                                        $attachments[$an]->mime = mimetype($parts[$x]->type) . "/" . strtolower($parts[$x]->subtype);
                                        $fname = "";
                                }
                        }
                }
        }
        else {
                # Not multipart
                if (eregi("html", $struct->subtype)) {
                        # HTML message
                        $part_needed = "body";
                        $part_encoding = $struct->encoding;
                        $html_entity = 1;
                }
                else {
                        $part_needed = "body";
                        $part_encoding = $struct->encoding;
                }
        }
        # Get part
        if ($part_needed == "body") {$body = imap_body($mbox,$num);}
        else {$body =imap_fetchbody($mbox,$num,$part_needed);}

        imap_close($mbox);

        switch ($part_encoding)
                {
                case 4:
                        $body = imap_qprint($body);
                        break;
                case 3:
                        $body = imap_base64($body);
                        break;
                default:
                        break;
                }
        if ($html_entity)
                {
                $body = parse_html($body);
                # Check for inline images
                if (sizeof($attachments) != 0) {
                        for ($c=0;$c<sizeof($attachments);$c++) {
                                list($x, $y, $z, $id) = explode("|", $attachments[$c]);
                                if (!empty($id)) {
                                        # Will get better...
                                        $id = eregi_replace("<([^>]*)>", "\\1", $id);
                                        $id = str_replace("$", "\\$", $id);
                                        $body = eregi_replace("src=(['\"])cid:" . $id . "(['\"])", "src=\\1$PHP_SELF?act=Attachview&num=$msg&part=$x\\2", $body);
                                        $body = eregi_replace("background=(['\"])cid:" . $id . "(['\"])", "background=\\1$PHP_SELF?act=Attachview&num=$msg&part=$x\\2", $body);
                                        $body = eregi_replace("src=cid:" . $id, "src=\"$PHP_SELF?act=Attachview&num=$msg&part=$x\"", $body);
                                        $body = eregi_replace("background=cid:" . $id, "background=\"$PHP_SELF?act=Attachview&num=$msg&part=$x\"",$body);
                                        }
                                }
                        }
                }
        else {$body = parse_text($body);}
        return $body;
}

if (!logged_in())
{
givehead();
echo 'Sie sind nicht angemeldet.

';
echo '[url="login.php"]Anmelden[/url]';
givefoot();
} else {



if ($act=="") {
        $mbox = getImap();
        $mcheck = imap_check($mbox);
        $mnum = $mcheck->Nmsgs;
        givehead();
        echo "<form action='email.php?act=delete' method=post name=delete>\n";
        $overview = imap_fetch_overview($mbox, "1:$mnum", 0);
        echo "<table border=0 cellpadding=4 cellspacing=0 width=600>";
        echo "<tr class=row><td width=8%></td><td width=35% class=row>Aktuelle Nachrichten in ";
        if($outbox) { echo "Postausgang"; } else { echo "Posteingang"; }
        echo "</td><td width=34%></td><td width=18%></td><td width=5%></td>";
        $s=sizeof($overview);
        $k=1;
        $l=1;
        for($i=$s-1; $i >= 0; $i--) {
                $val=$overview[$i];
                $rawsubject = imap_mime_header_decode($val->subject);
                $subject = $rawsubject[0]->text;
                if ($subject=='') {$subject = "Kein Betreff";}
                if (strlen($subject)>67) $subject = substr($subject,0,67)."...";

                $rawfrom = imap_mime_header_decode($val->from);
                $from = $rawfrom[0]->text;
                if ($from=='') {$from = "Kein Name";}

                $rawto = imap_mime_header_decode($val->to);
                $to = $rawto[0]->text;
                if ($to=='') {$to = "Kein Name";}

                $head = imap_fetchheader($mbox,$val->msgno);
                $mtype = "";
                $stype = "";
                $conttype = getheadervalue("Content-Type:",$head);
                if (!empty($conttype) && eregi("([^/]*)/([^ ;\n\t]*)", $conttype, $regs))
                        {$mtype = $regs[1];$stype = $regs[2];}
                if (strtolower($mtype)!="text" && strtolower($stype)!= "alternative" && !empty($mtype) && !empty($stype))
                        $stat="A"; else $stat="";

                if ($outbox && $from == $emailaddress) {
                        echo "<input type=hidden name=outbox value=true>";
                        if (round($k/2) == $k/2) { echo "<tr class=light>"; } else { echo "<tr>"; }
                        $k++;
                        $info=imap_headerinfo($mbox,$val->msgno);
                        $nummert=$val->msgno."@".$info->udate;
                        echo "<td><input TYPE='checkbox' NAME='num[]' class=check VALUE=$nummert></td>";
                        echo "<td>[url='email.php?act=view&num=$nummert&outbox=true']$to[/url]</td><td>$subject</td>";

                        $dateNumber=strtotime($val->date);
                        $date = date('d-m-y H:i',$dateNumber);
                        echo "<td>".$date."</td><td>".(round(($val->size/1000)+0.5))."k</td></tr>\n";
                } else if ( !$outbox && $from != $emailaddress){ 
                        if (round($l/2) == $l/2) { echo "<tr class=light>"; } else { echo "<tr>"; }
                        $l++;
                        $info=imap_headerinfo($mbox,$val->msgno);
                        $nummert=$val->msgno."@".$info->udate;
                        echo "<td><input TYPE='checkbox' class=check NAME='num[]' VALUE=$nummert></td>";
                        echo "<td>[url='email.php?act=view&num=$nummert']$from[/url]</td><td>$subject</td>";

                        $dateNumber=strtotime($val->date);
                        $date = date('d-m-y H:i',$dateNumber);
                        echo "<td>$date</td>";
                        echo "<td>".(round(($val->size/1000)+0.5))."k</td></tr>\n";
                }
        }       
        echo "<tr><td colspan=5></td></tr>";
        echo "<tr class=row><td></td><td class=row colspan=4>Aktionen</td></tr>";
        echo "<tr><td></td><td colspan=4>[url='javascript:void(document.forms[0].submit())']Nachricht(en) löschen[/url]</td></tr>";
        echo "<tr><td></td><td colspan=4>[url='email.php?act=compose']Neue Nachricht verfassen[/url]</td></tr>";
        if ($outbox) { echo "<tr><td></td><td colspan=4>[url='email.php']Zum Posteingang wechseln[/url]</td></tr>"; }
        else { echo "<tr><td></td><td colspan=4>[url='email.php?outbox=true']Zum Postausgang wechseln[/url]</td></tr>"; }
        echo "</table>";
        echo "</form>";

        imap_close($mbox);
        givefoot();
}

function & getRef(&$ref) {
  return $ref;
}

if ($act=="delete") {
        $mbox =getImap();
        for ($i=0;$i<sizeof($num);$i++) {
                if (is_array($num)) $sowhat = $num[$i]; else $sowhat = $num;
                $timetest= strstr($sowhat,"@");
                $pos = strpos($sowhat,"@");
                if ($pos!=0) {
                        $numr= substr($sowhat,0,$pos);
                        $info=imap_headerinfo($mbox,$numr); }
                imap_delete($mbox,$numr); }
        imap_expunge($mbox);
        imap_close($mbox);
        if ($outbox) { Header("Location: email.php?outbox=true"); }
        else { Header("Location: email.php"); }
}

if ($act=="view") {
        $mbox =getImap();
        $numorg=$num;
        $timetest= strstr($num,"@");
        $num= substr($num,0,strpos($num,"@"));
         
        givehead();
       
        echo "<table border=0 cellpadding=4 cellspacing=0 width=560>";
        echo "<tr class=row><td width=15%></td><td width=85% class=row>Message Headers</td></tr>";

        $info=imap_headerinfo($mbox,$num);
        $from=$info->from[0];
        $from=$from->mailbox ."@".$from->host;
        echo "<tr><td>von:</td><td>".$from."</td></tr>";
        $to=$info->toaddress;
        echo "<tr class=light><td valign=top>an:</td><td>".$to."</td></tr>";
        if ($info->ccaddress) { 
                $cc=$info->ccaddress;
                echo "<tr><td valign=top>cc:</td><td>".$cc."</td></tr>";
        }       
        $rawdsubject = imap_mime_header_decode($info->Subject);
        $subject = htmlspecialchars($rawdsubject[0]->text);
        if ($subject == "") { $subject = "Kein Betreff"; }
        if ($info->ccaddress) { echo "<tr class=light>"; } else { echo "<tr>"; }
        echo "<td>Betreff:</td><td>".$subject."</td></tr>";
        $dateNumber=strtotime($val->date);
        $date = date('d-m-Y H:i',$info->udate);
        if ($info->ccaddress) { echo "<tr>"; } else { echo "<tr class=light>"; }
        echo "<td>Datum:</td><td>".$date."</td></tr>";

        $body=parseStructure($mbox,$num);
        echo "<tr><td colspan=2></td></tr>";
        echo "<tr class=row><td width=15%></td><td width=85% class=row>Text</td></tr>";
        echo "<tr><td colspan=2>".$body."</td></tr>";

        if (sizeof($attachments) != 0){
        echo "<tr><td colspan=2></td></tr>";
                echo "<tr class=row><td width=15%></td><td width=85% class=row>Anhänge</td></tr>";
                for ($at=0;$at<sizeof($attachments);$at++) {
                        $file = $attachments[$at]->filename;
                        $part = $attachments[$at]->part;
                        if (empty($file)) {$file = $lang_unknown;} 
                        if (round($at/2) != $at/2) { echo "<tr class=light>"; } else { echo "<tr>"; }
                        echo "<td>".($at+1).".</td><td>[url="email.php?act=Attachview&num=$num&part=$part"]$file ".convsize($attachments[$at]->size)."[/url]</td></tr>";
                }
        }
        echo "<tr><td colspan=2></td></tr>";
        echo "<tr class=row><td width=15%></td><td width=85% class=row>Aktionen</td></tr>";
        echo "<tr><td></td><td>[url='email.php?act=reply&num=$numorg']Dem Sender antworten[/url]</td></tr>";
        echo "<tr><td></td><td>[url='email.php?act=replytoall&num=$numorg']Allen antworten[/url]</td></tr>";
        if ($outbox) { echo "<tr><td></td><td>[url='email.php?act=delete&num=$numorg&outbox=true']Nachricht löschen[/url]</td></tr>"; }
        else { echo "<tr><td></td><td>[url='email.php?act=delete&num=$numorg']Nachricht löschen[/url]</td></tr>"; }
    if($outbox) { echo "<tr><td></td><td>[url='email.php?outbox=true']Zurü zum Postausgang[/url]</td></tr>"; }
    else { echo "<tr><td></td><td>[url='email.php']Zurü zum Posteingang[/url]</td></tr></table>"; }
        givefoot();
}
       
elseif ($act=="reply" || $act=="replytoall")
{
        $mbox =getImap();
        $timetest= strstr($num,"@");
        $num= substr($num,0,strpos($num,"@"));              
        givehead();
        $replytext=imap_headerinfo($mbox,$num);
        $to=$replytext->reply_to[0];
        if ($to=="") {$to=$replytext->from[0];} 
        $tototal = $to->mailbox ."@".$to->host;
        $tototal = eregi_replace("\"","'",$tototal);
        $tototal = eregi_replace(","," ",$tototal);

        if ($act=="replytoall") {
                $tototal=$tototal.", ".str_replace($emailaddress,"",$replytext->toaddress);
                $cc = str_replace($emailaddress,"",$replytext->ccaddress);
        }

        $body=parseStructure($mbox,$num);
        $body = eregi_replace("<p([^>]*)>", "\n\n", $body);
        $body = strip_tags($body);
        $body = "\n\n\n\n----------------------- Original Message -----------------------\n\n".$body;
        $subj = $replytext->Subject;

        echo "<form name=rplsend ACTION=email.php?act=send enctype=multipart/form-data METHOD=post>";
        echo "<input type=hidden class=formText name=fr value=$emailaddress>";
        echo "<input type=hidden class=formText name=bcc>";
        echo "<table cellspacing=0 cellpadding=4 border=0 width=560>";
        echo "<tr class=row><td width=15%></td><td width=85% class=row>Antwort</td></tr>";
        echo "<tr><td>an:</td><td><input type=text style='width:400px' name=to value='$tototal'>";
        echo "<tr><td>cc:</td><td><input type=text style='width:400px' name=cc value='$cc'></td></tr>";
        echo "<tr><td>Betreff:</td><td><input type=text style='width:400px' name=su value='Re: $subj'></td></tr>";
        echo "<tr><td valign=top>Nachricht:</td><td><textarea rows=20 name=ms style='width:400px'>$body</textarea></td></tr>";
        echo "</td><td>Anhang:</td><td><input name=userfile style='width:400px' type=file></td></tr>";
        echo "<tr><td colspan=2></td></tr>";
        echo "<tr class=row><td width=15%></td><td width=85% class=row>Aktionen</td></tr>";
        echo "<tr><td></td><td><a href=javascript:document.rplsend.submit()>Nachricht senden</a></td></tr>";
        echo "<tr><td></td><td><a href=javascript:history.back()>zurück zur mailbox</a></td></tr>";
        echo "</form></table>";
        givefoot();
}

elseif ($act=="compose") {

        if ($num) {
                $to = $num[0];
                for ($i=1;$i<sizeof($num);$i++) {
                        $to.= ",".$num[$i]; } }
       
        givehead();
       
        echo "<form name=msgsend ACTION=email.php?act=send enctype=multipart/form-data METHOD=post>\n";
        echo "<input type=hidden name=MAX_FILE_SIZE VALUE=10000000>\n";
        echo "<input type=hidden class=formText name=fr value=$emailaddress>";
        echo "<input type=hidden class=formText name=bcc size=20>";
        echo "<table cellspacing=0 cellpadding=4 border=0 width=560>";
        echo "<tr class=row><td width=15%></td><td width=85% class=row>Neue Nachricht</td></tr>";
        echo "<tr><td>an:</td><td><input type=text style='width:400px' name=to value=$to></td></tr>";
        echo "<tr><td>cc:</td><td><input type=text style='width:400px' name=cc></td></tr>";
        echo "<tr><td>Betreff:</td><td><input style='width:400px' type=text name='su'></td></tr>";
        echo "<tr><td valign=top>Nachricht:</td><td><textarea rows=20 name=ms style='width:400px'></textarea></td></tr>";
        echo "<tr><td>Anhang:</td><td><input style='width:400px' name=userfile type=file></td></tr>";
        echo "<tr><td colspan=2></td></tr>";
        echo "<tr class=row><td width=15%></td><td width=85% class=row>Aktionen</td></tr>";
        echo "<tr><td></td><td><a href=javascript:document.msgsend.submit()>Nachricht senden</a></td></tr>";
        echo "<tr><td></td><td><a href=contacts.php>view contacts</a></td></tr>";
        echo "<tr><td></td><td><a href=javascript:history.back()>zurück zur mailbox</a></td></tr>";
        echo "</form></table>";
        givefoot();
}

elseif ($act=="Attachview")
        {
        $mbox =getImap();
        $msg=$num;
        $bypasscheck = 0;
        if (!eregi("^([0-9]*)$", $msg) or !eregi("([0-9\.]*)", $part)) exit();
        $tmpa = array();
        $ret = array();
        if (eregi("([0-9\.]*)\.([0-9\.]*)", $part, $ret))
                {
                $pone = ($ret[1] - 1);
                $ptwo = ($ret[2] - 1);
                }
        else {$pone = ($part - 1);}
        $dpara = array();
        $struct = imap_fetchstructure($mbox, $msg);
        $body = imap_fetchbody($mbox, $msg, $part);
        imap_close($mbox);      
        $tmpa = $struct->parts;
        if ($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;
}
       
elseif ($act=="send") {
        $head="Von: ".$fr."\n";
        $head.="CC: $cc\n";
        $head.="BCC: $emailaddress\n";
        $ms = str_replace('\\'.'"','"',$ms);
        $ms = str_replace('\\'."'","'",$ms);
        $su = str_replace('\\'.'"','"',$su);
        $su = str_replace('\\'."'","'",$su);
        if ($userfile!="") Attach($userfile,$userfile_name);
        mail($to,$su,$ms,$head);
        Header("Location: email.php");
}

exit();
}
?>
Tobias
It's not a bug, it's a feature.
  Mit Zitat antworten Zitat