Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
<?php
error_reporting(E_ALL);
/*/
Download a file using fpassthru()
/*/
$fileDir = "/path/tiarna/movie"; // supply a path name.
$fileName = "psa.tar.gz"; // supply a file name.
$fileString=$fileDir.'/'.$fileName; // combine the path and file
// translate file name properly for Internet Explorer.
if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")){
$fileName = preg_replace('/\./', '%2e', $fileName, substr_count($fileName, '.') - 1);
}
// make sure the file exists before sending headers
if(!$fdl=@fopen($fileString,'r')){
die("Cannot Open File!");
} else {
header("Cache-Control: ");// leave blank to avoid IE errors
header("Pragma: ");// leave blank to avoid IE errors
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$fileName."\"");
header("Content-length:".(string)(filesize($fileString)));
sleep(1);
fpassthru($fdl);
}
?>
<?php
error_reporting(E_ALL);
function _get_browser()
{
$browser = array ( //reversed array
"OPERA",
"MSIE", // parent
"NETSCAPE",
"FIREFOX",
"SAFARI",
"KONQUEROR",
"MOZILLA" // parent
);
$parent = "OTHER";
foreach ($browser as $parent)
{
if ( ($s = strpos(strtoupper($_SERVER['HTTP_USER_AGENT']), $parent)) !== FALSE )
{
$f = $s + strlen($parent);
$version = substr($_SERVER['HTTP_USER_AGENT'], $f, 8);
$version = preg_replace('/[^0-9,.]/','',$version);
$info = $parent." ".$version;
break; // first match wins
}
}
return $info;
}
$ip = $_SERVER['REMOTE_ADDR'];
$time = time();
$file = "./access.db";
$info = _get_browser();
$movie = "psa.tar.gz";
$content = file($file);
$k = count($content);
for($i = 0; $i < $k; $i++) {
$cont = explode(";", $content[$i]);
if($cont[0] == $ip) {
echo "<strong>Sie haben den Film bereits geladen!</strong>"; exit;
} elseif($k == 600) {
echo '<strong>Tut mir leid, aber es wurden bereits die maximal möglichen Downloads geladen<br/>'.$k.'</strong>';
}
}
$j = $k++;
$content[$j] = $ip.";".$info.";".$time."\n";
$fp = fopen($file, "a");
if(!fwrite($fp, $content[$j])) {
echo '<strong>Fehler! Bitte den Admin kontaktieren!<br/><a href="mailto:root@flexmex.net">Flex</a></strong>';
} else {
/*/
Download a file using fpassthru()
/*/
$fileDir = "/var/www/vhosts/flexmex.net/subdomains/tiarna/movie"; // supply a path name.
$fileName = $movie; // supply a file name.
$fileString=$fileDir.'/'.$fileName; // combine the path and file
// translate file name properly for Internet Explorer.
if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")){
$fileName = preg_replace('/\./', '%2e', $fileName, substr_count($fileName, '.') - 1);
}
// make sure the file exists before sending headers
if(!$fdl=@fopen($fileString,'r')){
die("Cannot Open File!");
} else {
header("Cache-Control: ");// leave blank to avoid IE errors
header("Pragma: ");// leave blank to avoid IE errors
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$fileName."\"");
header("Content-length:".(string)(filesize($fileString)));
sleep(1);
fpassthru($fdl);
}
}
?>