Open saweetha opened 6 years ago
<?php
session_start();
include('../config/connection.php');
if($_POST) {
$q = "SELECT * FROM users WHERE email = '$_POST[email]' AND password = SHA1('$_POST[password]')";
$r = mysqli_query($dbc, $q);
if(mysqli_num_rows($r) ==1) {
$_SESSION['username'] = $_POST['email'];
header('Location: index.php');
}
}
?>
<!DOCTYPE html>
this is my login code
<?php
session_start();
if(!isset($_SESSION['username'])) { header('Location: login.php'); }
?>
<?php include('config/setup.php'); ?>
<!DOCTYPE html>
my index code
I'm sorry I'm busy at the moment, please wait until Monday for further help. I'll try to fix it.
It should work just fine, if you continue to have problems please check the spelling inside the inputs.
Also, an easy way to call to the same page on a form post is to use ´<form action="" ...>´
https://www.youtube.com/watch?v=ldPPttGFJYk&list=PLAkMqlQoeMeiwvNWpe3mhgQxAa1jiGwmt&index=27 I did everything in this video, but the admin and password which appear in the video never appear in my website. I cant login into my admin. Where is the thing went wrong ? Any ideas ?