Advertisement
Guest User

Untitled

a guest
May 12th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.34 KB | None | 0 0
  1. <?php
  2.  
  3. // Set the defaul timezone
  4. date_default_timezone_set('America/New_York');
  5.  
  6. // MySql variables
  7. $username = "n********";
  8. $password = "*******";
  9. $database = "n******";
  10.  
  11. // Connect to the db
  12. mysql_connect(localhost,$username,$password);
  13. @mysql_select_db($database) or die("Unable to select database");
  14.  
  15. // Function variables
  16.  
  17. $id = $_POST['id'];
  18. $day = date("D");
  19.  
  20. if ($id==0){
  21.  
  22.     echo '<table>';
  23.  
  24. // Select the stuff from the db
  25. $query = "SELECT * FROM `rmf` ORDER BY `id` ASC";
  26. $result=mysql_query($query);
  27.  
  28. while ($row=mysql_fetch_array($result)) {
  29.  
  30. $name = $row['name'];
  31. $id = $row['id'];
  32.  
  33. // Show the stuff from the db
  34.  
  35.     echo "<tr><td><a href=\"/rmf.php?id=" . $id . "\" title=\"View " . $name . "&astr;s Face\">" . $name . "</a></td></tr>\n";
  36.  
  37.     }
  38.    
  39.     echo '</table>';
  40. }else{
  41.  
  42. // Select the stuff from the db
  43. $query = "SELECT * FROM `rmf` WHERE id='$id'";
  44. $result=mysql_query($query);
  45.  
  46. while ($row=mysql_fetch_array($result)) {
  47.  
  48. $name = $row['name'];
  49. $vote = $row['vote'];
  50. $numvotes = $row['numvotes'];
  51. $pic = $row['pic'];
  52.  
  53. // Show the stuff from the db
  54.  
  55.     echo '<h1>' . $name . '</h1>';
  56.     echo '<img src="' . $pic . '" alt="' . $name . '&astr;s Face" /><br />';
  57.     echo '<p>' . $name . ' has a rating of ' . $vote . '</p>';
  58.     echo '<p>' . $numvotes . ' people have voted.</p>';
  59.  
  60.     }
  61.  
  62. }
  63. mysql_close();
  64.  
  65. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement