username

Better way to get the user's name from device?

旧巷老猫 提交于 2019-11-28 21:31:22
I made a function that extracts a user name from the device name. The idea is to skip setup steps to allow the user to go straight to play upon starting the app the first time. This is a sub-optimal approach , as I can never trust the device name to hold the name of the user. The question is: What is a better way to do this? My function below gets the right name ... ... if the default name of the device has not changed ("Sanna's iPod") ... in English, ... in French and similar ("iPod de Sanna") ... in Swedish and similar ("Sannas iPod") if the name does not end with S ("Johannes iPod" =>

Getting computer name using VBA

与世无争的帅哥 提交于 2019-11-28 17:48:50
Is there a way to get the name of the computer in VBA? Dim sHostName As String ' Get Host Name / Get Computer Name sHostName = Environ$("computername") You can do like this: Sub Get_Environmental_Variable() Dim sHostName As String Dim sUserName As String ' Get Host Name / Get Computer Name sHostName = Environ$("computername") ' Get Current User Name sUserName = Environ$("username") End Sub Looks like I'm late to the game, but this is a common question... This is probably the code you want. Please note that this code is in the public domain, from Usenet, MSDN, and the Excellerando blog . Public

Check if username already exists in database MySQL PHP

泪湿孤枕 提交于 2019-11-28 13:05:52
I have a registration.php page I made and I need to check if a username is already in my database so that I won't have 2 members with the same name... Here is how I am inserting the user info into the database (username, password, date of registration, etc.): mysql_query("INSERT INTO UserDb (ID, TimeStamp, UserName, Password) VALUES ('$ipaddress', NOW(), '$user_username', '$user_password')"); How can I check that database "UserDb" under the "UserName" field to make sure the user's variable "$user_username" doesn't already exist? You can make the username field in the database a primary key or

How to get at the current users windows identity

狂风中的少年 提交于 2019-11-28 12:08:37
The site is running on my local IIS 6.1. I Would like to add some features to pull information from our AD. My AD code works on many other projects and on my dev server. Here are my attempts at writing out the username: Response.Write("1. " + this.Request.LogonUserIdentity.Name); Response.Write("2. " + Request.ServerVariables["Auth_User"]); Response.Write("3. " + WindowsIdentity.GetCurrent().Name.ToString()); The results I get are: NT AUTHORITY\IUSR administrator NT AUTHORITY\NETWORK SERVICE How can I get at the actual windows username like ourdomain/username Thanks This snippet shows how

Get Windows username of current user using php? [duplicate]

老子叫甜甜 提交于 2019-11-28 10:10:51
Possible Duplicate: How to read Windows loged in username with PHP/IIS I'm work on php tool that generate Data Access layer and generate some folders and files to user but i need to know how can i get username for current windows user to generate these folders on desktop ex: C:\\users\\<username>\\desktop I need to know the username. Thanks If by current windows user you mean the user running the script then that is set in an environment variable which you can get using: <?php echo getenv("username"); ?> If you want to get the home directory of the user running the script you should use <?php

Get Windows user name from SessionID

耗尽温柔 提交于 2019-11-28 09:27:26
Is there a method in C# to retrieve the user name from a given session id? (any session running on the system) The Win API function WTSQuerySessionInformation does this, but I'm searching for this funcationality in C#. joe There seems to be no .NET integrated method for this. So this is the current solution, using Windows Terminal services API: [DllImport("Wtsapi32.dll")] private static extern bool WTSQuerySessionInformation(IntPtr hServer, int sessionId, WtsInfoClass wtsInfoClass, out System.IntPtr ppBuffer, out int pBytesReturned); [DllImport("Wtsapi32.dll")] private static extern void

How do I retrieve the username that a Windows service is running under?

大憨熊 提交于 2019-11-28 08:24:36
Given a service name, I would like to retrieve the username that it runs under (i.e. the username shown in the 'Log On' tab of a service's properties window). There doesn't appear to be anything in the ServiceController class to retrieve this basic information. Nothing else in System.ServiceProcess looks like it exposes this information either. Is there a managed solution to this, or am I going to have to drop down into something lower-level? Riaan Using WMI, with the System.Management you can try the following code: using System; namespace WindowsServiceTest { class Program { static void Main

How to get the username in C/C++ in Linux? [closed]

自闭症网瘾萝莉.ら 提交于 2019-11-28 06:28:19
How can I get the actual "username" without using the environment (getenv, ...) in a program? The function getlogin_r() defined in unistd.h returns the username. See man getlogin_r for more information. Its signature is: int getlogin_r(char *buf, size_t bufsize); Needless to say, this function can just as easily be called in C or C++. Nemanja Boric From http://www.unix.com/programming/21041-getting-username-c-program-unix.html : /* whoami.c */ #define _PROGRAM_NAME "whoami" #include <stdlib.h> #include <pwd.h> #include <stdio.h> int main(int argc, char *argv[]) { register struct passwd *pw;

Can't change username and password from git

故事扮演 提交于 2019-11-28 05:47:45
问题 I use git extension. I wanted the password and username to be store in cache so I used: git-credential-winstore. It worked fine until I had to change the password in my computer (win7) and it asked me again to insert password. I inserted a wrong password and it stores in the cache and I can't change it. I tried to uninstall git and no use. I deleted from .gitconfig file in user\myUser the lines: [credential] helper = !'C:\\Users\\grin_d\\AppData\\Roaming\\GitCredStore\\git-credential-winstore

Save username-password with NSUserDefault, how and how much safe?

孤街浪徒 提交于 2019-11-28 04:42:31
问题 I would save a couple of values (username-password) with NSUserDefault. First: is there a way to save them together (like in an array for example)? Second: is it safe? or do I have encrypt the password in a some way? 回答1: Encryption will give you some security. The problem is your program would also have to decrypt the password, which means it must have the key stored in it somewhere. This will make it vulnerable to reverse-engineering. A better approach is to use an one-way function (such as