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.
if ((!empty($_COOKIE['id'])) && (!empty($_COOKIE['password'])) && (empty($_SESSION['id'])))
{
$id=$_COOKIE['id'];
$password=$_COOKIE['password'];
$users=mysql_query("select * from users where id='".$id."'",$mydb);
$user=mysql_fetch_assoc($users);
$sessionid=session_id();
$logintime=time();
mysql_query("update users set logintime='".$logintime."' where id='".$user['id']."'",$mydb);
mysql_query("update sessions set userid='".$user['id']."' where sessionid='".$sessionid."'",$mydb);
if ($user['password']==$password)
{
$_SESSION['id']=$user['id'];
}
}
if(isset($_COOKIE['LogIn_Username']) && isset($_COOKIE['LogIn_Password']) && !isset($_SESSION["userid"]))
{
header ("Location: login_user.php?kecks=true&link=".rawurlencode("http://".$_SERVER['HTTP_HOST']."".$_SERVER['REQUEST_URI']));
exit;
}
<?php
session_start ();
header('Content-Type: text/html; charset=UTF-8');
$now = time();
if(isset($_COOKIE['LogIn_Username']) && isset($_COOKIE['LogIn_Password']) && !isset($_SESSION["userid"]))
{
header ("Location: login_user.php?kecks=true&link=".rawurlencode("http://".$_SERVER['HTTP_HOST']."".$_SERVER['REQUEST_URI']));
exit;
}
if(isset($_COOKIE['LogIn_Username']) && isset($_COOKIE['LogIn_Password']) && isset($_SESSION["userid"]))
{
$pw = $_COOKIE['LogIn_Password'];
setcookie('LogIn_Username',$_SESSION["nickname"],$now);
setcookie('LogIn_Password',$pw,$now);
}
$myob=isset($_SERVER["HTTP_ACCEPT_ENCODING"])&&eregi("gzip, deflate", $_SERVER["HTTP_ACCEPT_ENCODING"]);
if($myob)
{
ob_start("ob_gzhandler");
}
else
{
ob_start();
}
ini_set('arg_separator.output', '&');
include("connect.php"); // und dann anderer Code
?>
<?php
// Session starten
session_start ();
// Datenbankverbindung aufbauen
include("connect.php");
if(isset($_GET["kecks"]) && $_GET["kecks"] == true)
{
$name = $_COOKIE['LogIn_Username'];
$pw = $_COOKIE['LogIn_Password'];
$autologin = 'on';
}
else
{
$name = $_POST["name"];
$pw = md5($_POST["pwd"]);
if(isset($_POST["autologin"]) && $_POST["autologin"] == 'on')
$autologin = 'on';
else
$autologin = 'off';
}
$sql = "SELECT userid, benutzername FROM users WHERE benutzername LIKE '".mysql_real_escape_string($name)."' AND passwort = '".mysql_real_escape_string($pw)."'";
$result = mysql_query ($sql) or die(mysql_error());
if (mysql_num_rows ($result) > 0)
{
// Benutzerdaten in ein Array auslesen.
$data = mysql_fetch_row ($result);
// Sessionvariablen erstellen und registrieren
$_SESSION["userid"] = $data[0];
$_SESSION["nickname"] = $data[1];
$sql = "SELECT wgg.websitegruppenglobalname FROM websitegruppenglobal wgg JOIN websitegruppenglobalmitglieder wggm ON wggm.websitegruppenglobalid = wgg.websitegruppenglobalid WHERE userid = ".$data[0];
$resource = mysql_query($sql) or die(mysql_error());
$group = mysql_fetch_array($resource);
$_SESSION["globalgroup"] = $group[0];
$sql = "SELECT sessionid FROM users_online WHERE userid = ".mysql_real_escape_string($data[0]);
$resource = mysql_query($sql) or die (mysql_error());
if(mysql_num_rows($resource) > 0)
{
$sessionold = mysql_fetch_array($resource);
session_id($sessionold[0]);
}
if($autologin == 'on')
{
$time = time() + (60*60*24*365*2);
setcookie('LogIn_Username',$_SESSION["nickname"],$time);
setcookie('LogIn_Password',$pw,$time);
}
header ("Location: ".rawurldecode($_GET["link"]));
exit;
}
else
{
header ("Location: index.php?fehler=1");
exit;
}
?>