Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<?php
if ($_POST['username'] && $_POST['password']){
# include the auth script
include('./auth.php');
}
session_start();
if (!($_SESSION['user_id'])) {
/* if no session, show login form */
if ($_POST['username'] && $_POST['password']){
/* include the auth script */
[b]require[/b]('auth.php');
} /* end if ($_POST['username'] && $_POST['password']) */
} /* end if (!($_session['user_id'])) */
else { /* already logged in */
echo "You are logged in, <b>{$_SESSION['user_name']}</b>.<br />";
} /* end else: already logged in*/
/* here you can add logout function:
if ($submit = "Logout") {... */
/* we assume you already queried
database for password and username */
if (mysql_num_rows($row) > 0) {
/* This means login is a-ok. */
$_SESSION['user_id'] = $row['user_id'];
$_SESSION['user_name'] = $row['user_name'];
}
session_start();
if (!($_SESSION['user_id'])) {
/* if no session, show login form */
if ($_POST['username'] && $_POST['password']){
/* include the auth script */
require('auth.php');
} /* end if ($_POST['username'] && $_POST['password']) */
else {
/*Show login form */
require("login_form.php");
}
} /* end if (!($_session['user_id'])) */
else { /* already logged in */
echo "You are logged in, <b>{$_SESSION['user_name']}</b>.<br />";
} /* end else: already logged in*/
/* here you can add logout function:
if ($submit = "Logout") {... */