-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
195 lines (160 loc) · 6.87 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?php
include_once("z_db.php");
$sql="SELECT maintain FROM settings WHERE sno=0";
if ($result = mysqli_query($con, $sql)) {
/* fetch associative array */
while ($row = mysqli_fetch_row($result)) {
$main= $row[0];
}
if($main==1 || $main==3)
{
print "
<script language='javascript'>
window.location = 'maintain.php';
</script>
";
}
}
if($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['username']))
{
$status = "OK"; //initial status
$msg="";
$username=mysqli_real_escape_string($con,$_POST['username']); //fetching details through post method
$password = mysqli_real_escape_string($con,$_POST['password']);
if ( strlen($username) < 6 ){
$msg=$msg."Username must be more than 5 char legth<BR>";
$status= "NOTOK";}
if ( strlen($password) < 6 ){ //checking if password is greater then 8 or not
$msg=$msg."Password must be more than 5 char legth<BR>";
$status= "NOTOK";}
if($status=="OK"){
// Retrieve username and password from database according to user's input, preventing sql injection
$query ="SELECT password FROM affiliateuser WHERE (username = '" . mysqli_real_escape_string($con,$_POST['username']) . "') AND (active = '" . mysqli_real_escape_string($con,"1") . "') AND (level = '" . mysqli_real_escape_string($con,"2") . "')";
if ($stmt = mysqli_prepare($con, $query)) {
/* execute query */
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $hash);
/* store result */
mysqli_stmt_store_result($stmt);
$num=mysqli_stmt_num_rows($stmt);
mysqli_stmt_data_seek($stmt, 0);
mysqli_stmt_fetch($stmt);
if(!(password_verify(mysqli_real_escape_string($con,$_POST['password']), $hash)))
$num = 0;
/* close statement */
mysqli_stmt_close($stmt);
}
//mysqli_close($con);
// Check username and password match
if (($num) == 1) {
$sqlquery11="SELECT expiry FROM affiliateuser where username = '$username'"; //fetching expiry date of username from table
$rec211=mysqli_query($con,$sqlquery11);
$row211 = mysqli_fetch_row($rec211);
$expirydate=$row211[0]; //assigning expiry date
$curdate=date("Y-m-d");
if($curdate > $expirydate)
{
$errormsg= "
<div class='alert alert-danger'>
<button type='button' class='close' data-dismiss='alert'>×</button>
<i class='fa fa-ban-circle'></i><strong>Please Fix Below Errors : </br></strong>Hello User, Your Account Has Been Deactivated, As Your Account Is Expired. Please Check Below To Renew Your Account.</div>"; //printing error if found in validation
$statusflag= "NOTOK";
}
else{
session_start();
// Set username session variable
$_SESSION['username'] = $username;
// Jump to secured page
print "
<script language='javascript'>
window.location = 'dashboard.php?page=dashboard%location=index.php';
</script>";
}
}
else{
$errormsg= "
<div class='alert alert-danger'>
<button type='button' class='close' data-dismiss='alert'>×</button>
<i class='fa fa-ban-circle'></i><strong>Please Fix Below Errors : </br></strong>Username And Password Does Not Match Or Your Account Is Inactive.</div>"; //printing error if found in validation
}}
else {
$errormsg= "
<div class='alert alert-danger'>
<button type='button' class='close' data-dismiss='alert'>×</button>
<i class='fa fa-ban-circle'></i><strong>Please Fix Below Errors : </br></strong>".$msg."</div>"; //printing error if found in validation
}
}
?>
<!DOCTYPE html>
<html lang="en" class="app">
<head>
<meta charset="utf-8" />
<title>MLM</title>
<meta name="description" content="app, web app, responsive, admin dashboard, admin, flat, flat ui, ui kit, off screen nav" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<link rel="stylesheet" href="css/app.v1.css" type="text/css" />
<!--[if lt IE 9]> <script src="js/ie/html5shiv.js"></script> <script src="js/ie/respond.min.js"></script> <script src="js/ie/excanvas.js"></script> <![endif]-->
<style type="text/css">html {
overflow-y: scroll;
background: url(images/login2.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
</style>
<div id="google_translate_element" align="right"></div><script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE, multilanguagePage: true}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</head>
<body>
<section id="content" class="m-t-lg wrapper-md animated fadeInUp">
<div class="container aside-xl"> <a class="navbar-brand block" href="index.php">Login</a>
<section class="m-b-lg">
<header class="wrapper text-center"> <strong>Sign in to to see stats</strong> </header>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"], ENT_QUOTES, "utf-8"); ?>" method="post">
<div class="list-group">
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST' && ($errormsg!=""))
{
print $errormsg;
}
?>
<div class="list-group-item">
<input type="text" placeholder="Username" class="form-control no-border" name="username" required>
</div>
<div class="list-group-item">
<input type="password" placeholder="Password" class="form-control no-border" name="password" required>
</div>
</div>
<button type="submit" class="btn btn-lg btn-primary btn-block">Sign in</button>
<div class="text-center m-t m-b"><a href="forgotpassword.php"><small style="color:#ffffff;">Forgot password?</small></a> | <a href="renewaccount.php"><small style="color:#ffffff;">Account Expired? Renew Here</small></a></div>
<div class="line line-dashed"></div>
<p class="text-center m-t m-b"><a href="#"><small style="color:#ffffff;">Don't Have Account?</small></a></p>
<a href="signup.php" class="btn btn-lg btn-default btn-block">Create an account</a>
</form>
</section>
</div>
</section>
<!-- footer -->
<footer id="footer">
<div class="text-center padder">
<p> <small style="color:#ffffff;"><?php $query="SELECT footer from settings where sno=0";
$result = mysqli_query($con,$query);
while($row = mysqli_fetch_array($result))
{
$footer="$row[footer]";
print $footer;
}
?></small> </p>
</div>
</footer>
<!-- / footer -->
<!-- Bootstrap -->
<!-- App -->
<script src="js/app.v1.js"></script>
<script src="js/app.plugin.js"></script>
</body>
</html>