Shadow-Here


Server : Apache
System : Linux methusalix2 3.16.0-11-amd64 #1 SMP Debian 3.16.84-1 (2020-06-09) x86_64
User : hios ( 1437)
PHP Version : 5.6.40-0+deb8u12
Disable Function : proc_close,proc_open,dl,shell_exec,passthru
Directory :  /home/priorityservice-prod.1697609600/wps-entry/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :
Current File : /home/priorityservice-prod.1697609600/wps-entry/test.php___
<?php 
error_reporting(E_ALL);
ini_set('display_errors', 1);

mb_internal_encoding('UTF-8');
mb_http_output('UTF-8');


$available = array(1,2,3,4,5,6,7);

?><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Webasto DB Encryption</title>
</head>
<body>
<pre>Available tests: <strong><?=implode(", ", $available);?></strong><br>
<strong>1</strong>: <a href="/test.php?test=1">sqlsrv</a> (could not find driver) http://php.net/manual/en/ref.pdo-sqlsrv.connection.php<br>
<strong>2</strong>: <a href="/test.php?test=2">dblib</a> (working / wrong encoding) http://php.net/manual/en/ref.pdo-dblib.connection.php<br>
<strong>3</strong>: <a href="/test.php?test=3">mssql</a> (could not find driver) http://php.net/manual/en/ref.pdo-dblib.connection.php<br>
<strong>4</strong>: <a href="/test.php?test=4">odbc+freetds 1</a> (using host,port) http://php.net/manual/en/ref.pdo-odbc.connection.php<br>
<strong>5</strong>: <a href="/test.php?test=5">odbc+freetds 2</a> (using servername, without encrypt in dsn) http://php.net/manual/en/ref.pdo-odbc.connection.php<br>
<strong>6</strong>: <a href="/test.php?test=6">odbc+freetds 3</a> (using servername, with encrypt in dsn) http://php.net/manual/en/ref.pdo-odbc.connection.php<br>
<strong>7</strong>: <a href="/test.php?test=7">odbc+freetds 4 + TDS_Version=7.2</a> (using servername, with encrypt in dsn) http://php.net/manual/en/ref.pdo-odbc.connection.php<br>
See "DSN prefix" at the provided php.net links<br>
<?php

