Jump to content

how do I display current number of registered users on login page


djsting_com

Recommended Posts

Hey

 

I launched my site a couple weeks back... and the way its setup right now, it's very hard for me to know how many users are currently registered with my site. I have seen phpbb forums that have text above the login area showing lots of member related information... such as total number of members registered, new today, and the newest members user ID. I am very new to PHP and want to know what this would require? Here is my current login page as it stands right now:

 

login.php

<?php 
include($_SERVER['DOCUMENT_ROOT']."/classes/access_user/access_user_class.php"); 

$my_access = new Access_user(false);

// $my_access->language = "de"; // use this selector to get messages in other languages
if (isset($_GET['activate']) && isset($_GET['ident'])) { // this two variables are required for activating/updating the account/password
$my_access->auto_activation = true; // use this (true/false) to stop the automatic activation
$my_access->activate_account($_GET['activate'], $_GET['ident']); // the activation method 
}
if (isset($_GET['validate']) && isset($_GET['id'])) { // this two variables are required for activating/updating the new e-mail address
$my_access->validate_email($_GET['validate'], $_GET['id']); // the validation method 
}
if (isset($_POST['Submit'])) {
$my_access->save_login = (isset($_POST['remember'])) ? $_POST['remember'] : "yes"; // use a cookie to remember the login
$my_access->count_visit = true; // if this is true then the last visitdate is saved in the database (field extra info)
$my_access->login_user($_POST['login'], $_POST['password']); // call the login method
} 
$error = $my_access->the_msg; 
?>

<head>
<title>..:: DJ Sting ::..</title>
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="../../AC_RunActiveContent.js" language="javascript"></script>
</head>
<body bgcolor="#000000" topmargin="0" leftmargin="0" link="#FFFFFF" alink="#757575" vlink="#FFFFFF">


<div align="center">
  <center>
  <table border="0" width="900" cellspacing="0" cellpadding="0">
    <tr>
      <td width="100%" valign="top" align="center">
      
<script language="javascript">
if (AC_FL_RunContent == 0) {
	alert("This page requires AC_RunActiveContent.js. In Flash, run \"Apply Active Content Update\" in the Commands menu to copy AC_RunActiveContent.js to the HTML output folder.");
} else {
	AC_FL_RunContent(
		'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
		'width', '900',
		'height', '143',
		'src', '../../images/top_panel1',
		'quality', 'high',
		'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
		'align', 'middle',
		'play', 'true',
		'loop', 'true',
		'scale', 'showall',
		'wmode', 'window',
		'devicefont', 'false',
		'id', 'top_panel1',
		'bgcolor', '#000000',
		'name', 'top_panel',
		'menu', 'true',
		'allowScriptAccess','sameDomain',
		'movie', '../../images/top_panel1',
		'salign', ''
		); //end AC code
}
</script>
<noscript>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="900" height="143" id="top_panel1" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="../../images/top_panel1.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" />	<embed src="../../images/top_panel1.swf" quality="high" bgcolor="#000000" width="900" height="143" name="top_panel1" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</noscript>
      
      
      </td>
    </tr>
  </table>
  </center>
</div>


