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
| <?php
include_once 'inc/config.php';
include_once 'inc/fonctions.php';
require_once("inc/rate.php");
if (!isset($_SESSION)) {
session_start();
}
/* require 'cache.inc.php';
cache('date.php'); */
$time_start = microtime_float();
if ( isset($_COOKIE['login']) && !empty($_COOKIE['login']) ){
session_start();
$_SESSION['login'] = $_COOKIE['login'];
$_SESSION['id'] = $_COOKIE['id'];
}
if (isset($_POST['connexion']) && $_POST['connexion'] == 'Connexion') {
if ((isset($_POST['login']) && !empty($_POST['login'])) && (isset($_POST['pass']) && !empty($_POST['pass']))) {
$sql = 'SELECT idx FROM trombino WHERE login="'.addslashes($_POST['login']).'" AND pass_md5="'.md5(addslashes($_POST['pass'])).'"';
$req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
$nb = mysql_num_rows($req);
if ($nb == 1) {
$data = mysql_fetch_array($req);
session_start();
$_SESSION['login'] = $_POST['login'];
$_SESSION['id'] = $data['idx'];
setcookie("login","$login",time()+365*24*30*3600);
setcookie("id","$data[idx]",time()+365*24*30*3600);
mysql_free_result($req);
header('Location: comptes.php');
exit();
}
elseif ($nb == 0) {
$erreur = 'Compte non reconnu.';
}
else {
$erreur = 'Probème dans la base de données : plusieurs membres ont les mêmes identifiants de connexion.';
}
mysql_free_result($req);
}
else {
$erreur = 'Au moins un des champs est vide.';
}
}
/*
$editFormAction = $_SERVER['PHP_SELF'];
if (isset ($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?".htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset ($_POST["Note_update"])) && ($_POST["Note_update"] == "note")) {
$q1 = mysql_query("SELECT `note`, `hits` FROM `trombino` WHERE idx = ".$_POST['idx']."");
$r1 = mysql_fetch_array($q1);
if ($r1['hits'] == 0) {
$updateSQL = sprintf("UPDATE trombino SET note=%d, hits=hits+1 WHERE idx=%d", $_POST['choix'], $_POST['idx']);
} else {
$note = ($r1['note'] + $_POST['choix']) / (2);
$updateSQL = sprintf("UPDATE trombino SET note=%d, hits=hits+1 WHERE idx=%d", $note, $_POST['idx']);
}
$q3 = mysql_query($updateSQL) or die(mysql_error());
$idx = $_POST['idx'];
setcookie("$idx","$idx",time()+365*24*30*3600);
header('Location: index.php');
}
*/
?> |
Partager