Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
info
CREATE TABLE admin ( id INT PRIMARY KEY AUTO_INCREMENT, username VARCHAR(30) UNIQUE, passcode VARCHAR(30) ); Config.php Database configuration file. $mysql_hostname = hostname; $mysql_user = username;
// If result matched $myusername and $mypassword, table row must be 1 row if($count==1) { session_register(myusername);
Love this
PDF?
9lessons.info
PHP Login Page Example.
$_SESSION[login_user]=$myusername; header(location: welcome.php); } else { $error=Your Login Name or Password is invalid; } } <form action= method=post> <label>UserName :</label> <input type=text name=username/><br /> <label>Password :</label> <input type=password name=password/><br/>
include(lock.php); <h1>Welcome <?php echo $login_session; ?></h1> logout.php SignOut Destroy the session value. session_start(); if(session_destroy()) { header(Location: login.php); }
lock.php Session verification. If no session value page redirect to login.php include(config.php); session_start(); $user_check=$_SESSION[login_user]; $ses_sql=mysql_query(select username from admin where username=$user_check ); $row=mysql_fetch_array($ses_sql);
Love this
PDF?