<div align="center">
  <center>
  <table border="0" width="900" background="../../images/ct_bg.jpg" height="589" cellspacing="0" cellpadding="0">
    <tr>
      <td width="100%" valign="top" align="center">
        <div align="center">
          <center>
          <table border="0" width="100%" cellspacing="23" cellpadding="3">
            <tr>
              <td width="100%">
                <div align="center">
                  <center>
                  <table border="0" width="100%" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="100%"><img border="0" src="../../images/members_title.gif" width="405" height="21"></td>
                    </tr>
                    <tr>
                      <td width="100%"><img border="0" src="../../images/title_bar.gif" width="405" height="1"></td>
                    </tr>
                  </table>
                  </center>
                </div>
              </td>
            </tr>
            <tr>
              <td width="100%">
                <div align="center">
                  <table border="0" width="100%" cellspacing="0" cellpadding="3">
                    <tr>
                      <td width="30%" valign="top">
                      
                      <div align="center">
                              <center>
                              <table border="0" width="100%" cellpadding="2">
                              <form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
                                <tr>
                                  <td><font size="1" face="Verdana" color="#FFFF00"><label for="login">Login:</font></label></td>
                                  <td width="100%"><input type="text" name="login" size="20" value="<?php echo (isset($_POST['login'])) ? $_POST['login'] : $my_access->user; ?>"></td>
                                </tr>
                                <tr>
                                  <td><font size="1" face="Verdana" color="#FFFF00"><label for="password">Password:</font></label></td>
                                  <td width="100%">
                                  <input type="password" name="password" size="8" value="<?php if (isset($_POST['password'])) echo $_POST['password']; ?>">
                                  </td>
                                </tr>
                                <tr>
                                  <td><font size="1" face="Verdana" color="#FFFF00"><label for="remember">Automatic login?</font></label></td>
                                  <td width="100%">
                                  <input type="checkbox" name="remember" value="yes"<?php echo ($my_access->is_cookie == true) ? " checked" : ""; ?>>
                                  </td>
                                </tr>
                                <tr>
                                  <td></td>
                                  <td width="100%">
                                  <input type="submit" name="Submit" value="Login">
                                  </td>
                                </tr></form>
                                <tr>
                                  <td colspan="2">
                                  
<p><font size="1" face="Verdana" color="#FFFF00"><b><?php echo (isset($error)) ? $error : " "; ?></font></b></p>
<p> </p>
<p> </p>
                                  
                                  </td>
                                </tr>
                                <tr>
                                  <td colspan="2">
                                  
<font size="1" face="Verdana" color="#FFFF00">
                                  
Not registered yet?</font> <a href="./register.php"><font color="#FF0000" face="Verdana" size="1">Click
Here</font></a>
                                  
                                  </td>
                                </tr>
                              <tr>
                                  <td colspan="2">
                                  
                                  <a href="./forgot_password.php"><font size="1" face="Verdana" color="#FFFF00">Forgot
                                  Your Password?</font></a>
                                  
                                  </td>
                              </tr>
                                <tr>
                                  <td colspan="2"> 
                                  
                                  
                                  
                                  </td>
                                </tr>
                                <tr>
                                  <td colspan="2">
                                  
                                  <font color="#84C0F5">
                                  
                                  <img border="0" src="../../images/bullet.gif" width="6" height="6">
                                  </font><b><a href="http://www.djsting.com/classes/access_user/downloads.php"><font face="Verdana" size="1" color="#84C0F5">DOWNLOAD
                                  SECTION</font></a></b>
                                  
                                  </td>
                                </tr>
                              </table>
                              </center>
                            </div>
                      
                      </td>
                      <td valign="top"><img border="0" src="../../images/line.gif" width="1" height="403"></td>
                      <td width="70%" valign="top">
                      
                      <div align="center">
                        <center>
                        <table border="0" width="100%" cellpadding="3">
                          <tr>
                            <td width="100%"><font face="Verdana" size="1" color="#84C0F5">If you wish to become a member of
                              </font><font face="Verdana" size="1" color="#FFFFFF"><strong>DJSTING.COM</strong></font><font face="Verdana" size="1" color="#84C0F5">,
                              then please follow these simple steps:</font><br><br></td>
                          </tr>
                          <tr>
                            <td width="100%"><b><font face="Verdana" color="#ff0000" size="1">STEP
                              1 : </font><font color="#84C0F5"><font face="Verdana" size="1">Enter your email address below and click GO to Subscribe
                              to our Mailing List/Newsletter</font></font></b></td>
                          </tr>
                          <tr>
                            <td width="100%"><font size="1"> </font></td>
                          </tr>
                          <tr>
                            <td width="100%">
                            
                            <table border="0" cellpadding="0" cellspacing="0"><tr><td width="100%"><div class="standard">
                      <form method="get" action="http://www.djsting.com/ccmail/index.php" target="_blank">
                      <font color="#84C0F5" face="Verdana" size="1">Insert Your Email Address Here:</font><br>
<input name="address" size="20" value="" class="tbox_max">
<select name="action" class="tbox">
      <option value="subscribe" selected>Subscribe</option>
      <option value="unsubscribe">Unsubscribe</option>
  </select>
