-
Notifications
You must be signed in to change notification settings - Fork 0
/
galaxy.php
58 lines (56 loc) · 1.49 KB
/
galaxy.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
<?php
include('include/header.php');
include('include/galaxy_data.php');
if(!$session->hasAccess(100))
{
echo('<div align="center" class="warning">You are not authorized to access this page</div>');
include('include/footer.php');
exit();
}
echo('<table width="100%">');
echo(' <tr>');
echo(' <td width="50%">');
$data = new GalaxyData;
$data->x = isset($_REQUEST['x']) ? $_REQUEST['x'] : '';
$data->y = isset($_REQUEST['y']) ? $_REQUEST['y'] : '';
$data->page = isset($_REQUEST['page']) ? $_REQUEST['page'] : '';
$data->order = isset($_REQUEST['order']) ? $_REQUEST['order'] : 'score_rank';
$data->direction = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : 'asc';
if(isset($_REQUEST['left']) && $_REQUEST['left'] != "")
{
$data->y--;
if($data->y < 1)
{
$data->y = 10;
$data->x--;
}
}
elseif(isset($_REQUEST['right']) && $_REQUEST['right'] != "")
{
$data->y++;
if($data->y > 10)
{
$data->y = 1;
$data->x++;
}
}
if($data->x != "" && $data->y != "")
{
$smarty->assign('data', $data->selectGalaxyPlanets());
$smarty->assign('gala', $data->selectGalaxy());
$smarty->display('galaxy_view.tpl');
}
else
{
$smarty->assign('data', $data->selectGalaxy());
$smarty->assign('count', $data->numberOfGalaxies());
$smarty->assign('page', $data->page);
$smarty->assign('order', $data->order);
$smarty->assign('dir', $data->direction);
$smarty->display('galaxy_list.tpl');
}
echo(' </td>');
echo(' </tr>');
echo('</table>');
include('include/footer.php');
?>