Guest User

Untitled

a guest
Apr 18th, 2018
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.95 KB | None | 0 0
  1. NOTE TEST PROGRAMMATION DERY
  2. ____________________________________________________________________________
  3. CONNECTION A DATABASE
  4. __________________________
  5. -----------------------
  6. Config.php
  7. -----------------------
  8. /**
  9. * These are the database login details
  10. */
  11.  
  12. define("HOST", "localhost"); // The host you want to connect to.
  13. define("USER", "sec_user"); // The database username.
  14. define("PASSWORD", "vNNmQVbpY8ZxJv2L"); // The database password.
  15. define("DATABASE", "clubnautique"); // The database name.
  16. define("CAN_REGISTER", "any");
  17. define("DEFAULT_ROLE", "member");
  18. define("SECURE", FALSE); // FOR DEVELOPMENT ONLY!!!!
  19.  
  20. -------------------------
  21. Connection.php
  22. -------------------------
  23. include_once 'Config.php'; // As functions.php is not included
  24.  
  25. try
  26. {
  27. $PDO=new PDO('mysql:HOST='.HOST.';dbname='.DATABASE,USER,PASSWORD);
  28.  
  29. }
  30. catch(Exception $e)
  31. {
  32. die('Erreur : ' . $e->getMessage());
  33. }
  34.  
  35. ____________________________________________________________________________
  36. recuperer du data dans la BD
  37. ____________________________________________________________________________
  38.  
  39. ---------------------------------
  40. get sets from the DB
  41. getinitialdata.php
  42. ---------------------------------
  43. <?php
  44. if(isset($_GET["Icb"]))
  45. {
  46.  
  47. include'../Connection/Connection.php';
  48.  
  49.  
  50. }
  51. else
  52. include'/Connection/Connection.php';
  53.  
  54. $pagination="";
  55. $start=0;
  56. $htmlId="MainContainer";
  57. $sql="SELECT
  58. id
  59. FROM
  60. news";
  61.  
  62. $news=$PDO->query($sql);
  63. $numrow=$news->rowCount();
  64.  
  65. if(isset($_GET['page']))
  66. {
  67. $start=$_GET['page']*3;
  68. }
  69.  
  70. $currentpage=$start/3+1;
  71.  
  72. if($numrow>3)
  73. {
  74. $url='/PhpMethods/GetInitialData.php';
  75. $pages=ceil($numrow/3);
  76. $pagination="<ul class='pagination' >";
  77.  
  78. //ajouter le precedant;
  79. if($currentpage==1)
  80. {
  81. $pagination.="<li class='disabled'><a>&laquo;</a></li>";
  82. }
  83. else
  84. $pagination.="<li onclick='GetData(".($currentpage-2).",\"{$url}\",\"{$htmlId}\")'><a>&laquo;</a></li>";
  85. //ajouter les pages
  86. for($i=0;$i<$pages;$i++)
  87. {
  88. $page=$i+1;
  89.  
  90. if($page==$currentpage)
  91. {
  92. $pagination.="<li class='active'><a>".$page."</a></li>";
  93. }
  94. else
  95. $pagination.="<li onclick='GetData(".$i.",\"{$url}\",\"{$htmlId}\")'><a>".$page."</a></li>";
  96. }
  97.  
  98. //ajouter le suivant
  99. if($currentpage==$pages)
  100. {
  101. $pagination.="<li class='disabled'><a>&raquo;</a></li>";
  102. }
  103. else
  104. $pagination.="<li onclick='GetData(".$currentpage.",\"{$url}\",\"{$htmlId}\")'><a>&raquo;</a></li>";
  105.  
  106.  
  107. $pagination.="</ul>";
  108.  
  109. }
  110.  
  111. $sql ="SELECT id ,title,SUBSTRING(descript,1,300) as descript,date,picture
  112. FROM
  113. news
  114. ORDER BY id
  115. DESC LIMIT ".$start.",3";
  116.  
  117. $stmt = $PDO->query($sql);
  118. $output = "<div style='max-height:650px;'>";
  119.  
  120. while($row = $stmt->fetch()){
  121. extract($row);
  122.  
  123. $output .= "<div id='".$row["id"]."' page='".$currentpage."' class='news' style='height:200px;max-height:200px;'>";
  124. $output .= "<div style='color:white; width:100%; clear:both; margin-left:5%;'>";
  125. $output .= "<a><h2>" . utf8_encode($row["title"]) . "</h2></a></div>";
  126. $output .= "<div class='ImgNews'style=' background-image : url(/img/".$row["picture"].")'></div>";
  127. $output .= "<div style='width:75%; font-size:12px; padding-top:1%; padding-left:25%;'>";
  128. $output .= "<a style='text-decoration:none;color:#F2F2F2'>" . utf8_encode($row["descript"]) . " ...</a>";
  129. $output .= "<div style='margin-top:2%'><p style='color:#F2F2F2;text-decoration:none;' >Date de parution : ". utf8_encode($row["date"]) . "</p></div></div>";
  130. $output .= "</div>";
  131.  
  132.  
  133.  
  134. }
  135. $output .= "</div>";
  136.  
  137. echo $output;
  138.  
  139. echo "<div style='margin-left:40%;'>".$pagination."</div>";
  140.  
  141.  
  142.  
  143. ?>
  144.  
  145. ---------------------------------
  146. get a specfic data from DB
  147. getnewsdetail.php
  148. ---------------------------------
  149. <?php
  150. include'../Connection/Connection.php';
  151.  
  152.  
  153. $Id = $_GET["id"];
  154. $Json=$_GET["json"];
  155. $sql = "SELECT * FROM news where id =" . $Id;
  156.  
  157. if(isset($_GET["page"]))
  158. {
  159. $page=$_GET["page"];
  160. }
  161. else $page="";
  162.  
  163. $url='PhpMethods/GetInitialData.php';
  164. $htmlId='MainContainer';
  165. $result = $PDO->query($sql);
  166.  
  167. If($Json=="false")
  168. {
  169. while($row = $result->fetch()){
  170. extract($row);
  171. $news = "<div style='min-height:420px;'>";
  172. $news .= "<div style='margin-left:2%;'><h2 style='color:#F2F2F2' id='title'>" . utf8_encode($row["title"]) . "</h2></div>";
  173. if(utf8_encode($row["picture"]) != null)
  174. {
  175. $news .= "<img src='../img/". utf8_encode($row["picture"]) ."' style='float:right;
  176. min-height:100px; max-height:50%; min-width:40%; max-width:40%;' class='round' />";
  177. }
  178. $news .= "<div id='desc' style='width:100%; padding:2%;color:#F2F2F2;'>" . utf8_encode($row["descript"]) . "</div>" ;
  179. $news.="<div class='share-button' style='margin-top:2%;margin-left:2%;'></div>";
  180. $news .= "</div>";
  181. $news .="<div style='margin-left:45%'><button class='btn btn-default' style='background:#d4d4d4;' onclick='GetData(".($page-1).",\"{$url}\",\"{$htmlId}\")'><a>Retour</a></button></div>";
  182.  
  183.  
  184. echo $news ;
  185.  
  186. }
  187. }
  188. else
  189. {
  190. if($Id!=0)
  191. {
  192. $row = $result->fetch();
  193. $newsdetails= array(
  194. 'id' => ($row["id"]),
  195. 'title' => ($row["title"]),
  196. 'picture' => ($row["picture"]),
  197. 'descript' => ($row["descript"])
  198. );
  199.  
  200. }
  201. else
  202. {
  203. $sql = "SELECT * FROM news
  204. LIMIT 0 ,1";
  205. $result = $PDO->query($sql);
  206. $row = $result->fetch();
  207. $newsdetails= array(
  208. 'id' => ($row["id"]),
  209. 'title' => ($row["title"]),
  210. 'picture' => ($row["picture"]),
  211. 'descript' => ($row["descript"])
  212. );
  213. }
  214.  
  215. echo json_encode($newsdetails);
  216.  
  217. }
  218.  
  219.  
  220.  
  221. ?>
  222.  
  223. ---------------------------------------------------------------
  224. insert dans DB
  225. ---------------------------------------------------------------
  226. <?php
  227. include_once '../Connection/Connection.php';
  228. include_once 'LoginFunctions.php';
  229.  
  230. $error_msg = "";
  231. if (!isset($_SESSION['user_id'],
  232. $_SESSION['email'],
  233. $_SESSION['login_string']))
  234. {
  235. safe_session_start();
  236. }
  237.  
  238. if(login_check($PDO)==true)
  239. {
  240. if(isset($_FILES['file-0']))
  241. {
  242. $uploads_dir = '../img';
  243.  
  244. $tmp_name = $_FILES["file-0"]["tmp_name"];
  245.  
  246. $name = $_FILES["file-0"]["name"];
  247.  
  248. $userfile_type = $_FILES['file-0']['type'];
  249.  
  250. $allowed_image_types = array( 'image/pjpeg' => "jpg",
  251. 'image/jpeg' => "jpg",
  252. 'image/jpg' => "jpg",
  253. 'image/png' => "png",
  254. 'image/x-png' => "png",
  255. 'image/gif' => "gif"
  256. );
  257.  
  258.  
  259. $allowed_image_ext = array_unique($allowed_image_types);
  260. $image_ext = "";
  261.  
  262. foreach ( $allowed_image_ext as $mime_type => $ext )
  263. {
  264. $image_ext .= strtoupper( $ext ) . " ";
  265. }
  266.  
  267.  
  268. $filename = basename( $_FILES['file-0']['name'] );
  269. $partFileName = substr( $filename, 0, strrpos($filename, '.') );
  270. $file_ext = strtolower( substr( $filename, strrpos($filename, '.') + 1 ));
  271.  
  272.  
  273. foreach ( $allowed_image_types as $mime_type => $ext )
  274. {
  275. //loop through the specified image types and if they match the extension then break out
  276. //everything is ok so go and check file size
  277. if( $file_ext == $ext && $userfile_type == $mime_type )
  278. {
  279. $output = "";
  280. break;
  281. }
  282. else
  283. {
  284. $output = "<br><h2 style='color:red; margin:20px;'>La zone de texte et de titre doivent obligatoirement être remplient</h2>";
  285. }
  286. }
  287.  
  288. echo $output;
  289.  
  290. move_uploaded_file($tmp_name, "$uploads_dir/$name");
  291.  
  292.  
  293.  
  294. }
  295. else
  296. $filename="N/A";
  297.  
  298. if(isset($_GET['name'],$_GET['desc']) & !isset($_GET['issub']))
  299. {
  300. $name=$_GET['name'];
  301. $desc=$_GET['desc'];
  302. if($name!="")
  303. {
  304. //Converit les accent corectement dans la bd
  305. $name = htmlentities($name, ENT_COMPAT, 'UTF-8');
  306. $desc = htmlentities($desc, ENT_COMPAT, 'UTF-8');
  307. $sql = "INSERT INTO categories
  308. (name, picture, descript)
  309. VALUES (?,?,?)";
  310.  
  311. $stmt=$PDO->prepare($sql);
  312. if($stmt->execute(array($name,$filename,$desc)))
  313. {
  314. echo"success";
  315. }
  316. else
  317. echo "<div class='alert alert-danger alert-dismissible' role='alert'>Erreur lors de l'insertion dans la base de donn&eacute;e <button class='close' data-dismiss='alert'>
  318. <span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button> </div>";
  319.  
  320. }
  321.  
  322.  
  323. }
  324. else
  325. {
  326. $name=$_GET['name'];
  327. $desc=$_GET['desc'];
  328. $categoryId=$_GET['id'];
  329.  
  330. if($name!="")
  331. {
  332. //Converit les accent corectement dans la bd
  333. $name = htmlentities($name, ENT_COMPAT, 'UTF-8');
  334. $desc = htmlentities($desc, ENT_COMPAT, 'UTF-8');
  335. $sql = "INSERT INTO subcategories
  336. (name,descript,categoryId)
  337. VALUES (?,?,?)";
  338.  
  339. $stmt=$PDO->prepare($sql);
  340. if($stmt->execute(array($name,$desc,$categoryId)))
  341. {
  342. echo"success";
  343. }
  344. else
  345. echo "<div class='alert alert-danger alert-dismissible' role='alert'>Erreur lors de l'insertion dans la base de donn&eacute;e <button class='close' data-dismiss='alert'>
  346. <span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button> </div>";
  347.  
  348. }
  349.  
  350.  
  351. }
  352.  
  353.  
  354.  
  355.  
  356. }
  357.  
  358. ?>
  359.  
  360. ---------------------------------------------------------------
  361. update dans DB
  362. ---------------------------------------------------------------
  363.  
  364. <?php
  365. include_once'../Connection/Connection.php';
  366. include_once 'LoginFunctions.php';
  367. $error_msg="";
  368. if (!isset($_SESSION['user_id'],
  369. $_SESSION['email'],
  370. $_SESSION['login_string']))
  371. {
  372. safe_session_start();
  373. }
  374.  
  375. if(login_check($PDO)==true)
  376. {
  377. $id=$_GET["id"];
  378.  
  379. //cheker si on delete ou edit la news
  380. if(isset($_GET["del"]))
  381. {
  382. $sql="DELETE FROM news
  383. WHERE id=?";
  384. $stmt = $PDO->prepare($sql);
  385.  
  386. if($stmt->execute(array($id)))
  387. {
  388. echo "success";
  389.  
  390.  
  391. }else
  392. $error_msg="erreur lors de la supression";
  393.  
  394. }
  395. else
  396. {
  397. // $title = filter_input(INPUT_GET, 'title', FILTER_SANITIZE_STRING);
  398. // $desc = filter_input(INPUT_GET, 'desc', FILTER_SANITIZE_STRING);
  399.  
  400. $title=$_GET['title'];
  401. $desc=$_GET['desc'];
  402. $title = htmlentities($title, ENT_COMPAT, 'UTF-8');
  403. $desc = htmlentities($desc, ENT_COMPAT, 'UTF-8');
  404.  
  405. if(isset($_GET['title'],$_GET['desc'],$_FILES['file-0']))
  406. {
  407. $uploads_dir = '../img';
  408.  
  409. $tmp_name = $_FILES["file-0"]["tmp_name"];
  410.  
  411. $name = $_FILES["file-0"]["name"];
  412.  
  413. $userfile_type = $_FILES['file-0']['type'];
  414.  
  415. $allowed_image_types = array( 'image/pjpeg' => "jpg",
  416. 'image/jpeg' => "jpg",
  417. 'image/jpg' => "jpg",
  418. 'image/png' => "png",
  419. 'image/x-png' => "png",
  420. 'image/gif' => "gif"
  421. );
  422.  
  423.  
  424. $allowed_image_ext = array_unique($allowed_image_types);
  425. $image_ext = "";
  426.  
  427. foreach ( $allowed_image_ext as $mime_type => $ext )
  428. {
  429. $image_ext .= strtoupper( $ext ) . " ";
  430. }
  431.  
  432.  
  433. $filename = basename( $_FILES['file-0']['name'] );
  434. $partFileName = substr( $filename, 0, strrpos($filename, '.') );
  435. $file_ext = strtolower( substr( $filename, strrpos($filename, '.') + 1 ));
  436.  
  437.  
  438. foreach ( $allowed_image_types as $mime_type => $ext )
  439. {
  440. //loop through the specified image types and if they match the extension then break out
  441. //everything is ok so go and check file size
  442. if( $file_ext == $ext && $userfile_type == $mime_type )
  443. {
  444. $output = "";
  445. break;
  446. }
  447. else
  448. {
  449. $output = "<br><h2 style='color:red; margin:20px;'>La zone de texte et de titre doivent obligatoirement être remplient</h2>";
  450. }
  451. }
  452.  
  453. echo $output;
  454.  
  455. move_uploaded_file($tmp_name, "$uploads_dir/$name");
  456.  
  457.  
  458.  
  459.  
  460. $sql="UPDATE news
  461. SET title= ? ,
  462. descript= ? ,
  463. picture= ?
  464. WHERE id=?";
  465. $stmt=$PDO->prepare($sql);
  466. if($stmt->execute(array($title,$desc,$filename,$id)))
  467. {
  468. echo("<div class='alert alert-success alert-dismissible' role='alert'>Nouvelle modifi&eacute;e avec succ&egrave;s
  469. <button type='button' class='close' data-dismiss='alert'><span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button></div>");
  470. include'../Admin/EditNewsForm.php';
  471. }
  472. else
  473. echo "<div class='alert alert-danger alert-dismissible' role='alert'>Erreur lors de la modification dans la base de donn&eacute;e
  474. <span class='glyphicon glyphicon-arrow-right'></span> Erreur lors de l'ex&eacute;cution <button type='button' class='close'
  475. data-dismiss='alert'><span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button> </div>";
  476.  
  477. }
  478. else
  479. {
  480. if(isset($_GET['title'],$_GET['desc']))
  481. {
  482. //donc on modifie seulement titre et description
  483. $sql="UPDATE news
  484. SET title= ? ,
  485. descript= ?
  486. WHERE id=?";
  487. $stmt=$PDO->prepare($sql);
  488. if($stmt->execute(array($title,$desc,$id)))
  489. {
  490. echo("<div class='alert alert-success alert-dismissible' role='alert'>Nouvelle modifi&eacute;e avec succ&egrave;s<button class='close' data-dismiss='alert'>
  491. <span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button></div>");
  492. include'../Admin/EditNewsForm.php';
  493. }
  494. else
  495. echo "<div class='alert alert-danger alert-dismissible' role='alert'>Erreur lors de la modification dans la base de donn&eacute;e <span class='glyphicon glyphicon-arrow-right'>
  496. </span> Erreur lors de l'ex&eacute;cution <button type='button' class='close' data-dismiss='alert'><span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button></div>";
  497.  
  498.  
  499. }
  500. else
  501. echo "<div class='alert alert-danger alert-dismissible' role='alert'>Erreur lors de la modification dans la base de donn&eacute;e <span class='glyphicon glyphicon-arrow-right'></span>
  502. titre ou description manquante<button type='button' class='close' data-dismiss='alert'><span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button></div>";
  503. }
  504.  
  505.  
  506. echo $error_msg;
  507.  
  508. }
  509. }
  510.  
  511.  
  512. ?>
  513.  
  514.  
  515. ---------------------------------------------------------
  516. DELETE dans DB
  517. ---------------------------------------------------------
  518. bien valider et faire pareil que le update en haut
  519. DELETE FROM table_name
  520. WHERE some_column = some_val
  521.  
  522.  
  523. ------------------------------------------------------------
  524. verifycredentials.php
  525. --------------------------------------------------------------
  526. <?php
  527. session_start();
  528. if(empty($_POST["username"] ))
  529. {
  530. $usernameisrequired="username is required";
  531. header("Location: ../login.php?missinginfo=true");
  532. }
  533.  
  534.  
  535. if(empty($_POST["password"] ))
  536. {
  537. $usernameisrequired="username is required";
  538. header("Location: ../login.php?missinginfo=true");
  539. }
  540. else
  541. {
  542. if(isset($_POST["username"],$_POST["password"]))
  543. {
  544. include_once '../connection/connection.php';
  545. $username=test_input($_POST["username"]);
  546. $password=test_input($_POST["password"]);
  547. $sql="SELECT * FROM USERS WHERE USERNAME=? AND PASS=?";
  548. $match=$PDO->prepare($sql);
  549. $match->execute(array($username,$password));
  550. $numrow=$match->rowCount();
  551. if($numrow==1)
  552. {
  553.  
  554. $_SESSION["user"]=$username;
  555. $_SESSION["islogged"]=true;
  556. header("Location: ../administration.php");
  557.  
  558. }
  559. else
  560. {
  561. header("Location: ../login.php?invalidlogin=true");
  562. }
  563.  
  564.  
  565. }
  566. else
  567. {
  568. header("Location: ../login.php?missinginfo=true");
  569. die();
  570. }
  571. }
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579. function test_input($data) {
  580. $data = trim($data);
  581. $data = stripslashes($data);
  582. $data = htmlspecialchars($data);
  583. return $data;
  584. }
  585. ?>
  586.  
  587. ------------------------------------------------------------
  588. getnews.php
  589. --------------------------------------------------------------
  590. <?php
  591. include "/connection/connection.php";
  592. $sql="select * from news";
  593.  
  594. $news=$PDO->query($sql);
  595. $numrow=$news->rowCount();
  596. $output="<div class='newscontainer'>";
  597. while($row=$news->fetch())
  598. {
  599. extract($row);
  600. $output.="<div id='".$row["id"]."' class='news'>";
  601. $output.="<h1>".utf8_encode($row["titre"])."</h1></br>";
  602. $output.= utf8_encode($row["text"]);
  603. $output.="</div>";
  604. }
  605.  
  606. $output.="</div>";
  607. echo $output;
  608.  
  609. ?>
  610.  
  611. ------------------------------------------------------------
  612. getimg.php
  613. --------------------------------------------------------------
  614. <?php
  615. include_once '../connection/connection.php';
  616.  
  617. if(isset($_GET["id"]))
  618. {
  619. $id=$_GET["id"];
  620. $sql="SELECT img from news WHERE id=".$id;
  621. $result=$PDO->query($sql);
  622. while($row=$result->fetch())
  623. {
  624. extract($row);
  625. $img= $row["img"];
  626. }
  627. echo $img;
  628. }
  629. else
  630. {
  631. echo"no id is set";
  632. }
  633.  
  634. ?>
  635.  
  636. ----------------------------------------------------------
  637. PAGES
  638. ----------------------------------------------------------
  639. index.php (dery)
  640.  
  641.  
  642. <html>
  643. <head>
  644. <title>PMAX</title>
  645. <link href="style/site.css" rel="stylesheet" type="text/css" />
  646. <link href="/style/bootstrap-theme.css" rel="stylesheet" type="text/css" />
  647. <link href="/style/bootstrap.css" rel="stylesheet" type="text/css" />
  648. <script src="scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
  649. <script src="scripts/juizDropDownMenu-2.0.0.min.js" type="text/javascript"></script>
  650. <script src="/scripts/bootstrap.js" type="text/javascript"></script>
  651. <script src="scripts/scripts.js" type="text/javascript"></script>
  652.  
  653. </head>
  654.  
  655. <body>
  656. <div class="Page">
  657. <div class="LeftSide">
  658. &nbsp;
  659. </div>
  660. <div class="MainContainer" id="MainContainer">
  661. bienvenue chez dery telecom :)
  662. <?php
  663. try{
  664.  
  665.  
  666. include"methods/getnews.php";
  667. }
  668. catch(Exception $e)
  669. {
  670. die('Erreur : ' . $e->getMessage());
  671. }
  672.  
  673.  
  674. ?>
  675. <a href="login.php">se connecter</a>
  676. <div class="response-output">
  677. </div>
  678. </div>
  679.  
  680. <div class="RightSide">
  681. &nbsp;
  682. </div>
  683.  
  684. </div>
  685.  
  686.  
  687. </body>
  688. </html>
  689.  
  690. --------------------------------------------------------------------
  691. login.php
  692. ----------------------------------------------------------------------
  693.  
  694. <html>
  695. <head>
  696. <title>PMAX</title>
  697. <link href="style/site.css" rel="stylesheet" type="text/css" />
  698. <link href="/style/bootstrap-theme.css" rel="stylesheet" type="text/css" />
  699. <link href="/style/bootstrap.css" rel="stylesheet" type="text/css" />
  700. <script src="scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
  701. <script src="scripts/juizDropDownMenu-2.0.0.min.js" type="text/javascript"></script>
  702. <script src="/scripts/bootstrap.js" type="text/javascript"></script>
  703. <script src="scripts/scripts.js" type="text/javascript"></script>
  704.  
  705. </head>
  706.  
  707. <body>
  708. <div class="Page">
  709. <div class="LeftSide">
  710. &nbsp;
  711. </div>
  712. <div class="MainContainer" id="MainContainer">
  713. <h1>Connection a dery intranet</h1>
  714. <?php
  715.  
  716. if(isset($_SESSION["islogged"]))
  717. {
  718. if($_SESSION["islogged"])
  719. {
  720. header("Location:administration.php");
  721. }
  722.  
  723. }
  724.  
  725.  
  726. if(isset($_POST["username"] , $_POST["password"] ))
  727. {
  728. $username=htmlentities($_POST["username"],ENT_QUOTES,'UTF-8');
  729. $password=htmlentities($_POST["password"],ENT_QUOTES,'UTF-8');
  730.  
  731. echo "username = ".$username;
  732. echo 'password = '.$password;
  733. }
  734. ?>
  735. <form action="methods/VerifyUserCredential.php" method="post" onsubmit="return validateMyForm();">
  736. <p>username: <input type="text" name="username" id="username" /></p>
  737. <span class="error"></span>
  738. <p>password: <input type="password" name="password" id="password" /></p>
  739. <span class="error"></span>
  740. <input type="submit" id="login-button"/>
  741. </form>
  742. <div class="response-output">
  743. <?php
  744. if(isset($_GET["missinginfo"]))
  745. {
  746. $output="<div> all infos are required</div>";
  747. echo $output;
  748. }
  749. else
  750. {
  751. if(isset($_GET["invalidlogin"]))
  752. {
  753. $output="<div> invalid login plz try again</div>";
  754. echo $output;
  755. }
  756. }
  757.  
  758. ?>
  759. </div>
  760. </div>
  761.  
  762. <div class="RightSide">
  763. &nbsp;
  764. </div>
  765.  
  766. </div>
  767.  
  768.  
  769. </body>
  770. </html>
  771. --------------------------------------------------------------------------------
  772. administration.php
  773. -------------------------------------------------------------------------------
  774.  
  775. <html>
  776. <head>
  777. <title>PMAX</title>
  778. <link href="style/site.css" rel="stylesheet" type="text/css" />
  779. <link href="/style/bootstrap-theme.css" rel="stylesheet" type="text/css" />
  780. <link href="/style/bootstrap.css" rel="stylesheet" type="text/css" />
  781. <script src="scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
  782. <script src="scripts/juizDropDownMenu-2.0.0.min.js" type="text/javascript"></script>
  783. <script src="/scripts/bootstrap.js" type="text/javascript"></script>
  784. <script src="scripts/scripts.js" type="text/javascript"></script>
  785.  
  786. </head>
  787.  
  788. <body>
  789. <div class="Page">
  790. <div class="LeftSide">
  791. &nbsp;
  792. </div>
  793. <div class="MainContainer" id="MainContainer">
  794. <h1>Administration a dery intranet</h1>
  795. <?php
  796. session_start();
  797. if(isset($_SESSION["islogged"]))
  798. {
  799. if($_SESSION["islogged"]!=true)
  800. {
  801. header("Location:login.php");
  802. }
  803.  
  804. }
  805. else
  806. {
  807. header("Location:login.php");
  808. }
  809.  
  810.  
  811. ?>
  812. <form action="<?php session_destroy(); ?>" method="post">
  813. <input type="submit" value="deconexion"/>
  814. </form>
  815. </div>
  816.  
  817. <div class="RightSide">
  818. &nbsp;
  819. </div>
  820.  
  821. </div>
  822.  
  823.  
  824. </body>
  825. </html>
Add Comment
Please, Sign In to add comment