-
Notifications
You must be signed in to change notification settings - Fork 7
/
findrichest.php
45 lines (27 loc) · 885 Bytes
/
findrichest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
include_once '/var/www/where_are_your_mysql_credentials/mysql.php';
$table_name = "richests_list";
$address=trim($_POST['address']);
if( strlen( $address ) > 0 ){
if( ! preg_match( "@^[A-Z2-7]{32}$@", $address ) ){
echo "Incorrect Byteball address.";
exit;
}
} else {
echo "Empty value.";
exit;
}
$query = "SELECT * FROM $table_name where address='".addslashes($address)."' LIMIT 1";
$q = mysqli_query($mysqli, $query);
if ( ! $q ) {
echo "Problem here...";
exit;
}
if(mysqli_num_rows ( $q )==1){
while( $row = mysqli_fetch_assoc ( $q ) ){
echo "Congratulations! You are the <b>#".$row[ 'id' ]."</b> richest with a value of <b>".number_format ( $row[ 'amount' ] , 0 , "." , "," )." </b>bytes.";
}
}else{
echo "Not found.";
}
?>