first commit
This commit is contained in:
4
config/.htaccess
Normal file
4
config/.htaccess
Normal file
@ -0,0 +1,4 @@
|
||||
AuthName "pwd"
|
||||
AuthType Basic
|
||||
AuthUserFile /var/www/web712/html/config/.htpasswd
|
||||
require valid-user
|
1
config/.htpasswd
Normal file
1
config/.htpasswd
Normal file
@ -0,0 +1 @@
|
||||
admin:$1$mJMmTGPR$/db9TUBE9VIYJMUcNezBk0
|
13
config/datenbankanbindung.php
Normal file
13
config/datenbankanbindung.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
//--Funktion-Datenbankverbindung--------------------------------------------------------------------
|
||||
|
||||
function dbconnect() //--Prozedur - kein return-Wert
|
||||
{
|
||||
|
||||
$db = @new mysqli( 'localhost', 'root', '', 'survey' );
|
||||
$db->query("SET NAMES 'utf8'");
|
||||
return $db;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
?>
|
46
config/func_cryption.php
Normal file
46
config/func_cryption.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
function cryption($hash, $method)
|
||||
{
|
||||
// Method e=encrypt, d=decrypt
|
||||
// Store the cipher method
|
||||
# Für PHP 7.1 noch 128
|
||||
$ciphering = "AES-128-CTR";
|
||||
|
||||
|
||||
// Use OpenSSl Encryption method
|
||||
$iv_length = openssl_cipher_iv_length($ciphering);
|
||||
$options = 0;
|
||||
|
||||
// Store the encryption key
|
||||
$key = "!O3JoDLnBI6#[M%4S!sZH1zU0?8+5C_!}";
|
||||
|
||||
// Non-NULL Initialization Vector for encryption
|
||||
$vector = '0843413489572156';
|
||||
|
||||
if ($method == 'e') {
|
||||
// Use openssl_encrypt() function to encrypt the data
|
||||
$encryption = openssl_encrypt($hash, $ciphering, $key, $options, $vector);
|
||||
return $encryption;
|
||||
}
|
||||
// Store a string into the variable which
|
||||
// need to be Encrypted
|
||||
|
||||
|
||||
if ($method == 'd') {
|
||||
// Use openssl_decrypt() function to decrypt the data
|
||||
$decryption = openssl_decrypt($hash, $ciphering, $key, $options, $vector);
|
||||
|
||||
# kryptische Returnwerte bei falschem String entfernen: Nur Zahlen und Buchstaben
|
||||
#$decryption = preg_replace('![^0-9a-zA-Z]!', '', $decryption);
|
||||
|
||||
# https://stackoverflow.com/questions/1176904/php-how-to-remove-all-non-printable-characters-in-a-string
|
||||
$decryption = preg_replace('/[\x00-\x1F\x7F-\xFF]/', '', $decryption);
|
||||
|
||||
return $decryption;
|
||||
}
|
||||
}
|
||||
#$crypt = cryption("!DWdMiU#", 'e');
|
||||
#echo $crypt;
|
||||
#echo "<br>";
|
||||
#echo cryption($crypt, 'd');
|
||||
?>
|
Reference in New Issue
Block a user