php error_reporting E_ALL title Список пользователей count function ge

 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
<?php
error_reporting(E_ALL);
$title = 'Список пользователей';
$count = 0;
function getIconAndMedal($user) {
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => 'http://spaces.ru/mysite/?name=' . $user,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERAGENT => 'Kolya xuj zalupa pidor ' . time() . rand(0, 1000)
));
$res = curl_exec($ch);
preg_match('/<img src="(.*?)" alt="\((ON|OFF)\)/i', $res, $ico_data);
$medal = false;
if(preg_match('/spaces\.ru\/i\/\/medal_(.*?).gif/', $res)) {
preg_match('/spaces\.ru\/i\/\/medal_(.*?).gif/', $res, $m);
$medal = 'http://' . $m[0];
}
curl_close($ch);
return array(base64_encode(file_get_contents($ico_data[1])), ($medal ? base64_encode(file_get_contents($medal)) : false));
}
echo "<html>
<head>
<title>$title</title>
<style type=\"text/css\">
.container {
max-width: 500px;
padding: 5px;
margin: 0 auto;
}
</style>
</head>
<body><div class=\"container\"><center>";
echo '<table border="1" style="width: 80%; text-align: center; padding: 5px; font-size: 100%;">';
echo '<tr><td>' .$title. '</td></tr>';
$handle = opendir('.');
while (false !== ($file = readdir($handle)))
if(preg_match('/\.txt$/', $file)) {
$u = reset(explode('.', $file));
$im = getIconAndMedal($u);
echo '<tr><td><img src="data:image/gif;base64,' . $im[0] . '" alt="status" /> <b style="color:#79358c;">' . $u . '</b> '.($im[1] ? '<img src="data:image/gif;base64,' . $im[1] . '" alt="status" />' : '').' </td></tr>';
$count++;
}
closedir($handle);
echo '</table><h3><strong><u>Количество пользователей:</u></strong> '. $count .'</h3> <br/></center></div></body></html>';