Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class CMS
- {
- var $names;
- var $options;
- var $get_storage;
- var $level = 0;
- function build_select($q,$r)
- {
- $query = mysqli_query($GLOBALS["con"],$q);
- $assoc = [
- 0 => "&table=",
- 1 => "&column=",
- 2 => "&row="
- ];
- while($row = mysqli_fetch_array($query))
- {
- $this->names[] = $row[$r];
- }
- for($i=0;$i<=sizeOf($this->names)-1;$i++)
- {
- $this->options = $this->options.'<option>'.$this->names[$i].'</option>';
- }
- echo '<select class="cms_select" onChange="location.href=\'cms.php?f'.$this->linear_associative($assoc,$this->level).'\'+this.value">'.
- $this->options.'
- </select>';
- $this->options = "";
- $this->names = "";
- $this->level++;
- }
- function linear_associative($arr,$endpoint)
- {
- $str = "";
- for($i=0;$i<=$endpoint;$i++)
- {
- $str = $str.$arr[$i].@$this->get_storage[$i];
- }
- return $str;
- }
- function analyse_get($get)
- {
- return (isset($_GET[$get])) ? true : false;
- }
- function level_up()
- {
- if($this->analyse_get("table"))
- {
- $this->get_storage[] = $_GET["table"];
- $this->build_select("describe ".$_GET["table"],"Field");
- }
- if($this->analyse_get("column"))
- {
- $this->get_storage[] = $_GET["column"];
- $this->build_select("SELECT `".$_GET["column"]."` FROM ".$_GET["table"],$_GET["column"]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment