$url = getSHOST() . "?mode=daterange&range=" . $from . ":" . $to . "&token=" . $_COOKIE['token'];
    //echo $url."<br>";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_REFERER, "www.google.com");
    $body = curl_exec($ch);
    curl_close($ch);
    //echo $body;
    $crypto = new Crypto($_COOKIE['keymas']);
    $json = json_decode($body);
    $choices = $json->choices;
    echo "<h4 style='color:white;text-decoration:bold;'>Select from These Choices</h4><br><form action='#' method='post'>";
    echo "<select name='choices[]' style='width:300px'>";
    for ($i = 0; $i < count($choices); $i++) {
        $msg = $crypto->aesDecrypt(utf8_decode($choices[$i]->result));
        $size = $choices[$i]->size;
        $branches = implode(":", $choices[$i]->branches);
        $rbvalue = implode(";", array($choices[$i]->id, $size, $branches));
        echo "<option value='" . $rbvalue . "'>" . $msg . "</option>";
    }
    echo "</select><br>";
    ?>
<br><input type="submit" class="btn" value='Submit' name='submit3'></input></form></div>
		<?php 
} else {
    if (isset($_POST["submit3"])) {
        echo "<div class='dashboard'>";
        require_once "classes.php";
        require_once "settings.php";
        $choicearray = explode(";", $_POST["choices"][0]);
 public function phase1($username, $passphrase)
 {
     $challenge = uniqid();
     $x = $username . $passphrase;
     $pbkdf2 = new PBKDF2();
     $key = $pbkdf2->deriveKey($x);
     $keymas = $pbkdf2->deriveKey($key . ":" . $challenge);
     $crypto = new Crypto($keymas);
     require_once "settings.php";
     $url = getSHOST() . "?mode=handshake&values=" . $username . ":" . $challenge;
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_REFERER, "www.google.com");
     $body = curl_exec($ch);
     $json = json_decode($body);
     $emsg = utf8_decode($json->message);
     $token = $crypto->aesDecrypt(utf8_decode($json->token));
     $plain = $crypto->aesDecrypt($emsg);
     $pl = $plain;
     if ($pl == "Standard Message#1") {
         setcookie("username", $username);
         setcookie("passphrase", $passphrase);
         setcookie("key", $key);
         setcookie("keymas", $keymas);
         setcookie("token", $token);
         echo "<script type='text/javascript'>window.location = \"phase2.php\";</script>";
     } else {
         //redirect("?err=true");
     }
 }