Advertisement
Guest User

tchaktchouka

a guest
Apr 2nd, 2016
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.50 KB | None | 0 0
  1. /* hada tableaux */
  2. <?php
  3. include ("test.php");
  4. include ("config.php");
  5.  
  6. $resultat = mysql_query("SELECT * FROM `disque`");
  7. $cat = $resultat;
  8.  
  9. ?>
  10. <table class="table table-striped">
  11. <thead>
  12. <tr>
  13. <th>Id</th>
  14. <th>Name</th>
  15. <th>Title</th>
  16. <th>Genre</th>
  17. </tr>
  18. </thead>
  19. <tbody>
  20. <?php
  21. $resultat = $cat;
  22. while ($affiche = mysql_fetch_array($resultat)) {
  23. ?>
  24. <tr>
  25. <td><h3><?php echo $affiche['id'];?></h3></td>
  26.  
  27. <td ><h3><?php echo $affiche['artiste'];?></h3></td>
  28.  
  29. <td><h3><?php echo $affiche['title'];?></h3><br></td>
  30.  
  31. <td ><h3><?php echo $affiche['genre'];?></h3></td>
  32. </tr>
  33. <?php
  34. }
  35. mysql_close();
  36. ?>
  37. </table>
  38.  
  39. /* hnaya la fin ta3 tableaux */
  40.  
  41. /* hada login */
  42.  
  43. <?php
  44. include ("config.php");
  45.  
  46.  
  47. if (isset($_SESSION['user']) != "") {}
  48. if (isset($_POST['submit'])) {
  49. $username = mysql_real_escape_string($_POST['username']);
  50. $password = mysql_real_escape_string($_POST['password']);
  51. $res = mysql_query("SELECT * FROM `user` WHERE `user`.`username`='$username'");
  52. $sadam = mysql_fetch_array($res);
  53. if ($sadam['password'] == md5($password)) {
  54. $_SESSION['user'] = $sadam['id'];
  55. header("Location:rayan.php");
  56. } else {
  57.  
  58. echo "<script>alert('wrong details');</script>";
  59.  
  60. }
  61.  
  62. }
  63.  
  64. include ("test.php");
  65. ?>
  66. <form method="post">
  67.  
  68.  
  69. <div class="container">
  70.  
  71. <form class="form-signin">
  72. <h2 class="form-signin-heading">Please sign in</h2>
  73. <label for="user" class="sr-only">username</label>
  74. <input type="text" id="user" class="form-control" name="username">
  75.  
  76. <label for="password" class="sr-only">Password</label>
  77. <input type="password" id="password" class="form-control" name="password">
  78. <button class="btn btn-lg btn-primary btn-block" type="submit" name="submit">login</button>
  79. </form>
  80.  
  81. </div> <!-- /container -->
  82. </form>
  83.  
  84. /* hnaya la fin ta3 login */
  85.  
  86. /* hada l formulaire ta3 l ADD */
  87.  
  88. <?php
  89. session_start();
  90. include_once 'config.php';
  91. if (!isset($_SESSION['user'])) {
  92. header("Location:index.php");
  93. }
  94. $res = mysql_query("SELECT * FROM `user` WHERE `user`.`id`=".$_SESSION['user']);
  95. $user = mysql_fetch_array($res);
  96. ?>
  97. <title>Bienvenue - <?php echo $user['username'];?></title>
  98. <form action="insert.php" method="post" accept-charset="utf-8">
  99. <label for="genre" class="sr-only">artist</label>
  100. <input type="artist" id="text" class="form-control" name="artist">
  101.  
  102. <label for="title" class="sr-only">title</label>
  103. <input type="text" id="text" class="form-control" name="title">
  104.  
  105. <label for="genre" class="sr-only">genre</label>
  106. <input type="text" id="text" class="form-control" name="genre">
  107. <button class="btn btn-lg btn-primary btn-block" type="submit" name="">Add</button>
  108.  
  109.  
  110. </form>
  111. /* hnaya la fin ta3 l formulaire */
  112.  
  113. /* hada l insert li b3atehouli lakhar */
  114.  
  115. <?php
  116. session_start();
  117. include_once 'config.php';
  118. if (!isset($_SESSION['user'])) {
  119. header("Location:index.php");
  120. }
  121. $res = mysql_query("SELECT * FROM `user` WHERE `user`.`id`=".$_SESSION['user']);
  122. $user = mysql_fetch_array($res);
  123. ?>
  124. <title>Bienvenue - <?php echo $user['username'];?></title>
  125. [20:26:01] fatiha belaouedj: enctype="multipart/form-data"
  126. [20:31:28] fatiha belaouedj: <form name="form1" method="POST" enctype="multipart/form-data" action="insert.php">
  127. <p>artiste : </p>
  128. <input width="300" type="text" name="name"/>
  129. </br>
  130. <p>title: </p>
  131. <input width="300" type="text" name="name"/>
  132. </br>
  133. <p>genre : </p>
  134. <input width="300" type="text" name="name"/>
  135. </br>
  136. <input class="active" type="submit" name="boutom" value="envoyer">
  137. </form>
  138. [20:37:19] games of life: <?php
  139. session_start();
  140. include_once 'config.php';
  141. if (!isset($_SESSION['user'])) {
  142. header("Location:index.php");
  143. }
  144. $res = mysql_query("SELECT * FROM `user` WHERE `user`.`id`=".$_SESSION['user']);
  145. $user = mysql_fetch_array($res);
  146. ?>
  147. [20:38:57] games of life: mani 7abaset zatla zadat tnakateli la memoire :/
  148. [20:41:17] fatiha belaouedj: <?php
  149.  
  150. $con = mysql_connect("localhost", "root", "", "test");
  151. if (isset($_POST['boutom'])) {
  152. $sql = "INSERT INTO `test`.`disque` ( `id`, `artiste`, `title`, `genre`)
  153. VALUES
  154. (NULL, '".$_POST['artiste']."', '".$_POST['title']."', '".$_POST['genre']."')";
  155.  
  156. $req = mysql_query($sql);
  157. if (mysql_query($con, $sql)) {
  158. die('Error:'.mysql_error($con));
  159. }
  160. }
  161. header("Location:class.php");
  162. mysql_close($con);
  163. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement