krisis007 Posted February 16, 2008 Report Share Posted February 16, 2008 (edited) Mans users.php <? require "include/bittorrent.php"; dbconn(); $searchstr = unesc($_GET["search"]); $search = trim($_GET['search']); $class = $_GET['class']; if ($class == '-' || !is_valid_id($class)) $class = ''; if ($search != '' || $class) { $query = "username LIKE " . sqlesc("%$search%") . " AND class='if (get_user_class() < UC_SYSOP)'"; if ($search) $q = "search=" . htmlspecialchars($search); } else { $letter = trim($_GET["letter"]); if ($letter == "" || strpos("abcdefghijklmnopqrstuvwxyz", $letter) === false) $letter = "All"; if (strlen($letter) == 3) { $query = "status='confirmed'"; $q = "letter=$letter"; } elseif (strlen($letter) == 1) { $query = "username LIKE class='()get_user_class() > UC_SYSOP)' AND status='confirmed'"; $q = "letter=$letter"; } else{ die;} } if ($class) { $query .= " AND class=$class"; $q .= ($q ? "&" : "") . "class=$class"; } stdhead("Pirtis"); print("<h1>Useri</h1>\n"); ?> <form method="get" action=users.php> <p align="center"> Meklet: <input type="text" name="search" size="40" value="<?= htmlspecialchars($searchstr) ?>" /> <input type="submit" value="Aiziet!" /> </p> </form> <? $page = $_GET['page']; $perpage = 100; $res = mysql_query("SELECT COUNT(*) FROM users WHERE $query") or sqlerr(); $arr = mysql_fetch_row($res); $pages = floor($arr[0] / $perpage); if ($pages * $perpage < $arr[0]) ++$pages; if ($page < 1) $page = 1; else if ($page > $pages) $page = $pages; for ($i = 1; $i <= $pages; ++$i) if ($i == $page) $pagemenu .= "<b>$i</b>\n"; else $pagemenu .= "<a href=?$q&page=$i><b>$i</b></a>\n"; if ($page == 1) $browsemenu .= "<b><< Atpakal</b>"; else $browsemenu .= "<a href=?$q&page=" . ($page - 1) . "><b><< Atpakal</b></a>"; $browsemenu .= " "; if ($page == $pages) $browsemenu .= "<b>Talak >></b>"; else $browsemenu .= "<a href=?$q&page=" . ($page + 1) . "><b>Talak >></b></a>"; print("<p>$browsemenu<br>$pagemenu</p>"); $offset = ($page * $perpage) - $perpage; $res = mysql_query("SELECT * FROM users WHERE $query ORDER BY username LIMIT $offset,$perpage") or sqlerr(); $num = mysql_num_rows($res); print("<table border=1 cellspacing=0 cellpadding=5>\n"); print("<tr><td class=colhead>Bilde</td><td class=colhead>Nosaukums</td><td class=colhead>Telefons</td><td class=colhead>Majas Lapa</td><td class=colhead>Adrese</td><td class=colhead>Reitings</td></tr>\n"); for ($i = 0; $i < $num; ++$i) { $arr = mysql_fetch_assoc($res); if ($arr['country'] > 0) { $cres = mysql_query("SELECT name,flagpic FROM countries WHERE id=$arr[country]"); if (mysql_num_rows($cres) == 1) { $carr = mysql_fetch_assoc($cres); $country = "<td href=\"userdetails.php?id=$arr[id]\"><img src=\"$arr[avatar]" ."\" width=\"100\" alt=\"".$arr[username]."\" title=\"".$arr[username]."\" border=\"0\" /></td>"; } } else $country = "<td align=center>---</td>"; print("<tr>$country<td align=left><a target=_blank href=../list/userdetails.php?id=$arr[id]><b>$arr[username]</b></a></td><td>$arr[tel]</td>" . "<td><a target=_blank href=$arr[web]><b>$arr[webtitle]</b></a></td><td>$arr[adrese]</td><td>Paslaik nav pieejams</td></tr>\n"); } print("</table>\n"); print("<p>$pagemenu<br>$browsemenu</p>"); stdfoot(); die; ?> pieversiet uzmanibu pirmajam rindam if ($search != '' || $class) { $query = "username LIKE " . sqlesc("%$search%") . " AND class='if (get_user_class() < UC_SYSOP)'"; if ($search) $q = "search=" . htmlspecialchars($search); } else { $letter = trim($_GET["letter"]); if ($letter == "" || strpos("abcdefghijklmnopqrstuvwxyz", $letter) === false) $letter = "All"; if (strlen($letter) == 3) { $query = "status='confirmed'"; $q = "letter=$letter"; } elseif (strlen($letter) == 1) { $query = "username LIKE class='()get_user_class() > UC_SYSOP)' AND status='confirmed'"; $q = "letter=$letter"; } else{ die;} } if ($class) { kas jalabo lai neraditu sysopus ieks users.php jo ja izlabo shita tad neit rada pilnigi visus. Edited February 16, 2008 by krisis007 Link to comment Share on other sites More sharing options...
anonīms Posted February 16, 2008 Report Share Posted February 16, 2008 $query = "username, status='confirmed'"; šādi mēģināji? Link to comment Share on other sites More sharing options...
krisis007 Posted February 16, 2008 Author Report Share Posted February 16, 2008 ja bet ja meginu ta nerada citus bet tikai mani Link to comment Share on other sites More sharing options...
Recommended Posts