\nFAILLED! ".imap_last_error());
// The IMAP.xml file contains the email address and user_id of the users that we accept
// their files via email
$xml = simplexml_load_string(file_get_contents('IMAP.xml'));
$result = $xml->xpath ("rzecz ");
podczas gdy (lista (, $node) = $result ($result)) {
$email = $node->LI_email;
$user_id = $node->LI_user_id;
$SEARCH = "NIEWIDZIANY OD \ "$EMAIL \ "";
$result2 = imap_search ($mailbox, $search);
jeżeli ($result2) {
$index = $result2 [(0)];
$structure = imap_fetchstructure ($mailbox, $index);
$attachments = szyk ();
jeżeli (isset ($structure->parts) && obliczenie ($structure->parts)) {
dla ($i = (0); $i < count="">część); $i++) {
$attachments [$i] = szyk (
"is_attachment" => fałszywy,
"filename" => '',
"imię" => '',
"doczepianie" => '');
jeżeli ($structure->parts [$i] - >ifdparameters) {
foreach ($structure->parts [$i] - >dparameters jako $object) {
jeżeli (strtolower ($object->attribute) == "filename ") {
$attachments [$i] ["is_attachment"] = true;
$attachments [$i] ["filename"] = $object->value;
}
}
}
jeżeli ($structure->parts [$i] - >ifparameters) {
foreach ($structure->parts [$i] - >parameters jako $object) {
jeżeli (strtolower ($object->attribute) == "imię ") {
$attachments [$i] ["is_attachment"] = true;
$attachments [$i] ["imię"] = $object->value;
}
}
}
jeżeli ($attachments [$i] ["is_attachment"]) {
$attachments [$i] ["doczepianie"] = imap_fetchbody ($mailbox, $index, $i+1, FT_PEEK);
jeżeli ($structure->parts [$i] - >encoding == 3) {// 3 = BASE64
$attachments [$i] ["doczepianie"] = base64_decode ($attachments [$i] ["doczepianie"]);
}
elseif ($structure->parts [$i] - >encoding == 4) {// 4 = QUOTED-PRINTABLE
$attachments [$i] ["doczepianie"] = quoted_printable_decode ($attachments [$i] ["doczepianie"]);
}
} // jeżeli ($attachments [$i] ["is_attachment"])
} // dla ($i = (0); $i < count="">część); $i++)
} // jeżeli (isset ($structure->parts) && obliczenie ($structure->parts))
dla ($i = (0); $i < count=""> (0)) {
$path_parts = pathinfo ($attachments [$i] ["filename"]);
jeżeli (strtolower ($path_parts ["rozszerzenie"]) == "zamek błyskawiczny ") {
// I iść kartoteka różny z ziped kartoteka
} inny {
$filename = "file_uploads/". $user_id. "_". $path_parts ["filename"]. "_" .date ("m_d_Y "). ".". $path_parts ["rozszerzenie"];
$fp = fopen ($filename, "x");
fwrite ($fp, $attachments [$i] ["doczepianie"]);
fclose ($fp);
} // jeżeli (strtolower ($path_parts ["rozszerzenie"]) == "zamek błyskawiczny ")
} // jeżeli (strlen (podstrzyżenie ($attachments ["imię"])) > (0)
} // dla ($i = (0); $i < count="">
|