I-AM-OBODO Posted October 29, 2008 Share Posted October 29, 2008 how can i make a username expire after a period of times eg after five logins i want the username and password to be invalid. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/ Share on other sites More sharing options...
Maq Posted October 29, 2008 Share Posted October 29, 2008 Have a field in your table called expire_logins and every time the user logs in just increment this value, and check to see if it's equal to 5. Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/#findComment-677576 Share on other sites More sharing options...
I-AM-OBODO Posted October 29, 2008 Author Share Posted October 29, 2008 pls how do i do that? can u give me a lead. thanks Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/#findComment-677581 Share on other sites More sharing options...
Maq Posted October 29, 2008 Share Posted October 29, 2008 Do you know how to create tables and access your database? Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/#findComment-677582 Share on other sites More sharing options...
I-AM-OBODO Posted October 29, 2008 Author Share Posted October 29, 2008 yes Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/#findComment-677584 Share on other sites More sharing options...
Maq Posted October 29, 2008 Share Posted October 29, 2008 Okay well create the field and assign the default value to 0. If the table is called expire_login then you would just do a query like: if(isset($_POST['login_button']) { $results = mysql_query("SELECT expire_login FROM users WHERE username = " . $username . ";"); $data = mysql_fetch_array($results); if($data['expire_login'] { //update database mysql_query("UPDATE users SET expire_login = expire_login + 1;") or die (mysql_error()); } else { //make them change their name/password } } This is not tested, sorry for any mistakes. Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/#findComment-677592 Share on other sites More sharing options...
I-AM-OBODO Posted October 29, 2008 Author Share Posted October 29, 2008 thanks. will try anyway Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/#findComment-677595 Share on other sites More sharing options...
Maq Posted October 29, 2008 Share Posted October 29, 2008 Sure, try it with your specific code and see what happens. Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/#findComment-677597 Share on other sites More sharing options...
I-AM-OBODO Posted October 29, 2008 Author Share Posted October 29, 2008 will this delete both the username and password? Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/#findComment-677605 Share on other sites More sharing options...
Maq Posted October 29, 2008 Share Posted October 29, 2008 will this delete both the username and password? No, my script is half pseudo code, it probably won't do anything if you just CnP into your page. You have to modify it to fit your specific code, if you try to do it and post what you have then we can help you further. Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/#findComment-677618 Share on other sites More sharing options...
I-AM-OBODO Posted October 29, 2008 Author Share Posted October 29, 2008 I have not started anything on it yet, i was just told i if i could do something like that and i told them i could. i am doing it from the scrash. the code you gave, would it work with a basic usrname and password login? modified of corse Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/#findComment-677663 Share on other sites More sharing options...
Maq Posted October 29, 2008 Share Posted October 29, 2008 I have not started anything on it yet, i was just told i if i could do something like that and i told them i could. i am doing it from the scrash. the code you gave, would it work with a basic usrname and password login? modified of corse Then you have a lot of work to do. Sounds like you don't even have a database or anything set up. Sorry, you might want to try to post in the freelance section because this sounds like a lot of work. I, and most people on these forums, are willing to help here and there but for something like this I don't think anyone really is going to do this for free unless they already have a login system set up to give to you. Good luck. Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/#findComment-677668 Share on other sites More sharing options...
I-AM-OBODO Posted November 3, 2008 Author Share Posted November 3, 2008 Oh! thanks for the help. I have designed the login and all seems to be working fine, but the problem now is when a user is loggen in, and for a reason or another he refreshed the page, the log count increases by 1 and its a problem. Is there a way of solving these? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/#findComment-680987 Share on other sites More sharing options...
Maq Posted November 3, 2008 Share Posted November 3, 2008 Yes, it's called sessions. If the session exists then don't increase count. Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/#findComment-681185 Share on other sites More sharing options...
I-AM-OBODO Posted November 4, 2008 Author Share Posted November 4, 2008 how do i do that! thanks Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/#findComment-681995 Share on other sites More sharing options...
Maq Posted November 4, 2008 Share Posted November 4, 2008 There's plenty of tutorials online and I think there's one on phpfreaks. Look around, find one, try it, then come back to help. Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/#findComment-682034 Share on other sites More sharing options...
I-AM-OBODO Posted November 5, 2008 Author Share Posted November 5, 2008 I have seen where wronged and i have now fixed it. Thanks all the same. Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/#findComment-682808 Share on other sites More sharing options...
I-AM-OBODO Posted November 11, 2008 Author Share Posted November 11, 2008 thanks alot. I have done the login and it worked fine but i was wondering if i could make the user expire after some days of first login lets assume 4 days after first login. thanks alot Quote Link to comment https://forums.phpfreaks.com/topic/130604-username-expire/#findComment-687751 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.