We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11979
    • 8 Posts
    i’m writting several snippets that involved posting info per user in a database of course the example below is a simple way to block users that are not logged in.....
        #get client info
        $client_id = $modx->getLoginUserID();
        if ($client_id!="") {
        $client_name = $modx->getLoginUserName();
        } else {
        return 'Stop since your not logged in...';
        }
    


    how safe is that and

    what would i check the web user session id against?


    $webuser_array = $modx->getWebUserInfo($user_id);
    $php_sessionid=$webuser_array['sessionid'];
    # i'm just guessing here
    $web_sessionid=$_COOKIE['sessionid'];
    
    #check it!
    if ($web_sessionid != $php_sessionid) {
    return'Invalid Session ID!';
    }
    


    that seems to verify is it safe?

    i’m also going to be searching the docs and other snippets for code.....