slitaz-forge diff usbkey/index.php @ rev 709

boot: add mypizza.slitaz.org link
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Dec 15 17:55:16 2019 +0100 (2019-12-15)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/usbkey/index.php	Sun Dec 15 17:55:16 2019 +0100
     1.3 @@ -0,0 +1,40 @@
     1.4 +<?php
     1.5 +foreach (array("confirm", "cancel", "show") as $action) {
     1.6 +	if (!isset($_GET[$action]))
     1.7 +		continue;
     1.8 +	$hash = $_GET[$action];
     1.9 +	if ($hash == "")
    1.10 +		continue;
    1.11 +	$data = unserialize(file_get_contents("pending/".
    1.12 +		substr($hash,0,1)."/".$hash));
    1.13 +	if (!isset($data))
    1.14 +		continue;
    1.15 +	if ($action == "confirm") {
    1.16 +		@mkdir("confirmed/".substr($hash,0,1),0777,TRUE);
    1.17 +		rename("pending/".substr($hash,0,1)."/".$hash,
    1.18 +			"confirmed/".substr($hash,0,1)."/".$hash);
    1.19 +	}
    1.20 +	if ($action == "cancel") {
    1.21 +		unlink("pending/".substr($hash,0,1)."/".$hash);
    1.22 +	}
    1.23 +	include("head.php");
    1.24 +	echo "<div id=\"content\">\n";
    1.25 +	echo "<h2>SliTaz USB key pre-order ".$action."ed.</h2>\n<p><table>\n";
    1.26 +	foreach ($data as $key => $value) 
    1.27 +		echo "<tr><td>".$key."</td><td><b>".$value."</b></td></tr>\n"; 
    1.28 +	echo "</table></p>\n";
    1.29 +	echo "</div>\n";
    1.30 +	include("tail.php");
    1.31 +	exit;
    1.32 +}
    1.33 +
    1.34 +foreach (explode(",", $_SERVER["HTTP_ACCEPT_LANGUAGE"]) as $lang) {
    1.35 +	foreach (array(';',' ','-') as $char) {
    1.36 +		if (($n = strpos($lang, $char)) !== false)
    1.37 +			$lang = substr($lang,0,$n);
    1.38 +	}
    1.39 +	if (is_dir($lang)) break;
    1.40 +	$lang = "en"; 
    1.41 +}
    1.42 +header("Location: $lang/");
    1.43 +?>