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