Kemik Posted July 5, 2007 Share Posted July 5, 2007 Hello, I'm making a league/ladder website where player's sign up, join a clan (group of players), or create a clan of their own. I've already created the user management side of things where users can sign up, edit their profile and I (as an admin) can also edit and delete their profile. Now I'm on to the clan management side. I've made the page where logged in users can create a clan, I approve the clan and then the clan shows as active. However, I'm now stuck on a few things. After they create a clan their user ID is added to a separate database table which links their user ID with the clan ID. This means other users can then join and be given the same clan ID. When the user creates the clan should I create a cookie on their machine which says they are part of X clan? Should I then also create a cookie on their machine saying they are the clan leader (in future this will give them access to edit their clan details which normal clan members cannot do). When a user logs in, as well as creating a user ID cookie (so they can access registered users only parts of the site) should I also create a cookie showing which clan they are part of, and again if they are a clan leader? Finally, on a different matter. When I login the database checks my user id to see if I have been flagged as an admin in the table. If yes, it creates a cookie on my machine which non-admins don't receive. Is this generally how admin systems work? I know it's a bit complicated to understand if you don't know how clans work but I've tried to simplify it as much as possible. Please ask if you have any questions which will help you help me Quote Link to comment https://forums.phpfreaks.com/topic/58594-cookies-when-to-use-them/ Share on other sites More sharing options...
john010117 Posted July 5, 2007 Share Posted July 5, 2007 #1 - 3 should be all stored in the database. #4 should create a cookie. Use less cookies as possible, as they are easy to edit. Quote Link to comment https://forums.phpfreaks.com/topic/58594-cookies-when-to-use-them/#findComment-290627 Share on other sites More sharing options...
Kemik Posted July 5, 2007 Author Share Posted July 5, 2007 Thanks john. So basically, just do a query at the start of every page to see if the userid in the cookie is a member/ leader of a clan? Quote Link to comment https://forums.phpfreaks.com/topic/58594-cookies-when-to-use-them/#findComment-290632 Share on other sites More sharing options...
john010117 Posted July 5, 2007 Share Posted July 5, 2007 Yep. Even though it uses slightly more resources, it's more secure. Quote Link to comment https://forums.phpfreaks.com/topic/58594-cookies-when-to-use-them/#findComment-290635 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.