-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
40 lines (26 loc) · 797 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
39
40
<?php
session_start();
$uname=$_POST['user'];
$pass=$_POST['psd'];
require('firstimport.php');
$tbl_name="users"; // Table name
mysqli_select_db($conn,"$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name WHERE u_name='$uname' and password='$pass'";
echo "$sql";
$result=mysqli_query($conn,$sql) or trigger_error(mysql_error.$sql);
//$row=mysql_fetch_array($result);
//echo "\n\n ..nam..".$row['f_name']."\n\n ..pass..".$row['password'];
if(mysqli_num_rows($result) < 1)
{
echo " .... LOGIN TRY ....";
$_SESSION['error'] = "1";
header("location:login1.php"); //
}
else
{
$_SESSION['name'] = $uname; // Make it so the username can be called by $_SESSION['name'] //
echo " .... LOGIN ....";
echo $_SESSION['name'];
header("location:index.php"); //
}
?>