Topic: last login
Hi,
I'm trying to make a plugin that shows me the last login of every user.
But it doesn't work very goot, it just shows me an empty table...
<?php
/***********************************************************************
Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org)
This file is part of PunBB.
PunBB is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PunBB is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
/***********************************************************************
DO NOT EDIT BELOW THIS LINE
/***********************************************************************/
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
exit;
// Tell admin_loader.php that this is indeed a plugin and that it is loaded
define('PUN_PLUGIN_LOADED', 1);
if (isset($_POST['last_login']))
{
//datenbank abrufen und nachschauen
mysql_connect("localhost", "hmmm", "gfdhgf") or die ("Could not connect"); //db571.1und1.de
mysql_select_db("yszgh") or die ("database doesn't exist");
$benutzer[]=mysql_query("SELECT username FROM forum_users" or die(mysql_error()));
$visit[]=mysql_query("SELECT last_visit FROM forum_users" or die(mysql_error()));
$userzahl=count($visit, COUNT_RECURSIVE);
echo $benutzer;
echo "<table border=1>
<tr><td>Benutzername</td><td>Letzter Login</td></tr>";
echo count($visit);
print_r ($benutzer);
print_r ($visit);
for ($i=0;$i<$userzahl;$i++){
echo "<tr><td>$benutzer[$i]</td><td>$visit[$i]</td></tr>";
}
echo "</table>";
generate_admin_menu($plugin);
}
else
{
generate_admin_menu($plugin);
?>
<div class="blockform">
<h2><span>Last Login</span></h2>
<div class="box">
<form id="example" method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>&foo=bar">
<div class="inform">
<fieldset>
<legend>Letzter Login</legend>
<div class="infldset">
<p>Dieses Plugin zeigt den letzten Login aller Forenmitglieder an</p>
<div class="fsetsubmit"><input type="submit" name="last_login" value="Last Login" tabindex="1" /></div>
</div>
</fieldset>
</div>
</form>
</div>
</div>
<?php
}
I hope anybody can help me the mistake(s) and to fix them.