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 echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>mjb's page: Shoutbox</title>
<?
$name = $_POST["name"];
$schrei = $_POST["schrei"];
$name = str_replace ("\n"," ", $name);
$name = str_replace ("<", " ", $name);
$name = str_replace (">", " ", $name);
$name = stripslashes ($name);
?>
<?php
$db = mysql_connect('localhost', 'user', 'passwort')
or die('Verbindung zum Datenbankserver schlug fehl!');
mysql_select_db('usr2', $db)
or die('Auswahl der Datenbank schlug fehl!');
if( isset($_POST['submit']) ) {
$query = 'INSERT INTO `shoutbox` (`time`, `name`, `schrei`) VALUES ("'.time().'", "'.mysql_real_escape_string(strip_tags($_POST['name'])).'", ("'.mysql_real_escape_string($_POST['schrei']).'");';
mysql_query($query)
or die('Datenbankabfrage schlug fehl!');
}
$query = '
SELECT
`time`,
`name`,
`schrei`
FROM
`shoutbox`
ORDER BY
`time` ASC
LIMIT
0, 30
';
$result = mysql_query($query)
or die('Datenbankabfrage schlug fehl!');
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Shoutbox</title>
</head>
<body>
<form name="shoutbox" action="shoutbox.php" method="post">
<p>Name:
<input type="text" name="name" class="textfeld" size="15" maxlength="20" value="<? echo htmlspecialchars(strip_tags($_POST['name'])); ?>" /></p>
<p>Schrei:
<input type="text" name="schrei" class="textfeld" size="50" maxlength="255" /></p>
<p><input type="submit" value="Schrei!" class="button" /></p>
</form>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<?php
while( $row = mysql_fetch_array($result, MYSQL_ASSOC) ) {
echo '<tr><td><p><i>'.$row['name'].'</i> schrie am '.$row['time'].':</p><p>'.$row['schrei'].'</p></td></tr>';
}
?>
</table>
</body>
</html>
$query = "INSERT INTO `shoutbox` (`time`, `name`, `schrei`) ".
"VALUES ('".time()."', '".mysql_real_escape_string(strip_tags($_POST['name']))."', '".mysql_real_escape_string($_POST['schrei'])."')";
if( isset($_POST['submit']) ) { ... }
<p><input type="submit" name="submit" value="Schrei!" class="button" /></p>