forked from heyman/mms-decoder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget.php
68 lines (55 loc) · 1.74 KB
/
get.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/**
* Copyright (C) 2004 Jonatan Heyman
*
* This file is part of MMS Decoder Example Application.
* Recieve an MMS from the client.
*
* MMS Decoder is free software; you can redistribute it and/or
* modify it under the terms of the Affero General Public License as
* published by Affero, Inc.; either version 1 of the License, or
* (at your option) any later version.
*
* MMS Decoder is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Affero General Public License for more details.
*
* You should have received a copy of the Affero General Public
* License in the COPYING file that comes with The Affero Project; if
* not, write to Affero, Inc., 510 Third Street, Suite 225, San
* Francisco, CA 94107 USA.
*/
// includes
require_once('../mmsdecoder.php');
require_once('config.php');
require_once('functions.php');
if ($HTTP_RAW_POST_DATA != "") {
// check if the raw post data shall be saved
if (SAVE_RAWDATA) {
// save RAW data
$data = $HTTP_RAW_POST_DATA;
$filename = md5($data . time() . rand(1, 1000));
$file = fopen($filename, 'wb');
fwrite($file, $data);
fclose($file);
$info = print_r($_SERVER, true);
$file = fopen($filename . "_info", 'wb');
fwrite($file, $info);
fclose($file);
}
// parse MMS
$mms = new MMSDecoder($HTTP_RAW_POST_DATA);
$mms->parse();
// connect to database
db_connect();
// save mms and it's parts
mms_save($mms);
// close db connection
db_close();
// set header
header('Content-type: application/vnd.wap.mms-message');
// send confirmation response
$mms->confirm();
}
?>