#2 search function for arrived angels
This commit is contained in:
parent
24e402c6e0
commit
c3a9e66c32
|
@ -1,6 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
function admin_arrive() {
|
function admin_arrive() {
|
||||||
$msg = "";
|
$msg = "";
|
||||||
|
$search = "";
|
||||||
|
if (isset ($_REQUEST['search']))
|
||||||
|
$search = strip_request_item('search');
|
||||||
|
|
||||||
if (isset ($_REQUEST['reset']) && preg_match("/^[0-9]*$/", $_REQUEST['reset'])) {
|
if (isset ($_REQUEST['reset']) && preg_match("/^[0-9]*$/", $_REQUEST['reset'])) {
|
||||||
$id = $_REQUEST['reset'];
|
$id = $_REQUEST['reset'];
|
||||||
|
@ -15,19 +18,35 @@ function admin_arrive() {
|
||||||
|
|
||||||
$users = sql_select("SELECT * FROM `User` ORDER BY `Nick`");
|
$users = sql_select("SELECT * FROM `User` ORDER BY `Nick`");
|
||||||
$table = "";
|
$table = "";
|
||||||
|
if ($search == "")
|
||||||
|
$tokens = array ();
|
||||||
|
else
|
||||||
|
$tokens = explode(" ", $search);
|
||||||
foreach ($users as $usr) {
|
foreach ($users as $usr) {
|
||||||
|
if (count($tokens) > 0) {
|
||||||
|
$match = false;
|
||||||
|
$index = join("", $usr);
|
||||||
|
foreach ($tokens as $t)
|
||||||
|
if (strstr($index, trim($t))) {
|
||||||
|
$match = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!$match)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$table .= '<tr>';
|
$table .= '<tr>';
|
||||||
$table .= '<td>' . $usr['Nick'] . '</td>';
|
$table .= '<td>' . $usr['Nick'] . '</td>';
|
||||||
if ($usr['Gekommen'] == 1)
|
if ($usr['Gekommen'] == 1)
|
||||||
$table .= '<td>yes</td><td><a href="' . page_link_to('admin_arrive') . '&reset=' . $usr['UID'] . '">reset</a></td>';
|
$table .= '<td>yes</td><td><a href="' . page_link_to('admin_arrive') . '&reset=' . $usr['UID'] . '&search=' . $search . '">reset</a></td>';
|
||||||
else
|
else
|
||||||
$table .= '<td></td><td><a href="' . page_link_to('admin_arrive') . '&arrived=' . $usr['UID'] . '">arrived</a></td>';
|
$table .= '<td></td><td><a href="' . page_link_to('admin_arrive') . '&arrived=' . $usr['UID'] . '&search=' . $search . '">arrived</a></td>';
|
||||||
$table .= '</tr>';
|
$table .= '</tr>';
|
||||||
}
|
}
|
||||||
return template_render('../templates/admin_arrive.html', array (
|
return template_render('../templates/admin_arrive.html', array (
|
||||||
'search' => "",
|
'search' => $search,
|
||||||
'table' => $table,
|
'table' => $table,
|
||||||
'msg' => $msg
|
'msg' => $msg,
|
||||||
|
'link' => page_link_to('admin_arrive')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -1,9 +1,8 @@
|
||||||
<form action="" method="post">
|
<form action="%link%" method="post">
|
||||||
<p>
|
<p>
|
||||||
<input type="text" name="search" value="%search%" /><input type="submit" name="submit" value="Search" />
|
<input type="text" name="search" value="%search%" /><input type="submit" name="submit" value="Search" />
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>%msg%
|
||||||
%msg%
|
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
Loading…
Reference in New Issue