if(isset($_GET['test'])) { 

//	$host = '37.203.59.139'; // old ip
    $host = '37.203.59.142'; // new ip
    
    $userFreetds = 'S24KoerblerVirtual';
	$user = 'S24Koerbler';
	$pass = 'K86BICeRxIwDwNKjpTeb';
	$port = '1433';
	$db   = 'TS_S24_KOERBLER_TEST';


	if(in_array($_GET['test'], $available)) { 
		echo 'Test ran: ';
		switch($_GET['test']) { 
			case 1: 
				try { 
				
					echo '<strong>sqlsrv</stron><br>';
					$handle = new PDO ("sqlsrv:host=$host:$port;Database=$db;Encrypt=1;TrustServerCertificate=1","$user","$pass");
				}catch(PDOException  $ex) { 
					echo "Failed to get DB handle: " . $ex->getMessage()."<br>";
					die();
				}
				// Result: Failed to get DB handle: could not find driver 
				
				break;
			case 2: 
				try { 
					echo '<strong>dblib</strong><br>';
					$handle = new PDO ("dblib:host=$host:$port;dbname=$db;Database=$db;Encrypt=1;TrustServerCertificate=1","$user","$pass");
				}catch(PDOException  $ex) { 
					echo "Failed to get DB handle: " . $ex->getMessage() . "<br>";
					die();
				}
				// Result: Working
			
				break;
			case 3: 
				try { 
					echo '<strong>mssql</strong><br>';
					$handle = new PDO ("mssql:host=$host:$port;dbname=$db;Database=$db;Encrypt=1;TrustServerCertificate=1","$user","$pass");
				}catch(PDOException  $ex) { 
					echo "Failed to get DB handle: " . $ex->getMessage() . "<br>";
					die();
				}
				// Result: Failed to get DB handle: could not find driver
				
				break;
			case 4: 
				try { 
					echo '<strong>odbc+freetds 1</strong><br>';
					$handle = new PDO ("odbc:Driver={FreeTDS};Server=$host,$port;dbname=$db;Database=$db","$user","$pass");
				}catch(PDOException  $ex) { 
					echo "Failed to get DB handle: " . $ex->getMessage() . "<br>";
					die();
				}
				// Result: SQLSTATE[08001] SQLDriverConnect: 0 [unixODBC][FreeTDS][SQL Server]Unable to connect to data source
			
				break;
			case 5: 
				try { 
					echo '<strong>odbc+freetds 2</strong><br>';
					$handle = new PDO ("odbc:Driver={FreeTDS};Servername=$userFreetds;Database=$db","$user","$pass");
				}catch(PDOException  $ex) { 
					echo "Failed to get DB handle: " . $ex->getMessage() . "<br>";
					die();
				}
				// Result: Working
			
				break;	
			case 6: 
				try { 
					echo '<strong>odbc+freetds 3</strong><br>';
					$handle = new PDO ("odbc:Driver={FreeTDS};Servername=$userFreetds;Database=$db;Encrypt=1;TrustServerCertificate=1;charset=UTF-8;","$user","$pass");
				}catch(PDOException  $ex) { 
					echo "Failed to get DB handle: " . $ex->getMessage() . "<br>";
					die();
				}
				// Result: Working
			
				break;	
			case 7: 
				try { 
					echo '<strong>odbc+freetds 4 + TDS_Version=7.2</strong><br>';
					$handle = new PDO ("odbc:Driver={FreeTDS};TDS_Version=7.2;Servername=$userFreetds;Database=$db;Encrypt=1;TrustServerCertificate=1;charset=UTF-8;","$user","$pass");
				}catch(PDOException  $ex) { 
					echo "Failed to get DB handle: " . $ex->getMessage() . "<br>";
					die();
				}
				// Result: Working
				
				break;
			
		}
		try { 
			$country = "at";
			
			// Table structure of countries (nvarchar on their side)
			//$stmt = $handle->prepare("select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='countries'");
			
			//$stmt = $handle->prepare("SELECT @@VERSION");
			
		//	$stmt = $handle->prepare("select top 1 * from [countries] where [locale] = 'at'");			
				
		//	$stmt = $handle->prepare("select top 1 * from [countries] where [locale] = ? ");
		//	$stmt->bindValue(1, $country);
			
			// select customers
			$stmt = $handle->prepare("SELECT * FROM ContractRequests");
		
			$stmt->execute();
			if(is_array($stmt->errorInfo()) && !empty($stmt->errorInfo())) { 
				print_r($stmt->errorInfo());
			}
			while ($row = $stmt->fetch()) {
				print_r($row);
			}
			
			echo 'Done';
		}catch(PDOException $ex) {
			print_r($ex->getMessage());
		}
		unset($handle); 
		unset($stmt);
	
	}else{
		?>
		Test not supported
		<?php 
	}
}else{
	?>
	No <strong>?test</strong> parameter given
	<?php 
}

	/* 
					'driver' => 'odbc',
		  //  'dsn' => 'dblib:host='.env('DB_HOST').';dbname='.env('DB_DATABASE').';',
			'dsn' => 'odbc:Driver=FreeTDS;Servername=S24Koerbler;TrustServerCertificate=YES;Encryption=YES',
			'host' => env('DB_HOST', 'localhost'),
			'database' => env('DB_DATABASE', 'forge'),
			'username' => env('DB_USERNAME', 'forge'),
			'password' => env('DB_PASSWORD', ''),
			'port' => env('DB_PORT', '5432'),
			'charset' => 'UTF-8',
				*/
				
				/*   dblib, sqlsrv
				  'driver' => 'sqlsrv',
		 //   'dsn' => 'Driver={FreeTDS};Servername=S24Koerbler;TrustServerCertificate=YES;Encryption=YES;Database=TS_S24_KOERBLER_TEST',
		//   'dsn' => 'Driver={FreeTDS};Servername=S24Koerbler;TrustServerCertificate=YES;Encryption=YES;ENCRYPT=YES;Database=TS_S24_KOERBLER_TEST;Uid='.env('DB_USERNAME', 'forge').';Pwd='.env('DB_PASSWORD', ''),
		   'dsn' => 'Driver={FreeTDS};Server='.env('DB_HOST', 'localhost').';TrustServerCertificate=YES;Encryption=YES;ENCRYPT=1;',
			//'dsn' => 'odbc:Driver={FreeTDS};Servername=S24Koerbler;TrustServerCertificate=YES;Encryption=YES;Database=TS_S24_KOERBLER_TEST;',
			//'dsn' => 'odbc:Driver={SQL Server};Servername=S24Koerbler;TrustServerCertificate=YES;Encryption=YES;Database=TS_S24_KOERBLER_TEST;',
		//	'dsn' => 'Driver={SQL Server};Server=(local);Trusted_Connection=Yes;Database=AdventureWorks',
			'grammar' => 'SqlServerGrammar',
			'username' => env('DB_USERNAME', 'forge'),
			'password' => env('DB_PASSWORD', ''),
			'database' => 'TS_S24_KOERBLER_TEST',
			'host'     => env('DB_HOST', 'localhost'),
			*/
?>
</pre>
</body>
</html>

Samx