Преглед на файлове

Add website to repo

tags/SensorLogger/0.1
Chris Smith преди 14 години
родител
ревизия
6491f837c1
променени са 10 файла, в които са добавени 596 реда и са изтрити 0 реда
  1. 2
    0
      website/.htaccess
  2. 415
    0
      website/GphpChart.class.php
  3. Двоични данни
      website/SensorLogger.apk
  4. Двоични данни
      website/SensorLogger.png
  5. Двоични данни
      website/android.png
  6. 6
    0
      website/common.php
  7. 79
    0
      website/data.php
  8. 22
    0
      website/index.html
  9. 52
    0
      website/test
  10. 20
    0
      website/upload.php

+ 2
- 0
website/.htaccess Целия файл

@@ -0,0 +1,2 @@
1
+RewriteEngine On
2
+RewriteRule ^/?(android/)?upload$ /android/upload.php [L]

+ 415
- 0
website/GphpChart.class.php Целия файл

@@ -0,0 +1,415 @@
1
+<?php
2
+class GphpChart 
3
+  {
4
+  var $chart;
5
+  var $chart_url;
6
+  var $base_url = "http://chart.apis.google.com/chart?";
7
+  var $width = 300;
8
+  var $height = 200;
9
+  var $types = array ("lc","lxy","bhs","bvs","bhg","bvg","p","p3","v","s");
10
+  var $chart_types = array('l' => 'line','b' => 'bar','p'=> 'pie','v' => 'venn','s' => 'scatter');
11
+  var $mandatory_parameters = array('chs','chd','cht');
12
+  var $data_prepared = false;
13
+  var $allowed_parameters = array(
14
+  'l' => array('chtt','chdl','chco','chf','chxt','chg','chm','chls','chxp'),
15
+  'b' => array('chtt','chbh','chdl','chco','chf','chxt','chxp'),
16
+  'p' => array('chtt','chco','chf','chl'),
17
+  'v' => array('chtt','chdl','chco','chf'),
18
+  's' => array('chtt','chdl','chco','chf','chxt','chg','chm','chxp'),
19
+  );
20
+  var $range = 1;
21
+  var $encodings = array(
22
+    's' => array('sep' => '','set' => ',','range' => 61,'missing' => '_'),
23
+    't' => array('sep' => ',','set' => '|','range' => 100,'missing' => -1),
24
+    'e' => array('sep' => '','set' => ',','range' => 4096,'missing' => '__'),
25
+    );
26
+  var $simple_encoding = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
27
+  // min and max values of horizontal axis
28
+  var $max_xt = 0;
29
+  var $min_xt = 100000; // fake value to be sure we got the min data value
30
+  // min and max values for vertical axis
31
+  var $max_yr = 0;
32
+  var $min_yr = 100000; // fake value to be sure we got the min data value
33
+  var $ratio = false;
34
+  var $cached = true;
35
+  var $prepared = false;
36
+  
37
+  function GphpChart($type = 'lc',$encoding = 't')
38
+  {
39
+  $this->chart = (object) NULL;
40
+  // $chart = new stdClass();
41
+  
42
+  if(!in_array($type,$this->types)) return false;
43
+  else $this->chart->cht = $type;
44
+  $this->chart_type = $this->chart_types[substr($this->chart->cht,0,1)];
45
+  
46
+  if(!in_array($encoding,array_keys($this->encodings))) return false;
47
+  else $this->encoding = $encoding;
48
+
49
+  $this->sep = $this->encodings[$this->encoding]['sep'];
50
+  $this->range = $this->encodings[$this->encoding]['range'];
51
+  $this->missing = $this->encodings[$this->encoding]['missing'];
52
+  $this->set = $this->encodings[$this->encoding]['set']; // set separator
53
+  if($this->chart_type == 'venn') $this->set = ',';
54
+  
55
+  
56
+  $string = $this->simple_encoding;
57
+  unset($this->simple_encoding);
58
+  for($i = 0;$i< strlen($string);$i++) $this->simple_encoding[] = $string[$i];
59
+  
60
+  $this->extended_encoding = $this->simple_encoding;
61
+  $this->extended_encoding[] = '-'; $this->extended_encoding[] =   '.'; $this->extended_encoding[] =   '_'; $this->extended_encoding[] =   ',';
62
+  }
63
+  
64
+  
65
+/* PRE GENERATION : add labels, data, axis, etc */  
66
+
67
+  function add_data($values,$color = '')
68
+  {
69
+  $this->cached = false;
70
+  if($color != '' && strlen($color) == 6) $this->chart->chco[] = $color;
71
+  $this->datas[] = $values; 
72
+  
73
+  } 
74
+  
75
+  function add_labels($axis,$values)
76
+  {
77
+  $this->cached = false;
78
+  if($values_type = $values['values_type'])
79
+  {
80
+  if($values_type == 'discret')
81
+    {
82
+    $min = $values['min']; $max = $values['max'];
83
+    unset($values);
84
+    for($i = $min; $i<=$max;$i++) $values[] = $i;
85
+    }
86
+  }
87
+  
88
+  // reverse order for Bar Horizontal 
89
+  if($this->chart->cht == 'bhs' && is_string($values[0])) $values = array_combine(array_keys($values),array_reverse(array_values($values)));
90
+  $this->labels[$axis][] = $values;
91
+
92
+  if($axis == 'x' || $axis == 't') 
93
+    {
94
+    $this->max_xt = max($this->max_xt,max($values));
95
+    $this->min_xt = min($this->min_xt,min($values));
96
+    }
97
+ 
98
+   // min and max values for vertical axis are calculated in prepare_data()  
99
+  }
100
+    
101
+  function set_bar_width($width,$space = 0)
102
+  {
103
+  $this->cached = false;
104
+  $this->chart->chbh = (int) $width;
105
+  if($space != 0) $this->chart->chbh .= ','.$space; 
106
+  }
107
+  function fill($area,$type,$params)
108
+  {
109
+  $this->cached = false;
110
+  $this->chart->chf[] = "$area,$type,$params";
111
+  }
112
+  function add_legend($array)
113
+  {
114
+  $this->cached = false;
115
+  if($this->chart_type == 'pie') $this->chart->chl = implode('|',$array);
116
+  else $this->chart->chdl = implode('|',$array);
117
+  }
118
+  function add_style($string)
119
+  {
120
+  $this->cached = false;
121
+  if($this->chart_type == 'line') $this->chart->chls[] = $string;
122
+  }
123
+  function add_grid($string)
124
+  {
125
+  $this->cached = false;
126
+  if($this->chart_type == 'line' || $this->chart_type == 'scatter') $this->chart->chg[] = $string;
127
+  }
128
+  function add_marker($string)
129
+  {
130
+  $this->cached = false;
131
+  if($this->chart_type == 'line' || $this->chart_type == 'scatter') $this->chart->chm[] = $string;
132
+  }
133
+/* END PRE GENERATION FUNCTIONS */
134
+
135
+  
136
+
137
+
138
+
139
+/* GENERATE FUNCTIONS : call prepare functions, prepare url, outputs url or full image string */
140
+  function get_Image_URL()
141
+  {
142
+  if($this->cached) 
143
+    {
144
+    if(!$this->filename) $this->generate_filename();
145
+    return $this->filename;
146
+    }
147
+  else
148
+    {
149
+    if(!$this->prepared) $this->prepare();
150
+    return $this->chart_url;
151
+    }  
152
+  }
153
+  function get_Image_String()
154
+  {
155
+  if($this->cached) 
156
+    {
157
+    if(!$this->filename) $this->generate_filename();
158
+    $string = '<img alt="'.$this->title.'" src="'.$this->filename.'" />';
159
+    }
160
+  else  
161
+    {
162
+    if(!$this->prepared) $this->prepare();
163
+    $string = '<img alt="'.$this->title.'" src="'.$this->chart_url.'" />';
164
+    }
165
+  return $string;
166
+  }
167
+
168
+  function prepare()
169
+  {
170
+  if(!$this->data_prepared) $this->prepare_data();
171
+  $this->prepare_labels();
172
+  $this->prepare_title();
173
+  $this->prepare_styles();
174
+  $this->prepare_url();
175
+  $this->prepared = true;
176
+  }
177
+/* END GENERATE FUNCTIONS */  
178
+  
179
+
180
+  /* CACHE FUNCTIONS */
181
+  function generate_filename()
182
+  {
183
+  $this->filename = urlencode($this->title).'.png';
184
+  }
185
+
186
+  function save_Image()
187
+  {
188
+  if(!$this->filename) $this->generate_filename();
189
+  /* get image file */
190
+  //$this->chart_url = htmlspecialchars($this->chart_url);
191
+  //$this->chart_url = urlencode($this->chart_url);
192
+  
193
+  if(    function_exists('file_get_contents')    && $this->image_content = file_get_contents($this->chart_url)    ) 
194
+    $this->image_fetched = true;
195
+    
196
+  if(!$this->image_fetched)
197
+    {
198
+    if($fp = fopen($this->chart_url,'r'))
199
+      {
200
+      $this->image_content = fread($fp);
201
+      fclose($fp);
202
+      $this->image_fetched = true;
203
+      }
204
+    }
205
+  
206
+  /* write image to cache */
207
+  if($this->image_fetched)
208
+    {
209
+    $fp = fopen($this->filename,'w+');  
210
+    if($fp) 
211
+      {
212
+      fwrite($fp,$this->image_content);
213
+      fclose($fp);
214
+      }
215
+    else { return false; }    
216
+    }
217
+  else { return false; }
218
+  
219
+  return true;
220
+  }
221
+  
222
+
223
+/* PREPARE FUNCTIONS : called by generate functions, these ones parse labels and data */  
224
+  function prepare_url()
225
+  {
226
+  $this->chart_url = $this->base_url;
227
+  /*
228
+  foreach($this->mandatory_parameters as $param)
229
+  {
230
+  if(!isset($this->chart->$param)) return false;
231
+  $params[] = $param.'='.$this->chart->$param;
232
+  }
233
+  */
234
+  foreach($this->chart as $k => $v)
235
+    {
236
+    if($v != '') $params[] = "$k=$v";
237
+    }
238
+  $this->chart_url .= implode('&',$params);
239
+  }
240
+  function prepare_styles()
241
+  {
242
+// SIZE
243
+ 
244
+  if(($this->width * $this->height) > 300000) 
245
+    {
246
+    
247
+    // reduces dimensions to match API limits ( 300mpixels )
248
+    $size = $this->width * $this->height;
249
+    $this->width = round($this->width * (300000 / $size),0);
250
+    $this->height = round($this->height * (300000 / $size),0);
251
+    }
252
+  $this->chart->chs = $this->width.'x'.$this->height;
253
+
254
+// colors
255
+  if(isset($this->chart->chco) && is_array($this->chart->chco)) $this->chart->chco = implode(',',$this->chart->chco);
256
+  if(isset($this->chart->chf) && is_array($this->chart->chf)) $this->chart->chf = implode('|',$this->chart->chf);
257
+
258
+// styles
259
+  if($this->chart_type == 'scatter' || $this->chart_type == 'line') 
260
+    {
261
+    if($this->chart_type == 'line') if(isset($this->chart->chls) && count($this->chart->chls)) $this->chart->chls = implode('|',$this->chart->chls);
262
+    if(isset($this->chart->chg) && count($this->chart->chg)) $this->chart->chg = implode('|',$this->chart->chg);
263
+// markers
264
+     if(isset($this->chart->chm) && count($this->chart->chm)) $this->chart->chm = implode('|',$this->chart->chm);
265
+    }
266
+
267
+    
268
+  
269
+  }
270
+  
271
+  function prepare_size()
272
+  {
273
+  }
274
+  
275
+  function prepare_data()
276
+  {
277
+  // for lines charts, calculate ratio
278
+  if($this->chart_type == 'line'  || $this->chart_type == 'bar' || $this->chart_type == 'scatter')
279
+    {
280
+    $this->max_yr = 0;
281
+    foreach($this->datas as $n => $data)
282
+      {
283
+      if($this->chart_type == 'scatter' && $n == 2) continue; // ignore min max values for plots sizes
284
+      $this->max_yr = max($this->max_yr,max($data));
285
+      $this->min_yr = min($this->min_yr,min($data));
286
+      }
287
+    $this->ratio = 0.9 * $this->range / $this->max_yr;
288
+    }
289
+   
290
+  foreach($this->datas as $n => $data)
291
+    {
292
+    if($this->chart_type == 'scatter' && $n == 2) $data = $this->encode_data($data,false); // do not normalize plots sizes
293
+    else $data = $this->encode_data($data);
294
+    
295
+    if($this->chart->cht == 'lxy') 
296
+      {
297
+      $this->datas[$n] = implode($this->sep,array_keys($data)).'|'.implode($this->sep,array_values($data));
298
+      }
299
+    else $this->datas[$n] = implode($this->sep,$data);
300
+    }
301
+  
302
+  $this->chart->chd = "$this->encoding:";
303
+  $this->chart->chd .= implode($this->set,$this->datas);
304
+  $this->data_prepared = true;
305
+  }
306
+  
307
+  
308
+  function prepare_labels()
309
+  {
310
+  //chxt= axis titles
311
+  //chxl= set:labels
312
+  //chxr= range
313
+  //chxp= positions
314
+  
315
+  $n = 0;
316
+  if(count($this->labels))
317
+  foreach($this->labels as $axis => $labelles)
318
+    {
319
+    foreach($labelles as $pos => $labels)
320
+      {
321
+      // axis type
322
+      $this->chart->chxt[$n] = $axis;
323
+      if(!count($labels)) continue; // no values = "neither positions nor labels. The Chart API therefore assumes a range of 0 to 100 and spaces the values evenly."
324
+      // axis range
325
+      
326
+      if($this->chart_type == 'line'  || $this->chart_type == 'bar')
327
+      {
328
+      if($axis == 'x' || $axis == 't') 
329
+        { 
330
+        if($this->max_xt) $this->chart->chxr[$n] = $n.','.$this->min_xt.','.$this->max_xt; 
331
+        }
332
+      else  
333
+        {
334
+        if($this->max_yr) $this->chart->chxr[$n] = $n.','.$this->min_yr.','.$this->max_yr;
335
+        }
336
+      }
337
+      
338
+      // axis labels
339
+      $this->chart->chxl[$n] = "$n:|".implode('|',$labels);
340
+      if($this->chart_type == 'line' || $this->chart_type == 'bar' || $this->chart_type == 'scatter')
341
+        {
342
+        if(array_slice(array_keys($labels),0,2) != array(0,1))  $this->chart->chxp[$n] = "$n,".implode(',',array_keys($labels));
343
+        else $this->chart->chxp[$n] = "$n,".implode(',',array_values($labels));
344
+        }
345
+      $n++;         
346
+      }
347
+    }
348
+  if(count($this->chart->chxr)) $this->chart->chxr = implode('|',$this->chart->chxr);
349
+  if(count($this->chart->chxp)) $this->chart->chxp = implode('|',$this->chart->chxp);    
350
+  if(count($this->chart->chxt)) $this->chart->chxt = implode(',',$this->chart->chxt);
351
+  if(count($this->chart->chxl)) $this->chart->chxl = implode('|',$this->chart->chxl);
352
+  }
353
+  function prepare_title()
354
+  {
355
+  //chtt=first+line|second+line
356
+  $this->chart->chtt = str_replace(array("\n","\n\r",'<br />','<br>'),'|',$this->title);
357
+  $this->chart->chtt = str_replace(' ','+',$this->chart->chtt);
358
+  }
359
+  
360
+/* END PREPARE FUNCTIONS */
361
+  
362
+/* ENCODING */
363
+  function encode_data($data,$ratio = true)
364
+  {
365
+  if($this->encoding == 's')
366
+    {
367
+    foreach($data as $n => $value)
368
+      {
369
+      if(empty($value) || $value == '') $data[$n] = $this->missing;
370
+      else $data[$n] = $this->simple_encoding[$value];
371
+      }
372
+    }
373
+  elseif($this->encoding == 't')
374
+    {
375
+    foreach($data as $n => $value)
376
+      {
377
+      
378
+      if(empty($value) || $value == '') $data[$n] = $this->missing; 
379
+      elseif($ratio && $this->ratio) $data[$n] = (float) round($value * $this->ratio,1);
380
+      else $data[$n] = (float) $value;
381
+      }
382
+    }
383
+  elseif($this->encoding == 'e')
384
+    {
385
+    $max = 0; $min = 100000;
386
+    foreach($data as $n => $value)
387
+      {
388
+      if(empty($value) || $value == '') $data[$n] = $this->missing;
389
+      else
390
+        {
391
+        // normalize
392
+        if($ratio && $this->ratio) $value = round($value * $this->ratio,0);
393
+        // encode
394
+        $max = max($max,$value);
395
+        $min = min($min,$value); 
396
+        $value = $this->extended_encode($value);
397
+        $data[$n] = $value;
398
+        }
399
+      }
400
+    }
401
+  return $data;
402
+  }  
403
+  
404
+  function extended_encode($value)
405
+  {
406
+  $first = floor($value / 64);
407
+  $second = $value - ($first * 64);
408
+  $first = $this->extended_encoding[$first];
409
+  $second = $this->extended_encoding[$second];
410
+  return $first.$second;
411
+  }
412
+  
413
+  }
414
+
415
+?>

