Conditions | 6 |
Paths | 8 |
Total Lines | 29 |
Code Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | function member_search($queryarray, $andor, $limit, $offset, $userid) |
||
12 | { |
||
13 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('users') . ' WHERE level > 0'; |
||
14 | if (0 != $userid) { |
||
15 | $sql .= " AND uid='0'"; |
||
16 | } |
||
17 | // because count() returns 1 even if a supplied variable |
||
18 | // is not an array, we must check if $querryarray is really an array |
||
19 | if (is_array($queryarray) && $count = count($queryarray)) { |
||
20 | $sql .= " AND ((uname LIKE '%{$queryarray[0]}%' OR name LIKE '%{$queryarray[0]}%')"; |
||
21 | for ($i = 1; $i < $count; $i++) { |
||
22 | $sql .= " $andor "; |
||
23 | $sql .= "(uname LIKE '%{$queryarray[$i]}%' OR name LIKE '%{$queryarray[$i]}%')"; |
||
24 | } |
||
25 | $sql .= ') '; |
||
26 | } |
||
27 | $sql .= ' ORDER BY uname,name ASC'; |
||
28 | |||
29 | $result = $GLOBALS['xoopsDB']->query($sql, (int)$limit, (int)$offset); |
||
30 | $ret = []; |
||
31 | $i = 0; |
||
32 | while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||
33 | $ret[$i]['link'] = '' . XOOPS_URL . "\userinfo.php?uid=" . $myrow['uid'] . ''; |
||
34 | $ret[$i]['title'] = '' . htmlspecialchars($myrow['uname'], ENT_QUOTES | ENT_HTML5) . ' / ' . htmlspecialchars($myrow['name'], ENT_QUOTES | ENT_HTML5) . ''; |
||
35 | $ret[$i]['time'] = '' . $myrow['user_regdate'] . ''; |
||
36 | $ret[$i]['uid'] = '' . $myrow['uid'] . ''; |
||
37 | $i++; |
||
38 | } |
||
39 | return $ret; |
||
40 | } |
||
43 |
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.