[MOD] Last Visit 3....
 
Notifications
Clear all

[MOD] Last Visit 3.0

61 Posts
22 Users
0 Reactions
28.9 K Views
(@itanshi)
Posts: 381
Reputable Member
 

alright, so the first part for the date, i put that after a , like the other bit?

$result2 = dbquery("SELECT *, UNIX_TIMESTAMP(date) as date, UNIX_TIMESTAMP(lastlog) as lastlog FROM "._AUTHORTABLE." LEFT JOIN ".Tableprefix."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$uid' LIMIT 1");

to?

$result2 = dbquery("SELECT *, UNIX_TIMESTAMP(date) as date, UNIX_TIMESTAMP(lastlog) as lastlog, DATE_FORMAT(lastlog, '%d/%m/%Y -  %H:%i')
FROM "._AUTHORTABLE." LEFT JOIN ".Tableprefix."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$uid' LIMIT 1");

I am rebuilding efiction! Join us on irc! #efiction at www.mibbit.com Instructions for irc πŸ˜€ Alpha released!

 
Posted : 25/03/2009 11:17 am
(@amancham)
Posts: 40
Eminent Member
 

Unfortunately I can't seem to get this mod to work on a new installation of eFiction 3.5

In some way most of the coding we're supposed to change looks a lot different now *lol* Anywho. I can log in and log off as often as I want, the date for the last login remains Jan 01, 1970 for all users. I tried the suggested fixes but me being not really good in coding doesn't know where to put it all and which one to change, sorry.

I did change the $tableprefix with TABLEPREFIX but that still doesn't change it.

As a last bit of information: I looked at the database and the lastlog date is not updated there. So I guess it has something to do with the session variables??

Help would be appreciated. Pretty please.

Link to look at: http://www.intayale.de/deFiction/viewuser.php?uid=1
Infos for this installation:
Version: 3.5
Modules: Last Login, Challenges
PHP:  5.2.9
MySQL: 5.0.77


Old
URL: http://fiction.intayale.de
Version: 3.3.1
Modules: Challenges, Story Tracker, Mulit-lang. eFiction
PHP:  4.4.8
MySQL: 5.0.51a

New
URL: http://intayale.de/deFiction
Version: 3.5
Modules: Last Login
PHP:  5.2.9
MySQL: 5.0.77

 
Posted : 11/04/2009 4:06 am
 Elle
(@jenny)
Posts: 594
Honorable Member
 

Does the date update itself in the database? (You can check in phpMyadmin.)


archive: dramione.org
site: accio.nu

Available for skin/mod commission! πŸ™‚

 
Posted : 11/04/2009 12:03 pm
(@amancham)
Posts: 40
Eminent Member
 

As a last bit of information: I looked at the database and the lastlog date is not updated there. So I guess it has something to do with the session variables??

figured that much out today. Yay, me is actually working with a database and looking INSIDE the tables and such ... kinda proud of myself πŸ˜‰
Nope, it doesn't update there. And I can't figure out what I've done wrong. πŸ™

EDIT: Now, this is fun... I have 2 Users. The Adminuser created during the installation process ... and another user. I just realised: For the Adminuser the last login date has changed and is set to today's date. But not for the other user. I did log in with both users, though.


Old
URL: http://fiction.intayale.de
Version: 3.3.1
Modules: Challenges, Story Tracker, Mulit-lang. eFiction
PHP:  4.4.8
MySQL: 5.0.51a

New
URL: http://intayale.de/deFiction
Version: 3.5
Modules: Last Login
PHP:  5.2.9
MySQL: 5.0.77

 
Posted : 11/04/2009 1:37 pm
 Elle
(@jenny)
Posts: 594
Honorable Member
 

Aha, sorry, I missed that.

Can you show me all your steps of working?

alright, so the first part for the date, i put that after a , like the other bit?

$result2 = dbquery("SELECT *, UNIX_TIMESTAMP(date) as date, UNIX_TIMESTAMP(lastlog) as lastlog FROM "._AUTHORTABLE." LEFT JOIN ".Tableprefix."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$uid' LIMIT 1");

to?

$result2 = dbquery("SELECT *, UNIX_TIMESTAMP(date) as date, UNIX_TIMESTAMP(lastlog) as lastlog, DATE_FORMAT(lastlog, '%d/%m/%Y -  %H:%i')
FROM "._AUTHORTABLE." LEFT JOIN ".Tableprefix."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$uid' LIMIT 1");

No, just use the UNIX_TIMESTAMP(lastlog) as lastlog.


archive: dramione.org
site: accio.nu

Available for skin/mod commission! πŸ™‚

 
Posted : 11/04/2009 7:18 pm
(@amancham)
Posts: 40
Eminent Member
 

No problem. That can happen. Admin does not update, btw. at least when I logged on today the date didn't change. Maybe  I accidentially changed it in the database. *shrugs*

Steps. okay.

1) Altered  Database  using

ALTER TABLE `DEUTSCHfanfiction_authors` ADD `lastlog` DATETIME NOT NULL ;

as I use  a prefix on my  installation (s) Btw.  ... does it have anything to do with 2 installations sharing the authors table??

2) open user/login.php to make changes.
your manual says we should look for this in line 50

