-
Similar Content
-
By JesusSuarz
Hello,
I'm trying to get some way to query if a user is online.
I don't want to know the current user.
if not something you can define for example $clientid or $userid or $emailclient ...
I am making an external site. and i need to work with user sessions. (I am making a remote connection with the api).
this function does not currently exist in the api available.
I've been seeing this: https://developers.whmcs.com/advanced/authentication/
however I do not see that it allows to define the user.
I was also seeing this: https://docs.whmcs.com/Sessions
I was able to save the cookie in the database, however I can't find any way to identify the one that belongs to each user.
any idea how I can get (which users are online?) ..
(please nothing to do with smarty, only php).
postdata: forget to tell the method I use to get user authentication in my application.
create the following code for my application:
I first make a connection to the api: https://developers.whmcs.com/api/authentication/
soon ValidateLogin: https://developers.whmcs.com/api-reference/validatelogin/
soon GetClientsDetails: https://developers.whmcs.com/api-reference/getclientsdetails/
soon CreateSsoToken: https://developers.whmcs.com/api-reference/createssotoken/
// validar usuario $command = 'ValidateLogin'; $postData = array( 'email' => $email_user, //post 'password2' => $password_user, //post ); $api_login = localAPI($command, $postData); //var de id de usuario: $api_login["userid"]; // si se encuentra el user entonces traer detalles del usuario via email $clientid = array(); // array que tiene el id del cliente if ($api_login["userid"] == true) { $command = 'GetClientsDetails'; $postData = array( 'email' => $email_user, // email login ); $details_client = localAPI($command, $postData); $clientid[] = $details_client["client_id"]; } // variable del clientid es: $clientid[0]; // crear token de session $command = 'CreateSsoToken'; $postData = array( 'client_id' => $clientid[0], ); $results_ssotoken = localAPI($command, $postData); echo '<pre>'; var_dump($results_ssotoken); echo '</pre>'; this will create the url with (CreateSsoToken) where the user will be redirected for autologin, however the cookie is created only after entering the client area. that's why I don't know how to get the cookie, or identify the user.
@brian! would you help me with this?
-
By ichilver
Hi
Is there a way in WHMCS to get a popup window to warn the logged in user that there session is about to timeout and log them out.
Similar to when you are logged into your bank and it warns you are about to be auto logged out.
Ian
-
By devadok
Hi,
I'm developing an addon and inside the hooks.php, I have the following code:
add_hook('AdminAreaHeaderOutput', 1, 'bnw_todo_itens'); function bnw_todo_itens($vars) { $check = true; // if session var exists, then check if we need to check again or not if (isset($_SESSION['todo_list_cache'])) { $last_checked = $_SESSION['todo_list_cache']; $now = time(); // do not check within 1 hour if (($now - $last_checked) < (60 * 60)) { $check = false; } } $adminid = $vars['adminid']; if ($check) { // check if there is any pending/new todo item $sql = "SELECT id, title, description, duedate, `status` "; $sql .= "FROM tbltodolist "; $sql .= "WHERE admin = " . $adminid . " "; $sql .= "AND `status` IN ('New', 'Pending') "; $sql .= "AND duedate <= '" . date('Y-m-d') . "' "; $sql .= "ORDER BY duedate "; $result = mysql_query($sql); while (($row = mysql_fetch_assoc($result))) { // create html } // updates the last checked time $_SESSION['todo_list_cache'] = time(); // returns the created html return $html; } }
When a refresh the page and try to read the session var that I have set ($_SESSION['todo_list_cache']), the variable doesn't exist. Whenever I try debugging the $_SESSION, all I see is:
[tkval] => Asd6a1sdfA3
[adminid] => 123
[adminpw] => 123123132123132123132123123
Does anyboy know what can be wrong?
Thanks
-
-
Recently Browsing 0 members
No registered users viewing this page.