Jump to content

How would I do "Users not logged in since *** delete them"


Recommended Posts

I know how I would set this up, and delete the user roughly.

I'll create a table called "Users Status" with ID, Username, date registered, and last logged in collumns. Last Logged in will be recorded as years, and will be set on every page. I will then be checking in admin control panel, if the user has not been logged in since whatever year. Delete them.

 

I was wondering if this is the best way to do it? or would there be an easier way.

 

Thanks

I would use a unix timestamp rather than a varchar field that showed the year they lost logged in. Unix time stamps are much more versatile, and can be used with mysql's, as well as phps time/date functions.

 

I would also probably use a Cron Job rather than searching through users in a control panel.

Well, the way I'd do it, is using mysql_query, and using it in PHP etc.

 

To delete users last logged in since ****, I'll do that via ACP, which is a manual thing.

 

I don't understand Cron, never looked into it. Might take time to figure it out.

 

It's not so much the deleting them, its perhaps how it should look in the database, should it be date and time, or years, or what?

 

What is a unix timestamp, and how would it be updated when user logs in?

if you want to be able to add a few features to a login system or want to see how a good one is coded then look at Jpmaster77's login script, there are two versions just make sure you get the second one with the admin features implemented and a few updats, the code might need modernising a little but its not hard (I did it :P).

Yeah, however.. what I wanted to do, aren't in his scripts, I used them before. It was easy to modify, however.. it has wayyy too many unessecary functions :P I basically have a better version made from a simple login system with activation, no admin features or ban, and I added them in. :P Well, still doing the ban.

u dont have to do it for acp just whenever someone logs in do mysql to

DELETE FROM users WHERE lastloggedin <= $two years ago

use the time() function the php manual .

then just make $twoyears ago the time() for two years ago today. then it will delete the user row. simple. if u dont want to delete everytime in case there isnt one just do

SELECT id FROM users WHERE lastloggedin <= '$twoyearsago';
mysql_query that than use mysql_num_rows() to check the number of rows where the lastloggedin is two years ago or more and if($number of rows >0 ){then do the delete

So when a user logs in automatically, itll delete those not logged in since whatever I set it as?

Or does that specific user has to login, to be deleted from Users. etc?

 

Btw, I never knew emo's were clever :) Hot :D

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.