aulus Posted March 29, 2011 Share Posted March 29, 2011 Hello everyone and thanks in advance for the help. I am working on a permission system for a site I am creating that will be used to restrict access to various areas of the site. I have a table with all the permission that is linked to a group that the user is a member of. I then use a query to get a list of the permission ids the user is part of and put those into the session array. I used a basic login script I found online I planned on modifying to add my own features and to make more secure. Originally it had just a member id and member name variable in the session array saved in the login script which are both working fine after login. I am using a dynamic variable to set one session variable for each permission with the id being the changing part in the variable name. The problem I found is that the new variables are not being set. When i removed the redirect from my login script so I could check the problem I found that the temp variable, which is also set before it saves to the session array, is blank as well. If I hit refresh on my browser the new variables become set and all is well. I was talking to nvee in irc chat who said I need to make a function on the page I am redirected to that checks if the variable exists. I looked through the original code of the login script I am using and found that this seems to be how they did it as well so I added an if statement to my index page to check if the variable has a value with and without using if isset. In both cases the new variable is still not getting set. He also gave me some pointers to help make my login checks more secure but the main thing IM concerned with right now is to make my new permission variables accessible to the session. My login script is available in my pastebin. Quote Link to comment https://forums.phpfreaks.com/topic/232034-new-session-array-variables-not-set/ Share on other sites More sharing options...
aulus Posted March 31, 2011 Author Share Posted March 31, 2011 I am still stuck on this problem. Am I not explaining something clearly enough? Quote Link to comment https://forums.phpfreaks.com/topic/232034-new-session-array-variables-not-set/#findComment-1194840 Share on other sites More sharing options...
aulus Posted April 2, 2011 Author Share Posted April 2, 2011 With some help from irc members I got this working. The problem was that I had to mysql queries and only the first was being ran. I combined the 2 queries into 1 then moved some of my code around to fit the new change. Now it works as its supposed to. Quote Link to comment https://forums.phpfreaks.com/topic/232034-new-session-array-variables-not-set/#findComment-1195802 Share on other sites More sharing options...
Genesis730 Posted April 2, 2011 Share Posted April 2, 2011 You're welcome Quote Link to comment https://forums.phpfreaks.com/topic/232034-new-session-array-variables-not-set/#findComment-1195805 Share on other sites More sharing options...
aulus Posted April 2, 2011 Author Share Posted April 2, 2011 Well I wasnt gonna call you out but thx for the help Genesis730. I learned quite a bit. Quote Link to comment https://forums.phpfreaks.com/topic/232034-new-session-array-variables-not-set/#findComment-1195807 Share on other sites More sharing options...
kenrbnsn Posted April 2, 2011 Share Posted April 2, 2011 If you want help on the forum, the quickest way to get it is to post your code here between tags. Ken Quote Link to comment https://forums.phpfreaks.com/topic/232034-new-session-array-variables-not-set/#findComment-1195809 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.