Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start(); // d�but de session
- //require("config.php");
- $base="Test";
- $username="";
- $password="";
- $lien=odbc_pconnect($base,$username,$password);
- if($lien<=0){
- exit("Impossible de se connecter au serveur");
- }
- //else {
- //echo "Conexion ok";
- error_reporting();
- if (isset($_POST['login'])){ // execution apres envoi du formulaire
- $login = $_POST['login']; // mise en variable du nom d'utilisateur
- $pass = md5($_POST['pass']); // mise en variable du mot de passe crypt�
- echo $pass;
- // requete sur la table administrateurs (on r�cup�re les infos de la personne)
- //mysql_select_db("prix", $dconnexion);
- $verif_query="SELECT id_user,login,pass,nom,prenom FROM utilisateurs WHERE login='$login' and pass='$pass'"; // requ�te sur la base administrateurs
- $verif = odbc_exec($lien,$verif_query) or die(odbc_error());echo $verif_query;echo $verif;
- $row_verif = odbc_fetch_array($verif);echo"dd".$row_verif."<br>.............";
- echo $row_verif["id_user"];echo $row_verif["nom"];echo $row_verif["pass"];
- $utilisateur = odbc_num_rows($verif);echo $utilisateur;
- if ($utilisateur) { // On test s'il y a un utilisateur correspondant
- //session_register("authentification"); // enregistrement de la session
- // d�claration des variables de session
- // le privil�ge de l'utilisateur (permet de d�finir des niveaux d'utilisateur)
- $_SESSION['nom'] = $row_verif["nom"]; // Son nom
- $_SESSION['prenom'] = $row_verif["prenom"]; // Son Pr�nom
- $_SESSION['login'] = $row_verif["login"]; // Son Login
- $_SESSION['pass'] = $row_verif["pass"]; // Son mot de passe (� �viter) ?>
- <script language='javascript'>
- window.href.location="accueil.php";
- </script><?php
- //header("Location:accueil.php"); // redirection si OK
- }
- else { ?>
- <script language="javascript">
- window.href.location="index.php";
- </script><?
- //header("Location:Index.php?erreur=login"); // redirection si utilisateur non reconnu
- }
- }
- // GESTION DE LA D�connexion
- if(isset($_GET['erreur']) && $_GET['erreur'] == 'logout'){ // Test sur les param�tres d'URL qui permettront d'identifier un "contexte" de d�connexion
- $prenom = $_SESSION['prenom']; // On garde le pr�nom en variable pour dire au revoir (soyons polis :-)
- session_unset("authentification");
- //header("Location:index.php?erreur=delog");
- }
- ?>
- <html>
- <head><title></title>
- <link href="css.css" rel="stylesheet" type="text/css" />
- <style type="text/css">
- <!--
- body {
- margin:0px;
- margin-bottom:0px;
- margin-left:0px;
- margin-right:0px;
- margin-top:0px;
- background-image:url(Image/fond.png);
- background-repeat:repeat-x
- }
- .Style1 {
- font-size: 24px;
- font-weight: bold;
- color: #663300;
- background-color:#FFFFFF;
- background-image:;
- }
- body {
- background-color: #FFFFFF;
- }
- .Style2 {font-size: 36px}
- -->
- </style>
- </head>
- <body>
- <div align="center" >
- <table width="100%" border="0">
- <tr>
- <td align="left"valign="middle"> </td>
- <td align="center" valign="middle"><span class="Style2">ADMINISTRATION XLOADER</span></td>
- <td align="right" valign="middle"> </td>
- </tr>
- </table>
- </div>
- <br /> <br /><br />
- <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
- <tr>
- <td align="center"> </td>
- </tr>
- </table>
- <br /><br /><br />
- <table width="300" border="1" align="center" id="table_ac">
- <tr>
- <td align="center" valign="middle">
- <form action="Index.php" method="post" name="connect">
- <p align="center" class="Style7"><strong>
- <?php if(isset($_GET['erreur']) && ($_GET['erreur'] == "login")) { // Affiche l'erreur ?>
- <span class="">Login ou mot de passe incorrect</span> <?php } ?>
- <?php if(isset($_GET['erreur']) && ($_GET['erreur'] == "delog")) { // Affiche l'erreur ?><?php } ?>
- <?php if(isset($_GET['erreur']) && ($_GET['erreur'] == "intru")) { // Affiche l'erreur ?>
- <span class="Style5">Echec d'authentification</span><span class="Style5"> </span>
- <?php } ?></strong></p>
- <table border="0">
- <tr>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td align="right" class="noir12"><span class="noir12">Login</span> </td>
- <td><input name="login" type="text" class="input" id="compte" /></td>
- </tr>
- <tr>
- <td align="right" class="noir12">Mot de Passe </td>
- <td><input name="pass" type="password" class="input" id="code" /></td>
- </tr>
- <tr>
- <td> </td>
- <td align="center"><br /><input type="submit" name="Submit" value="OK" /></td>
- </tr>
- </table>
- </form>
- </td>
- </tr>
- </table><br />
- <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
- <tr>
- <td align="center"> </td>
- </tr>
- </table>
- <br><br>
- <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
- <tr>
- <td align="center"> </td>
- </tr>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement