-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.php
More file actions
137 lines (109 loc) · 4.61 KB
/
index.php
File metadata and controls
137 lines (109 loc) · 4.61 KB
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
<?php
include_once ("admin/site/mmn_db.php");
include_once ("admin/site/config.php");
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 deve conter no mínimo 6 caracteres<BR>";
$status= "NOTOK";}
if ( strlen($password) < 6 ){ //checking if password is greater then 8 or not
$msg=$msg."Senha deve conter no mínimo 6 dígitos<BR>";
$status= "NOTOK";}
if($status=="OK"){
// Retrieve username and password from database according to user's input, preventing sql injection
$query ="SELECT * FROM affiliateuser WHERE (username = '" . mysqli_real_escape_string($con,$_POST['username']) . "') AND (password = '" . mysqli_real_escape_string($con,$_POST['password']) . "')";
if ($stmt = mysqli_prepare($con, $query)) {
/* execute query */
mysqli_stmt_execute($stmt);
/* store result */
mysqli_stmt_store_result($stmt);
$num=mysqli_stmt_num_rows($stmt);
/* close statement */
mysqli_stmt_close($stmt);
}
//mysqli_close($con);
// Check username and password match
if (($num) == 1) {
session_start();
// Set username session variable
$_SESSION['username'] = $username;
// Jump to secured page
print "
<script language='javascript'>
window.location = 'home.php?page=home%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>ERRO : </br></strong>Username ou Senha incorretos, tente novamente.</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>ERRO : </br></strong>".$msg."</div>"; //printing error if found in validation
}
}
?>
<!--
Author: W3layouts
Author URL: http://w3layouts.com
License: Creative Commons Attribution 3.0 Unported
License URL: http://creativecommons.org/licenses/by/3.0/
-->
<!DOCTYPE HTML>
<html>
<head>
<title><?php print $site_name ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="Modern Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template,
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel='stylesheet' type='text/css' />
<!-- Custom CSS -->
<link href="css/style.css" rel='stylesheet' type='text/css' />
<link href="css/font-awesome.css" rel="stylesheet">
<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<!----webfonts--->
<link href='http://fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,900' rel='stylesheet' type='text/css'>
<!---//webfonts--->
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
</head>
<body id="login">
<div class="login-logo">
<h2><a href="index.php"><img src="admin/site/logo.png" alt="" /></a></h2>
</div>
<h2 class="form-heading">login</h2>
<div class="app-cam">
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"], ENT_QUOTES, "utf-8"); ?>" method="post">
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST' && ($errormsg!=""))
{
print $errormsg;
}
?>
<input type="text" class="text" value="Seu username" name="username" required onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Seu Username';}">
<input type="password" value="Password" name="password" required onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Sua senha';}">
<div class="submit"><input type="submit" onclick="myFunction()" value="ENTRAR"></div>
<ul class="new">
<li class="new_left"><p><a href="rec_pass.php">Perdeu a senha?</a></p></li>
<li class="new_right"><p class="sign">#<a href="register.php">Criar Conta</a></p></li>
<div class="clearfix"></div>
</ul>
</form>
</div>
<?php
include_once ("admin/site/footer.php");
?>
</body>
</html>