Browse Source

php - add a simple btc test for pplns2, the same as ckdb

master
kanoi 9 years ago
parent
commit
e1dc5b629e
  1. 15
      pool/base.php
  2. 4
      pool/page_pplns2.php

15
pool/base.php

@ -272,6 +272,21 @@ function safepass($pass)
return true; return true;
} }
# #
# simple test without checksum validation
function btcaddr($addr)
{
$c0 = substr($addr, 0, 1);
if ($c0 != '1' && $c0 != '3')
return false;
$len = strlen($addr);
if ($len <= 26 || $len >= 37)
return false;
$rem = preg_replace('/[A-HJ-NP-Za-km-z1-9]/', '', $addr);
if (strlen($rem) > 0)
return false;
return true;
}
#
function bademail($email, $isold = false) function bademail($email, $isold = false)
{ {
if ($email == null || $email == '') if ($email == null || $email == '')

4
pool/page_pplns2.php

@ -51,10 +51,8 @@ function calctx($ans, $count, $miner_sat, $diffacc_total)
} }
if ($payaddress == 'none') if ($payaddress == 'none')
{ {
$c0 = substr($username, 0, 1);
$parts = explode('.', $username); $parts = explode('.', $username);
$len = strlen($parts[0]); if (btcaddr($parts[0]) === true)
if (($c0 == '1' || $c0 == '3') && $len > 26 && $len < 37)
$payaddress = $parts[0]; $payaddress = $parts[0];
else else
{ {

Loading…
Cancel
Save