-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvalidation.php
More file actions
53 lines (37 loc) · 726 Bytes
/
Copy pathvalidation.php
File metadata and controls
53 lines (37 loc) · 726 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
session_start();
$con=mysqli_connect('localhost','root');
if ($con)
{
echo "connection successful";
}
else
{
echo "no connection";
}
mysqli_select_db($con,'uniquedeveloper');
$name=$_POST['name'];
$pass=$_POST['password'];
$email=$_POST['email'];
$q="select * from login where username='$name' && password='$pass'";
$result=mysqli_query($con,$q);
$res=mysqli_fetch_assoc($result);
$num=mysqli_num_rows($result);
if ($num==1)
{
if ($res['username']=='admin')
{
header("location:admin/admin_main.php");
}
else
{
$_SESSION['username']=$name;
header('location:index.php');
}
}
else
{
$_SESSION['error']="error";
header('location:login.php');
}
?>