-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
31 lines (28 loc) · 856 Bytes
/
index.php
File metadata and controls
31 lines (28 loc) · 856 Bytes
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
<!--
In the name ALLAH the Beneficent , the Merciful.
-->
<?php
include "login_page_html_css.html";
$host = "localhost";
$user = "root";
$pass = "";
$db = "my_first_database";
$dpp = mysqli_connect ($host , $user , $pass , $db);
session_start();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$myusername = mysqli_real_escape_string($dpp , $_POST['username']);
$mypassword = mysqli_real_escape_string($dpp , $_POST['password']);
$sql = "SELECT id FROM user_table WHERE username = '$myusername' AND password = '$mypassword'";
$result = mysqli_query($dpp, $sql);
$row = mysqli_fetch_assoc($result);
$count = mysqli_num_rows($result);
if ($count == 1) {
echo "welcome";
$dpp->close();
}
else {
echo "please sign up first <br>";
header("Location: login.php");
}
}
?>