Example #1
0
    echo "\t\t<form method=\"post\" action=\"" . $_SERVER["PHP_SELF"] . "\"> \n";
    echo "\t\t\tEnter Your Signature: &nbsp; \n";
    echo "\t\t\t<input type=\"text\" name=\"signature\" size=\"60\"> \n";
    echo "\t\t\t<br><br> \n";
    echo "\t\t\tEnter Your Name: &nbsp; \n";
    echo "\t\t\t<input type=\"text\" name=\"owner_name\" size=\"60\"> \n";
    echo "\t\t\t<br><br> \n";
    echo "\t\t\tClaim Your Address: &nbsp; \n";
    echo "\t\t\t<input type=\"submit\" name=\"claim_address\" value=\"Verify And Claim\"> \n";
    echo "\t\t\t<br><br> \n";
    echo "\t\t\t<input type=\"hidden\" name=\"address_hash\" value=\"" . $address_hash . "\"> \n";
    echo "\t\t\t<input type=\"hidden\" name=\"address\" value=\"" . $_GET["address"] . "\"> \n";
    echo "\t\t</form> \n\n";
} elseif (isset($_POST["claim_address"])) {
    echo "\t\t<h2> Verification And Registry </h2> \n\n";
    $verified = verifymessage($_POST["address"], $_POST["signature"], $_POST["address_hash"]);
    if ($verified == "true") {
        echo "\t\t<p> Signature Verified! </p> \n\n";
        echo "\t\t<p> Updating Address Record: </p> \n\n";
        $updated = spectra_address_addowner($_POST["owner_name"], $_POST["address"]);
        if ($updated) {
            echo "\t\t<p> Address Record Updated </p> \n\n";
            echo "\t\t<p> \n";
            echo "\t\t\tThe name you entered will now be displayed as \n";
            echo "\t\t\tthe owner of this address in the balances list. \n";
            echo "\t\t</p> \n\n";
        } else {
            echo "\t\t<p> Unable to update address. </p> \n\n";
            echo "\t\t<p> \n";
            echo "\t\t\tThis error may be temporary, you can try  \n";
            echo "\t\t\tagain in a few moments. \n";
Example #2
0
         $sql = "select date_part('epoch', time)::integer as etime from {$psqlschema}.stats_mystats where server={$serverid} and user_id={$user_id} order by id desc limit 1";
         $result = pg_exec($link, $sql);
         $numrows = pg_numrows($result);
         if ($numrows > 0) {
             $row = pg_fetch_array($result, 0);
             $etime = $row["etime"];
             if ($msgdateunix - $etime < 5) {
                 $validate = 0;
                 print "Newly signed options must have a timestamp at least 5 seconds newer than previously signed options. ";
             }
         }
     }
     if ($validate == 1) {
         $sigok = 0;
         if (strlen($sig) > 35 && strlen($msg) > 0) {
             $sigok = verifymessage($u, $sig, $msg);
         }
         if ($sigok) {
             print "Signature passes!";
             $signedoptions = $msg;
             $signature = $sig;
             $sql = pg_prepare($link, "mystats_insert", "insert into {$psqlschema}.stats_mystats (server, user_id, time, signed_options, signature) VALUES ({$serverid}, {$user_id}, to_timestamp({$msgdateunix}), \$1, \$2)");
             $result = pg_execute($link, "mystats_insert", array($signedoptions, $signature));
             #print "SQL: $sql";
         } else {
             print "Signature fails!";
         }
     }
     $cmd = "options";
     # fall through
 }
Example #3
0
        spectra_api_response("", 0, "Address (?address=xxxxx) Is Required For Method 'isaddress'");
    }
    if (spectra_address_exists($_REQUEST["address"])) {
        spectra_api_response("Address Exists");
    } else {
        spectra_api_response("", 0, "Address Not Found");
    }
}
if ($_REQUEST["method"] == "getbalance") {
    if (!isset($_REQUEST["address"])) {
        spectra_api_response("", 0, "Address (?address=xxxxx) Is Required For Method 'getbalance'");
    }
    spectra_api_response(spectra_address_balance($_REQUEST["address"]));
}
if ($_REQUEST["method"] == "verifymessage") {
    spectra_api_response(verifymessage($_GET["address"], $_GET["signature"], urldecode($_GET["message"])));
}
if ($_REQUEST["method"] == "moneysupply") {
    spectra_api_response(spectra_money_supply());
}
/******************************************************************************
	Explorer API 
******************************************************************************/
if ($_REQUEST["method"] == "false") {
    //
}
/******************************************************************************
	Final Error trap
******************************************************************************/
spectra_api_response("", 0, "Invalid or Unrecognized Request");
/******************************************************************************
 public static function btc_sign($a = '', $m = '', $s = '')
 {
     // RegEx.
     $tmp = false;
     try {
         // Class model dbClub.
         load::auto('lib_verifymessage');
         // Control.
         if (verifymessage($a, $s, $m)) {
             $tmp = true;
         }
         // Return.
         return $tmp;
     } catch (Exception $e) {
         return $tmp;
     }
 }