Sitter och försöker parsa ett mms från cellsynt. Dem ska ju tvunget skicka det som en zip-fil. Detta innebär att jag har en zipfil i $_POST['content']. Koden ska skriva den till en temporär fil, packa upp och läsa in alla filer och stoppa i en databas. Mina problem är dessa:
* Det skapas av någon udda anledning två filer, en med extension och en utan. Den utan extension har inget innehåll heller men den ska inte existera över huvudtaget.
* Den filen med extension och innehåll ser ut som en random zipfil i nano men funkar inte att extrahera.
Kod:
Kod:
<?php
//Check if this is possibly an attempt to crack us
$haxx = false;
if(!isset($_POST['originator'])) $haxx = true;
if(!isset($_POST['destination'])) $haxx = true;
if(!isset($_POST['subject'])) $haxx = true;
if(!isset($_POST['content'])) $haxx = true;
if($haxx) die("Please don't try to h4xx0R us!");
//Create zip archive
$tempname = tempnam('/tmp','MMS').".zip";
$handle = fopen($tempname, 'w');
fwrite($handle,$_POST['content']);
fclose($handle);
?>
Felmeddelande från unzip:
Citat:
twister# unzip /tmp/MMSx4EF55.zip
Archive: /tmp/MMSx4EF55.zip
0\0�\\\0\0\0\0
caution: zipfile comment truncated
warning [/tmp/MMSx4EF55.zip]: zipfile claims to be last disk of a multi-part archive;
attempting to process anyway, assuming all parts have been concatenated
together in order. Expect "errors" and warnings...true multi-part support
doesn't exist yet (coming soon).
error [/tmp/MMSx4EF55.zip]: missing 1587817809 bytes in zipfile
(attempting to process anyway)
error [/tmp/MMSx4EF55.zip]: attempt to seek before beginning of zipfile
(please check that you have transferred or created the zipfile in the
appropriate BINARY mode and that you have compiled UnZip properly)
|
En 'ls -al /tmp' ger:
Citat:
twister# ls -al /tmp
total 104
drwxrwxrwt 5 root root 16384 2008-11-10 17:02 .
drwxr-xr-x 20 root root 4096 2008-11-02 15:29 ..
drwxrwxrwt 2 root root 1 2008-10-16 13:28 .ICE-unix
-rw------- 1 www-data www-data 0 2008-11-10 16:51 MMSHe3KVd
-rw-r--r-- 1 www-data www-data 21964 2008-11-10 16:51 MMSHe3KVd.zip
-rw------- 1 www-data www-data 0 2008-11-10 17:02 MMSx4EF55
-rw-r--r-- 1 www-data www-data 24369 2008-11-10 17:02 MMSx4EF55.zip
-rw-r--r-- 1 root root 26624 2008-11-10 15:37 mms.zip
drwxr-xr-x 2 root root 1 2008-11-02 11:10 .webmin
|