// Created by PhpStorm.
// User: Tanzila Islam
// Date: 7/7/15
// Time: 4:07 AM
<?php
session_start();
$userinfo = array(
'Mohita'=>'mohita',
'Kitty'=>'kitty'
);
if(isset($_POST['username'])) {
if($userinfo[$_POST['username']] == $_POST['password']) {
$_SESSION['username'] = $_POST['username'];
}else {
//Invalid Login
}
}
?>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
Name:<input type="text" name="username"> Password:<input type="password" name="password">
<input type="submit" name="submit" value="Log in"onclick="javascript: form.action='test1.php';" />
</form>
OUTPUT
// User: Tanzila Islam
// Date: 7/7/15
// Time: 4:07 AM
<?php
session_start();
$userinfo = array(
'Mohita'=>'mohita',
'Kitty'=>'kitty'
);
if(isset($_POST['username'])) {
if($userinfo[$_POST['username']] == $_POST['password']) {
$_SESSION['username'] = $_POST['username'];
}else {
//Invalid Login
}
}
?>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
Name:<input type="text" name="username"> Password:<input type="password" name="password">
<input type="submit" name="submit" value="Log in"onclick="javascript: form.action='test1.php';" />
</form>
OUTPUT
No comments:
Post a Comment