Двоични данни
website/SensorLogger.apk Целия файл


Двоични данни
website/SensorLogger.png Целия файл


Двоични данни
website/android.png Целия файл


+ 6
- 0
website/common.php Целия файл

@@ -0,0 +1,6 @@
1
+<?PHP
2
+
3
+ mysql_connect('localhost', 'md87_android', 'android73274');
4
+ mysql_select_db('md87_android');
5
+
6
+?>

+ 79
- 0
website/data.php Целия файл

@@ -0,0 +1,79 @@
1
+<?PHP
2
+
3
+ require('common.php');
4
+
5
+ if (isset($_GET['graph'])) {
6
+  $sql = 'SELECT record_data FROM unprocessed WHERE record_id = ' . ((int) $_GET['graph']);
7
+  $res = mysql_query($sql);
8
+  $row = mysql_fetch_assoc($res);
9
+
10
+  $datax = array();
11
+  $datay = array();
12
+  $dataz = array();
13
+  foreach (explode("\n", $row['record_data']) as $line) {
14
+   if (preg_match('/([0-9]+):(?:.*?,.*?,.*?,){'.($_GET['ds']-1).'}([0-9\.\-]+),([0-9\.\-]+),([0-9\.\-]+)/', $line, $m)) {
15
+    $datax[] = (double) $m[2];
16
+    $datay[] = (double) $m[3];
17
+    $dataz[] = (double) $m[4];
18
+   }
19
+  }
20
+  
21
+  $im = imagecreatetruecolor(count($datax) * 2, 330);
22
+  $w = imagecolorallocate($im, 255, 255, 255);
23
+  imagefill($im, 0, 0, $w);
24
+ 
25
+  $r = imagecolorallocate($im, 255, 0, 0);
26
+  $g = imagecolorallocate($im, 0, 255, 0);
27
+  $b = imagecolorallocate($im, 0, 0, 255);
28
+
29
+  $minx = min($datax); $maxx = max($datax); $rangex = max(1, $maxx - $minx);
30
+  $miny = min($datay); $maxy = max($datay); $rangey = max(1, $maxy - $miny);
31
+  $minz = min($dataz); $maxz = max($dataz); $rangez = max(1, $maxz - $minz);
32
+  $lastx = $lasty = $lastz = -0;
33
+
34
+  for ($i = 0; $i < count($datax); $i++) {
35
+   $x = ($datax[$i] - $minx) * 200 / $rangex;
36
+   $y = ($datay[$i] - $miny) * 200 / $rangey + 100;
37
+   $z = ($dataz[$i] - $minz) * 200 / $rangez + 200;
38
+
39
+   if ($i > 0) {
40
+    imageline($im, 2 * $i - 2, $lastx, $i * 2, $x, $r);
41
+    imageline($im, 2 * $i - 2, $lasty, $i * 2, $y, $g);
42
+    imageline($im, 2 * $i - 2, $lastz, $i * 2, $z, $b);
43
+   }
44
+
45
+   $lastx = $x; $lasty = $y; $lastz = $z;
46
+  }
47
+
48
+  header('Content-type: image/png');
49
+  imagepng($im);
50
+  return;
51
+ }
52
+
53
+ $sql = 'SELECT * FROM unprocessed';
54
+ $res = mysql_query($sql);
55
+
56
+ echo '<table border="1">';
57
+ $first = true;
58
+
59
+ while ($row = mysql_fetch_assoc($res)) {
60
+  if ($first) {
61
+   echo '<tr>';
62
+   foreach ($row as $k => $v) { echo '<th>', $k, '</th>'; }
63
+   echo '</tr>';
64
+   $first = false;
65
+  }
66
+
67
+  echo '<tr>';
68
+  foreach ($row as $k => $v) { echo '<td>', $k == 'record_data' ? count(explode("\n", $v)) . ' line(s)' : nl2br(htmlentities($v)), '</td>'; }
69
+
70
+  echo '<td>';
71
+  echo '<img src="data.php?graph=', $row['record_id'], '&amp;ds=1"><br>';
72
+  echo '<img src="data.php?graph=', $row['record_id'], '&amp;ds=2">';
73
+  echo '</td>';
74
+  echo '</tr>';
75
+ }
76
+
77
+ echo '</table>';
78
+
79
+?>

