Advertisement
Guest User

Untitled

a guest
May 28th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.06 KB | None | 0 0
  1. <?php
  2.  
  3. class get_content{
  4.     private $dbname = "exploits";
  5.     private $dbuser = "root";
  6.     private $dbpass = "";
  7.        
  8. function __construct(){
  9.         $sql = mysql_connect('localhost', $this->dbuser, $this->dbpass);
  10.         mysql_select_db($this->dbname, $sql);
  11.         $this->sql = $sql;
  12.     }
  13.  
  14. function get_topics($limit,$row = null){
  15.         $topics = mysql_query("SELECT * FROM topics ORDER BY last_post DESC LIMIT ".$limit."",$this->sql);
  16.         $array_topics = array(); $x=0;
  17.             while($fetchTopics = mysql_fetch_array($topics)){
  18.             $array_topics[$x] = $row == null ? $fetchTopics : $fetchTopics[$row];
  19.             $x++;}
  20.         $this->topics = $array_topics;
  21.     }
  22.    
  23. function get_posts($row = NULL,$topic,$limit){
  24.         $posts = mysql_query("SELECT * FROM posts WHERE tid= '".$topic."' LIMIT ".$limit."",$this->sql) or die(mysql_error());
  25.         if(mysql_num_rows($posts) !== null){
  26.         $array_posts = array(); $x=0;
  27.             while($fetchPosts = mysql_fetch_array($posts)){
  28.             $array_posts[$x] = $row == null ? $fetchPosts : $fetchPosts[$row];
  29.             $x++;}
  30.         $this->posts = $array_posts;
  31.         return true;
  32.             }
  33.         }
  34.    
  35. }
  36.  
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement