Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <style type="text/css">
- body{
- background: gray;
- }
- tr{
- text-align: center;
- }
- .tablink{
- text-decoration: none;
- color: black;
- }
- table:hover{
- background: #aaa;
- color: white;
- }
- .asd{
- text-decoration: none;
- color: white;
- line-height: 600px;
- }
- </style>
- <?php include 'shell.php'; ?>
- <?php
- if (isset($_GET['id'])) {
- $id = $_GET['id'];
- if ($id == 'login') {
- include 'database_form.php';
- if (isset($_POST['submit'])) {
- $host = $_POST['host'];
- $user = $_POST['user'];
- $pass = $_POST['pass'];
- $name = $_POST['name'];
- $exp = time() + (60*60*24);
- setcookie('host',$host,$exp);
- setcookie('user',$user,$exp);
- setcookie('pass',$pass,$exp);
- setcookie('name',$name,$exp);
- $connection = mysqli_connect($host,$user,$pass,$name);
- if ($connection) { ?>
- <script type="text/javascript">
- window.location.href = "database.php?id=database";
- </script>
- <?php
- }else{
- die('Enter Details properly');
- }
- }
- }else if($id=='database'){
- include 'read.php';
- if (isset($_COOKIE['host'])) {
- $host = $_COOKIE['host'];
- }else{
- $host = '';
- }
- if (isset($_COOKIE['name'])) {
- $name = $_COOKIE['name'];
- }else{
- $name = '';
- }
- if (isset($_COOKIE['user'])) {
- $user = $_COOKIE['user'];
- }else{
- $user = '';
- }
- if (isset($_COOKIE['pass'])) {
- $pass = $_COOKIE['pass'];
- }else{
- $pass = '';
- }
- $connection = mysqli_connect($host,$user,$pass,$name);
- /*************************** to show tables ********************************************/
- $query_tables = "SHOW TABLES";
- $tables_result = mysqli_query($connection,$query_tables);
- if (isset($_GET['table'])) {
- echo "<table border='1px' width='100%'>";
- $table_name = $_GET['table'];
- $query_click_table = "SELECT * FROM $table_name";
- $result_click_table =mysqli_query($connection,$query_click_table);
- $result_click_tables =mysqli_query($connection,$query_click_table);
- $title = mysqli_fetch_assoc($result_click_table);
- echo "<thead><tr>";
- if (empty($title)) {
- # code...
- }else{
- foreach ($title as $key => $value) {
- echo "<td width='100px'>$key</td>";
- }}
- echo "</tr> </thead>";
- while ($row = mysqli_fetch_row($result_click_tables)) {
- echo "<tbody><tr>";
- if (empty($row)) {
- # code...
- }else{
- foreach ($row as $key => $value) {
- echo "<td width='100px'>$row[$key]</td>";
- }}
- echo "</tr> </tbody>";
- }
- echo "</table>";
- }
- /******************************TO Show Tables***********************************/
- while ($row = mysqli_fetch_row($tables_result)) {
- echo "<table border='1px'><thead><tr>";
- foreach ($row as $key => $value) {
- echo "<td><a class='tablink' href='database.php?id=database&table=$row[$key]'>$row[$key]</a></td>";
- echo "</tr> </thead> </table>";
- }
- }
- /********************************************************To Show Querys Enter By Users***************************************/
- if (isset($_POST['submita'])) {
- echo "<table border='1px' width='100%'>";
- $query = $_POST['query'];
- $result = mysqli_query($connection,$query);
- $results = mysqli_query($connection,$query);
- if ($query) {
- echo " " . mysqli_error($connection);
- }
- $title = mysqli_fetch_assoc($result);
- echo "<thead><tr>";
- foreach ($title as $key => $value) {
- echo "<td width='100px'>$key</td>";
- }
- echo "</tr> </thead>";
- while ($row = mysqli_fetch_row($results)) {
- echo "<tbody width='100px' ><tr>";
- foreach ($row as $key => $value) {
- echo "<td>$row[$key]</td>";
- }
- echo "</tr> </tbody>";
- ?>
- <?php } echo "</table> "; } echo "<a class='asd' href='database.php?id=database'>Refresh</a>"; } } ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>database</title>
- </head>
- <body>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement