| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/(Del)eizo.hkosl.com/global/webadmin/ |
Upload File : |
<?php
include_once('../phpseclib0.3.6/Crypt/RSA.php');
$rsa = new Crypt_RSA();
$public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDH0i//hwmPSCUNAS9UiD3wSH43 NxwRKwGtHQKGarANuYNacSXb+rS2N0WKihz+aSkevePj5GZPtu21Fpx0Tt541DBl UrYL0vPK4S6QUX8I5vsOQ/XuIyh9NKcD2fbmf/1QrC+q7pv6xa6ctaV8u1RPGI7C AIPtMCrh9Pbg+EFo0wIDAQAB";
$rsa->loadKey($public_key); // public key
$plaintext = "qwerty123-+%$*%^@#$%";
//$rsa->setEncryptionMode(CRYPT_RSA_ENCRYPTION_OAEP);
$ciphertext = base64_encode($rsa->encrypt($plaintext));
var_dump($ciphertext);
$private_key = "MIICXAIBAAKBgQDH0i//hwmPSCUNAS9UiD3wSH43NxwRKwGtHQKGarANuYNacSXb +rS2N0WKihz+aSkevePj5GZPtu21Fpx0Tt541DBlUrYL0vPK4S6QUX8I5vsOQ/Xu Iyh9NKcD2fbmf/1QrC+q7pv6xa6ctaV8u1RPGI7CAIPtMCrh9Pbg+EFo0wIDAQAB AoGATSi2HRMtV1UR7YggGSG03SR5DGQs49o5/vldQL9QtTQF6zYW2u9fuZ71LO5x DLJZzQOhTJ4k/bIS7yLIjkboM4x75DlRpG14Umi+d2GePB+r9UiqeZ67Zh7OvKFU 1CIkNC2J9G0U2G4RSG2UAZKkimIofmptq7dXa5oYYNL74t0CQQDi4RHoxIhqh9mw rLxvawgcq6gseKuY5zEgJMHGtNQTIGqn1LgxCCwNx5473xc7jW6GQbgCtDVwGqeb VkejSSsFAkEA4XgGfrAFHSQdZ9+GkNsT+eZioX5wyxP78b3csTRPPii4NudJmyeu yHmmhhJV6fknQ9ZsYqLwHH3gJpzXeH/79wJAEL3S+H4oItRLeAIHFaGsQ5FXI5Dz +KB2u4x60BLf41ltBV1pChU0SwAD6R8ZM8fH9Bg9X9W0a8VLwOao+p+XkQJBANG3 MGNaGgeW9fsOAD5wZ85Dqm4IC6X4upmKPeJdg2+PtHjs/Jvid0JlVKzUFTGB3DHP GhVM9QWrV3jS3eBpOtUCQB6Fyf7bkMHxRwa2QLoB3bM/gvk0mJPCBFpILfI5RZZG XezjDt3Xo/MqppBr8nybC42OxjbID9ALPPe/VX9AVmA=";
$rsa->loadKey($private_key); // private key
echo $rsa->decrypt(base64_decode($ciphertext));
exit;
//$rsa->decrypt(base64_decode($row2{"test1"}));
//new pdo
if (!headers_sent()) {
header('X-UA-Compatible: IE=8,chrome=1');
}
//$dbh = new PDO("mysql:host=localhost;dbname=eizocomcn_db", "eixocomcnsa", "2E39enc3");
//$dbh->exec("set names utf8");
date_default_timezone_set("Asia/Hong_Kong");
if (!function_exists('random_string')) {
function random_string( $length = 8 ) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$random_string = substr( str_shuffle( $chars ), 0, $length );
return $random_string;
}
}
if (session_id() === "") { session_start(); }
error_reporting(E_ALL);
ini_set('display_errors', 1);
/*$sql = "insert into test (test1) values (?)";
if (!($sth = $dbh->prepare($sql))) {
throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
}
if (!$sth->execute(array($ciphertext))) {
throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
}*/
$dbh = mysql_connect("localhost", "eixocomcnsa", "2E39enc3");
if (!$dbh) {
die('Could not connect: ' . mysql_error());
}
$selected = mysql_select_db("eizocomcn_db",$dbh)
or die("Could not select first_test");
mysql_query("SET NAMES UTF8");
if (!function_exists('check_input')) {
function check_input($value)
{
if(!empty($value)){
// 去除斜杠
if (get_magic_quotes_gpc())
{
$value = stripslashes($value);
}
// 如果不是?字?加引号
$value = mysql_real_escape_string(htmlspecialchars($value)) ;
return $value;
}else{
return $value;
}
}
}
$sql = "insert into test (test1) values ('$ciphertext')";
mysql_query($sql);
$sql2 = "select * from test where id = 4";
$result2 = mysql_query($sql2);
$row2 = mysql_fetch_array($result2);
echo "<br><br>";
echo $rsa->decrypt(base64_decode($row2{"test1"}));
?>