NoNameCracksInc

CMS core class

Feb 17th, 2016
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 KB | None | 0 0
  1. Class CMS
  2. {
  3.  
  4.  var $names;
  5.  var $options;
  6.  var $get_storage;
  7.  var $level = 0;
  8.  
  9.  function build_select($q,$r)
  10.  {
  11.  
  12.     $query = mysqli_query($GLOBALS["con"],$q);
  13.     $assoc = [
  14.               0 => "&table=",
  15.               1 => "&column=",
  16.               2 => "&row="
  17.              ];
  18.  
  19.     while($row = mysqli_fetch_array($query))
  20.     {
  21.  
  22.      $this->names[] = $row[$r];
  23.     }
  24.  
  25.     for($i=0;$i<=sizeOf($this->names)-1;$i++)
  26.     {
  27.  
  28.      $this->options = $this->options.'<option>'.$this->names[$i].'</option>';
  29.     }
  30.  
  31.     echo '<select class="cms_select" onChange="location.href=\'cms.php?f'.$this->linear_associative($assoc,$this->level).'\'+this.value">'.
  32.              $this->options.'
  33.          </select>';
  34.  
  35.           $this->options = "";
  36.           $this->names = "";
  37.           $this->level++;
  38.  }
  39.  
  40.  function linear_associative($arr,$endpoint)
  41.  {
  42.  
  43.   $str = "";
  44.  
  45.   for($i=0;$i<=$endpoint;$i++)
  46.   {
  47.    $str = $str.$arr[$i].@$this->get_storage[$i];
  48.   }
  49.  
  50.    return $str;
  51.  }
  52.  
  53.  function analyse_get($get)
  54.  {
  55.  
  56.   return (isset($_GET[$get])) ? true : false;
  57.  }
  58.  
  59.  function level_up()
  60.  {
  61.  
  62.   if($this->analyse_get("table"))
  63.   {
  64.  
  65.     $this->get_storage[] = $_GET["table"];
  66.     $this->build_select("describe ".$_GET["table"],"Field");
  67.   }
  68.  
  69.   if($this->analyse_get("column"))
  70.   {
  71.  
  72.      $this->get_storage[] = $_GET["column"];
  73.      $this->build_select("SELECT `".$_GET["column"]."` FROM ".$_GET["table"],$_GET["column"]);  
  74.   }
  75.  }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment