[REQ] Better Memberlist

Posted on Saturday 12th July 2008 at 07:01 PM
UrbanTwitch
UrbanTwitch's Avatar
The default memberlist we get is pretty simple. It just has names.

Can anyone write a better one with contains the ID (member number), their name, position, and finally their status?

Much like the one here.

Thanks.
Posted on Sunday 13th July 2008 at 11:30 PM
Adam981
Adam981's Avatar
Just add the mysql query to display what you want :)
Posted on Monday 14th July 2008 at 12:03 AM
UrbanTwitch
UrbanTwitch's Avatar
Example please? For ID?
Posted on Tuesday 15th July 2008 at 12:53 PM
ilyas-shezad
ilyas-shezad's Avatar
What are the db columns for the data u want to display e.g.
by id do u mean id row in the members table?
and also by position do u mean userlevel?
and (just anothe example) there status as status in the table?

Thanks.
PHP-MYSQL-JAVASCRIPT-ACTIONSCRIPT-CSS-HTML
Making tutorials for flash, php and javascript
Posted on Tuesday 15th July 2008 at 03:08 PM
UrbanTwitch
UrbanTwitch's Avatar
ID, Username, Position, and Status

Like that. Thanks.
Posted on Wednesday 16th July 2008 at 11:14 AM
ilyas-shezad
ilyas-shezad's Avatar
Okay can u post ur current member list on here?
PHP-MYSQL-JAVASCRIPT-ACTIONSCRIPT-CSS-HTML
Making tutorials for flash, php and javascript
Posted on Wednesday 16th July 2008 at 02:32 PM
UrbanTwitch
UrbanTwitch's Avatar
PHP Code
  1. <?php include("/home/jsfdan/public_html/includes/vtop.php"); ?>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  3. "https://www.w3.org/TR/html4/strict.dtd">
  4.  
  5. <html>
  6. <head>
  7. <title>Members - sodaDome.com</title>
  8. <link rel="shortcut icon" href="https://sodadome.com/favicon.ico">
  9. <meta name="Description" content="About Me.">
  10. <meta name="Keywords" content="sodaplay, sodarace, soda ltd, physics, education, science, gravity, mass, friction, javascript_freek, dan jasnowski, sodaplay, sodarace, sodaconstructor, models, moovl, ed burton, soda">
  11.  
  12. <?php include("/home/jsfdan/public_html/temp2/includes/titleheader.php"); ?>
  13. </head>
  14.  
  15. <?php include("/home/jsfdan/public_html/temp2/includes/greenlinks.php"); ?>
  16.  
  17. <?php include("/home/jsfdan/public_html/temp2/includes/leftmenu.php"); ?>
  18.  
  19. <!-- START BODY CONTENT -->
  20.  
  21. <div id=title>Memberlist</div>
  22.  
  23. <?php
  24. echo "";
  25. if(isset($_GET['user'])) { //if there trying to view a profile
  26. //gets the user name and makes it safe
  27. $username = addslashes($_GET[user]);
  28. //querys the db to find the username
  29. $getuser = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'");
  30. //checks see if the username exists in the db
  31. $usernum = mysql_num_rows($getuser);
  32. //if it don't exist
  33. if($usernum == 0)
  34.  
  35. {
  36. //don't exist
  37.  
  38. echo ("User Not Found. Try again.");
  39.  
  40. }
  41. //if it does exist then show there profile
  42. else{
  43. $user = mysql_fetch_array($getuser);
  44. $user_rank = mysql_fetch_array(mysql_query("SELECT * FROM `groups` WHERE `lvlnum` = '$user[userlevel]';"));
  45.  
  46. echo "
  47. <div id=title>$user[username]'s Profile</div><br>
  48. <img src='$user[avvy]' width='100px' height='100px' title='$user[username]&#39;s avatar' border='0'><br>
  49. <br><b>Last Seen:</b> $user[last_seen]<br>
  50. <div style=padding-top: 0px;background-image: url(https://sodadome.com/sc2.gif); background-repeat: repeat-x;height: 18px;></div>
  51. <b>Member No.:</b> $user[id]<br>
  52. <b>User Rank:</b> $user_rank[full_name]<br>";
  53. if($user[ehidden] == "no"){
  54. echo "<b>Email:</b> <i>Hidden</i>";
  55. }else{
  56. echo "<b>Email:</b> $user[email]";
  57. }
  58. if($user[online] >= $offline){
  59. $online = "<span style='color:green;font-weight:bold;'>Online</span>";
  60. }else{
  61. $online = "<span style='color:red;font-weight:bold;'>Offline</span>";
  62. }
  63. echo "
  64. <b>Status:</b> $online<br>
  65. <b>Location:</b> $user[location]<br>
  66. <b>Gender:</b> $user[sex]<br>
  67. <b>Join Date:</b> $user[signupdate]<br>
  68. <b>Age:</b> $user[age]<br>
  69. <b>MSN:</b> $user[msn]<br>
  70. <b>AIM:</b> $user[aim]<br>
  71. <b>Website:</b> $user[website]<br>
  72. <b>About Me</b><br> $user[about]<br><br>
  73. <hr>
  74. <a href=https://sodadome.com/members.php>Return to Member List</a><br><br>
  75. ";
  76.  
  77. }
  78. }else{
  79. //gets all the members from the database
  80. $getusers = mysql_query("SELECT * FROM `members` ORDER BY `id` ASC") or die(mysql_error());
  81. //loops there name out
  82. while ($user = mysql_fetch_array($getusers)) {
  83. echo "$user[id] | <a href='members.php?user=$user[username]'>$user[username]</a><br>";
  84. }
  85. }
  86. echo "";
  87. ?>
  88. <?php
  89. include("config.php");
  90.  
  91. //Query database & Counts the rows in the members database
  92. $count = mysql_num_rows(mysql_query('SELECT * FROM `members`'));
  93.  
  94. echo 'Members: ' . $count . '';
  95.  
  96. $new = mysql_fetch_array(mysql_query("SELECT * FROM `members` ORDER BY `id` DESC LIMIT 0, 1")); //Gets the newest member
  97. echo "<br>Newest User: " . $new[username]; //Displays the newest member
  98. ?>
  99.  
  100.  
  101.  
  102. <div id=title>Users online</div>
  103. <?php
  104. include("online.php"); //get online configuration and such
  105. $get_online_users = mysql_query("SELECT * FROM `members` WHERE `online` >= '$offline' ORDER BY `userlevel` ASC"); //get all online users
  106. $total_users = mysql_num_rows($get_online_users);
  107. if($total_users == 0){ //see if anyone is logged in
  108. echo "No Users Online!"; //there isn't =O
  109. }else{ //maybe....
  110. $i = 1; //the variable 'i' is 1
  111. while($online = mysql_fetch_array($get_online_users)){ //loop online users
  112. if(($i > 0) && ($i != $total_users)){ //see if i is the same or not of total online users
  113. $comma = ', '; //if it isn't then theres a comma
  114. }else{ //or....
  115. $comma = ''; //if there isn't theres no comma
  116. } //end check
  117. echo "<a href='members.php?user=$online[username]'>$online[username]</a>$comma"; //echo the online users with the comma
  118. } //end loop
  119. } //end
  120. ?>
  121.  
  122.  
  123. <!-- END BODY CONTENT -->
  124.  
  125. <?php include("/home/jsfdan/public_html/temp2/includes/footer.php"); ?>


There you are.
Posted on Wednesday 16th July 2008 at 02:34 PM
UrbanTwitch
UrbanTwitch's Avatar
Online doesn't work though. :
Posted on Wednesday 16th July 2008 at 06:32 PM
ilyas-shezad
ilyas-shezad's Avatar
Go to the end of you script and replace...

PHP Code
  1. <div id=title>Users online</div>
  2. <?php
  3. include("online.php"); //get online configuration and such
  4. $get_online_users = mysql_query("SELECT * FROM `members` WHERE `online` >= '$offline' ORDER BY `userlevel` ASC"); //get all online users
  5. $total_users = mysql_num_rows($get_online_users);
  6. if($total_users == 0){ //see if anyone is logged in
  7. echo "No Users Online!"; //there isn't =O
  8. }else{ //maybe....
  9. $i = 1; //the variable 'i' is 1
  10. while($online = mysql_fetch_array($get_online_users)){ //loop online users
  11. if(($i > 0) && ($i != $total_users)){ //see if i is the same or not of total online users
  12. $comma = ', '; //if it isn't then theres a comma
  13. }else{ //or....
  14. $comma = ''; //if there isn't theres no comma
  15. } //end check
  16. echo "<a href='members.php?user=$online[username]'>$online[username]</a>$comma"; //echo the online users with the comma
  17. } //end loop
  18. } //end
  19. ?>


with...

PHP Code
  1. <div id=title>Users online</div>
  2. <?php
  3. include("online.php"); //get online configuration and such
  4. $get_online_users = mysql_query("SELECT * FROM `members` WHERE `online` >= '$offline' ORDER BY `userlevel` ASC"); //get all online users
  5. $total_users = mysql_num_rows($get_online_users);
  6. if($total_users == 0){ //see if anyone is logged in
  7. echo "No Users Online!"; //there isn't =O
  8. }else{ //maybe....
  9. $i = 1; //the variable 'i' is 1
  10. while($online = mysql_fetch_array($get_online_users)){ //loop online users
  11. if(($i > 0) && ($i != $total_users)){ //see if i is the same or not of total online users
  12. $comma = ', '; //if it isn't then theres a comma
  13. }else{ //or....
  14. $comma = ''; //if there isn't theres no comma
  15. } //end check
  16. echo "[$online[id}}<a href='members.php?user=$online[username]'>$online[username]</a> Position: <b>$online[position]</b> Status: <b>$online[status]</b><br>"; //echo the online users with the comma
  17. } //end loop
  18. } //end
  19. ?>


That will echo the users online in the format...

Code
[userid]Username Position: Top Status: Online [line break]
PHP-MYSQL-JAVASCRIPT-ACTIONSCRIPT-CSS-HTML
Making tutorials for flash, php and javascript
Posted on Wednesday 16th July 2008 at 07:30 PM
UrbanTwitch
UrbanTwitch's Avatar
Parse error: syntax error, unexpected '}', expecting ']' in /home/jsfdan/public_html/members.php on line 117
Login or register to respond to this forum topic.