Submit form to revial code.
<?php $PasswordHash = "Xr6RD73ALuOwRqh5";
<?php $PrivateKey = "rwkJcDCuIHE8QRDg";
<?php $PublicKey = "SLeuGs3jOxcAGr4r";
<?php require_once 'keys/PasswordHash.php'; require_once 'keys/PrivateKey.php'; require_once 'keys/PublicKey.php'; require_once 'encryption/encryption-class.php'; require_once 'encryption/encryption-functions.php'; require_once 'encryption/encryption-config.php';
<?php class KeyChain { public static function join_keys() { global $PrivateKey; global $PublicKey; $FullRing = $PrivateKey . $PublicKey; return $FullRing; } public static function hash_keys() { global $PasswordHash; return $PasswordHash; } public static function PrivateKey() { global $PrivateKey; return $PrivateKey; } public static function PublicKey() { global $PublicKey; return $PublicKey; } } class Encrypt extends KeyChain { public static function lock($string) { $keys = parent::join_keys(); $hash = parent::hash_keys(); $output = openssl_encrypt($string, 'AES-256-CBC', $key, 0, $initialization_vector); return $output; } public static function unlock($string) { $keys = parent::join_keys(); $hash = parent::hash_keys(); return $output; } }
<?php // add or remove as needed $fields_array = [ 'username', 'password', 'email', 'name', 'blank', ]; /* * blank added to validate if statment * once you know the value you can compare * example $blank = "b2VVU09PcStIZ21JZElPUElKN0QzZz09" ; * if ($username==$blank) { * * } */
<?php // SQL injection protecion function SQLClean($string) { return $value; } // Encrypt all fields in $fields_array on post foreach ($fields_array as $value) { $Postvalue = $value; $_POST[$Postvalue] = Encrypt::lock(SQLClean($_POST[$Postvalue])); } } // Encrypt on the fly function LockEncrypt($string) { return Encrypt::lock($string); } // Decrypt function UnLockEncrypt($string) { return Encrypt::unlock($string); }
<?php // Encrypt on the fly $encrypt_title = LockEncrypt('Encrypted Posted Values'); // value = Wnp6UHVsb2dnSEFYajg1ZzB0YXBzTDMyWnloWUFMNFRsbWw2V2ZUSis2MD0= $title = UnLockEncrypt($encrypt_title); echo $title; echo "<pre>"; echo "</pre>"; $_SESSION['name'] = UnLockEncrypt($_POST['name']); $_SESSION['email'] = UnLockEncrypt($_POST['email']); $_SESSION['blank'] = UnLockEncrypt($_POST['blank']); echo 'Decrypted Posted Values '; echo "<pre>"; echo "</pre>"; } ?> <form id="contactForm" action="" method="post" data-toggle="validator"> <div class="form-group"> <input type="text" class="form-control" id="name" value="<?php if (isset($_SESSION['name'])) echo $_SESSION['name'] ?>" name="name" placeholder="Full Name" required> <div class="help-block with-errors"></div> </div> <div class="form-group"> <input type="email" class="form-control" id="email" value="<?php if (isset($_SESSION['email'])) echo $_SESSION['email'] ?>" name="email" placeholder="Email" required> <div class="help-block with-errors"></div> </div> <div class="form-group"> <input type="text" class="form-control" id="blank" placeholder="blank no value" readonly="" name="blank" > <div class="help-block with-errors"></div> </div> <input type="submit" value="Submit" class="btn btn-primary" /> </form>