SHARE
TWEET

article.php

a guest Feb 27th, 2019 132 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $servername = "127.0.0.1";
  3. $dbname = "neridaar";
  4. $username = "ID";
  5. $password = "MDP";
  6.  
  7.    $bdd = new PDO("mysql:host=$servername;port=3306;dbname=$dbname; charset=utf8", $username, $password, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
  8.    if(isset($_GET['id']) AND !empty($_GET['id'])){
  9.       $get_id = htmlspecialchars($_GET['id']);
  10.       $article = $bdd->prepare('SELECT * FROM articles WHERE id = ?');
  11.       $article->execute(array($get_id));
  12.       if($article->rowCount() == 1){
  13.          $article = $article->fetch();
  14.          $titre = $article['tritre'];
  15.          $contenu = $article['contenu'];
  16.       } else {
  17.          die('Cet article n\'existe pas !');
  18.       }
  19.    } else{
  20.       die('Erreur');
  21.    }
  22.  
  23. ?>
  24. <!DOCTYPE html>
  25. <html lang="fr">
  26. <head>
  27.    <meta charset="UTF-8">
  28.    <title>Site Neridaar</title>
  29.    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  30.    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  31.    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
  32.    <link rel="stylesheet" href="../css/styles.css">
  33. </head>
  34. <body>
  35.    <nav class="navbar navbar-expand-md bg-dark navbar-dark sticky-top">
  36.      <a class="navbar-brand" href="#">Neridaar</a>
  37.      <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navb" aria-expanded="true">
  38.        <span class="navbar-toggler-icon"></span>
  39.      </button>
  40.      <div id="navb" class="navbar-collapse collapse hide">
  41.        <ul class="navbar-nav">
  42.          <li class="nav-item">
  43.            <a class="nav-link" href="../html/index.php">Accueil</a>
  44.          </li>
  45.          <li class="nav-item">
  46.            <a class="nav-link" href="../html/autre.php">Autre</a>
  47.          </li>
  48.          <li class="nav-item active">
  49.            <a class="nav-link" href="../html/article.php">Article</a>
  50.          </li>
  51.        </ul>
  52.  
  53.        <ul class="nav navbar-nav ml-auto">
  54.          <li class="nav-item">
  55.            <a class="nav-link" href="../html/connexion.php"><span class="fas fa-sign-in-alt"></span> Login</a>
  56.          </li>
  57.        </ul>
  58.      </div>
  59.    </nav>
  60.  
  61.  
  62.    <h1><?= $titre ?></h1>
  63.    <p><?= $contenu ?></p>
  64.  
  65.  
  66. </body>
  67. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top