<input type="submit" value="Go" class="button"></form>
</div></td></tr></table><br>

                            
                            </td>
                          </tr>
                          <tr>
                            <td width="100%"><b><font size="1" face="Verdana"><font color="#FF0000">STEP
                              2 :</font>
                              <a href="./register.php"><font color="#FFFFFF">Click
Here</font></a><font color="#84C0F5"> to register for our exclusive Members Area which allows you access to the Downloads Section.</font></font></b></td>
                          </tr>
                        </table>
                        </center>
                      </div>
                      
                      </td>
                    </tr>
                  </table>
                </div>
              </td>
            </tr>
            <tr>
              <td width="100%"></td>
            </tr>
            <tr>
              <td width="100%">
              </td>
            </tr>
            <tr>
              <td width="100%"></td>
            </tr>
          </table>
          </center>
        </div>
      </td>
    </tr>
  </table>
  </center>
</div>
<div align="center">
  <center>
  <table border="0" width="900" cellspacing="0" cellpadding="0">
    <tr>
      <td width="100%" align="center"><img border="0" src="../../images/bottom_bar.gif" width="900" height="1"></td>
    </tr>
  </table>
  </center>
</div>
<div align="center">
  <center>
  <table border="0" width="900" cellspacing="6" cellpadding="6">
    <tr>
      <td width="100%" height="55" align="center"><font size="1" face="Verdana" color="#FFFFFF"><a STYLE="text-decoration:none" href="http://www.djsting.com/homepage.html">HOME</a> | <a STYLE="text-decoration:none" href="http://www.djsting.com/biography.html">BIOGRAPHY</a> | <a STYLE="text-decoration:none" href="http://www.djsting.com/remix_services.html">REMIX SERVICES</a> | <a STYLE="text-decoration:none" href="http://www.djsting.com/remixes_mashups.html">MASHUPS</a> | <a STYLE="text-decoration:none" href="http://www.djsting.com/mixtapes.html">MIXTAPES</a> | <a STYLE="text-decoration:none" href="http://www.djsting.com/coverart.html">COVERART</a> | <a STYLE="text-decoration:none" href="http://www.djsting.com/classes/access_user/login.php">MEMBERS</a> | <a STYLE="text-decoration:none" href="http://www.djsting.com/links.html">LINKS</a> | <a STYLE="text-decoration:none" href="http://www.djsting.com/contact.html">CONTACT</a></font><br>
        <br><font size="1" face="Verdana" color="#757575">
        
        Copyright © 2008 djsting.com. All Rights Reserved.</font></td>
    </tr>
  </table>
  </center>
</div>

</body>

 

Any help on this would be greatly appreciated, thanks!

Link to comment
Share on other sites

Thank you thank you!! That worked perfectly :)

 

Is the code similar for other aspects to do with membership as well? This is sorta what I want to output, and from what you just gave me I think it'll be quite easy to do!

 

Membership:

Latest: <username>

New Today: 11

New Yesterday: 20

Overall: 11174

 

The overall is the one I just did obviously... are the others quite complicated to implement? Again I admit 100% that I'm really new to PHP... just feeling my way around. Thanks for helping me out with this!

Link to comment
Share on other sites

Another way to do it might be:

 

<?php   function getNumMembers(){
      if($this->num_members < 0){
         $q = "SELECT * FROM ".TBL_USERS;
         $result = mysql_query($q, $this->connection);
         $this->num_members = mysql_numrows($result);
      }
      return $this->num_members;
   }
?>

Link to comment
Share on other sites

Thanks for that guys :)

 

I'm researching this more and more to be able to get what I want done accomplished. As i mentioned earlier, this is the way i want it to look in the end:

 

Membership:

Latest: (displays the latest persons username that registered on the site)

New Today: (number of new registrations todays date)

New Yesterday: (number of new registrations yesterday)

Overall: (Total number of members registered)

 

This information is very helpful to me in building my site. I have 1 of those 4 taken care of (overall) and wish to code the remaining 3 soon, just need to know how to query the db to get that info. Any help would be appreciated thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.