if($passwd['password'] == $encryptedpassword) {
if(!isset($_SESSION)) session_start( );
$_SESSION[$sitekey."_useruid"] = $passwd['uid'];
$_SESSION[$sitekey."_salt"] = md5($passwd['email']+$encryptedpassword);

Now. Line 50 looks quite different πŸ˜‰

if($maintenance && $passwd['level'] < 0) {
header("Location: maintenance.php");
exit( );
}

So I searched for the string you have given in your description and found only one thing kinda matching which is in Line 68:

		if($passwd['password'] == $encryptedpassword) {
if(isset($_POST['cookiecheck'])) {
setcookie($sitekey."_useruid",$passwd['uid'], time()+60*60*24*30, "/");
setcookie($sitekey."_salt", md5($passwd['email']+$encryptedpassword),  time()+60*60*24*30, "/");
}

So I added your code in there, anyway, after the set cookie line and before the } I put in:

			// Last visit mod
$update_lastlog = dbquery("UPDATE ".$tableprefix."fanfiction_authors SET lastlog = now() WHERE uid = '$passwd[uid]' LIMIT 1");
// end Last visit mod

3. changes in includes/get_session_vars.php
according to your post we should look around line 30 for

if($userdata && $userdata['level'] != -1 && $_COOKIE[$sitekey.'_salt'] == md5($userdata['email']+$userdata['password'])) {
$useruid = $userdata['uid'];
$userpenname = $userdata['penname'];

it's line 31 for me, but that's kinda normal with codes *lol* anyway, it's the first line that's the same but instead of $useruid it's something with define:

	if($userdata && $userdata['level'] != -1 && $_COOKIE[$sitekey.'_salt'] == md5($userdata['email']+$userdata['password'])) {
define("USERUID", $userdata['uid']);
define("USERPENNAME", $userdata['penname']);

added your code after the second define because I know nothing about all those variables and I didn't bother to try and make them all look equally.

3) opened user/profile.php to add changes there.

Looked for

$result2 = dbquery("SELECT *, UNIX_TIMESTAMP(date) as date FROM "._AUTHORTABLE." LEFT JOIN ".$tableprefix."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$uid' LIMIT 1");

found the exact same line and changed it to:

$result2 = dbquery("SELECT *, UNIX_TIMESTAMP(date) as date, UNIX_TIMESTAMP(lastlog) as lastlog FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$uid' LIMIT 1");

searched for the line

$tpl->assign("userpenname", $userinfo['penname']." ".$nameinfo);

found the exact same line and added your code right afterwards so now it looks like this:

$tpl->assign("userpenname", $userinfo['penname']." ".$nameinfo);
if (date("$dateformat", $userinfo['lastlog']) == date("$dateformat", mktime(0, 0, 0, 0, 0, 0000)))  $tpl->assign("lastlog", ""._UNAVAILABLE.""); 
else $tpl->assign("lastlog", date("$dateformat", $userinfo['lastlog']));

I also added the

define ("_UNAVAILABLE", "Unavailable");

to both, my german and my english language file, and added Last login: {lastlog} to the skin I'm using. Uploaded all files and tried if it worked. So I log in with one of my two users and the date doesn't change. For Amancham it remains Jan 01, 1970 and for Admin-User (I'm pretty sure I accidentially changed it in the database yesterday) it stays Apr 11, 2009
Emtied the cache, did log in and log out several times.
So someone stated we should change $tableprefix to TABLEPREFIX:

Changed that in  includes/get_session_vars.php to:

	// Last visit mod
$update_lastlog = dbquery("UPDATE ".TABLEPREFIX."fanfiction_authors SET lastlog = now() WHERE uid = '$useruid' LIMIT 1");
// end Last visit mod

and in user/login.php

			// Last visit mod
$update_lastlog = dbquery("UPDATE ".TABLEPREFIX."fanfiction_authors SET lastlog = now() WHERE uid = '$passwd[uid]' LIMIT 1");
// end Last visit mod

uploaded files, tried again ... still doesn't work. With the other fixes I couldn't really work out where they should go and as it doesn't update in the database it's not a problem with displaying it ... anywho, that's where I stand right now.

Don't know if that is important or not ... I added all my old users from an 3.3.1  installatiion to the authors table in the 3.5 installation I'm working on right now. But Amancham and Admin were created in the "oldfashioned  way"  via install and via the admin panel for creating new users. Last login date doesn't update in any case. had a friend logging in with her Username yesterday night, but she's still stuck on somewhat november last year when she last logged in.


Old
URL: http://fiction.intayale.de
Version: 3.3.1
Modules: Challenges, Story Tracker, Mulit-lang. eFiction
PHP:  4.4.8
MySQL: 5.0.51a

New
URL: http://intayale.de/deFiction
Version: 3.5
Modules: Last Login
PHP:  5.2.9
MySQL: 5.0.77

 
Posted : 12/04/2009 2:51 am
 Elle
(@jenny)
Posts: 594
Honorable Member
 

I don't have access to a 3.5 installation, so I can't cross-reference. The "theory" behind this mod is this:

1. Add a lastlog column in the table.
2. When the user successfully logs in, update the lastlog row.
3. Pull up the date information to be used as a variable in the profile.

I think the problem is with $useruid/$passwd[uid]. It might be executing the query, but incorrectly.

Yeah. I'm probably going to have to set up a 3.5 test site or something. πŸ˜›


archive: dramione.org
site: accio.nu

Available for skin/mod commission! πŸ™‚

 
Posted : 12/04/2009 2:08 pm
(@amancham)
Posts: 40
Eminent Member
 

Unfortunatly I don't know jack about this kind of stuff πŸ™ Or I would try figure it out myself. but I'd just mess everything up πŸ™

Sorry about this. And if it's too much of a hustle I'll just take the mod out and use eFiction as is. Don't worry about me.


Old
URL: http://fiction.intayale.de
Version: 3.3.1
Modules: Challenges, Story Tracker, Mulit-lang. eFiction
PHP:  4.4.8
MySQL: 5.0.51a

New
URL: http://intayale.de/deFiction
Version: 3.5
Modules: Last Login
PHP:  5.2.9
MySQL: 5.0.77

 
Posted : 12/04/2009 2:34 pm
(@lyndsie)
Posts: 1263
Member Moderator
 

Eventually I am going to try installing this mod as well, probably on my eFic test site (3.5 now, but destined to become 3.5.1 in the near future).  I'll probably get to playing with it this week and can see what happens.


 
Posted : 12/04/2009 10:12 pm
(@amancham)
Posts: 40
Eminent Member
 

Thanks a lot. I kinda envy you people, to be honest. I'm totally overwhelmed whenever I open an PHP file πŸ˜€


Old
URL: http://fiction.intayale.de
Version: 3.3.1
Modules: Challenges, Story Tracker, Mulit-lang. eFiction
PHP:  4.4.8
MySQL: 5.0.51a

New
URL: http://intayale.de/deFiction
Version: 3.5
Modules: Last Login
PHP:  5.2.9
MySQL: 5.0.77

 
Posted : 13/04/2009 1:57 am
(@dsecrets)
Posts: 32
Eminent Member
 

I just installed this Mod. I am running eFiction version 3.5.

I also get the 1970 thing, but when I logged out and logged back in again, it set to my last log in..LOL..which was 5 minutes ago.


 
Posted : 14/04/2009 12:32 pm
(@itanshi)
Posts: 381
Reputable Member
 

yeah, its the old default time we're trying to fix


I am rebuilding efiction! Join us on irc! #efiction at www.mibbit.com Instructions for irc πŸ˜€ Alpha released!

 
Posted : 14/04/2009 12:35 pm
(@amancham)
Posts: 40
Eminent Member
 

when I logged out and logged back in again, it set to my last log in..LOL..which was 5 minutes ago.

*lol* now that you've mentioned it ... you're right. Looks like it's kinda one login off ... so next time you log in it sets the login from the last time as last login rather than the current login date.


Old
URL: http://fiction.intayale.de
Version: 3.3.1
Modules: Challenges, Story Tracker, Mulit-lang. eFiction
PHP:  4.4.8
MySQL: 5.0.51a

New
URL: http://intayale.de/deFiction
Version: 3.5
Modules: Last Login
PHP:  5.2.9
MySQL: 5.0.77

 
Posted : 14/04/2009 1:08 pm
 Elle
(@jenny)
Posts: 594
Honorable Member
 

yeah, its the old default time we're trying to fix

I'm confused now! What's the problem with the old default time? It should display _UNAVAILABLE. o_O


archive: dramione.org
site: accio.nu

Available for skin/mod commission! πŸ™‚

 
Posted : 14/04/2009 1:52 pm
(@itanshi)
Posts: 381
Reputable Member
 

Last logged in: Dec 31, 1969 for example


I am rebuilding efiction! Join us on irc! #efiction at www.mibbit.com Instructions for irc πŸ˜€ Alpha released!

 
Posted : 14/04/2009 1:57 pm
Page 3 / 5
Share: