Advertisement
Guest User

Untitled

a guest
Aug 6th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.62 KB | None | 0 0
  1.  
  2. <?php
  3.  
  4. include('config.php');
  5.  
  6. if (!isset($_GET['id']))
  7. {
  8.     header('Location: index.php');
  9. }
  10. else
  11. {
  12.     $id_get = intval($_GET['id']);
  13. }
  14.  
  15. $v1 = $bdd->query('SELECT id, titre, auteur, contenu FROM articles WHERE id ="'.$id_get.'" ');
  16. $donnees = $v1->fetch();
  17. if (isset($donnees['id'])){
  18.    
  19. ?>
  20.  
  21.  
  22. <!DOCTYPE html>
  23. <html>
  24.  
  25.     <head>
  26.         <HTML dir="ltr" lang="fr-FR">
  27.  
  28.         <title>Blog T.A games studio</title>
  29.         <link rel="stylesheet" href="styleblog.css" />
  30.     </head>
  31.         <body>
  32.             <div id="blocpage">
  33. <header>
  34. <h2> <?php echo strip_tags($donnees['titre']); ?> </h1>
  35. <p><?php echo nl2br(strip_tags($donnees['contenu'])); ?></p>
  36. <h5><em> par : <?php echo strip_tags($donnees['auteur']);?> </em></h5>
  37. <br/>
  38. </header>
  39. <h2>Commentaires : <br/>
  40. -   -   -   -   -   -   -   -   -   -   -   -</h2>
  41. <?php
  42. $v2 = $bdd->query('SELECT id, auteur, contenu, id_article FROM commentaires WHERE id_article = "'.$donnees['id'].'" ');
  43. while($info_com = $v2->fetch()) { ?>
  44.  
  45. <em><h5> <?php echo strip_tags($info_com['auteur']); ?> ecrit : <br/>
  46.     <?php echo nl2br(strip_tags($info_com['contenu'])); ?></em></h5><br/>
  47.     <hr/>
  48.  
  49. <?php
  50. }
  51. ?>
  52.  
  53.  
  54.  
  55.     <form action="postcomm.php" method="post">
  56.  
  57.             Votre pseudo :<br/>
  58.             <input type="text" name="auteur" id="auteur" maxlenght="12"/> <br/>
  59.             Votre commentaire : <br/>
  60.             <textarea name="contenu" id="contenu"></textarea>
  61.             <input type="submit" name="envoyer" value="Commenter !"/>
  62.             <input type="hidden" name="id_article" value="<?php echo $donnees['id']; ?>" />
  63.  
  64.     </form>
  65.  
  66.  
  67.  
  68.  
  69.  
  70. </div>
  71.         </body>
  72. </html>
  73.  
  74. <?php }
  75.  
  76. else
  77. {
  78.     echo '<h1>ID non existant (La page n\'existe pas) . </h1>';
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement