-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
78 lines (64 loc) · 1.82 KB
/
index.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
include_once 'header.php';
if(!isset($_SESSION['uid'])) {
?>
<div class="container text-center" style="width:auto;" ng-app="myApp" ng-controller="customersCtrl">
<p><b style="font-size:25px;">Login Page</b><br><br></p>
<form>
<input class="form-control" type="text" ng-model="uid" name="uid" placeholder="UserId" autofocus required>
<span ng-show="disp1">User Not Found!</span>
<br>
<input class="form-control" type="password" ng-model="pwd" name="pwd" placeholder="Password" autofocus required>
<span ng-show="disp2">Wrong Password!</span>
<br>
<button class="btn btn-primary" ng-click="send()">login</button>
</form>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$scope.reset = function() {
$scope.uid = '';
$scope.pwd = '';
$scope.disp1 = false;
$scope.disp2 = false;
}
$scope.send = function() {
$http({
method: "post",
url: "includes/login.inc.php",
data: {
'uid' : $scope.uid,
'pwd' : $scope.pwd
}
}).then(function (data) {
console.log(data);
if (data.data == 'User Not Found')
$scope.disp1 = true;
else
$scope.disp1 = false;
if (data.data == 'Wrong Password')
$scope.disp2 = true;
else
$scope.disp2 = false;
if (data.data == 1)
{
window.top.location='index.php';
exit();
}
}, function myError(response) {
console.log('Error');
});
}
$scope.reset();
});
</script>
<?php
}
else {
echo "<script>window.top.location='billing.php'</script>";
//header("Location: billing.php");
exit();
}
include_once 'footer.php';
?>