Account Creation date

Virtue

New member
Messages
259
Points
0
Hi All,

Is there a way to check when an account was created? If not, can I add something to make it possible?

 
I recently did an event regarding account creation dates. There is nothing solid as of right now but all is not lost. You have the login log, and unless you cleared it, you can do a sql command to figure out when they first time someone loged in is, which is basically their creation date. 

    .@youractid = getcharid(3);
    query_sql("SELECT `userid` FROM `login` WHERE `account_id` = "+.@youractid, .@userid$);
    
    query_sql("SELECT * FROM `loginlog` WHERE `user` LIKE '"+.@userid$+"' AND `time` < '2017-12-28 00:00:00' ORDER BY `loginlog`.`TIME` ASC LIMIT 1", .@time, .@ip, .@user$, .@rcode, .@unid, .@log$);
 

The first query finds the username since loginlogs are stored by username and not by account id. The second query finds their login dates earlier than the specified date since I needed this for my event. It sorts it by ascending, so first log is their oldest log. And then stored the log info in the specified variables. I did not need the exact date so this worked for me, but .@time will only return the year, since date format uses - and : as a result that may not work for you. I have not tested this but you should be able to use .@time$ and it will return the full date, again not sure since I did not need the full date. If you do not need this to be automated, you can just run the sql queries your self or do a search in the phpmyadmin and sort after. Also you may not use unique ids so you may need to remove .@unid from the above list.

Hope this helps.

 
Thanks for your idea. Although I'm thinking something about pre-registration and stuff. I think this would be done as a plugin on the website when users are creating their accounts though

 
Doesn't have to be anything complicated. 

You could use the birthday field is you aren't already using it and just instead of giving players the option to put in their own birthrate, just auto write in today's date. Here is a little guide from rathena.

https://rathena.org/board/topic/58932-flux-cp-birthdate-field-in-register-page/

If you are already using it, then you can simply add another row, or create a new table entirely just for storing registration dates.

 
the best thing i can think of is to take an account variable the first time they login to their first character (in a script).

Code:
OnPCLoginEvent:
     if (#Account_Created <= 0)
          #Account_Created = gettimetick(2);
     end;
 
Found a simpler way to do this though, just so that people would know.

ALTER TABLE `login` ADD COLUMN `reg_date` TIMESTAMP;


No modifications needed on whichever theme or CP you'll be using.

 
Back
Top