Created
January 11, 2019 15:50
-
-
Save arif98741/050b43226e8c3ed304fa66f336552bf3 to your computer and use it in GitHub Desktop.
Login Redirection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
//check user is logged in or not | |
if (!isset($_SESSION['login'])) { | |
header("location: login.php"); | |
} | |
echo "sit kale ato thanda lage ken?"; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//check user is logged in or not | |
session_start(); | |
if (isset($_SESSION['login'])) { | |
header("location: index.php"); | |
} | |
$con = mysqli_connect('localhost', 'root', '', 'b'); | |
if (isset($_POST['submit'])) { | |
$email = $_POST['email']; | |
$passward = $_POST['passward']; | |
$sql = "SELECT * FROM bb WHERE email='$email' AND passward='$passward'"; | |
$query = mysqli_query($con, $sql); | |
if (mysqli_num_rows($query) > 0) { | |
//set session | |
$_SESSION['login'] == TRUE; | |
header("location: home.php"); | |
} else { | |
header("location: login.php"); | |
} | |
} else { | |
} | |
?> | |
<html> | |
<form action="login.php" method="POST" > | |
Email : <input type="email" name="email"/> | |
Passward : <input type="passward" name="passward"/> | |
<input type="submit" value="submit" name="submit"/> | |
</form> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment