Mitgliederliste in PHP filtern

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Mitgliederliste in PHP filtern

    hallo...

    ich hab da schon eine kleine Javasript suche drin, aber nicht das was ich mir wünnsche, mehr in PHP um nach A.b oder C zu suchen oder mit einbezogen ob der User ein Foto, Hompage oder E-Mail hat sowie nach Geburtsdatum...

    Wie macht man eine Suche nach Objekten oder ABC die dann Angezeigt wird... versuch eine Userliste mit Suche zu machen...

    Quellcode

    1. <?php
    2. // Load headers
    3. require(TEMPLATEPATH."/all_header.tpl.php");
    4. ?>
    5. <html><head>
    6. <TITLE><?=$lng['memberlist']?></TITLE>
    7. <?=$css?>
    8. <head>
    9. <link rel="stylesheet" href="css/css2.css">
    10. </head>
    11. <body onload="window.focus();">
    12. <?
    13. if($total_pages>0){
    14. for($i=1; $i<=$total_pages; $i++){
    15. if($i==$page){
    16. }else{
    17. ?>
    18. &nbsp;&nbsp;<a href="main.php?include=11&session_id=<?=$session_id?>&amp;page=<?=$i?>&amp;orderby=<?=$orderby?>&amp;edit=<?=$edit?>&amp;kick=<?=$kick?>&amp;ban=<?=$ban?>"><b><?=$i?></b></a>
    19. <?
    20. }
    21. }
    22. }
    23. ?>
    24. <script language="JavaScript">
    25. var NS4 = (!document.all);
    26. var IE4 = (document.all);
    27. var zaehler = 0;
    28. function suchen(suchtext) {
    29. var txt, i, found;
    30. if (suchtext == "")
    31. return false;
    32. if (NS4) {
    33. if (!this.find(suchtext))
    34. while(this.find(suchtext, false, true))
    35. zaehler++;
    36. else
    37. zaehler++;
    38. if (zaehler == 0) alert(suchtext + " was not found on this page.");
    39. }
    40. if (IE4) {
    41. txt = this.document.body.createTextRange();
    42. for (i = 0; i <= zaehler && (found = txt.findText(suchtext)) != false; i++) {
    43. txt.moveStart("character", 1);
    44. txt.moveEnd("textedit");
    45. }
    46. if (found) {
    47. txt.moveStart("character", -1);
    48. txt.findText(suchtext);
    49. txt.select();
    50. txt.scrollIntoView();
    51. zaehler++;
    52. }
    53. else {
    54. if (zaehler > 0) {
    55. zaehler = 0;
    56. suchen(suchtext);
    57. }
    58. else { alert("Der Text \"" + suchtext + "\" wurde nicht gefunden."); }
    59. }
    60. }
    61. return false;
    62. }
    63. </script>
    64. <td height="583" align="left" > <div align="center">
    65. <p>
    66. <form name=search onSubmit="return suchen(this.suchtexting.value);">
    67. Auf dieser Seite suchen nach:
    68. <input name=suchtexting type=text size=20 onChange="n = 0;">
    69. <strong>
    70. <input type="submit" name="Submit" value="OK">
    71. </strong>
    72. </form>
    73. <div align="center">
    74. <table class="dforeground" border="0" cellspacing="1" cellpadding="6" width="50%">
    75. <tr valign="center">
    76. <td align="left"><center>
    77. <b><?=$lng["username"]?></b>
    78. </center></td>
    79. <td align="left"><center>
    80. <B>Homepage</B>
    81. </center></td>
    82. <td align="left"><center>
    83. <B><?=$lng["email"]?></B>
    84. </center></td>
    85. <td align="left"><center>
    86. <b>Bild</b>
    87. <td align="left"><center>
    88. <b>Geburtstag</b>
    89. </center></td>
    90. <td align="left"><center>
    91. <b>Jahrgang</b>
    92. </center></TD>
    93. <td align="left"><center>
    94. <b>Alter</b>
    95. </center></TD>
    96. </td>
    97. <td align="left">
    98. </td>
    99. </tr>
    100. <?
    101. for($i=0;$i<$userlist_count;$i++){
    102. // Get user's session ID
    103. $session2=NEW session($session->getUsersSession($userlist[$i][id]));
    104. // IP address
    105. if($show_ip){
    106. if($session2->ip){
    107. $ip=" [<a href=\"\" class=\"links\" onClick=\"window.open('http://network-tools.com/default.asp?prog=trace&Netnic=whois.arin.net&host=".$session2->ip."', 'whois', 'width=800, height=600, resizable=yes, scrollbars=yes'); return false;\">".$session2->ip."</A>]";
    108. }else{
    109. $ip="[?]";
    110. }
    111. }else{
    112. $ip="";
    113. }
    114. ?>
    115. <tr>
    116. <td align="left">
    117. <?
    118. if (strpos($userlist[$i][statusa], "1") === 0) {
    119. ?>
    120. <img src="<?=IMAGEPATH?>/Moderator.gif" width="12" height="12" border="0" alt="Moderator">
    121. <?
    122. } else {
    123. ?>
    124. <?
    125. if (strpos($userlist[$i][statusa], "2") === 0) {
    126. ?>
    127. <img src="<?=IMAGEPATH?>/Supermoderator.gif" width="12" height="12" border="0" alt="Supermoderator">
    128. <?
    129. } else {
    130. ?>
    131. <?
    132. if (strpos($userlist[$i][statusa], "3") === 0) {
    133. ?>
    134. <img src="<?=IMAGEPATH?>/Standesamt.gif" width="12" height="12" border="0" alt="Standesamt">
    135. <?
    136. } else {
    137. ?>
    138. <?
    139. if (strpos($userlist[$i][statusa], "4") === 0) {
    140. ?>
    141. <img src="<?=IMAGEPATH?>/Admin.gif" width="12" height="12" border="0" alt="Admin">
    142. <?
    143. } else {
    144. ?>
    145. <img src="<?=IMAGEPATH?>/clearpixel.gif" width="12" height="12" border="0" alt="">
    146. <?
    147. }
    148. }
    149. }
    150. }
    151. IF($user->sex){
    152. ?>
    153. <img src="<?=IMAGEPATH?>/sex_<?=$userlist[$i][sex]?>.gif" border="0" alt="">
    154. <?
    155. }else{
    156. ?>
    157. <img src="<?=IMAGEPATH?>/clearpixel.gif" width="0" height="0" border="0" alt="">
    158. <?
    159. }
    160. ?>
    161. <A href="" onClick="window.open('main.php?session_id=<?=$session_id?>&include=41&profile_user_id=<?=$userlist[$i][id]?>','pr<?=$userlist[$i][id]?>','width=500,height=500,top=1,resizable=yes,scrollbars=yes'); return false;"><FONT color="#<?=$userlist[$i][color]?>"><?=$userlist[$i][login]?></FONT></A>
    162. </td>
    163. <td align="left"><center>
    164. <?
    165. if (strpos($userlist[$i][name], "http://") === 0) {
    166. ?>
    167. <img src="<?=IMAGEPATH?>/roterbuntstift.gif" title="angezeigt" border="0" width="16" height="16"></td>
    168. <?
    169. } else {
    170. ?>
    171. <?
    172. if (strpos($userlist[$i][name], "www") === 0) {
    173. ?>
    174. <img src="<?=IMAGEPATH?>/roterbuntstift.gif" title="angezeigt" border="0" width="16" height="16"></td>
    175. <?
    176. } else {
    177. ?>
    178. <img src="<?=IMAGEPATH?>/leer.gif" title="angezeigt" border="0" width="16" height="16"></td>
    179. <?
    180. }
    181. }
    182. ?>
    183. </center>
    184. </TD>
    185. <center>
    186. <?
    187. if(!$userlist[$i][hide_email]||$edit&&$current_user->level&8){
    188. ?>
    189. <td align="center"><img src="<?=IMAGEPATH?>/roterbuntstift.gif" title="angezeigt" border="0" width="16" height="16"></td>
    190. <?
    191. }else{
    192. ?>
    193. <td align="center"><img src="<?=IMAGEPATH?>/leer.gif" title="angezeigt" border="0" width="16" height="16"></td>
    194. <?
    195. }
    196. ?>
    197. </center>
    198. <td align="left"><center>
    199. <?
    200. if (empty ($userlist[$i][photo])){
    201. ?>
    202. <img src="<?=IMAGEPATH?>/leer.gif" title="angezeigt" border="0" width="16" height="16"></td>
    203. <?
    204. } else {
    205. ?>
    206. <img src="<?=IMAGEPATH?>/roterbuntstift.gif" title="angezeigt" border="0" width="16" height="16"></td>
    207. <?
    208. }
    209. ?>
    210. <td align="left"><center>
    211. <?
    212. if (strpos($userlist[$i][hha], "0") === 0) {
    213. ?>
    214. <?
    215. } else {
    216. ?>
    217. <?
    218. if (strpos($userlist[$i][hha], "3") === 0) {
    219. ?>
    220. <?=$userlist[$i][date_birth_dd]?>.<?=$userlist[$i][date_birth_mm]?>
    221. <?
    222. } else {
    223. }
    224. }
    225. ?>
    226. </td>
    227. <TD align="left"><center>
    228. <?
    229. if (strpos($userlist[$i][hhb], "0") === 0) {
    230. ?>
    231. <?
    232. } else {
    233. ?>
    234. <?
    235. if (strpos($userlist[$i][hhb], "4") === 0) {
    236. ?>
    237. <?=$userlist[$i][date_birth_yyyy];?>
    238. <?
    239. } else {
    240. }
    241. }
    242. ?>
    243. </td>
    244. <td align="left"><center>
    245. <?
    246. if (strpos($userlist[$i][age], "0") === 0) {
    247. ?>
    248. <?
    249. } else {
    250. ?>
    251. <?
    252. if (strpos($userlist[$i][age], "5") === 0) {
    253. ?>
    254. <?php
    255. $jahr = $userlist[$i][date_birth_yyyy];
    256. $mon = $userlist[$i][date_birth_mm];
    257. $tag = $userlist[$i][date_birth_dd];
    258. $alter = (date('Y') - $jahr) - intval((date('j') < $tag) AND (date('n' ) <= $mon) );
    259. echo $alter ;
    260. ?>
    261. <?
    262. } else {
    263. }
    264. }
    265. ?>
    266. </td>
    267. </td>
    268. <td align="left">
    269. </td>
    270. <?
    271. if($edit){
    272. ?>
    273. <td align="center">
    274. <?
    275. if($session->user_id<>$userlist[$i]['id'] && $userlist[$i]['level']<131071){
    276. ?>
    277. <input type="button" class="buttons" value="<?=$lng["edit"]?>" onclick="window.location.href='main.php?session_id=<?=$session_id?>&include=18&profile_user_id=<?=$userlist[$i][id]?>';">
    278. <input type="button" class="buttons" value="<?=$lng["delete"]?>" onclick="if(confirm('<?=STR_REPLACE("'","\\'",STR_REPLACE("{USER}",$userlist[$i][login],$lng["confirmdeleteuser"]))?>')){window.location.href='main.php?session_id=<?=$session_id?>&include=18&profile_user_id=<?=$userlist[$i][id]?>&delete=1';}">
    279. <input type="button" class="buttons" value="Standesamt" onclick="window.location.href='main.php?session_id=<?=$session_id?>&include=46&profile_user_id=<?=$userlist[$i][id]?>';">
    280. </td>
    281. <?
    282. }else{
    283. }
    284. ?>
    285. <td align="center">
    286. <?
    287. if($session->user_id<>$userlist[$i]['id'] && $userlist[$i]['level']<4096){
    288. ?>
    289. <input type="button" class="buttons" value="<?=$lng["edit"]?>" onclick="window.location.href='main.php?session_id=<?=$session_id?>&include=18&profile_user_id=<?=$userlist[$i][id]?>';">
    290. <input type="button" class="buttons" value="<?=$lng["delete"]?>" onclick="if(confirm('<?=STR_REPLACE("'","\\'",STR_REPLACE("{USER}",$userlist[$i][login],$lng["confirmdeleteuser"]))?>')){window.location.href='main.php?session_id=<?=$session_id?>&include=18&profile_user_id=<?=$userlist[$i][id]?>&delete=1';}">
    291. </td>
    292. <?
    293. }else{
    294. }
    295. ?>
    296. <?
    297. }elseif($kick&&$userlist[$i]['online'] && $userlist[$i]['id']<>$session->user_id && $userlist[$i]['level']<131071){
    298. if(!$session2->kicked){
    299. ?>
    300. <td align="center">
    301. <input type="button" class="buttons" value="<?=$lng["kick"]?>" onclick="if(confirm('<?=STR_REPLACE("'","\\'",STR_REPLACE("{USER}",$userlist[$i][login],$lng["confirmkickuser"]))?>')){window.location.href='main.php?session_id=<?=$session_id?>&include=19&profile_user_id=<?=$userlist[$i][id]?>';}">
    302. <br>
    303. <input type="button" class="buttons" value="<?=$lng["ban"]?>" onclick="window.location.href='main.php?session_id=<?=$session_id?>&include=20&profile_user_id=<?=$userlist[$i][id]?>';">
    304. </td>
    305. <?
    306. }else{
    307. ?>
    308. <TD>&nbsp;</TD>
    309. <?
    310. }
    311. }elseif($ban && $userlist[$i]['id']<>$session->user_id && $userlist[$i]['level']<131071){
    312. ?>
    313. <td align="center">
    314. <input type="button" class="buttons" value="<?=$lng["ban"]?>" onclick="window.location.href='main.php?session_id=<?=$session_id?>&include=20&profile_user_id=<?=$userlist[$i][id]?>';">
    315. </td>
    316. <?
    317. }elseif(!$admin&&$userlist[$i][online]&&$session->getUsersRoom($userlist[$i][id])>0&&$session->room_id>0&&$session->room_id<>$session->getUsersRoom($userlist[$i][id])){
    318. ?>
    319. <td align="center">
    320. <a href="" onClick="window.open('main.php?session_id=<?=$session_id?>&include=12&user_id=<?=$userlist[$i][id]?>','invitation_<?=$userlist[$i][id]?>','width=300,height=200'); return false;"><?=$lng["invite"]?></A>
    321. <br>
    322. <A href="" onClick="window.open('main.php?session_id=<?=$session_id?>&include=5&profile_user_id=<?=$userlist[$i][id]?>','pr<?=$userlist[$i][id]?>','width=500,height=500,top=1,resizable=yes,scrollbars=yes'); return false;"><?=$lng["profile"]?></A>
    323. </td>
    324. <?
    325. }else{
    326. }
    327. }
    328. ?>
    329. </table>
    330. </div>
    331. <?
    332. // var_dump($user);
    333. IF($total_pages>1){
    334. FOR($i=1; $i<=$total_pages; $i++){
    335. IF($i==$page){
    336. }else{
    337. ?>
    338. &nbsp;&nbsp;<a href="main.php?include=11&session_id=<?=$session_id?>&amp;page=<?=$i?>&amp;orderby=<?=$orderby?>&amp;edit=<?=$edit?>&amp;kick=<?=$kick?>&amp;ban=<?=$ban?>"><b><?=$i?></b></a>
    339. <?
    340. }
    341. }
    342. }
    343. ?>
    344. </body></html>
    Alles anzeigen


    kann mir einer da weiterhelfen???
  • gewöhn dir doch bitte an sowohl php funktionen als auch html funktionen kleinzuschreiben.
    Und was soll denn das ganze tag geschließe und geöffne?

    Quellcode

    1. <?
    2. }
    3. ?>
    4. <?
    5. }
    6. ?>
    7. <?
    8. }
    9. ?>
    10. <?
    11. }
    12. ?>
    Alles anzeigen


    Viel leserlicher wäre es wenn du den PHP Code nur oben öffnen und unten schließen würdest und alle Ausgaben mit echos machen würdest.

    Ich konnte den zu durchsuchenden Teil deines Codes leider nicht ausmachen. Aber die kommen doch bestimmt aus irgendeiner Datenbank. Die relevanten Informationen solltest du bereits dort herausfiltern.

    Oder willst du den kompletten Datensatz suchen und nur bestimmte Teile hervorheben? Bin aus deinem Posting mal wieder nicht schlau geworden.
    Satzstellung und Rechtschreibung sind aber auch eine Zumutung....
  • Ich weiß, meine Programierung ist zum Teil unter alle Kanone. :D
    Habs oben jetzt mal einwenig Compackter gemacht und alles soweit in klein gesetzt...

    Mit dem Filtern ist schon eine gute Sache, nur wie ich es hinbekomme???

    So weit kenn ich mich mit PHP noch nicht aus (Anfänger mit dem Zeug noch viel zu lernen mal so erwähnt, bin mehr in dem Bereich HTML und Assembler (nichts mit HPs) am Coden)...

    Noch mal zurückgekommen, ich weiß, meine Rechtschreibung ist nicht der Renner... Ich Brauch eure Hilfe bei der Erstellung einer Miedgliederliste... So wie sie da steht zeigt sie nur alle an und die Suche in Javasript ist nur eine Notlösung...

    Möchte mehr die User nach A oder B oder C oder mit Foto oder E-Mail oder Geburtsdatum suchen lassen...

    ich füg mal 2 bilder zu, wie ich meine...

    http://the-icc-group.de/suche/suche1.JPG

    http://the-icc-group.de/suche/suche2.JPG

    greets
  • Hi,
    ich denke mit Filtern mein d0nUt ungefähr soetwas:

    Quellcode

    1. $_POST['username'] = addslashes($_POST['username']);
    2. $sql = "SELECT * FROM mitglieder WHERE username LIKE '".$_POST['username']."%'";
    3. if ($_POST['geschlecht'] == 'w' or $_POST['geschlecht'] == 'm')
    4. {
    5. $sql .= " AND geschlecht = '".$_POST['geschlecht']."'";
    6. }
    7. ...


    Tabellen- und Feldernamen müssen natürlich noch angepasst werden

    mfg
    n3or
    Fatal error: main(): Failed opening required '~signature.php~'
  • Hab die frage versehendlich an der Falschen stelle gepostet...

    Ich hab den Code noch nicht getestet, wenn er in der Lage ist, Mietglieder zu suchen, bau ich ihn dann ein, sieht schon gut aus...

    Da ich schon ein anderen gedanken hab, wie ich es Filtern kann, nur fällt mir nichts zu der Liste ein...

    Das Z.b. wenn man "to" eingibt und er dann Toxic/togar/toto ausgibt

    oder bei

    "ab" Absurd oder abser....

    Dank im Voraus... aus der "$userlist"

    greets