Want more? Explore the library at https://www.codecourse.com/lessons Official site https://www.codecourse.com Twitter https://twitter.com/teamcodecourse.
Original source
Want more? Explore the library at https://www.codecourse.com/lessons Official site https://www.codecourse.com Twitter https://twitter.com/teamcodecourse.
Original source
17 responses to “PHP Tutorials: Register & Login (Part 21): More Account Permissions”
Notice: Undefined variable: session_user_id in index.php is happening because the user is not logged in. In order to solve this, we only need to wrap Alex code with this if (logged_in()) { //alex code } where logged_in is a function that we (or Alex) created to check if the user has logged in or not.
Notice: Undefined variable: session_user_id in index.php
Please someone let me know how to solve this
You already have $user_data['type'] to return the value of type without having to create a function for it!
A better way to have access protection is in the "has_access" function to return the value of the user's type like this"mysql_result(mysql_query("SELECT `user_type` FROM `users` WHERE `user_id` = $user_id"), 0);"
And then checking for the access level like this: "if(has_access($user_data['user_id']) < 4)" this will check against everyone with a lower access key then 4, i.e. 1,2&3
My usertype setup:
1 – normal
2- vip
3 – op
4 – admin
eg. anyone lower than 4 isn't admin…
its what the pause is for on the video 🙂
What about 'user created in…'
Lập trình web là một môn học rất hay và cũng rất cần thiết đối với các doanh nghiệp cũng như cá nhân trong thời kỳ công nghệ thông tin đang phát triển như ngày nay.
Để trở thành một lập trình web chuyên nghiệp. Hãy đến với Athena.
Để hiểu rõ hơn về môn học này bạn hãy truy cập vào athena.edu.vn
Hoặc liên hệ: 92 nguyễn đình chiểu, p.đakao, q.1, tp.hcm
Tel: (08) 2210 3801 – 0943 23 00 99
Hey man, just want to thank you. You have helped me A LOT in the past two days. I have a uni assignment due in 15 hours and if it werent for your easy to understand and in depth tutorials I would have done fuck all and had a higher chance of failing this web application class. (lets hope i dont fail now lol)
I dont have any money but when I do i will surely send you a fair amount. Thank you so much! I love you (no homo)
If you log out here, at the end of this video tutorial, a warning shows up:
Notice: Undefined variable: session_user_id in index.php
and its a little bit longer 😀 and that was just the basic idea and not the currect solution
but its easy to add a new group, or delete, or modify
after that, if you want to know more send a pm
table users has an a_gtype column
table groups has all the premissions with an id
then simple get the acess type with a query for currect user
groups looks like this:
ID, NAME, CADD, CDEL, CMOD etc..and CSEE with tinyint or bool
if i have request the type for a post news then i call it:
if(canAccess($_SESSION['userid'],'CADD')){
// show the form or something
}
can acess gets the user from an array ( all user details is stored )
and query to he is able to do that
thats the basic
pizza + php = Morpheus
Hey Alex, grate work, i have learned so much from yout tutorials THANK YOU SO VERRY VERRY MUCH. I have only one question … what's next? 🙂
Make an profile upload thing:)))
3:18 Morpheus has arrived Alex. It's time to choose, the red pill, or the blue pill.
keep goin, but there is a more flexible premission system 🙂
but i solved this problem with an another table which can be modified by a default admin, and set premissions for different groups. ( or add a new group ) but this is great 😉
Man am buying a shirt !!