Topic: I wanna create a "Login Logging" page...

Don't ask why. Doesn't matter. I know it's possible, I just want to do it right.

Basically what I'm looking to do is add code to whatever controls user logging in and adds their name and time of login to a new table.

Then create a page (That only certain people would have access to.) that displays all this info.

I guess the real part I need help with is where the code should go for adding a row to the table I'll be using.

I'll have to create a new table in PHPMyAdmin. I guess I'd call it "loginlog" or something. It would have three columns. Username, IP and Time. Pretty obvious.

The whole reason I am doing this is because I need to know when and if certain users are visiting. You may say it would get too big too fast wouldn't it? Not really. My forum is really really small. If we have to, we can modify it to delete older entries after a week or month or whatever.

So I guess the first question is, what file should the Table modification code go in? And what code should be used? (I'm new to MySQL and the controlling of it with PHP. I'm able to easily read tables. But I've never made code that adds to tables and I don't want to screw anything up.) What file is used when a user first accesses a punBB forum and is registered to the database as "Logged in and online"?

2 (edited by quaker 2006-03-27 19:06)

Re: I wanna create a "Login Logging" page...

try this!
this is a login file that i created!
http://nalan.org/login1.php




<?php

define('PUN_ROOT', './');
define('PUN_QUIET_VISIT', 1);
require PUN_ROOT.'include/common.php';

//Set the page title here
$page_title = pun_htmlspecialchars($pun_config['o_board_title']) . ' / Chat';
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
require PUN_ROOT.'include/parser.php';

?>
<div class="logintop">
            <form id="login" name="login" name="qpost" method="post" action="login.php?action=in" onsubmit="return process_form(this)">
                <p>
                    <input type="hidden" name="form_sent" value="1" />
                    <input type="hidden" name="redirect_url" value="<?php echo $redirect_url ?>" />
                    <?php echo $lang_common['Username'] ?>:
                    <input type="text" name="req_username" size="16" maxlength="25" />
                     <?php echo $lang_common['Password'] ?>:

                    <input type="password" name="req_password" size="16" maxlength="16" wrap="virtual" onkeypress="if(event.keyCode==13) document.login.submit()" />
                     <a href="#" onclick="document.login.submit(); return true"><?php echo $lang_common['Login'] ?></a>  |  <a href="register.php"><?php echo $lang_common['Register'] ?></a>
                </p>
            </form>
        </div>


<?php

require PUN_ROOT.'footer.php';

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

3 (edited by Elzar 2006-03-28 17:41)

Re: I wanna create a "Login Logging" page...

Jasoco wrote:

Don't ask why. Doesn't matter. I know it's possible, I just want to do it right.

Basically what I'm looking to do is add code to whatever controls user logging in and adds their name and time of login to a new table.

Then create a page (That only certain people would have access to.) that displays all this info.

I guess the real part I need help with is where the code should go for adding a row to the table I'll be using.

I'll have to create a new table in PHPMyAdmin. I guess I'd call it "loginlog" or something. It would have three columns. Username, IP and Time. Pretty obvious.

The whole reason I am doing this is because I need to know when and if certain users are visiting. You may say it would get too big too fast wouldn't it? Not really. My forum is really really small. If we have to, we can modify it to delete older entries after a week or month or whatever.

So I guess the first question is, what file should the Table modification code go in? And what code should be used? (I'm new to MySQL and the controlling of it with PHP. I'm able to easily read tables. But I've never made code that adds to tables and I don't want to screw anything up.) What file is used when a user first accesses a punBB forum and is registered to the database as "Logged in and online"?

The last visit data is already stored.

Logged in as Elzar
Last visit: Yesterday 16:33:23

Instead of an extra page why not just modify the userlist or a users profile?

Re: I wanna create a "Login Logging" page...

true there.. but i only know how to create extra pages..haha

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: I wanna create a "Login Logging" page...

I need to know when certain members are coming and going. Call it a Big Brother modification if you want.

I don't need a new login page as everyone is auto-logged-in. So what I need to do is find the file that is called when that login is registered. Then add the user logging in, the current time and their IP into a new table.

Re: I wanna create a "Login Logging" page...

wow, so u want a stats on all members? i thought that i seen a mod so u can trck all members and it tells you what all they did in the forum?


http://www.punres.org/viewtopic.php?id=522
something like that?
a userstats mod?

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: I wanna create a "Login Logging" page...

That might work. I'll take a look see.

Re: I wanna create a "Login Logging" page...

kewl if ya need some basic help hit me up on http://nalan.org i got chat room.. i intergrated flastchat from www.tufat..com
im admin,quaker on there...

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!