list all user

Started on the old forum in January 2010 · view the original in the archive · old links redirect here

7 replies · 678 views · started 16 years ago · 1 min read

4 participants
joker12 Junior · 12 posts #1

Hi,

How can i make on lavalair script to see all user.

djlee Developer · 224 posts #2

if you dont understand basic PHP why would you try to operate a site beyond an off the shelf product ???

theory

$res = mysql_query("SELECT * FROM users ORDER BY username");
while($arr = mysql_fetch_assoc($res))
 echo $arr['username']."<br />";

If your trying to learn php then i suggest you have a stab at it yourself, once you know how its around 3 lines of code to do and 2 minutes work (1min30secs of which is making it colorful and adding in links where you need them)

riderz Lead · 975 posts #3

djlee mabe u can help me i just tought of this how to show all the users on the site in the online list and the first few pages show the online members when u go further it will show all the ofline members?

////////////////////////////////
else if($action=="online")
{  $pstyle = gettheme($sid);
    echo xhtmlhead("Online List",$pstyle);
$nouo = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE hidden = 1"));
gettimebar();
getnewmsg($sid);
getalert($sid);
getshouts($sid);
$num_items = getnumonline(); //changable
if (ismod($uid)){
	$clkd = "<a href=\"index.php?action=onlineh&sid=$sid\">hidden</a>.";
}
else{
	$clkd = "hidden.";
}
boxstart("Online Users");
echo "$num_items users are currently online among which ".$nouo[0]." are $clkd.<br/>";
    if($page=="" || $page<=0)$page=1;
    $num_items = getnumonline(); //changable
    $items_per_page= 10;
    $num_pages = ceil($num_items/$items_per_page);
    if($page>$num_pages)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;

    //changable sql
    $sql = "SELECT
            a.name, b.place, b.userid, sex FROM ibwf_users a
            INNER JOIN ibwf_online b ON a.id = b.userid WHERE b.hidden = 0
            GROUP BY 1,2
            LIMIT $limit_start, $items_per_page
    ";

    echo "<p><small>";
    $mols = mysql_fetch_array(mysql_query("SELECT name, value FROM ibwf_settings WHERE id='2'"));
    print "Most online: <b>$mols[1]</b><br/>";
    $mols = mysql_fetch_array(mysql_query("SELECT ppl, dtm FROM ibwf_mpot WHERE ddt='".date("d m y")."'"));
    print "Most online today only: <b>$mols[0]</b><br/>";
    $items = mysql_query($sql);
    echo mysql_error();
boxstart("Online Users");
    while ($item = mysql_fetch_array($items))
    {
      if ($item[3]=="M"){
      $icon = "<img src=\"images/male.gif\" alt=\"M\"/>";
      }else
      if ($item[3]=="F"){
      $icon = "<img src=\"images/female.gif\" alt=\"F\"/>";
      }
      $lnk = "<a href=\"index.php?action=viewuser&who=$item[2]&sid=$sid\">$item[0]</a>";
      echo "$icon $lnk - $item[1] <br/>";
    }
    echo "</small></p>";
    echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"index.php?action=online&page=$ppage&sid=$sid\">«PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"index.php?action=online&page=$npage&sid=$sid\">Next»</a>";
    }
    echo "<br/>$page/$num_pages<br/>";
    if($num_pages>2)
    {
      echo getjumper($action, $sid,"index");
    }
    echo "</p>";
  ////// UNTILL HERE >>

/////////main menu footer
echo "
         <div class=\"footer\">

	   <center><small>
	     <a href=\"index.php?action=online&sid=$sid\" accesskey=\"5\">Online Users(".getnumonline().")</a> |
	     <a href=\"index.php?action=mainthm&sid=$sid\">Theme Manager</a> <br/>
	     <a href=\"index.php?action=chbmsg&sid=$sid\">Set Mood</a> |
             <a href=\"index.php?action=stats&sid=$sid\">Site Stats</a><br/>
               <a href=\"index.php?action=main&sid=$sid\">HOME</a><br/>

<b>© copyright $date ©</b><br/>www.$stitle.$sdomain<br/>
           </small></center>

	 </div>
";
boxend();exit();
}

Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

ori Lead · 512 posts #4

thats easy riderz u just call up every member but order by online 1st then offline will appear the further u go thru it

ori Lead · 512 posts #5

like $sql = mysql_query("SELECT * FROM users WHERE banned = '0' ORDER BY lastseen DESC"); something like that should do trick

joker12 Junior · 12 posts #6

i have done this thank you, one more questions how can i add more field on register

djlee Developer · 224 posts #7

indeed ori is correct. just order the users as needed and created your pager system and away you go.

JOKER: this is quite basic stuff buddy, and if you've read any of my posts you'll realise two things... 1st i dont often provide fully functioning code as i prefer to teach people how to do it themselves (and partially due to numero 2), 2nd i dont use any source bases for any site i create so i dont know the code layout or even the sql layout.

But what you need is quite simple, you already have the display and processing, you just need to add to it, look at what you have already, hell you can even copy and paste it, if you wanna add a mob number field for example, copy the username field, change the name of the input and thats about it, then in the actually registration process (the real php part that inserts the user) copy username again changing it to assign $mob=$_POST['mobnum'] and then add mobnum to the (usually fairly large) insert query.

Just have a go and use google A LOT. You'll learn a lot more by fooking up 5 times than you will by being told exactly (actually most of the stuff i learn comes from going the wrong way around things)

joker12 Junior · 12 posts #8

djlee wrote: indeed ori is correct. just order the users as needed and created your pager system and away you go.

JOKER: this is quite basic stuff buddy, and if you've read any of my posts you'll realise two things... 1st i dont often provide fully functioning code as i prefer to teach people how to do it themselves (and partially due to numero 2), 2nd i dont use any source bases for any site i create so i dont know the code layout or even the sql layout.

But what you need is quite simple, you already have the display and processing, you just need to add to it, look at what you have already, hell you can even copy and paste it, if you wanna add a mob number field for example, copy the username field, change the name of the input and thats about it, then in the actually registration process (the real php part that inserts the user) copy username again changing it to assign $mob=$_POST['mobnum'] and then add mobnum to the (usually fairly large) insert query.

Just have a go and use google A LOT. You'll learn a lot more by fooking up 5 times than you will by being told exactly (actually most of the stuff i learn comes from going the wrong way around things)

its work 🙂 one more questions how can i add to send auto e-mail when the user register like new auto pm

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close