user-accounts

How can I get the active user name in a SYSTEM process using C++?

柔情痞子 提交于 2019-11-28 11:47:19
I have used GetUserName() METHOD , but the username it returned is 'SYSTEM' in a SYSTEM process.How can I get the active username in a SYSTEM process? THIS IS MY CODE: void getComputerUsername(char * username,char * domainname) { HANDLE hp , htoken; char buff[1024]; unsigned long size = 1024; TOKEN_USER *tuser; PSID sid; TCHAR * user = new TCHAR[256]; TCHAR * domain=new TCHAR[256]; SID_NAME_USE snu; hp = htoken = INVALID_HANDLE_VALUE; hp = GetCurrentProcess(); if(OpenProcessToken(hp, TOKEN_QUERY, &htoken)) { if(GetTokenInformation(htoken, TokenUser, (void*)buff, size, &size)) { tuser = (TOKEN

PHP and MySQL Select a Single Value

雨燕双飞 提交于 2019-11-28 07:28:00
I'd like to know how to select a single value from my MySQL table. The table includes columns username and id amongst others ( id is auto-increment and username is unique). Given the username, I want to set a session variable $_SESSION['myid'] equal to the value in the id column that corresponds to the given username. Here's the code that I've already tried: session_start(); $name = $_GET["username"]; $sql = "SELECT 'id' FROM Users WHERE username='$name'"; $result = mysql_query($sql); $value = mysql_fetch_object($result); $_SESSION['myid'] = $value; So far I'm getting: Catchable fatal error:

PHP Count Logged-In Users

社会主义新天地 提交于 2019-11-28 07:06:04
I'm having trouble figuring out how I can count the number of logged-in users in my application. What I have: When a user logs in, they get a session (which is used when the user wants to visit a protected page) and the IsLoggedIn column for the user in the users table is set to 1 to indicate that the user is logged in. When the user logs out, the value is set back to 0. Counting the number of 1s in the users table makes it easy to return the number of users logged-in. But... The Problem: If the user closes the browser without logging out, the value in the database stays 1, indicating that the

powershell - list local users and their groups

…衆ロ難τιáo~ 提交于 2019-11-28 06:22:34
I'd like to have a report with all the local users and their relative groups (users, power users, administrators and so on. I get the users in this way: $adsi = [ADSI]"WinNT://." $adsi.psbase.children | where {$_.psbase.schemaClassName -match "user"} | select @{n="Name";e={$_.name}} but I don't know how to retrieve their groups. Thanks in advance. $adsi = [ADSI]"WinNT://$env:COMPUTERNAME" $adsi.Children | where {$_.SchemaClassName -eq 'user'} | Foreach-Object { $groups = $_.Groups() | Foreach-Object {$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)} $_ | Select-Object @{n=

How to find the privileges and roles granted to a user in Oracle?

北城余情 提交于 2019-11-28 03:01:34
I am using Linux, Oracle10g. I have created one user called test. and granted create session and select any dictionary permission to the same user. i also granted sysdba and sysoper roles to the same users. Now i want to display all the privileges and roles granted to the user. I found following query but it shows only create session and select dictionary privileges. select privilege from dba_sys_privs where grantee='SAMPLE' order by 1; please help to resolve the issue. Thanks Look at http://docs.oracle.com/cd/B10501_01/server.920/a96521/privs.htm#15665 Check USER_SYS_PRIVS, USER_TAB_PRIVS,

How can I get a list Local Windows Users (Only the Users that appear in the windows Logon Screen)

我的未来我决定 提交于 2019-11-28 01:52:12
How can I get a list of Local Windows Users (Only the Users that appear in the windows Logon Screen) I have tried many methods using Windows Principle library & WMI Select commands. I keep getting Administrator, Guest & some other bizarre accounts (VUSRNEIL-DELL, $HOMEGROUPUSER, ASPNET...etc.) Neither of these 3 user accounts appear on the Logon screen. How can I Differentiate between these user types? I am coding in C# Leniel Maccaferri Just add a reference to System.Management in a Console Application and try this code: using System; using System.Management; using System.Linq; namespace

create local user account

限于喜欢 提交于 2019-11-27 08:43:42
i have this code to create a local windows user public static bool CreateLocalWindowsAccount(string username, string password, string displayName, string description, bool canChangePwd, bool pwdExpires) { try { PrincipalContext context = new PrincipalContext(ContextType.Machine); UserPrincipal user = new UserPrincipal(context); user.SetPassword(password); user.DisplayName = displayName; user.Name = username; user.Description = description; user.UserCannotChangePassword = canChangePwd; user.PasswordNeverExpires = pwdExpires; user.Save(); //now add user to "Users" group so it displays in Control

Verify user password in Meteor

醉酒当歌 提交于 2019-11-27 08:29:52
There are some irreversible actions that user can do in my app. To add a level of security, I'd like to verify that the person performing such an action is actually the logged in user. How can I achieve it? For users with passwords, I'd like a prompt that would ask for entering user password again. How can I later verify this password, without sending it over the wire? Is a similar action possible for users logged via external service? If yes, how to achieve it? I can help with the first question. As of this writing, meteor doesn't have a checkPassword method, but here's how you can do it: On

How to grant full permission to a file created by my application for ALL users?

心不动则不痛 提交于 2019-11-27 06:35:30
The tool I develop needs to grant access rights "Full Control" to a file created by it. It needs to be read, modified and deleted from all windows accounts and even possible future accounts. Could this be achieved? I know I can try this for a SPECIFIC_USER: FileSystemAccessRule rule = new FileSystemAccessRule(SPECIFIC_USER, FileSystemRights.FullControl, AccessControlType.Allow); FileSecurity fSecurity = File.GetAccessControl(filePath); fSecurity.SetAccessRule(rule); File.SetAccessControl(filePath, fSecurity); But how do I grant it to all users? And even possible future accounts? If the latter

How to find the privileges and roles granted to a user in Oracle?

放肆的年华 提交于 2019-11-27 05:01:50
问题 I am using Linux, Oracle10g. I have created one user called test. and granted create session and select any dictionary permission to the same user. i also granted sysdba and sysoper roles to the same users. Now i want to display all the privileges and roles granted to the user. I found following query but it shows only create session and select dictionary privileges. select privilege from dba_sys_privs where grantee='SAMPLE' order by 1; please help to resolve the issue. Thanks 回答1: Look at