Advertisement
Guest User

Untitled

a guest
Apr 13th, 2016
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.80 KB | None | 0 0
  1. <?php
  2. session_start();
  3. require_once 'includes/db.php';
  4. require_once 'includes/init.php';
  5. if (!($user -> LoggedIn()))
  6. {
  7. header('location: connexion.php');
  8. die();
  9. }
  10.  
  11. if (!($user -> notBanned($odb)))
  12. {
  13. header('location: connexion.php');
  14. die();
  15. }
  16.  
  17. $SQLGetInfo = $odb -> prepare("SELECT * FROM `users` WHERE `username` = :username ORDER BY `id` DESC");
  18. $SQLGetInfo -> execute(array(':username' => $_SESSION['username']));
  19. while ($userInfo = $SQLGetInfo -> fetch(PDO::FETCH_ASSOC))
  20. {
  21. $id = $userInfo['ID'];
  22. $username = $userInfo['username'];
  23. $email = $userInfo['email'];
  24. $rank = ($userInfo['rank'] == 1) ? 'Administrateur' : 'Membre';
  25. $date = date("d/m/Y" ,$userInfo['date']);
  26. $ip = $userInfo['ip'];
  27. $avatar = $userInfo['avatar'];
  28. }
  29. ?>
  30. <!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
  31. <!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
  32. <!--[if !IE]><!-->
  33. <html lang="fr">
  34. <!--<![endif]-->
  35. <!-- BEGIN HEAD -->
  36. <head>
  37. <meta charset="utf-8"/>
  38. <title>JohnBelvis | Mon profil</title>
  39. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  40. <meta content="width=device-width, initial-scale=1" name="viewport"/>
  41. <meta content="" name="description"/>
  42. <meta content="" name="author"/>
  43. <!-- BEGIN GLOBAL MANDATORY STYLES -->
  44. <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css"/>
  45. <link href="assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
  46. <link href="assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css"/>
  47. <link href="assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
  48. <link href="assets/global/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
  49. <link href="assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css"/>
  50. <!-- END GLOBAL MANDATORY STYLES -->
  51. <!-- BEGIN PAGE LEVEL PLUGIN STYLES -->
  52. <link href="assets/global/plugins/jquery-file-upload/blueimp-gallery/blueimp-gallery.min.css" rel="stylesheet"/>
  53. <link href="assets/global/plugins/jquery-file-upload/css/jquery.fileupload.css" rel="stylesheet"/>
  54. <link href="assets/global/plugins/jquery-file-upload/css/jquery.fileupload-ui.css" rel="stylesheet"/>
  55. <link href="assets/global/plugins/bootstrap-daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css"/>
  56. <link href="assets/global/plugins/fullcalendar/fullcalendar.min.css" rel="stylesheet" type="text/css"/>
  57. <link href="assets/global/plugins/jqvmap/jqvmap/jqvmap.css" rel="stylesheet" type="text/css"/>
  58. <link href="assets/global/plugins/morris/morris.css" rel="stylesheet" type="text/css">
  59. <!-- END PAGE LEVEL PLUGIN STYLES -->
  60. <!-- BEGIN PAGE STYLES -->
  61. <link href="assets/admin/pages/css/tasks.css" rel="stylesheet" type="text/css"/>
  62. <link href="assets/admin/pages/css/timeline-old.css" rel="stylesheet" type="text/css"/>
  63. <!-- END PAGE STYLES -->
  64. <!-- BEGIN THEME STYLES -->
  65. <link href="assets/global/css/components-rounded.css" id="style_components" rel="stylesheet" type="text/css"/>
  66. <link href="assets/global/css/plugins.css" rel="stylesheet" type="text/css"/>
  67. <link href="assets/admin/layout4/css/layout.css" rel="stylesheet" type="text/css"/>
  68. <link id="style_color" href="assets/admin/layout4/css/themes/light.css" rel="stylesheet" type="text/css"/>
  69. <link href="assets/admin/layout4/css/custom.css" rel="stylesheet" type="text/css"/>
  70. <!-- END THEME STYLES -->
  71. <!-- DOC: To use 'rounded corners' style just load 'components-rounded.css' stylesheet instead of 'components.css' in the below style tag -->
  72. <link href="assets/global/css/components-rounded.css" id="style_components" rel="stylesheet" type="text/css"/>
  73. <link href="assets/global/css/plugins.css" rel="stylesheet" type="text/css"/>
  74. <link href="assets/admin/layout4/css/layout.css" rel="stylesheet" type="text/css"/>
  75. <link href="assets/admin/layout4/css/themes/light.css" rel="stylesheet" type="text/css" id="style_color"/>
  76. <link href="assets/admin/layout4/css/custom.css" rel="stylesheet" type="text/css"/>
  77. <!-- END THEME STYLES -->
  78. <link rel="shortcut icon" href="favicon.ico"/>
  79. </head>
  80. <!-- END HEAD -->
  81. <!-- BEGIN BODY -->
  82. <!-- DOC: Apply "page-header-fixed-mobile" and "page-footer-fixed-mobile" class to body element to force fixed header or footer in mobile devices -->
  83. <!-- DOC: Apply "page-sidebar-closed" class to the body and "page-sidebar-menu-closed" class to the sidebar menu element to hide the sidebar by default -->
  84. <!-- DOC: Apply "page-sidebar-hide" class to the body to make the sidebar completely hidden on toggle -->
  85. <!-- DOC: Apply "page-sidebar-closed-hide-logo" class to the body element to make the logo hidden on sidebar toggle -->
  86. <!-- DOC: Apply "page-sidebar-hide" class to body element to completely hide the sidebar on sidebar toggle -->
  87. <!-- DOC: Apply "page-sidebar-fixed" class to have fixed sidebar -->
  88. <!-- DOC: Apply "page-footer-fixed" class to the body element to have fixed footer -->
  89. <!-- DOC: Apply "page-sidebar-reversed" class to put the sidebar on the right side -->
  90. <!-- DOC: Apply "page-full-width" class to the body element to have full width page without the sidebar menu -->
  91. <body class="page-header-fixed page-sidebar-closed-hide-logo page-sidebar-closed-hide-logo">
  92. <!-- BEGIN HEADER -->
  93. <div class="page-header navbar navbar-fixed-top">
  94. <!-- BEGIN HEADER INNER -->
  95. <div class="page-header-inner">
  96. <!-- BEGIN LOGO -->
  97. <div class="page-logo">
  98. <a href="index.php">
  99. <img src="assets/admin/image/logo.png" alt="logo" class="logo-default"/>
  100. </a>
  101. <div class="menu-toggler sidebar-toggler">
  102. <!-- DOC: Remove the above "hide" to enable the sidebar toggler button on header -->
  103. </div>
  104. </div>
  105. <!-- END LOGO -->
  106. <!-- BEGIN RESPONSIVE MENU TOGGLER -->
  107. <a href="javascript:;" class="menu-toggler responsive-toggler" data-toggle="collapse" data-target=".navbar-collapse">
  108. </a>
  109. <!-- END RESPONSIVE MENU TOGGLER -->
  110.  
  111. <!-- BEGIN PAGE TOP -->
  112. <div class="page-top">
  113. <!-- BEGIN HEADER SEARCH BOX -->
  114. <!-- DOC: Apply "search-form-expanded" right after the "search-form" class to have half expanded search box -->
  115. <form class="search-form" action="extra_search.html" method="GET">
  116. <div class="input-group">
  117. <input type="text" class="form-control input-sm" value="Recherche..." name="query">
  118. <span class="input-group-btn">
  119. <a href="javascript:;" class="btn submit"><i class="icon-magnifier"></i></a>
  120. </span>
  121. </div>
  122. </form>
  123. <!-- END HEADER SEARCH BOX -->
  124. <!-- BEGIN TOP NAVIGATION MENU -->
  125. <div class="top-menu">
  126. <ul class="nav navbar-nav pull-right">
  127. <li class="separator hide">
  128. </li>
  129. <!-- BEGIN NOTIFICATION DROPDOWN -->
  130. <!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
  131. <li class="dropdown dropdown-extended dropdown-notification dropdown-dark" id="header_notification_bar">
  132. <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
  133. <i class="icon-bell"></i>
  134. <span class="badge badge-success">
  135. 0 </span>
  136. </a>
  137.  
  138. </li>
  139. <!-- END NOTIFICATION DROPDOWN -->
  140. <li class="separator hide">
  141. </li>
  142. <!-- BEGIN INBOX DROPDOWN -->
  143. <!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
  144. <li class="dropdown dropdown-extended dropdown-inbox dropdown-dark" id="header_inbox_bar">
  145. <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
  146. <i class="icon-envelope-open"></i>
  147. <span class="badge badge-danger">
  148. 0 </span>
  149. </a>
  150. </li>
  151. <!-- END INBOX DROPDOWN -->
  152. <li class="separator hide">
  153. </li>
  154. <!-- BEGIN TODO DROPDOWN -->
  155. <!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
  156. <li class="dropdown dropdown-extended dropdown-tasks dropdown-dark" id="header_task_bar">
  157. <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
  158. <i class="icon-calendar"></i>
  159. <span class="badge badge-primary">
  160. 0 </span>
  161. </a>
  162. </li>
  163. <!-- END TODO DROPDOWN -->
  164. <!-- BEGIN USER LOGIN DROPDOWN -->
  165. <!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
  166. <li class="dropdown dropdown-user dropdown-dark">
  167. <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
  168. <span class="username username-hide-on-mobile">
  169. <?php echo ''.$_SESSION['username']; ?></span>
  170. <!-- DOC: Do not remove below empty space(&nbsp;) as its purposely used -->
  171. <img alt="" class="img-circle" src="avatar/<?php echo $odb->query("SELECT `avatar` FROM `users`")->fetchColumn(0); ?>"/>
  172. </a>
  173. <ul class="dropdown-menu dropdown-menu-default">
  174. <li>
  175. <a href="profil.php">
  176. <i class="icon-user"></i> Mon profil </a>
  177. </li>
  178. <li>
  179. <a href="parametre.php">
  180. <i class="icon-calendar"></i> Paramètre </a>
  181. </li>
  182. <li>
  183. <a href="mes-tickets.php">
  184. <i class="icon-envelope-open"></i> Support <span class="badge badge-danger">
  185. </span>
  186. </a>
  187. </li>
  188. <li class="divider">
  189. </li>
  190. <li>
  191. <a href="deconnexion.php">
  192. <i class="icon-key"></i> Déconnexion </a>
  193. </li>
  194. </ul>
  195. </li>
  196. <!-- END USER LOGIN DROPDOWN -->
  197. </ul>
  198. </div>
  199. <!-- END TOP NAVIGATION MENU -->
  200. </div>
  201. <!-- END PAGE TOP -->
  202. </div>
  203. <!-- END HEADER INNER -->
  204. </div>
  205. <!-- END HEADER -->
  206. <div class="clearfix">
  207. </div>
  208. <!-- BEGIN CONTAINER -->
  209. <div class="page-container">
  210. <!-- BEGIN SIDEBAR -->
  211. <div class="page-sidebar-wrapper">
  212. <!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
  213. <!-- DOC: Change data-auto-speed="200" to adjust the sub menu slide up/down speed -->
  214. <div class="page-sidebar navbar-collapse collapse">
  215. <!-- BEGIN SIDEBAR MENU -->
  216. <!-- DOC: Apply "page-sidebar-menu-light" class right after "page-sidebar-menu" to enable light sidebar menu style(without borders) -->
  217. <!-- DOC: Apply "page-sidebar-menu-hover-submenu" class right after "page-sidebar-menu" to enable hoverable(hover vs accordion) sub menu mode -->
  218. <!-- DOC: Apply "page-sidebar-menu-closed" class right after "page-sidebar-menu" to collapse("page-sidebar-closed" class must be applied to the body element) the sidebar sub menu mode -->
  219. <!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
  220. <!-- DOC: Set data-keep-expand="true" to keep the submenues expanded -->
  221. <!-- DOC: Set data-auto-speed="200" to adjust the sub menu slide up/down speed -->
  222. <ul class="page-sidebar-menu " data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200">
  223. <li>
  224. <a href="index.php">
  225. <i class="icon-home"></i>
  226. <span class="title">Tableau de bord</span>
  227. </a>
  228. </li>
  229. <li>
  230. <a href="javascript:;">
  231. <i class="icon-rocket"></i>
  232. <span class="title">Premium</span>
  233. <span class="arrow "></span>
  234. </a>
  235. <ul class="sub-menu">
  236. <li>
  237. <a href="premium-accueil.php">
  238. Accueil</a>
  239. </li>
  240. <li>
  241. <a href="premium-video.php">
  242. Vidéo</a>
  243. </li>
  244. <li>
  245. <a href="premium-donation.php">
  246. Donation</a>
  247. </li>
  248. <li>
  249. <a href="premium-support.php">
  250. Support</a>
  251. </li>
  252. </ul>
  253. </li>
  254. <li>
  255. <a href="video.php">
  256. <i class="icon-basket"></i>
  257. <span class="title">Vidéo</span>
  258. </a>
  259. </li>
  260. <li>
  261. <a href="donation.php">
  262. <i class="icon-diamond"></i>
  263. <span class="title">Donation</span>
  264. </a>
  265. </li>
  266. <li>
  267. <a href="telechargement.php">
  268. <i class="icon-puzzle"></i>
  269. <span class="title">Téléchargement</span>
  270. </a>
  271. </li>
  272. <li>
  273. <a href="live.php">
  274. <i class="icon-settings"></i>
  275. <span class="title">Live</span>
  276. </a>
  277. </li>
  278.  
  279. <li>
  280. <a href="evenement.php">
  281. <i class="icon-bar-chart"></i>
  282. <span class="title">Evenement</span>
  283. </a>
  284. <li>
  285. <a href="partenaire.php">
  286. <i class="icon-docs"></i>
  287. <span class="title">Partenaire</span>
  288. </a>
  289. </li>
  290. <li>
  291. <a href="support.php">
  292. <i class="icon-docs"></i>
  293. <span class="title">Support</span>
  294.  
  295. </a>
  296. </li>
  297. <li>
  298. <a href="admin/index.php">
  299. <i class="icon-docs"></i>
  300. <span class="title">Panel administrateur</span>
  301.  
  302. </a>
  303. </li>
  304. </ul>
  305. <!-- END SIDEBAR MENU -->
  306.  
  307. </div>
  308. </div>
  309. <!-- END SIDEBAR -->
  310. <!-- BEGIN CONTENT -->
  311. <div class="page-content-wrapper">
  312. <div class="page-content">
  313. <!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
  314. <!-- /.modal -->
  315. <!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
  316. <!-- BEGIN PAGE HEADER-->
  317.  
  318.  
  319. <div class="portlet box green">
  320. <div class="portlet-title">
  321. <div class="caption">
  322. <i class="fa fa-gift"></i>Mon profil
  323. </div>
  324. </div>
  325.  
  326. <div class="portlet-body form">
  327. <!-- BEGIN FORM-->
  328. <form action="" method="POST" class="form-horizontal" enctype="multipart/form-data">
  329. <div class="form-body">
  330.  
  331. <center><img class="img-circle" src="avatar/<?php echo $odb->query("SELECT `avatar` FROM `users` WHERE ".$userInfo['avatar']." ")->fetchColumn(0); ?>" width="150" /></center><br />
  332.  
  333. <center><span class="btn green fileinput-button">
  334. <i class="fa fa-plus"></i>
  335. <span>
  336. Ajouter un avatar</span>
  337. <input type="file" name="avatar">
  338. </span></center><br />
  339.  
  340. <?php
  341. if(isset($_FILES['avatar']) AND !empty($_FILES['avatar']['name']))
  342. {
  343. $tailleMax = 2097152;
  344. $extensionsValides = array('jpg','jpeg','gif','png');
  345. if($_FILES['avatar']['size'] <= $tailleMax)
  346. {
  347. $extensionUpload = strtolower( substr(strrchr($_FILES['avatar']['name'], '.'), 1));
  348. if(in_array($extensionUpload,$extensionsValides))
  349. {
  350. $chemin = "avatar/".$_SESSION['ID'].".".$extensionUpload;
  351. $resultat = move_uploaded_file($_FILES["avatar"]["tmp_name"], $chemin);
  352.  
  353. if($resultat)
  354. {
  355. $updateavatar = $bdd->prepare('UPDATE users SET avatar = :avatar WHERE ID = :id');
  356. $updateavatar->execute(array('avatar' => $_SESSION['ID'].".".$extensionUpload,'id'=> $_SESSION['ID']));
  357. }
  358. else
  359. {
  360. $msg ="Erreur durant l'importation de votre photo de profil ";
  361. }
  362. }
  363. else
  364. {
  365. $msg = "Votre photo de profil doit etre format jpg,jpeg,gif ou png";
  366. }
  367.  
  368. }
  369. }
  370. ?>
  371.  
  372. <div class="form-group">
  373. <label class="col-md-3 control-label">Nom d'utilisateur</label>
  374. <div class="col-md-4">
  375. <input type="text" readonly="readonly" class="form-control input-circle" value="<?php echo ''.$_SESSION['username']; ?>">
  376. </div>
  377. </div>
  378.  
  379. <div class="form-group">
  380. <label class="col-md-3 control-label">Adresse email</label>
  381. <div class="col-md-4">
  382. <div class="input-group">
  383. <span class="input-group-addon input-circle-left">
  384. <i class="fa fa-envelope"></i>
  385. </span>
  386. <input type="email" readonly="readonly" class="form-control input-circle-right" value="<?php echo htmlentities($email);?>">
  387. </div>
  388. </div>
  389. </div>
  390.  
  391. <div class="form-group">
  392. <label class="col-md-3 control-label">Date d'inscription</label>
  393. <div class="col-md-4">
  394. <div class="input-group">
  395. <span class="input-group-addon input-circle-left">
  396. <i class="fa fa-calendar"></i>
  397. </span>
  398. <input type="email" readonly="readonly" class="form-control input-circle-right" value="<?php echo htmlentities($date);?>">
  399. </div>
  400. </div>
  401. </div>
  402.  
  403. <div class="form-group">
  404. <label class="col-md-3 control-label">Don effectué</label>
  405. <div class="col-md-4">
  406. <input type="text" readonly="readonly" class="form-control input-circle" value="0 euros">
  407. </div>
  408. </div>
  409.  
  410. <div class="form-group">
  411. <label class="col-md-3 control-label">Type</label>
  412. <div class="col-md-4">
  413. <input type="text" readonly="readonly" name="type" class="form-control input-circle" value="<?php echo htmlentities($rank);?>">
  414. </div>
  415. </div>
  416.  
  417. <div class="form-group">
  418. <label class="col-md-3 control-label">Adresse IP</label>
  419. <div class="col-md-4">
  420. <input type="text" readonly="readonly" class="form-control input-circle" value="<?php echo htmlentities($ip);?>">
  421. </div>
  422. </div>
  423. <div class="form-group">
  424. <label class="col-md-3 control-label"></label>
  425. <div class="col-md-4">
  426. <input type="checkbox" class="form-control input-circle" value="1">Cocher pour ne plus reçevoir d'email
  427. </div>
  428. </div>
  429.  
  430. <div class="form-actions">
  431. <div class="row">
  432. <div class="col-md-offset-3 col-md-9">
  433. <button type="submit" name="avatar" class="btn btn-circle default">Confirmer le changement d'avatar</button>
  434. </div>
  435. </div>
  436. </div>
  437.  
  438. </form>
  439. <!-- END FORM-->
  440. </div>
  441. </div>
  442.  
  443.  
  444.  
  445. <!-- END THEME PANEL -->
  446. </div>
  447.  
  448.  
  449. <!-- END PAGE TOOLBAR -->
  450.  
  451.  
  452. <div class="portlet box green">
  453. <div class="portlet-title">
  454. <div class="caption">
  455. <i class="fa fa-gift"></i>Modifier mon adresse email
  456. </div>
  457. </div>
  458. <div class="portlet-body form">
  459. <!-- BEGIN FORM-->
  460. <form action="" method="POST" class="form-horizontal">
  461. <div class="form-body">
  462. <div class="form-group">
  463. <label class="col-md-3 control-label">Adresse email actuel</label>
  464. <div class="col-md-4">
  465. <input type="email" class="form-control input-circle" value="<?php echo htmlentities($email);?>">
  466. </div>
  467. </div>
  468. <div class="form-group">
  469. <label class="col-md-3 control-label">Nouvelle adresse email</label>
  470. <div class="col-md-4">
  471. <input type="email" name="email" class="form-control input-circle" value="">
  472. </div>
  473. </div>
  474. <div class="form-group">
  475. <label class="col-md-3 control-label">Mot de passe</label>
  476. <div class="col-md-4">
  477. <input type="password" name="cpassword" class="form-control input-circle" value="">
  478. </div>
  479. </div>
  480. <?php
  481. if (isset($_POST['updateEmailBtn']))
  482. {
  483. $cpassword = $_POST['cpassword'];
  484. $nemail = $_POST['nemail'];
  485. if (!empty($cpassword) && !empty($nemail))
  486. {
  487. if (filter_var($nemail, FILTER_VALIDATE_EMAIL))
  488. {
  489. $SQLCheckCurrent = $odb -> prepare("SELECT COUNT(*) FROM `users` WHERE `username` = :username AND `password` = :password");
  490. $SQLCheckCurrent -> execute(array(':username' => $_SESSION['username'], ':password' => SHA1($cpassword)));
  491. $countCurrent = $SQLCheckCurrent -> fetchColumn(0);
  492. if ($countCurrent == 1)
  493. {
  494. $SQLUpdate = $odb -> prepare("UPDATE `users` SET `email` = :email WHERE `username` = :username AND `ID` = :id");
  495. $SQLUpdate -> execute(array(':email' => $nemail,':username' => $_SESSION['username'], ':id' => $_SESSION['ID']));
  496. echo '<div class="alert alert-success"><p><strong>SUCCESS: </strong>Email Has Been Updated</p></div>';
  497. }
  498. else
  499. {
  500. echo '<div class="alert alert-danger"><p><strong>FAILURE: </strong>Current Password is Incorrect.</p></div>';
  501. }
  502. }
  503. else
  504. {
  505. echo '<div class="alert alert-danger"><p><strong>FAILURE: </strong>Email is not valid</p></div>';
  506. }
  507. }
  508. else
  509. {
  510. echo '<div class="alert alert-danger"><p><strong>FAILURE: </strong>Please fill in all fields</p></div>';
  511. }
  512. }
  513. ?>
  514. <div class="form-actions">
  515. <div class="row">
  516. <div class="col-md-offset-3 col-md-9">
  517. <button type="submit" name="updateEmailBtn" class="btn btn-circle default">Changer l'adresse email</button>
  518. </div>
  519. </div>
  520. </div>
  521. </form>
  522. <!-- END FORM-->
  523. </div>
  524. </div>
  525.  
  526.  
  527.  
  528. <!-- END THEME PANEL -->
  529. </div>
  530.  
  531.  
  532. <!-- END PAGE TOOLBAR -->
  533.  
  534.  
  535. <div class="portlet box green">
  536. <div class="portlet-title">
  537. <div class="caption">
  538. <i class="fa fa-gift"></i>Modifier mon mot de passe
  539. </div>
  540. </div>
  541. <div class="portlet-body form">
  542. <!-- BEGIN FORM-->
  543. <form action="" method="POST" class="form-horizontal">
  544. <div class="form-body">
  545. <div class="form-group">
  546. <label class="col-md-3 control-label">Mot de passe actuel</label>
  547. <div class="col-md-4">
  548. <input type="password" name="cpassword" class="form-control input-circle" value="">
  549. </div>
  550. </div>
  551. <div class="form-group">
  552. <label class="col-md-3 control-label">Nouveau mot de passe</label>
  553. <div class="col-md-4">
  554. <input type="password" name="npassword" class="form-control input-circle" value="">
  555. </div>
  556. </div>
  557. <div class="form-group">
  558. <label class="col-md-3 control-label">Retaper le nouveau mot de passe</label>
  559. <div class="col-md-4">
  560. <input type="password" name="rpassword" class="form-control input-circle" value="">
  561. </div>
  562. </div>
  563. <?php
  564. if (isset($_POST['updatePassBtn']))
  565. {
  566. $cpassword = $_POST['cpassword'];
  567. $npassword = $_POST['npassword'];
  568. $rpassword = $_POST['rpassword'];
  569. if (!empty($cpassword) && !empty($npassword) && !empty($rpassword))
  570. {
  571. if ($npassword == $rpassword)
  572. {
  573. $SQLCheckCurrent = $odb -> prepare("SELECT COUNT(*) FROM `users` WHERE `username` = :username AND `password` = :password");
  574. $SQLCheckCurrent -> execute(array(':username' => $_SESSION['username'], ':password' => SHA1($cpassword)));
  575. $countCurrent = $SQLCheckCurrent -> fetchColumn(0);
  576. if ($countCurrent == 1)
  577. {
  578. $SQLUpdate = $odb -> prepare("UPDATE `users` SET `password` = :password WHERE `username` = :username AND `ID` = :id");
  579. $SQLUpdate -> execute(array(':password' => SHA1($npassword),':username' => $_SESSION['username'], ':id' => $_SESSION['ID']));
  580. echo '<div class="alert alert-success"><p><strong>SUCCESS: </strong>Password Has Been Updated</p></div>';
  581. }
  582. else
  583. {
  584. echo '<div class="alert alert-danger"><p><strong>FAILURE: </strong>Current Password is incorrect.</p></div>';
  585. }
  586. }
  587. else
  588. {
  589. echo '<div class="alert alert-danger"><p><strong>FAILURE: </strong>New Passwords Did Not Match.</p></div>';
  590. }
  591. }
  592. else
  593. {
  594. echo '<div class="alert alert-danger"><p><strong>FAILURE: </strong>Please fill in all fields</p></div>';
  595. }
  596. }
  597. ?>
  598. <div class="form-actions">
  599. <div class="row">
  600. <div class="col-md-offset-3 col-md-9">
  601. <button type="submit" name="updatePassBtn" class="btn btn-circle default">Changer le mot de passe</button>
  602. </div>
  603. </div>
  604. </div>
  605. </form>
  606. <!-- END FORM-->
  607. </div>
  608. </div>
  609.  
  610.  
  611.  
  612. <!-- END THEME PANEL -->
  613. </div>
  614.  
  615. <!-- END PAGE TOOLBAR -->
  616. </div>
  617. <!-- END PAGE CONTENT-->
  618. </div>
  619. <!-- BEGIN CONTENT -->
  620. </div>
  621. <!-- END CONTENT -->
  622. </div>
  623. <!-- END CONTAINER -->
  624. <!-- BEGIN FOOTER -->
  625. <div class="page-footer">
  626. <div class="page-footer-inner">
  627. 2016 &copy; JohnBelvis
  628. </div>
  629. <div class="scroll-to-top">
  630. <i class="icon-arrow-up"></i>
  631. </div>
  632. </div>
  633. <!-- END FOOTER -->
  634. <!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
  635. <!-- BEGIN CORE PLUGINS -->
  636. <!--[if lt IE 9]>
  637. <script src="assets/global/plugins/respond.min.js"></script>
  638. <script src="assets/global/plugins/excanvas.min.js"></script>
  639. <![endif]-->
  640. <script src="assets/global/plugins/jquery.min.js" type="text/javascript"></script>
  641. <script src="assets/global/plugins/jquery-migrate.min.js" type="text/javascript"></script>
  642. <!-- IMPORTANT! Load jquery-ui.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
  643. <script src="assets/global/plugins/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
  644. <script src="assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
  645. <script src="assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
  646. <script src="assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
  647. <script src="assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
  648. <script src="assets/global/plugins/jquery.cokie.min.js" type="text/javascript"></script>
  649. <script src="assets/global/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
  650. <script src="assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
  651. <!-- END CORE PLUGINS -->
  652. <script src="assets/global/scripts/metronic.js" type="text/javascript"></script>
  653. <script src="assets/admin/layout4/scripts/layout.js" type="text/javascript"></script>
  654. <script src="assets/admin/layout4/scripts/demo.js" type="text/javascript"></script>
  655. <script>
  656. jQuery(document).ready(function() {
  657. Metronic.init(); // init metronic core components
  658. Layout.init(); // init current layout
  659. Demo.init(); // init demo features
  660. });
  661. </script>
  662. <!-- END JAVASCRIPTS -->
  663. </body>
  664. <!-- END BODY -->
  665. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement