Sorry, you cannot use this access method.


"; exit; } $thisis=file_get_contents("./mcrypt_login.php"); } else if (isset($_POST['register'])) { if (strpos(str_replace('//localhost', '//www.rjmprogramming.com.au/',('' . strtolower($_SERVER['HTTP_REFERER']))), 'rjmprogramming.com.au/') === false) { echo "

Sorry, you cannot use this access method.


"; exit; } $thisis=file_get_contents("./mcrypt_login.php"); } $redir="./mcrypt_first_nonlogin.php"; if (isset($_GET['redirectto'])) { $redir=str_replace("+"," ",urldecode($_GET['redirectto'])); } else if (isset($_POST['redirectto'])) { $redir=str_replace("+"," ",urldecode($_POST['redirectto'])); } function enc_this($what) { /* Data */ // Thanks to http://php.net/manual/en/function.mdecrypt-generic.php $key = 'this is a very long key, even too long for the cipher'; $plain_text = 'very important data'; $plain_text = ''; if ($what != "") { $plain_text = $what; } else { return ''; } /* Open module, and create IV */ $td = mcrypt_module_open('des', '', 'ecb', ''); $key = substr($key, 0, mcrypt_enc_get_key_size($td)); $iv_size = mcrypt_enc_get_iv_size($td); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); /* Initialize encryption handle */ if (mcrypt_generic_init($td, $key, $iv) != -1) { /* Encrypt data */ $c_t = mcrypt_generic($td, $plain_text); mcrypt_generic_deinit($td); /* Reinitialize buffers for decryption */ mcrypt_generic_init($td, $key, $iv); $p_t = mdecrypt_generic($td, $c_t); /* Clean up */ mcrypt_generic_deinit($td); mcrypt_module_close($td); } if (strncmp($p_t, $plain_text, strlen($plain_text)) == 0) { return $c_t; //echo $p_t . " ... " . $c_t; //"ok\n"; } else { return ""; } } function dec_this($what) { /* Data */ // Thanks to http://php.net/manual/en/function.mdecrypt-generic.php $key = 'this is a very long key, even too long for the cipher'; // later, automate this $plain_text = 'very important data'; $plain_text = ''; if ($what != "") { $plain_text = $what; } else { return ''; } /* Open module, and create IV */ $td = mcrypt_module_open('des', '', 'ecb', ''); $key = substr($key, 0, mcrypt_enc_get_key_size($td)); $iv_size = mcrypt_enc_get_iv_size($td); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); /* Initialize encryption handle */ if (mcrypt_generic_init($td, $key, $iv) != -1) { /* Encrypt data */ $c_t = mcrypt_generic($td, $plain_text); mcrypt_generic_deinit($td); /* Reinitialize buffers for decryption */ mcrypt_generic_init($td, $key, $iv); $p_t = mdecrypt_generic($td, $what); /* Clean up */ mcrypt_generic_deinit($td); mcrypt_module_close($td); } return $p_t; //echo $p_t . " ... " . $c_t; //"ok\n"; } $words=""; if (isset($_GET['words'])) { $words=str_replace("+"," ",urldecode($_GET['words'])); } else if (isset($_POST['words'])) { $words=str_replace("+"," ",urldecode($_POST['words'])); } //echo dec_this(enc_this($words)); $uname=""; $pword=""; $fuser=""; $fpwd=""; if (isset($_GET['username']) && isset($_GET['password'])) { $uname=str_replace("+"," ",urldecode($_GET['username'])); $pword=str_replace("+"," ",urldecode($_GET['password'])); for ($il=0; $il= 0) { session_start(); $_SESSION['username'] = $uname; } else if ($ufound < 0 && isset($_GET['register'])) { $found=0; session_start(); $_SESSION['username'] = $uname; file_put_contents("./mcrypt_login.php", str_replace('" ' . '"' . ']', '"' . base64_encode(enc_this($uname)) . '"," ' . '"' . ']', str_replace('"' . '"' . ']', '"' . base64_encode(enc_this($pword)) . '","' . '"' . ']', $thisis))); } } else if (isset($_POST['username']) && isset($_POST['password'])) { $uname=str_replace("+"," ",urldecode($_POST['username'])); $pword=str_replace("+"," ",urldecode($_POST['password'])); for ($il=0; $il= 0) { session_start(); $_SESSION['username'] = $uname; } else if ($ufound < 0 && isset($_POST['register'])) { $found=0; session_start(); $_SESSION['username'] = $uname; file_put_contents("./mcrypt_login.php", str_replace('" ' . '"' . ']', '"' . base64_encode(enc_this($uname)) . '"," ' . '"' . ']', str_replace('"' . '"' . ']', '"' . base64_encode(enc_this($pword)) . '","' . '"' . ']', $thisis))); } } if ($found >= 0) { // navigate to next page //echo ""; header("Location: " . $redir); exit; } else if ($uname == "" && $pword == "") { echo "Registration and Login via PHP Mcrypt - RJM Programming - December, 2018

Registration and Login via PHP Mcrypt

RJM Programming - December, 2018

Username:
Password:

 
"; } else if ($ufound >= 0) { echo "Registration and Login via PHP Mcrypt - RJM Programming - December, 2018

Sorry, this username has different password.


"; } else { echo "Registration and Login via PHP Mcrypt - RJM Programming - December, 2018

Sorry, your entered username and password not found.


"; } ?>