-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
38 lines (33 loc) · 883 Bytes
/
login.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
require_once('functions.php');
if(isset($_POST['username']) || isset($_POST['password'])){
if($_POST['username']=="" || $_POST['password']==""){
echo "Either password or username is blank";
}
$user = userAuth($_POST['username'], $_POST['password']);
if($user->num_rows == 1){
$profile = $user->fetch_array(MYSQLI_ASSOC);
$_SESSION['username'] = $profile['username'];
// print_r($profile);
// echo $_SESSION['username'];
header('location: index.php');
}
echo "hello";
}
?>
<form action="login.php" method="POST">
<table>
<tr>
<input type="text" name="username" placeholder="username" />
</tr>
<tr>
<input type="password" name="password" placeholder="password" />
</tr>
<tr>
<input type="submit" value="submit" />
</tr>
</table>
</form>