c-o-d-e Posted November 20, 2009 Share Posted November 20, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/182303-how-would-i-do-users-not-logged-in-since-delete-them/ Share on other sites More sharing options...
peter_anderson Posted November 20, 2009 Share Posted November 20, 2009 Doing it manually via the ACP, or automatically via a cron job? Are you looking for a query to do it? Quote Link to comment https://forums.phpfreaks.com/topic/182303-how-would-i-do-users-not-logged-in-since-delete-them/#findComment-961974 Share on other sites More sharing options...
mikesta707 Posted November 20, 2009 Share Posted November 20, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/182303-how-would-i-do-users-not-logged-in-since-delete-them/#findComment-961976 Share on other sites More sharing options...
c-o-d-e Posted November 20, 2009 Author Share Posted November 20, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/182303-how-would-i-do-users-not-logged-in-since-delete-them/#findComment-961979 Share on other sites More sharing options...
mikesta707 Posted November 20, 2009 Share Posted November 20, 2009 look into the mysql documentation here for there various date column types. You would update the last login when the user logs in, just like you would update anything Quote Link to comment https://forums.phpfreaks.com/topic/182303-how-would-i-do-users-not-logged-in-since-delete-them/#findComment-961994 Share on other sites More sharing options...
juliaadams Posted November 21, 2009 Share Posted November 21, 2009 Do it with using sql via ACP or PHP. Quote Link to comment https://forums.phpfreaks.com/topic/182303-how-would-i-do-users-not-logged-in-since-delete-them/#findComment-962432 Share on other sites More sharing options...
FaT3oYCG Posted November 21, 2009 Share Posted November 21, 2009 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 ). Quote Link to comment https://forums.phpfreaks.com/topic/182303-how-would-i-do-users-not-logged-in-since-delete-them/#findComment-962451 Share on other sites More sharing options...
c-o-d-e Posted November 22, 2009 Author Share Posted November 22, 2009 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 I basically have a better version made from a simple login system with activation, no admin features or ban, and I added them in. Well, still doing the ban. Quote Link to comment https://forums.phpfreaks.com/topic/182303-how-would-i-do-users-not-logged-in-since-delete-them/#findComment-962940 Share on other sites More sharing options...
emopoops Posted November 22, 2009 Share Posted November 22, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/182303-how-would-i-do-users-not-logged-in-since-delete-them/#findComment-962963 Share on other sites More sharing options...
c-o-d-e Posted November 22, 2009 Author Share Posted November 22, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/182303-how-would-i-do-users-not-logged-in-since-delete-them/#findComment-963207 Share on other sites More sharing options...
emopoops Posted November 23, 2009 Share Posted November 23, 2009 no ti will delete all unless u specific it to be the certain user. Quote Link to comment https://forums.phpfreaks.com/topic/182303-how-would-i-do-users-not-logged-in-since-delete-them/#findComment-963608 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.