Advertisement
Underworld1337

Untitled

Oct 13th, 2014
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1. <?php
  2. class board
  3. {
  4.     /**
  5.       * state
  6.       * + show home
  7.       * + show topic
  8.       * + show thread
  9.       */
  10.     private $con;
  11.     private $admin;
  12.  
  13.     public function __construct() {
  14.         $this->con = $GLOBALS['DB'];
  15.     }
  16.  
  17.     public function board_show_home(){
  18.         $qry = $this->con->prepare("SELECT * FROM feedback_cats ORDER BY cID ASC");
  19.         /**
  20.           * cID int AI
  21.           * cName varchar(30)
  22.           * active tinyint 1,0
  23.           * admin tinyint 1,0
  24.           **/
  25.         if ($qry->execute()){
  26.             if ($qry->rowCount() != 0){
  27.                 $cat_cnt = $qry->rowCount();
  28.                 $cat_arr = array_combine(range(1, $cat_cnt), array_values($qry->fetchAll(PDO::FETCH_ASSOC)));
  29.                 $ret = "";
  30.                 foreach($cat_arr as $cat){
  31.                     if($cat['admin'] == 1 && $this->admin == 'yes' && $cat['active'] == 1 || $cat['admin'] == 0 && $cat['active'] == 1){
  32.                         $ret .= "<div><a style=\"display:block\" onfocus=\"this.blur()\" href=\"indexInternal.es?action=internalBoard&amp;subaction=view&amp;cat=" . $cat['cID'] . "\">" . $cat['cName'] . "</a></div>"; // category name + Link
  33.                     }
  34.                 }
  35.                 return $ret;
  36.             }
  37.         }
  38.     }
  39. }
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement