<?php
    
/**
     *    Users List for Mambo portal
     *    Retrieving data from mySQL table
     *    19-12-2001
      *
     *    Copyright (C) 2000 - 2001 Emir Sakic
     *    Distributed under the terms of the GNU General Public License
     *    This software may be used without warranty provided and these statements are left intact.
     *    This source is available at http://www.superbosna.com/mambo_hacks
     *
     *    Mambo is Copyright (C) 2000-2001 Miro Construct Pty Ltd
     *    Source is available at http://sourceforge.net/projects/mambo
     *    Site Name: Mambo Open Source Edition Version 3.0.6
     *    File Name: users.php
     *    Developer: Emir Sakic - saka@hotmail.com
     *    Date: 19/12/2001
     *     Version #: 1.0.0
     *    Comments: This script displays list of registrated users on your Mambo portal.
     *            Just set the variables below, upload anywhere on the site with Mambo and execute.
     *            Demo can be viewed at http://www.superbosna.com/clanovi
     *            Send your comments and suggestions to: saka@hotmail.com
    **/

/* SET YOUR VARIABLES HERE */
$db_host "localhost";                // database host
$db_user "username";                // database username
$db_pass "password";                // database password
$db_name "mambodb_name";            // mambo database name
$site_name "YourSite.Com";            // name of your site
$rows_per_page 30;                // set how many rows per page you want displayed
$email_displayed 0;                // set this value to 1 if you want users emails to be displayed

/* NO CHANGES BELOW THIS LINE (unless you know what you are doing) */

?>

<html>
<head>
<title>Users List</title>
<style>
<!--
body { color: #000000; font: 7.5pt verdana; font-weight: none; text-decoration: none }
a:link { color: #000000; font-weight: none; text-decoration: underline; font-family: verdana; font-size: 7.5pt}
a:visited { color: #000000; font: 7.5pt verdana; font-weight: none; text-decoration: underline }
a:active { color: #000000; font: 7.5pt verdana; font-weight: none; text-decoration: underline }
a:hover { color: #999999; font-weight: none; font-family: verdana; font-size: 7.5pt; text-decoration: none }
td { color: #000000; font: 7.5pt verdana; font-weight: none; text-decoration: none; }
-->
</style>
</head>
<body>

<?
// Connecting, selecting database
$link mysql_connect($db_host$db_user$db_pass)
    or die(
"Could not connect");
//print "Connected successfully<br>";
mysql_select_db($db_name)
    or die(
"Could not select database");

// Performing SQL query
$query "SELECT * FROM users LIMIT 0, 10000";    // limits can be changed
$result mysql_query($query)
    or die(
"Query failed");

// Make sure that we recieved some data from our query
$num_of_rows mysql_num_rows ($result)
or die (
"The query: '$query' did not return any data");
print 
"<table width=100%>
    <tr bgcolor=#D3D3BC>
        <td align=center colspan=2>
            <b>$site_name has: $num_of_rows registrated users</b>
        </td>
    </tr>\n"
;

// Calculate # of pages
$pages ceil($num_of_rows $rows_per_page);

if (empty(
$action)) $action 1;

$from = ($action-1) * $rows_per_page;

// Performing SQL query again
$query "SELECT * FROM users LIMIT $from, $rows_per_page";
$result mysql_query($query)
    or die(
"Query failed");

print 
"\t<tr bgcolor=#EEEEE0>
        <td align=left>
            Script&nbsp;made&nbsp;by:&nbsp;<a href=\"http://www.sakic.org\" target=_blank>Saka</a>
        </td>
        <td align=right width=100%>Page: "
;

for (
$i 1$i <= $pages$i++) {
    if (
$i == $action) {
        print 
"<b>$i</b></a> ";
    } else {
        print 
"<a href=\"$PHP_SELF?action=$i\">$i</a> ";
    }
}

print 
"\t\t</td>\n\t</tr>\n</table>\n\n";

print 
"<table width=100%>\n";
print 
"\t<tr bgcolor=#D3D3BC>\n";
print 
"\t\t<td align=center><b>#</b></td>\n";
print 
"\t\t<td align=center><b>Name</b></td>\n";
print 
"\t\t<td align=center><b>Nick</b></td>\n";
print 
"\t\t<td align=center><b>E-mail</b></td>\n";
print 
"\t</tr>\n";
// Use mysql_fetch_row to retrieve the results
for ($count 1$row mysql_fetch_row ($result); ++$count)
{
$evenodd $count 2;
if (
$evenodd == 0) {
    print 
"\t<tr bgcolor=#F5F5EF>\n";
} else {
    print 
"\t<tr bgcolor=#EEEEE0>\n";
}
$nr=$row[0]-61;
print 
"\t\t<td align=right>$nr</td>\n";
print 
"\t\t<td>$row[1]</td>\n";
print 
"\t\t<td>$row[2]</td>\n";
if (
$email_displayed) {
    print 
"\t\t<td><a href=mailto:$row[3]>$row[3]</a></td>\n";
} else {
    print 
"\t\t<td>secret</td>\n";
}
print 
"\t</tr>\n";
}
print 
"</table>\n";

// Closing connection
mysql_close($link);
?>

</body>
</html>