Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.87 KB | None | 0 0
  1. <?php
  2. $username = $_POST['un'];
  3. $password = $_POST['unb'];
  4.  
  5. $usernameinreverse = strrev($username);
  6.  
  7. if ($usernameinreverse == $password) {
  8. echo "good";
  9. } else {
  10.     echo "nope";
  11.  
  12. exit("bad pass");
  13. }
  14. ?>
  15. <html><head><title>Display Books</title></head>
  16. <body>
  17. <h1>Display all Titles</h1>
  18. <table border=9>
  19. <tr><th><a href="u.php?view=category">Category</th><th><a href="u.php?view=title">Title</th><th><a href="u.php?view=author">Author</th><th><a href="u.php?view=publisher">Publisher</th><th><a href="u.php?view=price">Price</th><th><a href="u.php?view=isbn">ISBN</th></tr>
  20.  
  21.  <?php
  22.  
  23.  
  24.    
  25.  
  26.  
  27.  
  28.  
  29.  
  30. include_once "books2.php";
  31.  
  32. $getcat = $_GET["category"];
  33. echo $getcat;
  34.  
  35.  
  36. $getview = $_GET["view"];
  37. echo $getview;
  38.  
  39. $array = $books;
  40. //print_r(array_values($array));
  41. //print_r(array_keys($array, $getcat));
  42.  
  43. //$key = array_search("Business", $array);
  44. //print_r(array_values($array));
  45. //echo $key;
  46. //print_r(array_filter($array, "Nonfiction"));
  47. //array_filter($array, function($a) { return $a['category'] == 'Business'; });
  48.  
  49.  
  50. //array_filter($array, function($a) { return $a['category'] == 'Business'; });
  51.  
  52. function type($boop)
  53. {
  54.     return $boop['category'] == $getcat;
  55. }
  56. print_r(array_filter($array, "type"));
  57.  
  58.  
  59.  
  60.  
  61.  foreach ($books as $key => $row)
  62.     $mrsort[$key]  = $row[$getview];
  63.  
  64. array_multisort($mrsort, SORT_DESC, $books);
  65.  
  66. foreach ($books as $book):
  67.  
  68.  
  69. ?>
  70.  
  71.  
  72. <tr><td>&nbsp;<a href="u.php?category=<?php echo $book['category'];?>"> <?php echo $book['category'];?> </a>&nbsp</td>
  73.     <td>&nbsp;<?php echo $book['title'];?>&nbsp</td>
  74.     <td>&nbsp;<?php echo $book['author'];?>&nbsp</td>
  75.     <td>&nbsp;<?php echo $book['publisher'];?>&nbsp</td>
  76.     <td align=right>&nbsp;<?php echo $book['price'];?>&nbsp</td>
  77.     <td>&nbsp;<a href=cart.php?isbn=<?php echo $book['isbn'];?>>Add to Cart</a></td>
  78. </tr>
  79. <?php
  80. endforeach;
  81. ?>
  82.  
  83. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement