include simple_html_dom php if empty _GET header Location else htmlent

 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
<?
include 'simple_html_dom.php';
if (empty($_GET['u'])) {
header('Location: /');
} else {
$u = htmlentities($_GET['u']);
}
$html = file_get_html('http://m.championat.com/stat/sport/'.$u);
foreach($html->find('title') as $element)
$title = $element->plaintext;
$set['title'] = $title = str_replace('- Чемпионат.com', '', $title);
include_once '../system/load.php';
include_once '../system/head.php';
include 'head.php';
echo '<div class="title">'.$title.'</div>';
foreach($html->find('tr') as $element) {
foreach($element->find('div.stat__date') as $header)
echo '<div class="menu_razd">'.$header->plaintext.'</div>';
foreach($element->find('td') as $header)
$q[] = $header->plaintext.' ';
if (!empty($q[0])) {
$p = empty($q[4]) ? NULL : 'игр ( '.$q[3].') очков( '.$q[4].')';
echo '<div class="main_menu">'.$q[0].$q[1].$q[2].$p.'</div>';
}
$q = NULL;
}
include_once '../system/foot.php';
?>