Tag: user

MySQL

Reset Root Password for MySQL user in Windows

1. Stop MySQL service. Run services.msc as administrator and stop it. 2. Run cmd.exe as administrator. 3. Execute: c:xamppmysqlbinmysqld.exe –skip-grant-tablesc:xamppmysqlbinmysqld.exe –skip-grant-tables 4. Run another cmd.exe as administrator. 5. Execute: c:xamppmysqlbinmysql.exec:xamppmysqlbinmysql.exe 6. Execute query: UPDATE mysql.user SET Password=PASSWORD(’newpasswd’) WHERE USER=’root’;UPDATE mysql.user SET Password=PASSWORD(‘newpasswd’) WHERE User=’root’; FLUSH PRIVILEGES;FLUSH PRIVILEGES; 7. Close cmd windows. 8. Kill mysqld process …

MySQL

Restore the MySQL root user’s full privileges in Windows

1. Stop MySQL service. Run services.msc as administrator and stop it. 2. Run cmd.exe as administrator. 3. Execute: c:xamppmysqlbinmysqld.exe –skip-grant-tablesc:xamppmysqlbinmysqld.exe –skip-grant-tables 4. Run another cmd.exe as administrator. 5. Execute: c:xamppmysqlbinmysql.exec:xamppmysqlbinmysql.exe 6. Execute query: UPDATE mysql.user SET Grant_priv=’Y’, Super_priv=’Y’ WHERE USER=’root’;UPDATE mysql.user SET Grant_priv=’Y’, Super_priv=’Y’ WHERE User=’root’; FLUSH PRIVILEGES;FLUSH PRIVILEGES; 7. Close cmd windows. 8. Kill …

Kohana, PHP

Creating your own Model User

If you are trying to create your own Model User and you receive the message bellow: ErrorException [ Fatal Error ]: Call to undefined method Model_User::unique_key()ErrorException [ Fatal Error ]: Call to undefined method Model_User::unique_key()ErrorException [ Fatal Error ]: Call to undefined method Model_User::unique_key()ErrorException [ Fatal Error ]: Call to undefined method Model_User::unique_key() then you …

Kohana, PHP

How to avoid repeating code to check if a user is logged in

First of all create your own Controller that all other controllers will inherit from. Name it Mycontroller, for example: defined(’SYSPATH’) or die(’No direct script access.’);   class Controller_Mycontroller extends Controller {   public function before() { parent::before(); //…. }   } // Enddefined(‘SYSPATH’) or die(‘No direct script access.’); class Controller_Mycontroller extends Controller { public function …

C++

Retrieve the User-Agent HTTP

ObtainUserAgentString retrieves the User-Agent HTTP request header string that is currently being used. //.. #pragma comment (lib, "urlmon.lib") //.. char httpUseragent[512]; DWORD szhttpUserAgent = sizeof(httpUseragent); ObtainUserAgentString( 0, httpUseragent, &szhttpUserAgent ); printf("%sn", httpUseragent); //..//.. #pragma comment (lib, "urlmon.lib") //.. char httpUseragent[512]; DWORD szhttpUserAgent = sizeof(httpUseragent); ObtainUserAgentString( 0, httpUseragent, &szhttpUserAgent ); printf("%sn", httpUseragent); //..

Microsoft Windows

Hide a User from the Welcome Screen

Hide user from Windows welcome screen: reg add "HKEY_LOCAL_MACHINESoftwareMicrosoftWindows NTCurrentVersionWinlogonSpecialAccountsUserList" /v <username> /t REG_DWORD /d 0 /freg add "HKEY_LOCAL_MACHINESoftwareMicrosoftWindows NTCurrentVersionWinlogonSpecialAccountsUserList" /v <username> /t REG_DWORD /d 0 /f Replace <username> Show user on Windows welcome screen: reg add "HKEY_LOCAL_MACHINESoftwareMicrosoftWindows NTCurrentVersionWinlogonSpecialAccountsUserList" /v <username> /t REG_DWORD /d 1 /freg add "HKEY_LOCAL_MACHINESoftwareMicrosoftWindows NTCurrentVersionWinlogonSpecialAccountsUserList" /v <username> /t REG_DWORD /d 1 …