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
|
<?php require_once('Connections/connexion.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['LOGIN'])) {
$loginUsername=$_POST['LOGIN'];
$password=$_POST['PASSWD'];
$MM_fldUserAuthorization = "NIVEAU";
<?php
if (
?>
$MM_redirectLoginSuccess = "application/authentificationexemple.php";
$MM_redirectLoginFailed = "erreurAuthentification.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_connexion, $connexion);
$LoginRS__query=sprintf("SELECT LOGIN, PASSWD, NIVEAU FROM `USER` WHERE LOGIN=%s AND PASSWD=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $connexion) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'NIVEAU');
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title> - Accueil</title>
<base />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<link rel="stylesheet" type="text/css" media="all" href="style.css" />
<script type="text/javascript" src="ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript" src="scripts/lib.util.js"></script>
<script type="text/javascript" src="scripts/menu.js"></script>
<script type="text/javascript" src="scripts/form_checker.js"></script>
<script type="text/javascript" src="scripts/AC_RunActiveContent.js"></script>
</head>
<body>
<a name="top"></a>
<h1>EXEMPLE</h1>
<div id="home_col">
<div class="case">
<form method="POST" action="<?php echo $loginFormAction; ?>" name="form_espaceMembre" id="form_espaceMembre">
<h4> ESPACE MEMBRE: <h4>
<p><label for="LOGIN">Login :</label><input type="text" name="LOGIN" id="LOGIN" class="saisie" /></p><br />
<p><label for="PASSWD">Password:</label><input type="password" name="PASSWD" id="PASSWD" class="saisie" /></p>
<input type="image" src="img/btn_ok.gif" name="login_valid" class="valid" /><br clear="all" />
<input type="hidden" name="MM_insert" value="form_espaceMembre" />
</form>
</div>
</div>
</div>
</body>
</html> |
Partager