17 thoughts on “PHP Tutorials: Register & Login (Part 21): More Account Permissions

  • September 1, 2018 at 12:39
    Permalink

    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.

  • September 1, 2018 at 12:39
    Permalink

    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…

  • September 1, 2018 at 12:39
    Permalink

    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

  • September 1, 2018 at 12:39
    Permalink

    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)

  • September 1, 2018 at 12:39
    Permalink

    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

  • September 1, 2018 at 12:39
    Permalink

    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

  • September 1, 2018 at 12:39
    Permalink

    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

  • September 1, 2018 at 12:39
    Permalink

    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? 🙂

  • September 1, 2018 at 12:39
    Permalink

    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 😉

Leave a Reply