Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.90 KB | None | 0 0
  1. <?php
  2.     session_start();
  3.    
  4.     require("variables.php");
  5.    
  6.     mysql_connect($host, $user, $pass);
  7.     mysql_select_db($db);
  8.    
  9.     if (!empty($_GET['id'])) {
  10.         $id = $_GET['id'];
  11.         $query  = "SELECT * FROM approved WHERE id=".$_GET['id'];
  12.     }
  13.     elseif (!empty($_GET['option'])) {
  14.         $op = $_GET['option'];
  15.         if ($op == "random") {
  16.             $query = "SELECT * FROM approved ORDER BY rand() LIMIT ".$perpage;
  17.         }
  18.         elseif ($op == "top") {
  19.             $query = "SELECT * FROM approved ORDER BY total DESC LIMIT 100";
  20.         }
  21.     }
  22.         elseif ($op == "latest") {
  23.        
  24.         }
  25.     else {
  26.         $query = "SELECT * FROM approved LIMIT ".$perpage;
  27.     }
  28.    
  29.     $result = mysql_query($query);
  30.    
  31.    
  32. ?>
  33.  
  34. <html>
  35.     <head>
  36.         <title>Quote Database</title>
  37.         <link rel="stylesheet" type="text/css" href="default.css" />
  38.     </head>
  39.    
  40.     <body>
  41.         <div id="main">
  42.             <div id="header">
  43.                 <div id="logo">
  44.                 <img src="logo.png" width="100px" height="70px" />
  45.                 <div style="float:right;">
  46.                 <h1>Quote Databse</h1>
  47.                 <h2>Owned by Lkill</h2>
  48.                 </div>
  49.                 </div>
  50.                 <div id="menu">
  51.                     <ul>
  52.                         <li><a href="index.php">Home</a></li>
  53.                         <li><a href="index.php?option=latest">Latest</a></li>
  54.                         <li><a href="index.php?option=random">Random</a></li>
  55.                         <li><a href="index.php?option=top">Top</a></li>
  56.                         <li><a href="#">Home</a></li>
  57.                     </ul>
  58.                 </div>
  59.             </div>
  60.            
  61.             <div id="content">
  62.         <?php
  63.             while ($row = mysql_fetch_array($result)) {
  64.                 $text = "<div id=\"wrap\"><ul><li><a href=\"index.php?id=".$row['id']."\">".$row['id']."</a></li><li><a href=\"vote.php?id=".$row['id']."&op=u\">".$row['up']." + </a></li><li>(".$row['total'].")</li><li><a href=\"vote.php?id=".$row['id']."&op=d\">". $row['down'] ."- </a></li></ul>\n";
  65.                 $text = $text."<div id=\"quote\">".$row['quote']."</div>";
  66.                 echo $text;
  67.             }
  68.         ?>
  69.             </div>
  70.            
  71.             <div id="footer">
  72.                 <p>Testing</p>
  73.             </div>
  74.     </body>
  75. </html>
  76.  
  77. <?php mysql_close(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement