Advertisement
H4T3D

PHP NO ADMIN (MYSQL Management System)

Jan 15th, 2016
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 60.17 KB | None | 0 0
  1. <?php
  2. /*
  3.  
  4.  PHP NO ADMIN (MYSQL Management System)
  5.  
  6.  PhpNoAdmin (Handle Administration of MySQL in single page)
  7.  
  8.  Mini PhpMyadmin Version 1.6 Beta
  9.  
  10.  https://www.facebook.com/HAT.programmers
  11.  
  12.   Demo : http://phpnoadmin.viper-7.com/H3PAVx/5.6.10?
  13.   Servername:db4free.net
  14.   Username :phpnoadmin
  15.   Password :phpnoadmin
  16.  
  17.  
  18.   Coded By Hat programmers
  19.  
  20.   Disclaimer :
  21.   *Free Distribution But With Orignal Coders name
  22.   *Only For Educational purposes We Dont Take Any Responsiblity Of Any Type
  23.  
  24. */
  25.  
  26. define('Name', 'MySql Management System PhpNoAdmin');
  27. define('VERSION', '1.6');
  28. define('Copyright', 'HAT Programmers');
  29.  error_reporting(0);
  30.  
  31. ini_set('max_execution_time', 0);
  32. set_time_limit(0);
  33. set_magic_quotes_runtime(0);
  34. ob_end_clean();
  35. ob_start();
  36. session_start();
  37.  
  38. function sql($sql)
  39.   {
  40.     if(isset($_GET['dbname'])){
  41.      mysql_select_db($_GET['dbname']);
  42.     }
  43.  
  44.     echo '<div class="row">
  45.               <div class="col-lg-12">';
  46.  
  47.   if (mysql_query($sql))
  48.     {
  49.     $result = mysql_query($sql);
  50.    
  51.     echo '
  52.    <div class="form-group has-success">
  53.               <div class="alert alert-success alert-dismissable">
  54.                           <button type="button" class="close fa fa-check" data-dismiss="alert" aria-hidden="true">&#10008;</button>
  55.                        Mysql Query was Valid</br><hr></hr><a href="#" class="alert-link">MySql Query : ' . htmlspecialchars($sql) . '</a>.
  56.                       </div>
  57.                       </div>';
  58.        
  59.  
  60.         if ((is_bool($result === false))) {
  61.           echo "<table class=\"order-table table\">";
  62.            
  63.         $arr = mysql_fetch_assoc($result);
  64.  
  65.         if (is_bool($arr) === true) {return;}
  66.         array_unique($arr);
  67.     echo "<thead><tr>";
  68.     foreach($arr as $name => $value)
  69.         {
  70.         echo "<th>" .  htmlspecialchars($name) . "</th>";
  71.         }
  72.  
  73.       echo "</tr></thead>
  74.      <tbody id=\"myTable\">";
  75.  
  76.      
  77.  
  78.       $results = mysql_query($sql);
  79.       while ($arrs = mysql_fetch_assoc($results))
  80.             {
  81.             echo "<tr>";
  82.             foreach($arrs as $name => $value)
  83.             {
  84.             echo '<td>' .  htmlspecialchars($value) . "</td>";
  85.             }
  86.             echo "</tr>";
  87.             }
  88.  
  89.            
  90.     echo "</tbody>
  91.      </table>
  92.      ";
  93.       // FOR PAGINATION
  94.             if (isset($_GET['pages'])) {
  95.                 echo "
  96.                 <div class=\"col-md-12 text-center\">
  97.      <ul class=\"pagination\" id=\"myPager\"></ul>
  98.      </div>
  99.      </div>
  100. </div>";
  101.  
  102.       echo '
  103.  
  104.      <script>
  105.      $.fn.pageMe = function(opts){
  106.    var $this = this,
  107.        defaults = {
  108.            perPage: 7,
  109.            showPrevNext: false,
  110.            hidePageNumbers: false
  111.        },
  112.        settings = $.extend(defaults, opts);
  113.    
  114.    var listElement = $this;
  115.    var perPage = settings.perPage;
  116.    var children = listElement.children();
  117.    var pager = $(\'.pager\');
  118.    
  119.    if (typeof settings.childSelector!="undefined") {
  120.        children = listElement.find(settings.childSelector);
  121.    }
  122.    
  123.    if (typeof settings.pagerSelector!="undefined") {
  124.        pager = $(settings.pagerSelector);
  125.    }
  126.    
  127.    var numItems = children.size();
  128.    var numPages = Math.ceil(numItems/perPage);
  129.  
  130.    pager.data("curr",0);
  131.    
  132.    if (settings.showPrevNext){
  133.        $(\'<li><a href="#" class="prev_link">«</a></li>\').appendTo(pager);
  134.    }
  135.    
  136.    var curr = 0;
  137.    while(numPages > curr && (settings.hidePageNumbers==false)){
  138.        $(\'<li><a href="#" class="page_link">\'+(curr+1)+\'</a></li>\').appendTo(pager);
  139.        curr++;
  140.    }
  141.    
  142.    if (settings.showPrevNext){
  143.        $(\'<li><a href="#" class="next_link">»</a></li>\').appendTo(pager);
  144.    }
  145.    
  146.    pager.find(\'.page_link:first\').addClass(\'active\');
  147.    pager.find(\'.prev_link\').hide();
  148.    if (numPages<=1) {
  149.        pager.find(\'.next_link\').hide();
  150.    }
  151.     pager.children().eq(1).addClass("active");
  152.    
  153.    children.hide();
  154.    children.slice(0, perPage).show();
  155.    
  156.    pager.find(\'li .page_link\').click(function(){
  157.        var clickedPage = $(this).html().valueOf()-1;
  158.        goTo(clickedPage,perPage);
  159.        return false;
  160.    });
  161.    pager.find(\'li .prev_link\').click(function(){
  162.        previous();
  163.        return false;
  164.    });
  165.    pager.find(\'li .next_link\').click(function(){
  166.        next();
  167.        return false;
  168.    });
  169.    
  170.    function previous(){
  171.        var goToPage = parseInt(pager.data("curr")) - 1;
  172.        goTo(goToPage);
  173.    }
  174.    
  175.    function next(){
  176.        goToPage = parseInt(pager.data("curr")) + 1;
  177.        goTo(goToPage);
  178.    }
  179.    
  180.    function goTo(page){
  181.        var startAt = page * perPage,
  182.            endOn = startAt + perPage;
  183.        
  184.        children.css(\'display\',\'none\').slice(startAt, endOn).show();
  185.        
  186.        if (page>=1) {
  187.            pager.find(\'.prev_link\').show();
  188.        }
  189.        else {
  190.            pager.find(\'.prev_link\').hide();
  191.        }
  192.        
  193.        if (page<(numPages-1)) {
  194.            pager.find(\'.next_link\').show();
  195.        }
  196.        else {
  197.            pager.find(\'.next_link\').hide();
  198.        }
  199.        
  200.        pager.data("curr",page);
  201.         pager.children().removeClass("active");
  202.        pager.children().eq(page+1).addClass("active");
  203.    
  204.    }
  205. };
  206.  
  207. $(document).ready(function(){
  208.    
  209.  $(\'#myTable\').pageMe({pagerSelector:\'#myPager\',showPrevNext:true,hidePageNumbers:false,perPage:4});
  210.    
  211. });
  212. </script>';
  213. }// end of pages
  214.  
  215.     } //check if result is boolean
  216.     }//end of if query is right
  217.     else
  218.     {
  219.  
  220.     echo '<div class="form-group has-success"><div class="alert alert-danger alert-dismissable">
  221.                           <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&#10008;</button>
  222.                           Error MySql QUERY : ' . htmlspecialchars($sql) . ' </br><hr></hr>  <a href="#" class="alert-link">' . htmlspecialchars(mysql_error()) . '</a>.
  223.                       </div></div>
  224.                       ';
  225.                      
  226.     }
  227.    
  228.       echo '</div></div>';
  229.  
  230.   }
  231.  
  232.   function checkingsql($sql){ echo "
  233.    <script>var r = confirm('Do You Really Want To Execute\\n \"$sql\"');
  234.    if(r){
  235.        window.location.assign(\"?checksql=$sql\");
  236.           }
  237.      </script>
  238.    ";}
  239.  
  240.    
  241. function getrows($dbname, $tbl)
  242.   {
  243.   $servername = $GLOBALS['servername'];
  244.   $username = $GLOBALS['username'];
  245.   $password = $GLOBALS['password'];
  246.   $conn = new mysqli($servername, $username, $password);
  247.   $sql3 = "SHOW COLUMNS FROM $dbname.$tbl";
  248.   $result = mysqli_query($conn, $sql3);
  249.   while ($row = mysqli_fetch_array($result))
  250.     {
  251.     echo $row['Field'] . ",";
  252.     }
  253.     mysqli_close($conn);
  254.   }
  255.  
  256.  
  257.  
  258.  
  259. if (!isset($_SESSION['username']))
  260.   {
  261.   echo "
  262. <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
  263. <link href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" rel=\"stylesheet\">
  264. <style>
  265. body {
  266.   z-index: 1030;
  267. background-color: #333333;
  268. }
  269. legend {color:white;}
  270.  
  271. .footer_bottom {
  272.   background: #333;
  273.   padding: 1em 0;
  274.   text-align: center;
  275. }
  276.  
  277. .copy p {
  278.   color: #fff;
  279.   font-size: 0.85em;
  280. }
  281.  
  282. </style>
  283. <body>
  284. <center>
  285. <div class=\"container\">
  286. <div class=\"row\">
  287. <div class=\"col-sm-12\">
  288. <div class=\"col-sm-3\"></div>
  289. <div class=\"col-sm-6\">
  290. <fieldset class=\"scheduler-border\">
  291.   <legend class=\"scheduler-border\">Database Connection</legend>
  292. <font color=\"white\" size=\"10\">PHP</font><b><font color=\"yellow\" size=\"8\">NOAdmin</font></a></b>
  293. <hr></hr>
  294. <form action='' method='POST' role=\"form\">
  295. <div class=\"form-group\">
  296. <label for=\"email\">Servername:</label>
  297. <div class=\"form-group input-group\">
  298.        <span class=\"input-group-addon\">Servername</span>
  299. <input type=\"text\" name=\"servername\" class=\"form-control\" value='localhost'/></div>
  300. <label for=\"email\">UserName:</label>
  301. <div class=\"form-group input-group\">
  302.        <span class=\"input-group-addon\">Username</span>
  303. <input type=\"text\" name=\"username\" class=\"form-control\" value='root'/></div>
  304. <label for=\"email\">Password:</label>
  305. <div class=\"form-group input-group\">
  306.        <span class=\"input-group-addon\">Password</span>
  307. <input type=\"password\" class=\"form-control\" name=\"password\" /></div></br>
  308. <input type=\"submit\" name=\"connct_now\" class=\"btn btn-default form-control\" value=\"Connect\"/>
  309. </div>
  310. </form>
  311. </div>
  312. </div>
  313. </fieldset>
  314. </div>
  315. </div>
  316. </div>
  317. </body>
  318. <div class=\"footer_bottom\">
  319.                <div class=\"container\">
  320.                        <div class=\"copy\">
  321.                           <p>Copyright &copy; 2015 HAT programmers. All Rights Reserved . Developed by <a href=\"https://www.facebook.com/HAT.programmers/\" target=\"_blank\"> HAT Programmers</a> </p>
  322.                        </div>
  323.                </div>
  324.        </div>
  325. ";
  326.   if (isset($_GET['error']))
  327.     {
  328.     header('HTTP/1.0 401 Unauthorized');
  329.     echo "
  330. <div class=\"container\">
  331. <div class=\"alert alert-danger\">
  332. <strong> Invalid Credentials </strong> Failed To Connect !
  333. </div>
  334. </div>
  335. ";
  336.     }
  337.  
  338.   if (isset($_POST['connct_now']))
  339.     {
  340.     $servername = $_POST['servername'];
  341.     $username = $_POST['username'];
  342.     $password = $_POST['password'];
  343.     $connection = mysql_connect($servername, $username, $password);
  344.     $_SESSION['servername'] = $servername;
  345.     $_SESSION['username'] = $username;
  346.     $_SESSION['password'] = $password;
  347.     $_SESSION['connection'] = $connection;
  348.     header("location:?");
  349.     }
  350.   }
  351.   else
  352.   {
  353.   $GLOBALS['servername'] = $_SESSION['servername'];
  354.   $GLOBALS['username'] = $_SESSION['username'];
  355.   $GLOBALS['password'] = $_SESSION['password'];
  356.  
  357. echo '
  358. <head>
  359. <style>
  360. table,td,tr{
  361. border: 1px solid black;
  362. width:100%;
  363. }
  364.  
  365.  
  366. th{
  367. border: 1px solid black;
  368. width:100%;
  369. color: blue;
  370.  
  371. }
  372.  
  373.  
  374.  
  375. // /////////////
  376.  
  377.  
  378.  
  379.  
  380.  
  381. #wrapper {
  382. padding-left: 0;
  383. -webkit-transition: all 0.5s ease;
  384. -moz-transition: all 0.5s ease;
  385. -o-transition: all 0.5s ease;
  386. transition: all 0.5s ease;
  387. }
  388.  
  389. #wrapper.toggled {
  390. padding-left: 250px;
  391. }
  392.  
  393. #sidebar-wrapper {
  394. z-index: 1000;
  395. position: fixed;
  396. left: 250px;
  397. width: 0;
  398. height: 100%;
  399. margin-left: -250px;
  400. overflow-y: auto;
  401. background: #000;
  402. -webkit-transition: all 0.5s ease;
  403. -moz-transition: all 0.5s ease;
  404. -o-transition: all 0.5s ease;
  405. transition: all 0.5s ease;
  406. }
  407.  
  408. #wrapper.toggled #sidebar-wrapper {
  409. width: 250px;
  410. }
  411.  
  412. #page-content-wrapper {
  413. width: 100%;
  414. position: absolute;
  415. padding: 15px;
  416. }
  417.  
  418. #wrapper.toggled #page-content-wrapper {
  419. position: absolute;
  420. margin-right: -250px;
  421. }
  422.  
  423. /* Sidebar Styles */
  424.  
  425. .sidebar-nav {
  426. position: absolute;
  427. top: 0;
  428. width: 250px;
  429. margin: 0;
  430. padding: 0;
  431. list-style: none;
  432. }
  433.  
  434. .sidebar-nav li {
  435. text-indent: 20px;
  436. line-height: 40px;
  437. }
  438.  
  439. .sidebar-nav li a {
  440. display: block;
  441. text-decoration: none;
  442. color: #999999;
  443. }
  444.  
  445. .sidebar-nav li a:hover {
  446. text-decoration: none;
  447. color: #fff;
  448. background: rgba(255,255,255,0.2);
  449. }
  450.  
  451. .sidebar-nav li a:active,
  452. .sidebar-nav li a:focus {
  453. text-decoration: none;
  454. }
  455.  
  456. .sidebar-nav > .sidebar-brand {
  457. height: 65px;
  458. font-size: 18px;
  459. line-height: 60px;
  460. }
  461.  
  462. .sidebar-nav > .sidebar-brand a {
  463. color: #999999;
  464. }
  465.  
  466. .sidebar-nav > .sidebar-brand a:hover {
  467. color: #fff;
  468. background: none;
  469. }
  470.  
  471. @media(min-width:768px) {
  472. #wrapper {
  473.   padding-left: 250px;
  474. }
  475.  
  476. #wrapper.toggled {
  477.   padding-left: 0;
  478. }
  479.  
  480. #sidebar-wrapper {
  481.   width: 250px;
  482. }
  483.  
  484. #wrapper.toggled #sidebar-wrapper {
  485.   width: 0;
  486. }
  487.  
  488. #page-content-wrapper {
  489.   padding: 20px;
  490.   position: relative;
  491. }
  492.  
  493. #wrapper.toggled #page-content-wrapper {
  494.   position: relative;
  495.   margin-right: 0;
  496. }
  497. }
  498.  
  499. div.related {
  500. background-color: #888;
  501. line-height: 30px;
  502. color: #ffffff;
  503. }
  504. div.related {
  505.      width: 100%;
  506.      font-size: 90%;
  507. }
  508. div.related ul {
  509. margin: 0;
  510. padding: 0 0 0 10px;
  511. list-style: none;
  512. }
  513. div.related li.right {
  514. float: right;
  515. margin-right: 5px;
  516. }
  517. div.related li {
  518. display: inline;
  519. }
  520. user agent stylesheetli {
  521. display: list-item;
  522. text-align: -webkit-match-parent;
  523. }
  524.  
  525.  
  526. .footer_bottom {
  527.   background: #333;
  528.   padding: 1em 0;
  529.   text-align: center;
  530. }
  531.  
  532. .copy p {
  533.   color: #fff;
  534.   font-size: 0.85em;
  535. }
  536.  
  537. .fa-minus-circle{color:red;}
  538. }
  539.  
  540.  
  541. </style>
  542.  
  543. </style>
  544. <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
  545. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
  546. <link rel="stylesheet" href="http://lucas.ucs.ed.ac.uk/test/codemirror/lib/codemirror.css">
  547. <script src="http://lucas.ucs.ed.ac.uk/test/codemirror/lib/codemirror.js"></script>
  548. <script src="http://lucas.ucs.ed.ac.uk/test/codemirror/mode/mysql/mysql.js"></script>
  549. <style>.CodeMirror {margin: 0px; width: 100%; height: 359px; background-color: aliceblue; border: 4px solid #765942; border-radius: 10px;}</style>
  550. </head>
  551. ';
  552.   echo '<body>';
  553.   function headers()
  554.     {
  555.     echo '
  556.    <nav class="navbar navbar-default';
  557.     if (isset($_GET['popup'])) {
  558.     echo "hidden-xs";
  559.     }
  560.     else{
  561.       echo "visible-xs";
  562.     }
  563.     echo'">
  564.  <div class="container-fluid">
  565.    <!-- Brand and toggle get grouped for better mobile display -->
  566.    <div class="navbar-header">
  567.      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
  568.        <span class="sr-only">Toggle navigation</span>
  569.        <span class="icon-bar"></span>
  570.        <span class="icon-bar"></span>
  571.        <span class="icon-bar"></span>
  572.      </button>
  573.      <a class="navbar-brand" href="?">PhpNoAdmin</a>
  574.    </div>
  575.  
  576.    <!-- Collect the nav links, forms, and other content for toggling -->
  577.    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
  578.      <ul class="nav navbar-nav">
  579.        <li class="active"><a href="?status"><i class="fa fa-bar-chart"></i><span class="sr-only">(current)</span></a></li>
  580.        <li><a href="#">Link</a></li>
  581.        <li class="dropdown">
  582.          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
  583.          <ul class="dropdown-menu">
  584.            <li><a href="#">Action</a></li>
  585.            <li><a href="#">Another action</a></li>
  586.            <li><a href="#">Something else here</a></li>
  587.            <li role="separator" class="divider"></li>
  588.            <li><a href="#">Separated link</a></li>
  589.            <li role="separator" class="divider"></li>
  590.            <li><a href="#">One more separated link</a></li>
  591.          </ul>
  592.        </li>
  593.      </ul>
  594.      <form class="navbar-form navbar-left" role="search" action="https://search.oracle.com/search/search?" method="GET" target="_blank">
  595.        <div class="form-group">
  596.          <input type="text" class="form-control" placeholder="Search" name="q">
  597.          <input type="hidden" name="group" value="MySQL">
  598.          <input type="hidden" name="x" value="0">
  599.        </div>
  600.        <button type="submit" class="btn btn-default">Go</button>
  601.      </form>
  602.      <ul class="nav navbar-nav navbar-right">
  603.        <li><a href="#">Link</a></li>
  604.        <li class="dropdown">
  605.          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-user fa-fw"></i><span class="caret"></span></a>
  606.          <ul class="dropdown-menu">
  607.            <li><a href="#">Action</a></li>
  608.            <li><a href="#">Another action</a></li>
  609.            <li><a href="#">Something else here</a></li>
  610.            <li role="separator" class="divider"></li>
  611.            <li><a href="?logout" class="fa fa-sign-out">logout</a></li>
  612.          </ul>
  613.        </li>
  614.      </ul>
  615.    </div><!-- /.navbar-collapse -->
  616.  </div><!-- /.container-fluid -->
  617. </nav>
  618.  
  619.    <div class="related">
  620.  <ul>
  621.    <li class="right" style="margin-right: 10px">
  622.      <a href="#"  onclick="javascript:window.history.foward();" title="Go Foward" accesskey="I">&#8594;</a></li>
  623.    <li class="right">
  624.      <a href="#" onclick="javascript:window.history.back();" title="Go Back" accesskey="N">&#8592;</a> |</li>
  625.    <li><a href="?"><b>Server:</b> ' . $_SERVER['SERVER_NAME'] . '</a> >> ';
  626.     if (isset($_GET['dbname']))
  627.       {
  628.       echo $_GET['dbname'] . ">>";
  629.       }
  630.  
  631.     if (isset($_GET['tbl']))
  632.       {
  633.       echo $_GET['tbl'];
  634.       }
  635.  
  636.     echo '</li>
  637.  </ul>
  638. </div>
  639.  
  640. ';
  641.     echo "<script>
  642.                (function(document) {
  643.        'use strict';
  644.  
  645.        var LightTableFilter = (function(Arr) {
  646.  
  647.                var _input;
  648.  
  649.                function _onInputEvent(e) {
  650.                        _input = e.target;
  651.                        var tables = document.getElementsByClassName(_input.getAttribute('data-table'));
  652.                        Arr.forEach.call(tables, function(table) {
  653.                                Arr.forEach.call(table.tBodies, function(tbody) {
  654.                                        Arr.forEach.call(tbody.rows, _filter);
  655.                                });
  656.                        });
  657.                }
  658.  
  659.                function _filter(row) {
  660.                        var text = row.textContent.toLowerCase(), val = _input.value.toLowerCase();
  661.                        row.style.display = text.indexOf(val) === -1 ? 'none' : 'table-row';
  662.                }
  663.  
  664.                return {
  665.                        init: function() {
  666.                                var inputs = document.getElementsByClassName('light-table-filter');
  667.                                Arr.forEach.call(inputs, function(input) {
  668.                                        input.oninput = _onInputEvent;
  669.                                });
  670.                        }
  671.                };
  672.        })(Array.prototype);
  673.  
  674.        document.addEventListener('readystatechange', function() {
  675.                if (document.readyState === 'complete') {
  676.                        LightTableFilter.init();
  677.                }
  678.        });
  679.  
  680. })(document);
  681. </script>
  682. ";
  683.     echo '<div id="page-content-wrapper">
  684.       <div class="container-fluid">
  685.           <div class="row">
  686.               <div class="col-lg-12">';
  687.     }
  688.  
  689.   function footer()
  690.     {
  691.     echo ' </div>
  692. </div>
  693.                                <hr></hr>
  694.                                <div class="footer_bottom">
  695.                <div class="container">
  696.                        <div class="copy">
  697.                           <p>Copyright &copy; ' . date("Y") . ' HAT programmers. All Rights Reserved .  Developed By <a href="https://www.facebook.com/HAT.programmers/" target="_blank"> HAT Programmers</a> </p>
  698.                        </div>
  699.                </div>
  700.        </div>
  701.  
  702.  
  703.           </div>
  704.       </div>
  705.   </div>
  706.  
  707.  ';
  708.     } // end of footer
  709.   echo '<div id="wrapper">
  710.  
  711.   <div id="sidebar-wrapper">
  712.  
  713.       <ul class="sidebar-nav">
  714. <img src="http://i.imgur.com/7CzBtVF.gif">
  715.  
  716.           <li class="sidebar-brand dropdown">
  717.               <a href="?">
  718.                   <i><font color="white" size="3">php</font><b><font color="yellow" size="3">NOAdmin</font></a></b></i>
  719.               </a>
  720.           </li>
  721.  
  722.           <li class="sidebar-brand dropdown">
  723.               <a href="?">
  724.                   <i class="fa fa-home"> DashBoard</i>
  725.               </a>
  726.           </li>
  727.  
  728.                  <li>
  729.                        <a href="#demo4" data-toggle="collapse" class="fa fa-database fa-lg"> Databases</a></br>
  730.                <div class="collapse" id="demo4">
  731.  
  732.                ';
  733.                 if (!($conn = mysql_connect($servername, $username, $password)))
  734.     {
  735.     session_destroy();
  736.     session_unset();
  737.     header("location:?error");
  738.     }
  739.    
  740.             $result = mysql_query("SHOW DATABASES");
  741.  
  742.                 while ($row = mysql_fetch_array($result))
  743.     {
  744.       echo '<a href="?dbname='.$row[0].'" href="#demo3" data-parent="#MainMenu">'.$row[0].'</a>';
  745.     }
  746.  
  747.  
  748.  
  749.                 echo '</div>
  750.            </li>
  751.                        </br>
  752.           <li>
  753.               <a href="?info" class="fa fa-info-circle fa-lg" > System Info</a></br>
  754.           </li>
  755.           <li>
  756.               <a href="?phpinfo" class="fa fa-info fa-lg" > PHP Info</a></br>
  757.           </li>
  758.           <li>
  759.               <a href="?import';if (isset($_GET['dbname'])) {
  760.                 echo "&dbname=".$_GET['dbname'];
  761.                }
  762.                echo'" class="fa fa-upload fa-lg" > Import</a></br>
  763.           </li>
  764.             <li>
  765.               <a href="?export';if (isset($_GET['dbname'])) {
  766.                 echo "&dbname=".$_GET['dbname'];
  767.                }
  768.                echo'" class="fa fa-download fa-lg" > Export</a></br>
  769.           </li>
  770.           <li>
  771.               <a href="?sql';if (isset($_GET['dbname'])) {
  772.                 echo "&dbname=".$_GET['dbname'];
  773.                }
  774.                echo'" class="fa fa-terminal fa-lg" > Sql Query</a></br>
  775.           </li>
  776.  
  777.                  <li>
  778.                        <a href="#demo5" data-toggle="collapse" class="fa fa-code fa-lg">MySQL 2 php</a></br>
  779.                <div class="collapse" id="demo5">
  780.                <a href="#" data-toggle="collapse" data-parent="#SubMenu1">PHP Connect</a>
  781.                <div class="collapse list-group-submenu" id="SubMenu1">
  782.            <a href="#" class="list-group-item" data-parent="#SubMenu1">Subitem 1 a</a>
  783.            <a href="#" class="list-group-item" data-parent="#SubMenu1">Subitem 2 b</a>
  784.            </div>
  785.                <a href="?mysql2php&database">PHP Database</a>
  786.                <a href="?mysql2php&table">PHP Create Tables</a>
  787.                <a href="?mysql2php&insert">PHP Insert Data</a>
  788.                <a href="?mysql2php&update">PHP Update Data</a>
  789.                <a href="?mysql2php&delete">PHP Delete Data</a>
  790.                         </div>
  791.  
  792.                        </li>
  793.                        </br>
  794.            <li>
  795.               <a href="?users" class="fa fa-users fa-lg" > Users</a></br>
  796.           </li>
  797.      
  798.            <li>
  799.               <a href="?chart" class="fa fa-line-chart  fa-lg" > Chart</a></br>
  800.           </li>
  801.  
  802.            <li>
  803.               <a href="?search&';if (isset($_GET['dbname'])) {
  804.                 echo "dbname=".$_GET['dbname'];
  805.                }
  806.                echo'" class="fa fa-search fa-lg" > Search</a></br>
  807.           </li>
  808.  
  809.           <li>
  810.               <a href="?eng" class="fa fa-server fa-lg" > ENGINES</a></br>
  811.           </li>
  812.  
  813.            <li>
  814.               <a href="?kill" class="fa fa-trash-o fa-lg" > Kill</a></br>
  815.           </li>
  816.  
  817.            </ul>
  818.   </div>
  819.   ';
  820.   if (isset($_GET['popup']))
  821.     {
  822.     echo "<button class=\"btn btn-default\" id=\"menu-toggle\" onClick=\"JavaScript:window.close();\" style=\"width:100%\">Close Window</button>";
  823.     }
  824.     else
  825.     {
  826.     echo '<a href="#menu-toggle" class="btn btn-default" id="menu-toggle" style="width:100%">&#8592; Menu</a>';
  827.     }
  828.  
  829.   echo '
  830. <script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
  831.  
  832. <!-- Bootstrap Core JavaScript -->
  833. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  834.  
  835. <!-- Menu Toggle Script -->
  836. <script>
  837. $("#menu-toggle").click(function(e) {
  838.    e.preventDefault();
  839.    $("#wrapper").toggleClass("toggled");
  840. });
  841. </script>
  842.  
  843.  
  844. ';
  845.   ob_start();
  846.   headers();
  847.  
  848.   // Check connection
  849.  
  850.   if (!($conn = mysql_connect($servername, $username, $password)))
  851.     {
  852.  
  853.     // die("Connection failed: " . $conn->connect_error);
  854.  
  855.     session_destroy();
  856.     session_unset();
  857.     header("location:?error");
  858.     }
  859.  
  860.   $result = mysql_query("SHOW DATABASES");
  861.   echo '<h3><i class="fa fa-database fa-lg"> Databases </i> </h3><hr></hr>';
  862.   echo '<form method="POST">
  863.        <div class="form-inline"><div class="form-group input-group">
  864.        <span class="input-group-addon">Create Database</span>
  865.        <input type="text" class="form-control" name="CreateDatabase" id="inputError"></div>
  866.        <button type="submit" class="btn btn-default" name="dbmaker">Create</button>
  867.        </div></form>';
  868.   if (isset($_POST['dbmaker']))
  869.     {
  870.     if (!($conn = mysql_connect($servername, $username, $password)))
  871.       {
  872.       die("Connection failed: " . $conn->connect_error);
  873.       }
  874.  
  875.     $sql = 'CREATE DATABASE ' . $_POST['CreateDatabase'];
  876.  
  877.     sql($sql,$showbox="show");
  878.  
  879.     } //end of make db
  880.   echo '<input type="search" class="light-table-filter form-control" data-table="order-table" placeholder="Filter">';
  881.   echo "</br><code> Query : SHOW DATABASES </code><br><br />";
  882.   echo "<table class=\"order-table table\"><thead><tr><th>DataBase Name</th><th><i class=\"fa fa-minus-circle\"></i></th><th><i class=\"fa fa-area-chart\"></i></th></tr></thead><tbody>";
  883.   while ($row = mysql_fetch_array($result))
  884.     {
  885.     echo "<tr><td><a href=?dbname=" . $row[0] . ">" . $row[0] . "</a></td><td><a href='?drop=" . $row[0] . "'><i class=\"fa fa-minus-circle\"></i></a></td><td><a href='?chart&dbname=".$row[0]."'><i class=\"fa fa-area-chart\"></i></a></td></tr>";
  886.     } //shuru ka show database
  887.   echo "</tbody></table>";
  888.   if (isset($_GET['drop']))
  889.     {
  890.     $drop = $_GET['drop'];
  891.     $sql = "Drop Database $drop";
  892.  
  893.     checkingsql($sql);
  894.  
  895.     }
  896.   if (isset($_GET['checksql'])) {
  897.  
  898.       $sql=$_GET['checksql'];
  899.      
  900.       sql($sql);
  901.     }
  902.  
  903.   footer();
  904.  
  905.   // Show Tables From DataBase
  906.  
  907.   if (isset($_GET['dbname']))
  908.     {
  909.     ob_end_clean();
  910.     ob_start();
  911.     headers();
  912.     $dbname = $_GET['dbname'];
  913.  
  914.     // echo "<h3> Database :" . $dbname . "</h3></br>";
  915.  
  916.     echo '<div class="form-inline"><div class="form-group input-group">
  917.        <span class="input-group-addon">Create Table</span>
  918.        <form  method="GET">
  919.        <input type="text" class="form-control" name="Createtable" id="inputError"></div>
  920.        <div class="form-group input-group">
  921.        <span class="input-group-addon">COLUMNS</span>
  922.        <input type="number" class="form-control" name="COLUMNS" id="inputError" style="width: 5em;" value="1"/></div>
  923.        <input type="hidden" class="form-control" name="dbname" value="' . $_GET['dbname'] . '">
  924.        <button type="submit" class="btn btn-default">Create</button>
  925.        </div></br></hr>';
  926.     echo '<i class="fa fa-table fa-2x">
  927.        Tables From ' . $dbname . '</i><br /></br>';
  928.     $sql = "SHOW tables FROM $dbname";
  929.     echo "<code> Query : $sql </code><br /></br>";
  930.     $result = mysql_list_tables($dbname);
  931.     echo "<table class=\"table table-striped table-hover\"><thead><tr><th>Table Name</th><th>Define</th><th>Empty</th><th>Drop</th></tr></thead>";
  932.  
  933.     // echo"<tr>";
  934.  
  935.     while ($row = mysql_fetch_row($result))
  936.       {
  937.       print "<tr><td><a href='?dbname=$dbname&tbl=$row[0]'>$row[0]</a></td><td><a href='#' onclick=\"window.open('?define&dbname=$dbname&tbl=$row[0]&popup','1444238799072','toolbar=no,width=573,height=638,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=0,top=0');return false;\" > Define</a></td><td><a href='?dbname=$dbname&truncate=$row[0]'><i class=\"fa fa-paint-brush\"></i></a></td><td><a href='?dbname=$dbname&drop=$row[0]'><i class=\"fa fa-minus-circle\"></i></a></td></tr>";
  938.       }
  939.  
  940.     if (isset($_GET['truncate']))
  941.       {
  942.       $sql = "Truncate Table " . $_GET['dbname'].".".$_GET['truncate'];
  943.       checkingsql($sql);
  944.       }
  945.  
  946.     if (isset($_GET['drop']))
  947.       {
  948.       $sql = "Drop Table " .$_GET['dbname'].".".$_GET['drop'];
  949.       checkingsql($sql);
  950.       }
  951.  
  952.     // echo"</tr></table>";// end of while
  953.  
  954.     } // end of show Database Tables
  955.  
  956.   // Show Rows From Tables
  957.  
  958.   if (isset($_GET['tbl']))
  959.     {
  960.     ob_end_clean();
  961.     ob_start();
  962.     headers();
  963.  
  964.     // Check connection
  965.  
  966.     $tbl = $_GET['tbl'];
  967.     echo '<div class="main">';
  968.  
  969.     // echo "<h3> Database :".$dbname."</h3></br>";
  970.     // echo "<h3> Table :".$tbl."</h3></br>";
  971.  
  972.     $conn = new mysqli($servername, $username, $password);
  973.     $sql3 = "SHOW COLUMNS FROM $dbname.$tbl";
  974.     $sql = "Select * FROM $dbname.$tbl";
  975.     $result = mysqli_query($conn, $sql3);
  976.     echo '<input type="search" class="light-table-filter form-control" data-table="order-table" placeholder="Filter">';
  977.     echo "</br><code> Query : $sql </code><br /></br>";
  978.     sql($sql);
  979.     echo "</br>
  980.    <script>
  981.    $(document).ready(function(){
  982.    $(\"#flip\").click(function(){
  983.        $(\"#panel\").slideToggle(\"slow\");
  984.            });
  985.          });
  986.        </script>
  987.          ";
  988.              $sql="SHOW INDEX FROM $dbname.$tbl";
  989.           echo '<a id="flip">INDEXES+</a>
  990.                <div id="panel" style="display:none;">';sql($sql);echo'</div>';
  991.              
  992.               echo"</div>";
  993.  
  994.               footer();
  995.     } // end of show Database Tables
  996.  
  997.     if (isset($_POST['Update'])) {
  998.       # code...
  999.      echo "Update now ??";
  1000.     }
  1001.  
  1002.   if (isset($_GET['export']))
  1003.     {
  1004.     ob_end_clean();
  1005.     ob_start();
  1006.     headers();
  1007.     echo '<h3>Export Database</h3><hr></hr>';
  1008.     echo "When you export a database, you are creating a backup file of the database. This backup file is usually a .sql file (a text file), and can be used to copy and import the database onto another server. In this article we'll show you how to export your database.<br /></br>";
  1009.     echo '<h5>Select Database</h5>';
  1010.     echo '<form action="" method="POST" class="form-inline">
  1011.                <select name="dbname" class="form-control">';
  1012.     $result = mysql_query("SHOW DATABASES");
  1013.     echo '<h3><i class="fa fa-database fa-2x"> Databases : </i> </h3>';
  1014.      if ((isset($_GET['dbname']))) {
  1015.         echo "<option value='" . $_GET['dbname'] . "' selected>" . $_GET['dbname'] . "</option>";
  1016.       }
  1017.  
  1018.     while ($row = mysql_fetch_array($result))
  1019.       {
  1020.       echo "<option value='" . $row[0] . "'>" . $row[0] . "</option>";
  1021.       }
  1022.  
  1023.     echo '</select><select name="filetype" class="form-control">
  1024.  
  1025.                                <option value="filetype_sql">SQL</option>
  1026.                                <option value="filetype_txt">TXT</option>
  1027.  
  1028.                                        </select>
  1029.    <input type="submit" value="Export" class="btn btn-default" ></form>';
  1030.  
  1031.  
  1032.     if (isset($_POST['dbname']))
  1033.       {
  1034.       $DbName = $_POST['dbname'];
  1035.       function Export_Database($host, $user, $pass, $name, $tables = false, $backup_name = false)
  1036.         {
  1037.         $mysqli = new mysqli($host, $user, $pass, $name);
  1038.         $mysqli->select_db($name);
  1039.         $mysqli->query("SET NAMES 'utf8'");
  1040.         $queryTables = $mysqli->query('SHOW TABLES');
  1041.         while ($row = $queryTables->fetch_row())
  1042.           {
  1043.           $target_tables[] = $row[0];
  1044.           }
  1045.  
  1046.         if ($tables !== false)
  1047.           {
  1048.           $target_tables = array_intersect($target_tables, $tables);
  1049.           }
  1050.  
  1051.         foreach($target_tables as $table)
  1052.           {
  1053.           $result = $mysqli->query('SELECT * FROM ' . $table);
  1054.           $fields_amount = $result->field_count;
  1055.           $rows_num = $mysqli->affected_rows;
  1056.           $res = $mysqli->query('SHOW CREATE TABLE ' . $table);
  1057.           $TableMLine = $res->fetch_row();
  1058.           $content = (!isset($content) ? '' : $content) . "\n\n" . $TableMLine[1] . ";\n\n";
  1059.           for ($i = 0, $st_counter = 0; $i < $fields_amount; $i++, $st_counter = 0)
  1060.             {
  1061.             while ($row = $result->fetch_row())
  1062.               { //when started (and every after 100 command cycle):
  1063.               if ($st_counter % 100 == 0 || $st_counter == 0)
  1064.                 {
  1065.                 $content.= "\nINSERT INTO " . $table . " VALUES";
  1066.                 }
  1067.  
  1068.               $content.= "\n(";
  1069.               for ($j = 0; $j < $fields_amount; $j++)
  1070.                 {
  1071.                 $row[$j] = str_replace("\n", "\\n", addslashes($row[$j]));
  1072.                 if (isset($row[$j]))
  1073.                   {
  1074.                   $content.= '"' . $row[$j] . '"';
  1075.                   }
  1076.                   else
  1077.                   {
  1078.                   $content.= '""';
  1079.                   }
  1080.  
  1081.                 if ($j < ($fields_amount - 1))
  1082.                   {
  1083.                   $content.= ',';
  1084.                   }
  1085.                 }
  1086.  
  1087.               $content.= ")";
  1088.  
  1089.               // every after 100 command cycle [or at last line] ....p.s. but should be inserted 1 cycle eariler
  1090.  
  1091.               if ((($st_counter + 1) % 100 == 0 && $st_counter != 0) || $st_counter + 1 == $rows_num)
  1092.                 {
  1093.                 $content.= ";";
  1094.                 }
  1095.                 else
  1096.                 {
  1097.                 $content.= ",";
  1098.                 }
  1099.  
  1100.               $st_counter = $st_counter + 1;
  1101.               }
  1102.             }
  1103.  
  1104.           $content.= "\n\n\n";
  1105.           }
  1106.  
  1107.         // $backup_name = $backup_name ? $backup_name : $name."___(".date('H-i-s')."_".date('d-m-Y').")__rand".rand(1,11111111).".sql";
  1108.  
  1109.         $filetype = $_POST['filetype'];
  1110.         if ($filetype == "filetype_sql")
  1111.           {
  1112.           $backup_name = $backup_name ? $backup_name : $name . ".sql";
  1113.           $myfile = fopen("$backup_name", "w") or die("Unable to open file!");
  1114.           fwrite($myfile, $content);
  1115.           fclose($myfile);
  1116.           echo '<div class="alert alert-info fade in">
  1117.                   <a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">&#10008;</a>
  1118.                   <strong>Export : </strong> ' . $backup_name . ' Exported Successfully!
  1119.                   </div>';
  1120.           exit;
  1121.           }
  1122.           else
  1123.           {
  1124.           $backup_name = $backup_name ? $backup_name : $name . ".txt";
  1125.           $myfile = fopen("$backup_name", "w") or die("Unable to open file!");
  1126.           fwrite($myfile, $content);
  1127.           fclose($myfile);
  1128.           echo '<div class="alert alert-info fade in">
  1129.                                        <a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">&#10008;</a>
  1130.                                        <strong>Export : </strong> ' . $backup_name . ' Exported Successfully!
  1131.                                        </div>';
  1132.           exit;
  1133.           }
  1134.         }
  1135.  
  1136.       Export_Database($servername, $username, $password, $DbName, $tables = false, $backup_name = false);
  1137.       footer();
  1138.       }
  1139.     }
  1140.  
  1141.   if (isset($_GET["info"]))
  1142.     {
  1143.     ob_end_clean();
  1144.     ob_start();
  1145.     function convertByte($s)
  1146.       {
  1147.       if ($s >= 1073741824) return sprintf('%1.2f', $s / 1073741824) . ' GB';
  1148.       elseif ($s >= 1048576) return sprintf('%1.2f', $s / 1048576) . ' MB';
  1149.       elseif ($s >= 1024) return sprintf('%1.2f', $s / 1024) . ' KB';
  1150.         else return $s . ' B';
  1151.       }
  1152.  
  1153.     $ssys = "None";
  1154.     if (is_dir("/usr/local/cpanel"))
  1155.       {
  1156.       $ssys = "Running On Cpanel";
  1157.       }
  1158.     elseif (is_dir("/usr/local/directadmin"))
  1159.       {
  1160.       $ssys = "Running On Directadmin";
  1161.       }
  1162.  
  1163.     if (ini_get('safe_mode'))
  1164.       {
  1165.       $smde = " ON";
  1166.       }
  1167.       else
  1168.       {
  1169.       $smde = " OFF";
  1170.       }
  1171.  
  1172.     function showdisablefunctions()
  1173.       {
  1174.       if ($disablefunc = @ini_get("disable_functions"))
  1175.         {
  1176.         return "<span style='color:#00FF1E'>" . $disablefunc . "</span>";
  1177.         }
  1178.         else
  1179.         {
  1180.         return "<span style='color:#00FF1E'>None</span>";
  1181.         }
  1182.       }
  1183.  
  1184.     headers();
  1185.     echo "<h3 class=\"fa fa-cogs fa-3x\" > System Info </h3><br /></br><hr></hr>";
  1186.     echo "<table>";
  1187.     echo " <tr><th><span style='color:red;'><strong>System:</strong></span></th><td>" . php_uname() . "</td></tr>";
  1188.     echo "<tr><th><span style='color:red;'><strong>DataBase Connection : </strong></span></th><td><font color='green'>Connected successfully !</font></td></tr>";
  1189.     echo "<tr><th><span style='color:red;'><strong>PHP version:</strong></span></th><td> " . phpversion() . " on " . php_sapi_name() . "</td></tr>";
  1190.     echo "<tr><th><span style='color:red;'><strong>MySQL Server Version:</strong></span></th><td> " . mysql_get_server_info() . "</td></tr>";
  1191.     echo "<tr><th><span style='color:red;'><strong>MySQL Host Info:</strong></span></th><td> " . mysql_get_host_info() . "</td></tr>";
  1192.     echo "<tr><th><span style='color:red;'><strong>MySQL client info:</strong></span></th><td> " . mysql_get_client_info() . "</td></tr>";
  1193.     echo "<tr><th><span style='color:red;'><strong>MySQL protocol version:</strong></span></th><td> " . mysql_get_proto_info() . "</td></tr>";
  1194.     echo "<tr><th><span style='color:red;'><strong>WebServer:</strong></span></th><td> " . $_SERVER['SERVER_SOFTWARE'] . "</td></tr>";
  1195.     if (function_exists("disk_total_space"))
  1196.       {
  1197.       echo "<tr><th><span style='color:red;'><strong>Free Disk:</strong></span></th><td>" . convertByte(disk_free_space("/")) . " / " . convertByte(disk_total_space("/")) . "</td></tr>";
  1198.       }
  1199.  
  1200.  
  1201.       $arr=explode("GB",  convertByte(disk_free_space("/")) );
  1202.        $arr1=explode("GB",  convertByte(disk_total_space("/")) );
  1203.  
  1204.  
  1205.     echo "</table></br>";
  1206.     echo'
  1207.  
  1208.     <div class="panel-body">
  1209.                            <div class="flot-chart">
  1210.                          
  1211.                             <script type="text/javascript" src="https://www.google.com/jsapi"></script>
  1212.                              <script type="text/javascript">
  1213.      google.load("visualization", "1", {packages:["corechart"]});
  1214.      google.setOnLoadCallback(drawChart);
  1215.      function drawChart() {
  1216.  
  1217.        var data = google.visualization.arrayToDataTable([
  1218.          [\'disk_total_space\', \'GB Space\'],
  1219.          [\'Occupied Space\',   '. $arr[0] .' ],
  1220.          [\'Free Space\',    '. $arr1[0] .']
  1221.        ]);
  1222.  
  1223.        var options = {
  1224.          title: \'Total Free Space On Server\'
  1225.        };
  1226.  
  1227.        var chart = new google.visualization.PieChart(document.getElementById(\'piechart\'));
  1228.  
  1229.        chart.draw(data, options);
  1230.      }
  1231.    </script>
  1232.  </head>
  1233.  <body>
  1234.    <div id="piechart" style="width: 900px; height: 500px;"></div>
  1235.  </body>
  1236. </html>
  1237.  
  1238.  
  1239.                            </div>
  1240.                        </div>
  1241.    ';
  1242.     footer();
  1243.     }
  1244.  
  1245.   if (isset($_GET["phpinfo"]))
  1246.     {
  1247.     ob_end_clean();
  1248.     ob_start();
  1249.     headers();
  1250.     ob_start();
  1251.     phpinfo();
  1252.     $pinfo = ob_get_contents();
  1253.     ob_end_clean();
  1254.     echo "<style>
  1255.    #phpinfo {}
  1256. #phpinfo pre {}
  1257. #phpinfo a:link {}
  1258. #phpinfo a:hover {}
  1259. #phpinfo table {}
  1260. #phpinfo .center {}
  1261. #phpinfo .center table {}
  1262. #phpinfo .center th {}
  1263. #phpinfo td, th {}
  1264. #phpinfo h1 {}
  1265. #phpinfo h2 {}
  1266. #phpinfo .p {}
  1267. #phpinfo .e {}
  1268. #phpinfo .h {}
  1269. #phpinfo .v {}
  1270. #phpinfo .vr {}
  1271. #phpinfo img {}
  1272. #phpinfo hr {}
  1273. </style>";
  1274.     $pinfo = preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $pinfo);
  1275.     echo $pinfo;
  1276.     footer();
  1277.     }
  1278.  
  1279.   if (isset($_GET["import"]))
  1280.     {
  1281.     ob_end_clean();
  1282.     ob_start();
  1283.     headers();
  1284.     echo "<h3 class=\"fa fa-upload fa-2x \" > File to Import :</h3>";
  1285.     echo "<hr></hr>";
  1286.     echo "Upload [txt] or [sql] File.<br /></br>
  1287. PHP No Admin's ability to import databases makes it much easier to recover from disaster and even migrate a database from one server to another. Since the process is done through a web-based interface, you don't have to sit in front of the server to recover your database.<br /></br>";
  1288.     echo '
  1289. <form method=POST enctype="multipart/form-data" action="" class="form-inline">
  1290. <span class="btn btn-default btn-file"><input type="file" name="files" ></span>
  1291. <input type="submit" value="Import" class="btn btn-default" id="menu-toggle">
  1292. </form>
  1293. ';
  1294.     $files = @$_FILES["files"];
  1295.     if ($files["name"] != '')
  1296.       {
  1297.       $fullpath = $files["name"];
  1298.       if (move_uploaded_file($files['tmp_name'], $fullpath))
  1299.         {
  1300.         echo "<h5>Data Imported From $fullpath Successfully</h5>";
  1301.         $file = fopen($fullpath, "r");
  1302.         while (!feof($file))
  1303.           {
  1304.           $import = fgets($file);
  1305.           // $sql = mysql_query($import);
  1306.           // if (!($conn = mysql_connect($servername, $username, $password)))
  1307.           //  {
  1308.           //  die("Connection failed: " . $conn->connect_error);
  1309.           //  }
  1310.           sql($import);
  1311.  
  1312.           }
  1313.  
  1314.         fclose($file);
  1315.         }
  1316.       }
  1317.  
  1318.     footer();
  1319.     }
  1320.  
  1321.   // user priviledges
  1322.  
  1323.   if (isset($_GET["users"]))
  1324.     {
  1325.     ob_end_clean();
  1326.     ob_start();
  1327.     headers();
  1328.     echo "<h1 class=\"fa fa-user-secret fa-3x\" > User Priviledges </h1><br /></br>";
  1329.     $conn = new mysqli($servername, $username, $password);
  1330.     $sql = "SELECT * From mysql.user";
  1331.     echo "<code> Query : $sql </code><br /></br>";
  1332.     sql($sql);
  1333.     // $result = $conn->query($sql);
  1334.     // echo '<table>';
  1335.     // echo "<tr><th>Host</th><th>User</th><th>Password</th><th>Private</th><th>Update Private<th>Delete Private</th><th>Password Expired</th></tr>";
  1336.     // if ($result->num_rows > 0)
  1337.     //  {
  1338.  
  1339.     //  // output data of each row
  1340.  
  1341.     //  while ($row = $result->fetch_assoc())
  1342.     //    {
  1343.     //    echo "<tr><td>" . $row["Host"] . "</td><td>" . $row["User"] . "</td><td>" . $row["Password"] . "</td><td>" . $row["Select_priv"] . "</td><td>" . $row["Update_priv"] . "<td>" . $row["Delete_priv"] . "</td><td>" . $row['password_expired'] . "</td></tr>";
  1344.     //    }
  1345.  
  1346.     //  echo '</table>
  1347.   //                       <br />
  1348.   //                       </br>';
  1349.     //
  1350.     //  }
  1351.     //   else
  1352.     //  {
  1353.     //  echo "0 results";
  1354.     //  }
  1355.  
  1356.     // $conn->close();
  1357.       echo '<div class="form-inline"><div class="form-group input-group">
  1358.        <span class="input-group-addon"><i class="fa fa-user-plus"> Username</i></span>
  1359.        <form  method="POST">
  1360.        <input type="text" class="form-control" name="newuser" id="inputError"></div>
  1361.        <div class="form-group input-group">
  1362.        <span class="input-group-addon"><i class="fa fa-unlock-alt"> Password</i></span>
  1363.        <input type="password" class="form-control" name="newpass" id="inputError"/></div>
  1364.         <button type="submit" class="btn btn-default" name="createnewuser">Create New User</button>
  1365.      </div></br></hr>';
  1366.  
  1367.     footer();
  1368.     }
  1369.  
  1370.   if (isset($_POST['createnewuser']))
  1371.     {
  1372.     $sql = "CREATE USER '" . $_POST["newuser"] . "'@'localhost' IDENTIFIED BY '" . $_POST["newpass"] . "';";
  1373.     sql($sql);
  1374.     }
  1375.  
  1376.   if (isset($_GET['sql']))
  1377.     {
  1378.     ob_end_clean();
  1379.     ob_start();
  1380.     headers();
  1381.     echo '<h3>Run SQL Queries </h3>';
  1382.     echo '<hr></hr>';
  1383.     echo 'SQL queries are commands that you issue to the MySQL server to tell it to perform various functions. Designed for advanced users, this allows you to quickly make changes to your database simply by issuing the appropriate commands.<br /></br>';
  1384.     echo '<form action="" method="POST"><textarea name="sqlquery" id="code">';
  1385.     if (isset($_GET['sqls']))
  1386.       {
  1387.       $sql = $_GET['sqls'];
  1388.       echo $sql;
  1389.       }
  1390.  
  1391.     echo '</textarea><br /></br><input type="submit"  value="GO" class="btn btn-default" id="menu-toggle"></form>';
  1392.     echo '<script>
  1393.    var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  1394.    mode: "text/x-mysql",
  1395.    lineNumbers: true,
  1396.    indentUnit: 4,
  1397.    tabMode: "indent",
  1398.    matchBrackets: true
  1399.  });
  1400. </script>';
  1401.     if (isset($_POST['sqlquery']))
  1402.       {
  1403.       $sql = $_POST['sqlquery'];
  1404.       sql($sql);
  1405.       }
  1406.     }
  1407.  
  1408.   if (isset($_GET['search']))
  1409.     {
  1410.     ob_end_clean();
  1411.     ob_start();
  1412.     headers();
  1413.     echo '<h3 class="fa fa-search fa-3x" > Search </h3>';
  1414.     echo '<hr></hr>';
  1415.     echo '<br /></br>This section describes the Search sub-page where single-table search is available.
  1416.  
  1417. The main use for the tool for some users is with the Search mode, for finding and updating data. For this, the phpNOAdmin team has made it possible to define which sub-page is the starting page in Table view<br /></br>';
  1418.     if (!(isset($_POST["dbname"]) || isset($_GET["dbname"])))
  1419.     {
  1420.     echo '<h5>Select Database</h5>';
  1421.     echo '<form action="" method="POST" >
  1422.                <select name="dbname" class="form-inline form-group glyphicon glyphicon-search">';
  1423.     $result = mysql_query("SHOW DATABASES");
  1424.     echo '<h3><i class="fa fa-database fa-2x"> Databases : </i> </h3>';
  1425.     while ($row = mysql_fetch_array($result))
  1426.       {
  1427.       echo "<option value='" . $row[0] . "'>" . $row[0] . "</option>";
  1428.       }
  1429.  
  1430.     echo '</select>&nbsp;&nbsp;&nbsp;<input type="submit" value="Select Database" class="btn btn-default"></form>';
  1431.     }
  1432.     else
  1433.       {
  1434.         if (isset($_POST["dbname"])) {
  1435.           $dbname = $_POST["dbname"];
  1436.         }
  1437.         elseif (isset($_GET["dbname"])){
  1438.            $dbname = $_GET["dbname"];
  1439.         }
  1440.      
  1441.       echo '<h5>Select Tables From Database ' . $dbname . '</h5>';
  1442.       echo '<form action="" method="POST" >
  1443.            <input type="hidden" value="' . $dbname . '" name="dbname"/>
  1444.            <select name="tbname" class="form-inline glyphicon glyphicon-search">';
  1445.       $result = mysql_query("SHOW tables FROM $dbname");
  1446.       echo '<h3><i class="fa fa-database fa-2x"> Databases : </i> </h3>';
  1447.       while ($row = mysql_fetch_array($result))
  1448.         {
  1449.         echo "<option value='" . $row[0] . "'>" . $row[0] . "</option>";
  1450.         }
  1451.  
  1452.       echo '</select>&nbsp;&nbsp;&nbsp;<input type="submit" value="Select Table" class="btn btn-default" ></form>';
  1453.       }
  1454.  
  1455.     if (isset($_POST["tbname"]))
  1456.       {
  1457.       $dbname = $_POST["dbname"];
  1458.       $tbname = $_POST["tbname"];
  1459.       echo '<form action="" method="POST">
  1460.                        <input type="hidden" value="' . $dbname . '" name="dbname"/>
  1461.                        <input type="hidden" value="' . $tbname . '" name="tbname"/>
  1462.  
  1463.                        <table class="data" style="margin: 0px 0px 12px; color: rgb(68, 68, 68); font-family: sans-serif; font-size: 13.1199998855591px; background-color: rgb(255, 255, 255);"><tbody><tr class="noclick odd" style="background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"><td style="padding: 0.3em; margin: 0.1em; vertical-align: top; text-shadow: rgb(255, 255, 255) 0px 1px 0px;"><select name="databasename" style="margin: 6px; font-size: 1em; color: rgb(51, 51, 51); outline: none; transition: all 0.2s; border-radius: 2px; border-color: rgb(187, 187, 187); padding: 3px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">';
  1464.       $result = mysql_query("SHOW COLUMNS FROM $dbname.$tbname");
  1465.       echo '<h3><i class="fa fa-database fa-2x"> Databases : </i> </h3>';
  1466.       while ($row = mysql_fetch_array($result))
  1467.         {
  1468.         echo "<option value='" . $row[0] . "'>" . $row[0] . "</option>";
  1469.         }
  1470.  
  1471.       echo '</select></td>
  1472.  
  1473. <td style="padding: 0.3em; margin: 0.1em; vertical-align: top; text-shadow: rgb(255, 255, 255) 0px 1px 0px;">';
  1474.       echo '<select name="like" style="margin: 6px; font-size: 1em; color: rgb(51, 51, 51); outline: none; transition: all 0.2s; border-radius: 2px; border-color: rgb(187, 187, 187); padding: 3px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"><option value="=">=</option><option value=">">&gt;</option><option value=">=">&gt;=</option><option value="<">&lt;</option><option value="<=">&lt;=</option><option value="!=">!=</option><option value="LIKE">LIKE</option><option value="LIKE %">LIKE %...%</option><option value="NOT LIKE">NOT LIKE</option><option value="IN">IN (...)</option><option value="NOT IN">NOT IN (...)</option><option value="BETWEEN">BETWEEN</option><option value="NOT BETWEEN">NOT BETWEEN</option><option value="IS NULL">IS NULL</option><option value="IS NOT NULL">IS NOT NULL</option></select></td><td data-type="int(11)" style="padding: 0.3em; margin: 0.1em; vertical-align: top; text-shadow: rgb(255, 255, 255) 0px 1px 0px;"><input type="text" name="value_to_search" size="20" class="textfield" id="fieldID_0" style="margin: 6px; font-size: 1em; color: rgb(85, 85, 85); outline: none; border-radius: 2px; border: 1px solid rgb(124, 124, 124); padding: 4px; transition: all 0.2s; box-shadow: rgb(170, 170, 170) 0px 1px 3px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"></td>
  1475. <td><input type="submit" value="GO" class="btn btn-default"></td></tr></tbody></table>
  1476. </form>';
  1477.       } // end of if is set db name
  1478.     } // end of search
  1479.   if (isset($_POST['databasename']))
  1480.     {
  1481.  
  1482.     // Testing
  1483.  
  1484.     ob_end_clean();
  1485.     ob_start();
  1486.     headers();
  1487.  
  1488.     // Testing
  1489.  
  1490.     $tbname = $_POST["tbname"];
  1491.     $feild = $_POST['databasename'];
  1492.     $like = $_POST['like'];
  1493.     $value_to_search = $_POST['value_to_search'];
  1494.     $Sql = "SELECT * FROM $dbname.$tbname WHERE $feild $like '$value_to_search'";
  1495.  
  1496.     // $Sql="SELECT * FROM $dbname.CHARACTER_SETS WHERE $databasename $like '$value_to_search'";
  1497.  
  1498.     echo "<br /></br><code> Query : $Sql </code>";
  1499.  
  1500.     sql($Sql);
  1501.  
  1502.     footer();
  1503.     }
  1504.  
  1505.   if (isset($_GET['define']))
  1506.     {
  1507.     ob_end_clean();
  1508.     ob_start();
  1509.     headers();
  1510.     $dbname = $_GET['dbname'];
  1511.     $tbl = $_GET['tbl'];
  1512.     $Sql = "DESCRIBE $dbname.$tbl";
  1513.     echo "<code> Query : $Sql </code><br /></br>";
  1514.  
  1515.       sql($Sql);
  1516.     }
  1517.  
  1518.   if (isset($_GET['chart']))
  1519.     {
  1520.     ob_end_clean();
  1521.     ob_start();
  1522.     headers();
  1523.     echo '<h3 class="fa fa-area-chart fa-3x" > Hierarchical Database Model</h3>';
  1524.     echo '<hr></hr>
  1525.    A hierarchical database model is a data model in which the data is organized into a tree-like structure. The data is stored as records which are connected to one another through links. A record is a collection of fields, with each field containing only one value. The entity type of a record defines which fields the record contains.
  1526.  
  1527.    <br></br>';
  1528.     echo "
  1529.                <script type='text/javascript' src='https://www.google.com/jsapi'></script>  
  1530.                <script type='text/javascript'>  
  1531.                google.load('visualization', '1', {packages:['orgchart']});  
  1532.                google.setOnLoadCallback(drawChart);  
  1533.                function drawChart() {  
  1534.                var data = new google.visualization.DataTable();  
  1535.                data.addColumn('string', 'Node');  
  1536.                data.addColumn('string', 'Parent');  
  1537.                ";
  1538.     if (isset($_GET['dbname']))
  1539.       {
  1540.       $dbname = $_GET['dbname'];
  1541.       echo "data.addRows([ ";
  1542.       echo "['" . $dbname . "', ''],";
  1543.       $sql = "SHOW TABLES FROM " . $dbname;
  1544.       $result = mysql_query($sql);
  1545.       while ($rows = mysql_fetch_row($result))
  1546.         {
  1547.         echo "['" . $rows[0] . "','" . $dbname . "'],";
  1548.         }
  1549.  
  1550.       echo "]);
  1551.                        var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));  
  1552.                        chart.draw(data);  
  1553.                                }  
  1554.                        </script>  
  1555.  
  1556.                        <center><div id='chart_div'></div></center>
  1557.  
  1558.                        ";
  1559.       }
  1560.       else
  1561.       {
  1562.         echo "data.addRows([ ";
  1563.         $result = mysql_query("SHOW DATABASES");
  1564.         while ($row = mysql_fetch_array($result)) {
  1565.             echo "['" . $row[0] . "', 'Databases'],";
  1566.            }
  1567.  
  1568.  
  1569.         echo "]);
  1570.                        var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));  
  1571.                        chart.draw(data);  
  1572.                                }  
  1573.                        </script>  
  1574.  
  1575.                        <center><div id='chart_div'></div></center>
  1576.  
  1577.                        ";
  1578.       }
  1579.     }
  1580.  
  1581.   if (isset($_GET['Createtable']))
  1582.     {
  1583.     ob_end_clean();
  1584.     ob_start();
  1585.     headers();
  1586.     echo "Create Table " . $_GET['Createtable'] . "." . $_GET['dbname'];
  1587.     echo '<form method="POST">
  1588.  
  1589.        <div class="form-group">
  1590.        <div class="form-group input-group">
  1591.        <span class="input-group-addon">Table Name</span>
  1592.        <input type="text" class="form-control" name="tablename" id="inputError" value="' . $_GET['Createtable'] . '">
  1593.        </div></div>';
  1594.     for ($i = 0; $i < $_GET['COLUMNS']; $i++)
  1595.       {
  1596.       echo '<div class="form-group">
  1597.        <div class="form-group input-group">
  1598.        <span class="input-group-addon">Name</span>
  1599.        <input type="text" class="form-control" name="colname" id="inputError">
  1600.        </div>
  1601.        <select class="form-control" name="type'.$i.'">
  1602.        <option value="int">Int</option>
  1603.        <option value="varchar">varchar</option>
  1604.        <option value="text">text</option>
  1605.        <option value="date">date</option>
  1606.        <optgroup label="Numeric">
  1607.        <option value="INT">INT</option>
  1608.        <option value="TINYINT">TINYINT</option>
  1609.        <option value="SMALLINT">SMALLINT</option>
  1610.        <option value="MEDIUMINT">MEDIUMINT</option>
  1611.        <option value="BIGINT">BIGINT</option>
  1612.        <option value="FLOAT">FLOAT</option>
  1613.        <option value="DOUBLE">DOUBLE</option>
  1614.        <option value="DECIMAL">DECIMAL</option>
  1615.        <optgroup label="Date and Time">
  1616.        <option value="DATE">DATE</option>
  1617.        <option value="DATETIME">DATETIME</option>
  1618.        <option value="TIMESTAMP">TIMESTAMP</option>
  1619.        <option value="TIME">TIME</option>
  1620.        <option value="YEAR">YEAR</option>
  1621.        <optgroup label="String">
  1622.        <option value="CHAR">CHAR</option>
  1623.        <option value="VARCHAR">VARCHAR</option>
  1624.        <option value="BLOB">BLOB</option>
  1625.        <option value="TEXT">TEXT</option>
  1626.        <option value="TINYTEXT">TINYTEXT</option>
  1627.        <option value="MEDIUMTEXT">MEDIUMTEXT</option>
  1628.        <option value="LONGTEXT">LONGTEXT</option>
  1629.        <option value="ENUM">ENUM</option>
  1630.        </select>
  1631.        <div class="form-group input-group">
  1632.        <span class="input-group-addon">Length/Values</span>
  1633.        <input type="text" class="form-control" name="length'.$i.'" id="inputError">
  1634.        </div>
  1635.        </div>
  1636.        <div class="form-group">
  1637.        <select class="form-control" name="default">
  1638.        <option value="None">None</option>
  1639.        <option value="NULL">NULL</option>
  1640.        <option value="int">Int</option>
  1641.        <option value="int">Int</option>
  1642.        </select>
  1643.        <select class="form-control" name="collation">
  1644.        </select>
  1645.        <select class="form-control" name="attributes">
  1646.        </select>
  1647.        <div class="form-group input-group">
  1648.        <label>NULL</label>
  1649.        <input name="null'.$i.'" type="checkbox" value="null" class="allow_null">
  1650.        </div>
  1651.        <div class="form-group input-group">
  1652.        <span class="input-group-addon">Index</span>
  1653.        <select class="form-control" name="index" id="inputError">
  1654.        <option value="PRIMARY">PRIMARY</option>
  1655.        <option value="UNIQUE">UNIQUE</option>
  1656.        <option value="INDEX">INDEX</option>
  1657.        <option value="FULLTEXT">FULLTEXT</option>
  1658.        </select>
  1659.        </div>
  1660.  
  1661.        <div class="form-group input-group">
  1662.        <label>AUTO_INCREMENT</label>
  1663.        <input name="AUTO_INCREMENT'.$i.'" type="checkbox" value="AUTO_INCREMENT">
  1664.        </div>
  1665.        <div class="form-group input-group">
  1666.        <span class="input-group-addon">Comments</span>
  1667.        <input type="text" class="form-control" name="comments'.$i.'" id="inputError">
  1668.        </div>
  1669. ';
  1670.       }
  1671.  
  1672.     echo '<button type="submit" class="btn btn-default" name="tbmaker">Create</button>
  1673.        </div>
  1674.        </div>
  1675.        </form>';
  1676.     footer();
  1677.     }
  1678.  
  1679.   if (isset($_GET['kill']))
  1680.     {
  1681.  
  1682.     echo "
  1683.  <script>
  1684.  var txt;
  1685.  var r =  confirm(\"Do You Want To Kill Me ! \\n:( \");
  1686.  if (r == true) {
  1687.      window.location.assign(\"?killed\");
  1688.  } else {
  1689.                alert('Thanx For Spearing My Life :)');
  1690.  }
  1691.       </script>
  1692.       ";
  1693.     }
  1694.  
  1695.   if (isset($_POST['tbmaker']))
  1696.     {
  1697.       $tablename = $_POST['tablename'];
  1698.       $db = $_GET['dbname'];
  1699.       $index = $_POST['index'];
  1700.       $AUTO_INCREMENT = $_POST['AUTO_INCREMENT'];
  1701.  
  1702.     for($i=0;$i<=$_GET['COLUMNS'];$i++){
  1703.  
  1704.      $colname.$i = $_POST["colname$i"];
  1705.      $length.$i = $_POST['length'.$i];
  1706.      $type.$i = $_POST['type'.$i];
  1707.      $null.$i = $_POST['null'.$i];
  1708.  
  1709.                     }
  1710.  
  1711.  
  1712.  
  1713.  
  1714.     // CREATE TABLE MyGuests (
  1715.     // id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  1716.     // firstname VARCHAR(30) NOT NULL,
  1717.     // lastname VARCHAR(30) NOT NULL,
  1718.     // email VARCHAR(50),
  1719.     // reg_date TIMESTAMP
  1720.     // )
  1721.  
  1722.     echo $sql="CREATE TABLE ".$tablename.".".$db."(";
  1723.  
  1724.       for($i=0;$i<=$_GET['COLUMNS'];$i++){
  1725.        
  1726.         echo $colname.$i." ".$type."(".$length.") ".$AUTO_INCREMENT." ".$index." ,";
  1727.        
  1728.         }  
  1729.  
  1730.  
  1731.       echo ")";
  1732.  
  1733.  
  1734.  
  1735.     // $url = explode("\r\n", $_POST['url']);
  1736.     // $sql="CREATE TABLE `$db`.`$tablename` ( `$colname` $type($length) NOT NULL ) ENGINE = InnoDB;";
  1737.  
  1738.  
  1739.     // CREATE TABLE MyGuests (
  1740.     // id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  1741.     // firstname VARCHAR(30) NOT NULL,
  1742.     // lastname VARCHAR(30) NOT NULL,
  1743.     // email VARCHAR(50),
  1744.     // reg_date TIMESTAMP
  1745.     // )
  1746.  
  1747.     //$sql = "CREATE TABLE `$db`.`$tablename` ( `$colname` $type($length) NOT NULL ) ENGINE = InnoDB;";
  1748.     echo '<div class="row">
  1749.        <div class="col-lg-12">';
  1750.     sql($sql);
  1751.     echo '</div>
  1752.        </div>';
  1753.   //  footer();
  1754.     }
  1755.  
  1756.   if (isset($_GET['mysql2php']))
  1757.     {
  1758.     ob_end_clean();
  1759.     ob_start();
  1760.     headers();
  1761.     function phpmaker()
  1762.       {
  1763.       echo '<?php
  1764. $servername = "' . $GLOBALS['servername'] . '";
  1765. $username = "' . $GLOBALS['username'] . '";
  1766. $password = "' . $GLOBALS['password'] . '";
  1767.  
  1768.  
  1769.  
  1770. // Create connection
  1771.  
  1772.  
  1773. $conn = new mysqli($servername, $username, $password);
  1774.  
  1775.  
  1776.  
  1777. // Check connection
  1778.  
  1779.  
  1780. if ($conn->connect_error) {
  1781.   die("Connection failed: " . $conn->connect_error);
  1782. }
  1783. echo "Connected successfully";
  1784. ';
  1785.       }
  1786.  
  1787.     echo '<h3 class="fa fa-code fa-3x">MySQL 2 php</h3><hr></hr>';
  1788.     echo "Mysql 2 Php Converts your Mysql Queries To php in one click Just Select The Type and Let Mysql Do the rest work !<br /></br>";
  1789.     echo '
  1790.       <form action=""method="POST">
  1791.       <textarea class="form-control" name="converter" id="code">';
  1792.     if (isset($_GET['connect']))
  1793.       {
  1794.       echo phpmaker() . "?>";
  1795.       }
  1796.     elseif (isset($_GET['database']))
  1797.       {
  1798.       echo phpmaker() . '// Create database
  1799.                        $sql = "CREATE DATABASE' . $_GET['database'] . '
  1800.                        if ($conn->query($sql) === TRUE) {
  1801.   echo "Database created successfully";
  1802. } else {
  1803.   echo "Error creating database: " . $conn->error;
  1804. }
  1805.  
  1806. $conn->close();
  1807. ?>';
  1808.       }
  1809.     elseif (isset($_GET['table']))
  1810.       {
  1811.  
  1812.       // http://localhost/test.php?mysql2php&table&dbname=information_schema&tbl=CHARACTER_SETS
  1813.  
  1814.       $dbname = $_GET['dbname'];
  1815.       $tbl = $_GET['tbl'];
  1816.       echo phpmaker() . '$sql = "INSERT INTO ' . $dbname . '.' . $tbl . ' (';
  1817.       getrows($dbname, $tbl);
  1818.       echo ')
  1819. VALUES (\'John\', \'Doe\', \'john@example.com\')";
  1820.  
  1821. if ($conn->query($sql) === TRUE) {
  1822.   echo "New record created successfully";
  1823. } else {
  1824.   echo "Error: " . $sql . "<br />" . $conn->error;
  1825. }
  1826.  
  1827. $conn->close();
  1828. ?>';
  1829.       }
  1830.  
  1831.     echo '</textarea>
  1832.                <script>
  1833.                        var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  1834.                        mode: "text/x-mysql",
  1835.                        tabMode: "indent",
  1836.                        matchBrackets: true
  1837.                                });
  1838.                </script>
  1839.       </br>
  1840.       <input class="btn btn-default" type="submit" name="start_converting" value="Convert"/>
  1841.       </form>
  1842.       ';
  1843.     if (isset($_GET['start_converting']))
  1844.       {
  1845.       }
  1846.     }
  1847.  
  1848.   if (isset($_GET['killed']))
  1849.     {
  1850.     session_destroy();
  1851.     session_unset();
  1852.     unlink(__FILE__);
  1853.     header("location:?");
  1854.     }
  1855.  
  1856.   if (isset($_GET['logout']))
  1857.     {
  1858.     session_destroy();
  1859.     session_unset();
  1860.     header("location:?");
  1861.     }
  1862.   } // end of else connection in start
  1863.  
  1864.  
  1865.  
  1866.   if (isset($_GET['status'])) {
  1867.     ob_end_clean();
  1868.     ob_start();
  1869.     headers();
  1870.  
  1871.     $sql="SHOW GLOBAL STATUS;";
  1872.     sql($sql);
  1873.   }
  1874.  
  1875.  
  1876.   if (isset($_GET['eng'])) {
  1877.     ob_end_clean();
  1878.     ob_start();
  1879.     headers();
  1880.     $sql="SHOW ENGINES;";
  1881.     sql($sql);
  1882.   }
  1883.  
  1884.  
  1885.  
  1886. ?>
  1887. </body>
  1888. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement