diff --git a/pool/base.php b/pool/base.php index e9e4a6c6..53426167 100644 --- a/pool/base.php +++ b/pool/base.php @@ -272,6 +272,21 @@ function safepass($pass) 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) { if ($email == null || $email == '') diff --git a/pool/page_pplns2.php b/pool/page_pplns2.php index e759f2f2..e8cbc9af 100644 --- a/pool/page_pplns2.php +++ b/pool/page_pplns2.php @@ -51,10 +51,8 @@ function calctx($ans, $count, $miner_sat, $diffacc_total) } if ($payaddress == 'none') { - $c0 = substr($username, 0, 1); $parts = explode('.', $username); - $len = strlen($parts[0]); - if (($c0 == '1' || $c0 == '3') && $len > 26 && $len < 37) + if (btcaddr($parts[0]) === true) $payaddress = $parts[0]; else {