Advertisement
Guest User

Untitled

a guest
May 17th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.86 KB | None | 0 0
  1. login($_POST['email'], $_POST['password']); $email=$_POST['email']; $_SESSION["email"] = "$email"; } ?>
  2.  
  3. <?php
  4. session_start();
  5. if (isset($_POST['login']))
  6. {
  7. include_once 'user-dbop.php';
  8. $objUser = new User();
  9. $objUser->login($_POST['email'], $_POST['password']);
  10.  
  11. $email=$_POST['email'];
  12. $_SESSION["email"] = "$email";
  13.  
  14. }
  15. ?>
  16.  
  17. <html>
  18. <head>
  19. <meta charset="utf-8">
  20. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  21. <meta name="viewport" content="width=device-width, initial-scale=1">
  22. <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
  23. <meta name="description" content="">
  24. <meta name="author" content="">
  25. <link rel="icon" href="../../favicon.ico">
  26.  
  27. <title>connexion </title>
  28. <!-- Bootstrap core CSS -->
  29. <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  30. <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  31. <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  32. <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
  33.  
  34. <link rel="stylesheet" href="https://fortawesome.github.io/Font-Awesome/assets/font-awesome/css/font-awesome.css">
  35. <!--<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>-->
  36. <link href='https://fonts.googleapis.com/css?family=Indie+Flower' rel='stylesheet' type='text/css'>
  37. <style>
  38. .at_background{
  39. background: url(back2.jpg) no-repeat center center fixed;
  40. -webkit-background-size: cover;
  41. -moz-background-size: cover;
  42. -o-background-size: cover;
  43. background-size: cover;
  44. }
  45. .at_font{
  46. color: navy;
  47. /*font-family: 'Indie Flower', cursive;*/
  48. font-family: 'Lobster', cursive;
  49. }
  50. </style>
  51.  
  52.  
  53. <style type="text/css">
  54.  
  55. body {
  56.  
  57. /**scalable background to fill available viewport**/
  58. background: url(img/bleu.jpg) center center fixed;
  59.  
  60. -webkit-background-size: cover;
  61. -moz-background-size: cover;
  62. -o-background-size: cover;
  63. background-size: cover;
  64. }
  65.  
  66. </style>
  67.  
  68.  
  69.  
  70. <body>
  71.  
  72.  
  73. <div class="container">
  74.  
  75. <div style=" margin-top: 5px" class="well well-sm">
  76. <h1 style="color: white"><img src="img/mobilis-edd.png" class="img-rounded pull-xs-left" width="150" height="55"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <mark style="background-color:rgb(224,224,224) ">Gestion des demandes de récupirations</mark></h1>
  77. </div>
  78.  
  79. <nav class="navbar navbar-inverse" style="background-color: #505050 ;">
  80. <div class="container-fluid">
  81.  
  82. <div class="navbar-header">
  83. <a class="glyphicon glyphicon-home navbar-brand" href="index.php"></a>
  84. </div>
  85.  
  86.  
  87.  
  88. </div>
  89. </nav>
  90. <div class="row well well-lg ">
  91.  
  92. <div >
  93. <div class="jumbotron ">
  94. <h2 > Veuillez vous connecter !</h2>
  95.  
  96. <hr>
  97. <form action="" method="post">
  98. <div class="form-group">
  99. <label for="email">Email:</label>
  100. <input type="email" class="form-control" id="email" placeholder="Enter email" name="email" required>
  101. </div>
  102. <div class="form-group">
  103. <label for="pwd">Password:</label>
  104. <input type="password" class="form-control" id="pwd" placeholder="Enter password" name="password">
  105. </div>
  106.  
  107. <button type="submit" class="btn btn-primary" name="login">Connecter</button>
  108.  
  109. </form>
  110. </div>
  111. </div>
  112.  
  113. </div>
  114.  
  115.  
  116. <div style="background-color: rgb(81,80,82)" class="panel-footer panel-custom">
  117. <p style="color: #ffffff;" class="text-center">Equipe developement WEB DSI 2016@</b>
  118. </div>
  119.  
  120. </div>
  121.  
  122. </body>
  123.  
  124. </html>
  125.  
  126. <html>
  127. <head>
  128. <meta charset="utf-8">
  129. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  130. <meta name="viewport" content="width=device-width, initial-scale=1">
  131. <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
  132. <meta name="description" content="">
  133. <meta name="author" content="">
  134. <link rel="icon" href="../../favicon.ico">
  135.  
  136. <title>fonction</title>
  137. <!-- Bootstrap core CSS -->
  138. <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  139. <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  140. <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  141. <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
  142. <link rel="stylesheet" href="https://fortawesome.github.io/Font-Awesome/assets/font-awesome/css/font-awesome.css">
  143. <!--<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>-->
  144. <link href='https://fonts.googleapis.com/css?family=Indie+Flower' rel='stylesheet' type='text/css'>
  145. <?php
  146.  
  147. if (!isset($_SESSION))
  148. session_start();
  149. include_once 'config.php';
  150.  
  151. class User {
  152.  
  153. var $dbObj;
  154.  
  155. public function __construct() {
  156. $this->dbObj = new db();
  157. }
  158.  
  159. public function insert($password, $name, $address, $contact_no, $about, $email, $affectation) {
  160. $password = hash('sha256', $password);
  161. $sql = " INSERT INTO `user`"
  162. . " (`password`,`name`,`address`,`contact_no`,`about`,`email`,`affectation`,`user_id`)"
  163. . " VALUES('$password','$name','$address','$contact_no','$about','$email','$affectation','')";
  164. echo $sql;
  165. return $this->dbObj->ExecuteQuery($sql, 2);
  166. }
  167.  
  168. public function update( $password, $name, $address, $contact_no, $about, $old_password, $email, $user_id) {
  169. if (empty($password))
  170. $password = $old_password;
  171. else
  172. $password = hash('sha256', $password);
  173. $sql = " UPDATE"
  174. . " user "
  175. . " SET password = '$password',name = '$name',address = '$address',"
  176. . " contact_no = '$contact_no',about = '$about', email = '$email'"
  177. . " WHERE user_id = '$user_id'";
  178. return $this->dbObj->ExecuteQuery($sql, 3);
  179. }
  180.  
  181. public function select_by_id($user_id) {
  182. $sql = " SELECT"
  183. . " user_id,user_name,password,name,address,contact_no,about,email"
  184. . " FROM user WHERE user_id = '$user_id'";
  185. return $this->dbObj->ExecuteQuery($sql, 1);
  186. }
  187.  
  188. public function delete_account($user_id) {
  189. $sql = " DELETE FROM user WHERE user_id = '$user_id'";
  190. return $this->dbObj->ExecuteQuery($sql, 3);
  191. }
  192.  
  193. public function login($email, $password) {
  194. $password = hash('sha256', $password);
  195. $sql = " SELECT"
  196. . " name, email"
  197. . " FROM user WHERE"
  198. . " email = '$email' AND password = '$password'";
  199. $data = $this->dbObj->ExecuteQuery($sql, 1);
  200. if (mysqli_num_rows($data) > 0) {
  201. $fetch_data = mysqli_fetch_assoc($data);
  202. $_SESSION['user_id'] = $fetch_data['user_id'];
  203. $_SESSION['name'] = $fetch_data['name'];
  204. echo "<SCRIPT>alert("marquer sont message");</SCRIPT>";
  205. header("location:list.php");
  206. }
  207. else {
  208. echo "<script >
  209. window.location='login.php';
  210. alert('Invalid User Name or Password !!');
  211. </script>";
  212.  
  213. }
  214. }
  215.  
  216. }
  217.  
  218. ?>
  219. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement