From 7a499698968f4cbc49f2db8aa79308cbdc343804 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 7 Jan 2014 09:40:18 +0100 Subject: [PATCH] [ADDED] Address validation script Will allow admins to run a validateaddress check via RPC calls against the coind for all currently available users in the accounts table. * UNSET for users without a coin_address * INVALID for addresses not validated against the RPC * VALID for addresses that validated fine Just to give people a small tool at hands. Usually addresses are already validated during account edit, so this script is mostly for those pools that have not had that change yet and wish to notify their users. Addresses #1177 --- scripts/shared.inc.php | 47 ++++++++++++++++++++++++++++++ scripts/validate_addresses.php | 52 ++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 scripts/shared.inc.php create mode 100755 scripts/validate_addresses.php diff --git a/scripts/shared.inc.php b/scripts/shared.inc.php new file mode 100644 index 00000000..18fa4834 --- /dev/null +++ b/scripts/shared.inc.php @@ -0,0 +1,47 @@ + diff --git a/scripts/validate_addresses.php b/scripts/validate_addresses.php new file mode 100755 index 00000000..39a34ffa --- /dev/null +++ b/scripts/validate_addresses.php @@ -0,0 +1,52 @@ +#!/usr/bin/php +getAllAssoc(); + +// Table mask +$mask = "| %-35.35s | %-35.35s | %-40.40s | %-7.7s |\n"; +echo 'Validating all coin addresses. This may take some time.' . PHP_EOL . PHP_EOL; + +printf($mask, 'Username', 'E-Mail', 'Address', 'Status'); +foreach ($users as $aData) { + if (empty($aData['coin_address'])) { + $status = 'UNSET'; + } + $ret = $bitcoin->validateaddress($aData['coin_address']); + if ($ret['isvalid']) { + $status = 'VALID'; + } else { + $status = 'INVALID'; + } + printf($mask, $aData['username'], $aData['email'], $aData['coin_address'], $status); +}