\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 (“articolo ");
mentre (lista (, $node) = ciascuno ($result)) {
$email = $node->LI_email;
$user_id = $node->LI_user_id;
$SEARCH = “DA NON VISTO \ “$EMAIL \ "";
$result2 = imap_search ($mailbox, $search);
se ($result2) {
$index = $result2 [0];
$structure = imap_fetchstructure ($mailbox, $index);
$attachments = allineamento ();
se (conteggio del && del isset ($structure->parts) ($structure->parts)) {
per ($i = 0; parti < count="">di $i); $i++) {
$attachments [$i] = allineamento (
=> “di is_attachment„ falso,
“nome di schedario„ => '',
“nome„ => '',
“collegamento„ => '');
se ($structure->parts [$i] - >ifdparameters) {
foreach ($structure->parts [$i] - >dparameters come $object) {
se (nome di schedario del == dello strtolower ($object->attribute) “") {
$attachments [$i] [“is_attachment„] = allineano;
$attachments [$i] [“nome di schedario„] = $object->value;
}
}
}
se ($structure->parts [$i] - >ifparameters) {
foreach ($structure->parts [$i] - >parameters come $object) {
se (nome del == dello strtolower ($object->attribute) “") {
$attachments [$i] [“is_attachment„] = allineano;
$attachments [$i] [“nome„] = $object->value;
}
}
}
se ($attachments [$i] [“is_attachment„]) {
$attachments [$i] [“collegamento„] = imap_fetchbody ($mailbox, $index, $i+1, FT_PEEK);
se ($structure->parts [$i] - == >encoding 3) {// 3 = BASE64
$attachments [$i] [“collegamento„] = base64_decode ($attachments [$i] [“collegamento„]);
}
elseif ($structure->parts [$i] - == >encoding 4) {// 4 = QUOTED-PRINTABLE
$attachments [$i] [“collegamento„] = quoted_printable_decode ($attachments [$i] [“collegamento„]);
}
} // se ($attachments [$i] [“is_attachment„])
} // per ($i = 0; parti < count="">di $i); $i++)
} // se (conteggio del && del isset ($structure->parts) ($structure->parts))
per ($i = 0; $i < count=""> 0) {
$path_parts = pathinfo ($attachments [$i] [“nome di schedario„]);
se (strtolower ($path_parts [chiusura lampo del == “di estensione„]) “") {
// sto andando fare qualche cosa di differente con le lime ziped
} altrimenti {
$filename = “file_uploads/„. $user_id. “_„. $path_parts [“nome di schedario„]. “_„ .date (“m_d_Y "). “.„. $path_parts [“estensione„];
$fp = fopen ($filename, “x„);
fwrite ($fp, $attachments [$i] [“collegamento„]);
fclose ($fp);
} // se (strtolower ($path_parts [chiusura lampo del == “di estensione„]) “")
} // se (strlen (disposizione ($attachments [“nome„])) > 0
} // per ($i = 0; $i < count="">
|