-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathguest.php
70 lines (51 loc) · 1.33 KB
/
guest.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?
if(isset($_GET["id"]) && (strlen(trim($_GET["id"])) == 5)) {
$prefix = $_GET["id"];
} else {
exit(0);
}
include_once("config.php");
$link = mysql_connect($mysql_host, $mysql_user, $mysql_pwd);
if (!$link) {
die();
}
mysql_select_db($mysql_db) || die(mysql_close($link));
$row = mysql_fetch_array(mysql_query("select count(*) as howmany from stata where pefixa='".$prefix."'"));
$number_of_rows = $row["howmany"];
$countrys = array();
$q = "SELECT country FROM stata where pefixa='".$prefix."' order by country asc";
$r = mysql_query($q);
if (mysql_num_rows($r) > 0) {
while ($l = mysql_fetch_array($r)) {
$countrys[] = $l['country'];
}
}
mysql_close($link);
echo "Installed: ".$number_of_rows."<br>\r\n";
/**$result = array();
foreach ($countrys as $key => $value) {
$count = 0;
foreach ($countrys as $a) {
if ($a == $countrys[$key]) $count++;
}
$result[$key][$value] = $count;
}
$strana = array();
$j = 0;
foreach ($result as $key => $value) {
if($j != 0) {
if($result[$j] != $result[$j - 1]) {
$strana[$j] = $result[$j];
}
} else {
$strana[$j] = $result[$j];
}
$j ++;
}
echo count($strana); echo "<br>\r\n";
echo "Country:<br>\r\n";
for ($i = 0; $i < count($strana); $i ++) {
foreach ($strana[$i] as $key => $value) {
print_r($strana[$i]); /**echo " ".$strana[$i][$key]; echo "<br>\r\n";
}
}*/