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
| <?php require_once('../Connections/trith2006.php'); ?>
<?php
// *** Validate request to login to this site.
session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}
if (isset($_POST['login'])) {
$loginUsername=$_POST['login'];
$password=md5($_POST['pass']);
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "editeurpro.php";
$MM_redirectLoginFailed = "login2.php";
setcookie('editeur_membre[login]', $loginUsername, (time() + 3600)); // envoie un coockie
setcookie('editeur_membre[password]', $password, (time() + 3600)); // envoie un coockie
$MM_redirecttoReferrer = false;
mysql_select_db($database_trith2006, $trith2006);
$LoginRS__query=sprintf("SELECT login, password FROM editeur_membre WHERE login='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $trith2006) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;
//register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Document sans titre</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<p>login
<input name="login" type="text" id="login">
</p>
<p>pass
<input name="pass" type="text" id="pass">
</p>
<p>
<input type="submit" name="Submit" value="Envoyer">
</p>
</form>
</body>
</html> |
Partager