Advertisement
Guest User

Untitled

a guest
May 5th, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.86 KB | None | 0 0
  1. <?php
  2. session_start(); // d�but de session
  3. //require("config.php");
  4. $base="Test";
  5. $username="";
  6. $password="";
  7. $lien=odbc_pconnect($base,$username,$password);
  8. if($lien<=0){
  9. exit("Impossible de se connecter au serveur");
  10. }
  11. //else {
  12. //echo "Conexion ok";
  13.  
  14. error_reporting();
  15. if (isset($_POST['login'])){ // execution apres envoi du formulaire
  16. $login = $_POST['login']; // mise en variable du nom d'utilisateur
  17. $pass = md5($_POST['pass']); // mise en variable du mot de passe crypt�
  18. echo $pass;
  19. // requete sur la table administrateurs (on r�cup�re les infos de la personne)
  20. //mysql_select_db("prix", $dconnexion);
  21. $verif_query="SELECT id_user,login,pass,nom,prenom FROM utilisateurs WHERE login='$login' and pass='$pass'"; // requ�te sur la base administrateurs
  22. $verif = odbc_exec($lien,$verif_query) or die(odbc_error());echo $verif_query;echo $verif;
  23. $row_verif = odbc_fetch_array($verif);echo"dd".$row_verif."<br>.............";
  24. echo $row_verif["id_user"];echo $row_verif["nom"];echo $row_verif["pass"];
  25. $utilisateur = odbc_num_rows($verif);echo $utilisateur;
  26.  
  27.  
  28. if ($utilisateur) { // On test s'il y a un utilisateur correspondant
  29. //session_register("authentification"); // enregistrement de la session
  30.  
  31. // d�claration des variables de session
  32. // le privil�ge de l'utilisateur (permet de d�finir des niveaux d'utilisateur)
  33. $_SESSION['nom'] = $row_verif["nom"]; // Son nom
  34. $_SESSION['prenom'] = $row_verif["prenom"]; // Son Pr�nom
  35. $_SESSION['login'] = $row_verif["login"]; // Son Login
  36. $_SESSION['pass'] = $row_verif["pass"]; // Son mot de passe (� �viter) ?>
  37. <script language='javascript'>
  38. window.href.location="accueil.php";
  39. </script><?php
  40. //header("Location:accueil.php"); // redirection si OK
  41. }
  42. else { ?>
  43. <script language="javascript">
  44. window.href.location="index.php";
  45. </script><?
  46. //header("Location:Index.php?erreur=login"); // redirection si utilisateur non reconnu
  47. }
  48. }
  49.  
  50.  
  51. // GESTION DE LA D�connexion
  52. if(isset($_GET['erreur']) && $_GET['erreur'] == 'logout'){ // Test sur les param�tres d'URL qui permettront d'identifier un "contexte" de d�connexion
  53. $prenom = $_SESSION['prenom']; // On garde le pr�nom en variable pour dire au revoir (soyons polis :-)
  54. session_unset("authentification");
  55. //header("Location:index.php?erreur=delog");
  56. }
  57. ?>
  58. <html>
  59. <head><title></title>
  60. <link href="css.css" rel="stylesheet" type="text/css" />
  61. <style type="text/css">
  62. <!--
  63. body {
  64. margin:0px;
  65. margin-bottom:0px;
  66. margin-left:0px;
  67. margin-right:0px;
  68. margin-top:0px;
  69. background-image:url(Image/fond.png);
  70. background-repeat:repeat-x
  71. }
  72. .Style1 {
  73. font-size: 24px;
  74. font-weight: bold;
  75. color: #663300;
  76. background-color:#FFFFFF;
  77. background-image:;
  78. }
  79. body {
  80. background-color: #FFFFFF;
  81. }
  82. .Style2 {font-size: 36px}
  83. -->
  84. </style>
  85. </head>
  86. <body>
  87. <div align="center" >
  88. <table width="100%" border="0">
  89. <tr>
  90. <td align="left"valign="middle">&nbsp;</td>
  91. <td align="center" valign="middle"><span class="Style2">ADMINISTRATION XLOADER</span></td>
  92. <td align="right" valign="middle">&nbsp;</td>
  93. </tr>
  94. </table>
  95. </div>
  96. <br /> <br /><br />
  97. <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  98. <tr>
  99. <td align="center">&nbsp;</td>
  100. </tr>
  101. </table>
  102. <br /><br /><br />
  103. <table width="300" border="1" align="center" id="table_ac">
  104. <tr>
  105. <td align="center" valign="middle">
  106. <form action="Index.php" method="post" name="connect">
  107. <p align="center" class="Style7"><strong>
  108. <?php if(isset($_GET['erreur']) && ($_GET['erreur'] == "login")) { // Affiche l'erreur ?>
  109. <span class="">Login ou mot de passe incorrect</span> <?php } ?>
  110. <?php if(isset($_GET['erreur']) && ($_GET['erreur'] == "delog")) { // Affiche l'erreur ?><?php } ?>
  111. <?php if(isset($_GET['erreur']) && ($_GET['erreur'] == "intru")) { // Affiche l'erreur ?>
  112. <span class="Style5">Echec d'authentification</span><span class="Style5"> </span>
  113. <?php } ?></strong></p>
  114. <table border="0">
  115. <tr>
  116. <td>&nbsp;</td>
  117. <td>&nbsp;</td>
  118. </tr>
  119. <tr>
  120. <td align="right" class="noir12"><span class="noir12">Login</span>&nbsp;&nbsp;&nbsp;</td>
  121. <td><input name="login" type="text" class="input" id="compte" /></td>
  122. </tr>
  123. <tr>
  124. <td align="right" class="noir12">Mot de Passe&nbsp;&nbsp;&nbsp; </td>
  125. <td><input name="pass" type="password" class="input" id="code" /></td>
  126. </tr>
  127. <tr>
  128. <td>&nbsp;</td>
  129. <td align="center"><br /><input type="submit" name="Submit" value="OK" /></td>
  130. </tr>
  131. </table>
  132. </form>
  133. </td>
  134. </tr>
  135. </table><br />
  136. <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  137. <tr>
  138. <td align="center">&nbsp;</td>
  139. </tr>
  140. </table>
  141. <br><br>
  142. <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  143. <tr>
  144. <td align="center">&nbsp;</td>
  145. </tr>
  146. </table>
  147. </body>
  148. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement