-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex_process.php
More file actions
executable file
·43 lines (38 loc) · 1.39 KB
/
index_process.php
File metadata and controls
executable file
·43 lines (38 loc) · 1.39 KB
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
39
40
41
42
43
<link href="styles.css" rel="stylesheet" type="text/css">
<?php
session_start();
include_once("dbconnect.php");
$username=(isset($_POST['username'])) ? $_POST['username'] : "";
$password=(isset($_POST['password'])) ? md5($_POST['password']) : "";
if($username=="" || $password=="")
{
$_SESSION['message']="Please enter Username or Password";
$_SESSION['messagetype']="errormessage";
header("location: index.php");
exit();
}
$check_db_for_username=mysql_query("select * from users where(username='$username' and password='$password')");
if($check_db_for_username==FALSE)
{
$_SESSION['message']="Error Encounter accesing user information!" .mysql_error();
$_SESSION['messagetype']="errormessage";
header("location: index.php");
exit();
}
$total_check_db_for_username=mysql_num_rows($check_db_for_username);
if($total_check_db_for_username<=0)
{
$_SESSION['message']="Invalid Username and Pasword";
$_SESSION['messagetype']="errormessage";
header("location: index.php");
exit();
}
mysql_data_seek($check_db_for_username,0);
$row_check_db_for_username=mysql_fetch_assoc($check_db_for_username);
$_SESSION['user_category']=$row_check_db_for_username['user_category'];
$_SESSION['current_user']=$username;
$_SESSION['message']="Succesfully Login!";
$_SESSION['messagetype']="sucessmessage";
header("location: home.php");
exit();
?>