apple3
5:page login2.php
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="user">User Name</label>
<div class="col-md-4">
<input id="user" name="user" type="text" placeholder="user name" class="form-control input-md">
<span class="help-block">Please enter user name</span>
</div>
</div>
<?php
include 'db.php';
$name = $_POST['user'];
$pass = $_POST['pass'];
$check =mysql_query("select * from user where username='$name' and password='$pass' ");
$row = mysql_fetch_array($check);
if($row['username']== $name & $row['password']== $pass) {
echo "login successful" .$row['username'];
}else{
echo "login failed";
}
?>
/////////////////////////////////////////End/////////////////////
6:page logout.php
<?php
session_start();
//unset($_SESSION["nome"]);
// where $_SESSION["nome"] is your own variable. if you do not have one use only this as follow **session_unset();**
header("Location: home.php");
session_start();
session_unset();
session_destroy();
header("location:login.php");
exit();
?>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="user">User Name</label>
<div class="col-md-4">
<input id="user" name="user" type="text" placeholder="user name" class="form-control input-md">
<span class="help-block">Please enter user name</span>
</div>
</div>
<?php
include 'db.php';
$name = $_POST['user'];
$pass = $_POST['pass'];
$check =mysql_query("select * from user where username='$name' and password='$pass' ");
$row = mysql_fetch_array($check);
if($row['username']== $name & $row['password']== $pass) {
echo "login successful" .$row['username'];
}else{
echo "login failed";
}
?>
/////////////////////////////////////////End/////////////////////
6:page logout.php
<?php
session_start();
//unset($_SESSION["nome"]);
// where $_SESSION["nome"] is your own variable. if you do not have one use only this as follow **session_unset();**
header("Location: home.php");
session_start();
session_unset();
session_destroy();
header("location:login.php");
exit();
?>
////////////////////////////End//////////////////////
Comments
Post a Comment