-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_login.php
54 lines (39 loc) · 1.31 KB
/
admin_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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
session_start();
$uname=$_POST['user'];
$pass=$_POST['psd'];
require('firstimport.php');
mysqli_select_db($conn,"$db_name")or die("cannot select DB");
if($uname=="admin" and $pass=="admin"){
$_SESSION['name'] = $uname; // Make it so the username can be called by $_SESSION['name'] //
echo " .... LOGIN ....";
echo $_SESSION['name'];
header("location:addTrain.php"); //
}
else {
echo " .... LOGIN TRY ....";
$_SESSION['error'] = "1";
header("location:admin_login1.php"); //
}
// 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"); //
// }
?>