Exemplo n.º 1
0
include 'algorithm.php';
include '../connect_db.php';
function generateKeyPass($length = 6)
{
    $chars = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "o", "p", "r", "s", "t", "u", "v", "x", "y", "z");
    $vocals = array("a", "e", "i", "o", "u");
    $xpassword = "";
    mt_srand((double) microtime() * 1000000);
    for ($i = 1; $i <= $length; $i++) {
        $xpassword .= $i % 2 == 0 ? $chars[mt_rand(0, count($chars) - 1)] : $vocals[mt_rand(0, count($vocals) - 1)];
    }
    return $xpassword;
}
if (isset($_SESSION['userwd'])) {
    $ishare_username = $_SESSION['userwd'];
    $checkUserInIshare = mysql_query("SELECT * FROM i_users WHERE userwd='{$ishare_username}'") or die(mysql_error());
    $dapat = mysql_fetch_array($checkUserInIshare);
    $ishare_email = $dapat['email'];
    $ishare_keypass = generateKeyPass(10);
    mysql_query("UPDATE i_users SET keypass='******' WHERE userwd='{$ishare_username}'") or die(mysql_error());
    $secretkey = 'Ishare+';
    $encrypted_kp = ssl_encrypt($secretkey, $ishare_keypass);
    $encrypted_email = ssl_encrypt($secretkey, $ishare_email);
    $_SESSION['erkp'] = $encrypted_kp;
    $_SESSION['erem'] = $encrypted_email;
    echo 'Registering...';
    sleep(2);
    header('Location: register_proceed.php');
} else {
    header('Location: 404.php');
}
Exemplo n.º 2
0
         echo "c:s=ER&msg=Could+not+initialize+Mcrypt+module\n";
         exit;
     }
     $iv = '';
     for ($i = 0; $i < mcrypt_enc_get_iv_size($td); $i++) {
         $iv .= chr(mt_rand(0, 255));
     }
     $key = '';
     for ($i = 0; $i < mcrypt_enc_get_key_size($td); $i++) {
         $key .= chr(mt_rand(0, 255));
     }
     mcrypt_generic_init($td, $key, $iv);
     mcrypt_generic_init($te, $key, $iv);
     $pkey = $_REQUEST["pk"];
     $pkey = "-----BEGIN PUBLIC KEY-----\n" . rtrim(preg_replace('/(.{1,64})/', "\\1\n", $pkey)) . "\n-----END PUBLIC KEY-----";
     $symkey = base64_encode(ssl_encrypt($iv . $key, $pkey));
 }
 // open the remote socket
 $msg = openRemote($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
 if ($msg) {
     echo "c:s=ER&msg=" . urlencode("REMOTE {$msg}") . "\n";
     exit;
 }
 if ($rmsock) {
     stream_set_blocking($rmsock, 1);
 }
 // open the interprocess socket
 if ($useunix) {
     // this is for the unix socket type
     $ident = stream_socket_get_name($rmsock ? $rmsock : $usock, false);
     $ident = preg_replace('/^.*?:/', '', $ident);