slitaz-forge view usbkey/index.php @ rev 348

mirror: add QR code
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Mar 20 18:32:44 2013 +0100 (2013-03-20)
parents
children
line source
1 <?php
2 foreach (array("confirm", "cancel", "show") as $action) {
3 if (!isset($_GET[$action]))
4 continue;
5 $hash = $_GET[$action];
6 if ($hash == "")
7 continue;
8 $data = unserialize(file_get_contents("pending/".
9 substr($hash,0,1)."/".$hash));
10 if (!isset($data))
11 continue;
12 if ($action == "confirm") {
13 @mkdir("confirmed/".substr($hash,0,1),0777,TRUE);
14 rename("pending/".substr($hash,0,1)."/".$hash,
15 "confirmed/".substr($hash,0,1)."/".$hash);
16 }
17 if ($action == "cancel") {
18 unlink("pending/".substr($hash,0,1)."/".$hash);
19 }
20 include("head.php");
21 echo "<div id=\"content\">\n";
22 echo "<h2>SliTaz USB key pre-order ".$action."ed.</h2>\n<p><table>\n";
23 foreach ($data as $key => $value)
24 echo "<tr><td>".$key."</td><td><b>".$value."</b></td></tr>\n";
25 echo "</table></p>\n";
26 echo "</div>\n";
27 include("tail.php");
28 exit;
29 }
31 foreach (explode(",", $_SERVER["HTTP_ACCEPT_LANGUAGE"]) as $lang) {
32 foreach (array(';',' ','-') as $char) {
33 if (($n = strpos($lang, $char)) !== false)
34 $lang = substr($lang,0,$n);
35 }
36 if (is_dir($lang)) break;
37 $lang = "en";
38 }
39 header("Location: $lang/");
40 ?>