-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfind_reg.php
130 lines (114 loc) · 3.94 KB
/
find_reg.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php /* adminova stranka - editace clena */
define("__HIDE_TEST__", "_KeAr_PHP_WEB_");
@extract($_REQUEST);
require_once("./cfg/_colors.php");
require_once ("./connect.inc.php");
require_once ("./sess.inc.php");
if (!IsLoggedManager() || !IsLoggedSmallAdmin())
{
header("location: ".$g_baseadr."error.php?code=21");
exit;
}
$reg = (isset($reg) && is_numeric($reg)) ? (int)$reg : 0;
$year = (isset($year) && is_numeric($year)) ? (int)$year : 0;
require_once ("./ctable.inc.php");
require_once ("./header.inc.php"); // header obsahuje uvod html a konci <BODY>
require_once ("./common.inc.php");
require_once ("./common_user.inc.php");
DrawPageTitle('Hledání volných registračních čísel');
?>
<TABLE width="100%" cellpadding="0" cellspacing="0" border="0">
<TR>
<TD width="2%"></TD>
<TD width="90%" ALIGN=left>
<CENTER>
<form method=post action="find_reg.php">
<?
$data_tbl = new html_table_form();
echo $data_tbl->get_css()."\n";
echo $data_tbl->get_header()."\n";
echo $data_tbl->get_new_row('Registrační číslo', $g_shortcut.' <input type="text" name="reg" value="'.(($reg != 0)? RegNumToStr($reg) : '').'"> (9999)');
echo $data_tbl->get_new_row('Rok narození', '<input type="text" name="year" value="'.(($year != 0)? $year : '').'"> (9999)');
echo $data_tbl->get_empty_row();
echo $data_tbl->get_new_row('','<INPUT TYPE="submit" VALUE="Vyhledat"> <BUTTON onclick="javascript:close_popup();">Zavřít</BUTTON>');
echo $data_tbl->get_footer()."\n";
?>
</form>
<?
if($reg != 0 || $year != 0)
{
db_Connect();
if($reg != 0)
{
DrawPageSubTitle('Dle registračního čísla - '.$g_shortcut.RegNumToStr($reg));
$query = "SELECT * FROM ".TBL_USER." WHERE reg = ".$reg." ORDER BY reg ASC";
@$vysledek=query_db($query);
$cnt= ($vysledek != FALSE) ? mysqli_num_rows($vysledek) : 0;
if($cnt > 0)
{
$data_tbl = new html_table_mc();
$col = 0;
$data_tbl->set_header_col_with_help($col++,'Reg.č.',ALIGN_LEFT,"Registrační číslo");
$data_tbl->set_header_col($col++,'Jméno',ALIGN_LEFT);
$data_tbl->set_header_col($col++,'Aktivní',ALIGN_CENTER);
echo $data_tbl->get_css()."\n";
echo $data_tbl->get_header()."\n";
echo $data_tbl->get_header_row()."\n";
while ($zaznam=mysqli_fetch_array($vysledek))
{
$row = array();
$row[] = $g_shortcut.RegNumToStr($zaznam['reg']);
$row[] = $zaznam['prijmeni'].' '.$zaznam['jmeno'];
$row[] = ($zaznam['hidden'] == 1)? 'Ne':'Ano';
echo $data_tbl->get_new_row_arr($row)."\n";
}
echo $data_tbl->get_footer()."\n";
}
else
echo('Registrační číslo '.$g_shortcut.RegNumToStr($reg).' nebylo nalezeno.');
}
else if($year != 0)
{
DrawPageSubTitle('Dle roku narození - '.$year);
$year0 = $year;
if($year0 > 100)
$year0 = $year0 % 100;
$year0 *= 100;
$y1 = $year0;
$y2 = $year0 + 99;
$query = "SELECT * FROM ".TBL_USER." WHERE reg >= ".$y1." AND reg <= ".$y2." ORDER BY reg ASC";
@$vysledek=query_db($query);
$cnt= ($vysledek != FALSE) ? mysqli_num_rows($vysledek) : 0;
if($cnt > 0)
{
$data_tbl = new html_table_mc();
$col = 0;
$data_tbl->set_header_col_with_help($col++,'Reg.č.',ALIGN_LEFT,"Registrační číslo");
$data_tbl->set_header_col($col++,'Jméno',ALIGN_LEFT);
$data_tbl->set_header_col($col++,'Aktivní',ALIGN_CENTER);
echo $data_tbl->get_css()."\n";
echo $data_tbl->get_header()."\n";
echo $data_tbl->get_header_row()."\n";
while ($zaznam=mysqli_fetch_array($vysledek))
{
$row = array();
$row[] = $g_shortcut.RegNumToStr($zaznam['reg']);
$row[] = $zaznam['prijmeni'].' '.$zaznam['jmeno'];
$row[] = ($zaznam['hidden'] == 1)? 'Ne':'Ano';
echo $data_tbl->get_new_row_arr($row)."\n";
}
echo $data_tbl->get_footer()."\n";
}
else
echo('Nebyl nalezen žádný člen s rokem narození '.$year);
}
}
?>
</CENTER>
</TD>
<TD width="2%"></TD>
</TR>
</TABLE>
<?
HTML_Footer();
?>