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
| <?php
require_once ('cnx.php');
require ('cfg.php');
require('setting.php');
require ('function.php');
require('auth.php');
if(Auth::islog()){
echo'<SCRIPT LANGUAGE="JavaScript">document.location.href="index.html"</SCRIPT>';
}else{
}
// CONNEXION //
//print_r( $_POST);
if(isset($_POST['submit_log'])){
$email = $_POST['email'];
$password = sha1($_POST['password']);
$q = array('email'=>$email, 'password'=>$password);
$sql = 'SELECT email,password FROM users WHERE email = :email AND password = :password';
$req = $cnx->prepare($sql);
$req->execute($q);
$count = $req->rowCount($sql);
if($count == 1){
//Verifier si l'utilisateur est actif
$sql = 'SELECT email,password FROM users WHERE email = :email AND password = :password AND activer = 1';
$req = $cnx->prepare($sql);
$req->execute($q);
$actif = $req->rowCount($sql);
if($actif == 1){
$_SESSION['Auth'] = array(
'email' => $email,
'password' => $password
);
// On met à jour la date de la dernière visite:
$der_co = date('Y-m-d h:i:s');
$ip = $_SERVER['REMOTE_ADDR'];
$connexion = $cnx->exec("UPDATE users SET last_conex ='$der_co', ip ='$ip' WHERE email='".$_SESSION['Auth']['email']."' && password='".$_SESSION['Auth']['password']."'");
echo'<SCRIPT LANGUAGE="JavaScript">document.location.href="index.html"</SCRIPT>';
}else{
$error = '<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Erreur:</strong> Votre compte n\'est pas activé, veuillez vérifier vos mails (spams) pour activer votre compte !
</div>';
}
}else{
//Si utilisateur inconnu
$error = '<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Erreur:</strong> Utilisateur inexistant ou erreur d\'identification !
</div>';
}
}
?><!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title><?= $title_page_signin; ?></title>
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="stylesheet" type="text/css" href="lib/bootstrap/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="stylesheets/theme.css">
<link rel="stylesheet" href="lib/font-awesome/css/font-awesome.css">
<script src="lib/jquery-1.7.2.min.js" type="text/javascript"></script>
<!-- Demo page code -->
<style type="text/css">
#line-chart {
height:300px;
width:800px;
margin: 0px auto;
margin-top: 1em;
}
.brand { font-family: georgia, serif; }
.brand .first {
color: #ccc;
font-style: italic;
}
.brand .second {
color: #fff;
font-weight: bold;
}
</style>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="../assets/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
</head>
<!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]-->
<!--[if IE 7 ]> <body class="ie ie7 "> <![endif]-->
<!--[if IE 8 ]> <body class="ie ie8 "> <![endif]-->
<!--[if IE 9 ]> <body class="ie ie9 "> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<body class="">
<!--<![endif]-->
<?php include 'navbar.php'; ?>
<?php if(isset($error)){ echo $error; } ?><?php if(isset($succes )){ echo $succes ; } ?>
<div class="row-fluid">
<div class="dialog">
<div class="block">
<p class="block-heading"><i class="icon-lock"></i> Se Connecter</p>
<div class="block-body">
<form action="<?php $_SERVER['PHP_SELF'] ?>" name="submit_log" id="submit_log" method="post">
<label><i class="icon-envelope-alt"></i> Email</label>
<input type="text" name="email" id="email" placeholder="Email" required class="span12" />
<label><i class="icon-key"></i> Password</label>
<input type="password" name="password" id="password" placeholder="Mot de passe" required class="span12" />
<input type="submit" name="submit_log" value="Se connecter" class="btn btn-success pull-right" /><a class="btn pull-left" href="sign-up.html">Inscription</a><a class="btn btn-danger pull-left" style="width:80px;" href="mdp.html">Oubli ?</a>
<div class="clearfix"></div>
</form>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$("#refresh_cap").click(function() {
$("#captcha").attr("src", "captcha.php?"+(new Date()).getTime());
});
});
</script>
<script src="lib/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript">
$("[rel=tooltip]").tooltip();
$(function() {
$('.demo-cancel-click').click(function(){return false;});
});
</script>
</body>
</html> |
Partager