+ 22
- 0
website/index.html Целия файл

@@ -0,0 +1,22 @@
1
+<?xml version="1.0"?>
2
+<html xmlns="http://www.w3.org/1999/xhtml">
3
+  <head>
4
+    <title>Android projects by Chris Smith</title>
5
+    <link rel="stylesheet" type="text/css" href="/style.css"/>
6
+    <style type="text/css">
7
+     .qr { float: left; clear: left; margin-right: 15px; }
8
+     .qr img { width: 128px; }
9
+    </style>
10
+  </head>
11
+  <body style="margin-top: 0; padding-top: 0;">
12
+    <h1 style="background: url('android.png') no-repeat right; padding-top: 50px; margin-top: 0;">Android projects by <span>Chris Smith</span></h1>
13
+    <div>
14
+     <div class="app">
15
+      <a href="SensorLogger.apk" class="qr"><img src="SensorLogger.png" alt="SensorLogger.apk QR code"></a>
16
+      <h2>Sensor logger</h2>
17
+      <p>Logs changes in accelerometer readings and allows them to be uploaded for use in research.</p>
18
+     </div>
19
+    </div>
20
+    <div id="footer"/>
21
+  </body>
22
+</html>

+ 52
- 0
website/test Целия файл

@@ -0,0 +1,52 @@
1
+Array
2
+(
3
+    [CONTENT_LENGTH] => 22
4
+    [CONTENT_TYPE] => text/plain
5
+    [DOCUMENT_ROOT] => /home/chris/websites/chris.smith.name/
6
+    [GATEWAY_INTERFACE] => CGI/1.1
7
+    [HTTP_CONNECTION] => Keep-Alive
8
+    [HTTP_EXPECT] => 100-Continue
9
+    [HTTP_HOST] => chris.smith.name
10
+    [HTTP_USER_AGENT] => Apache-HttpClient/UNAVAILABLE (java 1.4)
11
+    [HTTP_X_APPLICATION] => SensorLogger
12
+    [HTTP_X_IMEI] => 000000000000000
13
+    [HTTP_X_VERSION] => 0.1
14
+    [PATH] => /bin:/usr/bin
15
+    [QUERY_STRING] => 
16
+    [REDIRECT_STATUS] => 200
17
+    [REDIRECT_URL] => /android/upload
18
+    [REMOTE_ADDR] => 109.170.137.175
19
+    [REMOTE_PORT] => 40247
20
+    [REQUEST_METHOD] => POST
21
+    [REQUEST_URI] => /android/upload
22
+    [SCRIPT_FILENAME] => /home/chris/websites/chris.smith.name/android/upload.php
23
+    [SCRIPT_NAME] => /android/upload.php
24
+    [SERVER_ADDR] => 85.234.138.2
25
+    [SERVER_ADMIN] => chris87@gmail.com
26
+    [SERVER_NAME] => chris.smith.name
27
+    [SERVER_PORT] => 80
28
+    [SERVER_PROTOCOL] => HTTP/1.1
29
+    [SERVER_SIGNATURE] => <address>Apache/2.2.12 (Ubuntu) Server at chris.smith.name Port 80</address>
30
+
31
+    [SERVER_SOFTWARE] => Apache/2.2.12 (Ubuntu)
32
+    [PHP_SELF] => /android/upload.php
33
+    [REQUEST_TIME] => 1260298135
34
+    [argv] => Array
35
+        (
36
+        )
37
+
38
+    [argc] => 0
39
+)
40
+
41
+
42
+Array
43
+(
44
+)
45
+
46
+
47
+Array
48
+(
49
+)
50
+
51
+
52
+Hello worldHello world

+ 20
- 0
website/upload.php Целия файл

@@ -0,0 +1,20 @@
1
+<?PHP
2
+
3
+ require('common.php');
4
+
5
+ $headers = '';
6
+
7
+ foreach ($_SERVER as $k => $v) {
8
+  if (substr($k, 0, 7) == 'HTTP_X_') {
9
+   $headers .= substr($k, 7) . ': ' . $v . "\n";
10
+  }
11
+ }
12
+
13
+ $sql  = 'INSERT INTO unprocessed (record_ip, record_headers, record_data) VALUES (';
14
+ $sql .= '\'' . mysql_real_escape_string($_SERVER['REMOTE_ADDR']) . '\', ';
15
+ $sql .= '\'' . mysql_real_escape_string($headers) . '\', ';
16
+ $sql .= '\'' . mysql_real_escape_string(file_get_contents('php://input')) . '\')';
17
+
18
+ mysql_query($sql) or die('Error: ' . mysql_error() . '<br>'. $sql);
19
+
20
+?>

Loading…
Отказ
Запис