================================================================================ SUPERADMIN PASSWORD RESET - SQL QUERY GUIDE ================================================================================ METHOD 1: QUICK RESET (Copy & Paste Ready) -------------------------------------------------------------------------------- This method uses a pre-generated password hash for the password: Admin@123 Step 1: Open phpMyAdmin (http://localhost/phpmyadmin) Step 2: Select your database: homnex_db Step 3: Click on the "SQL" tab Step 4: Copy and paste ONE of the following queries: OPTION A: Reset the FIRST superadmin found ------------------------------------------- UPDATE users SET password = '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', status = 'active' WHERE user_type = 'superadmin' LIMIT 1; OPTION B: Reset superadmin by SPECIFIC EMAIL --------------------------------------------- UPDATE users SET password = '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', status = 'active' WHERE email = 'your-email@example.com' AND user_type = 'superadmin'; (Replace 'your-email@example.com' with your actual email) OPTION C: Reset superadmin by USER ID -------------------------------------- UPDATE users SET password = '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', status = 'active' WHERE id = 1 AND user_type = 'superadmin'; (Replace '1' with your actual user ID) After running the query: - New Password: Admin@123 - Login at: http://localhost/homnex/admin/login ================================================================================ METHOD 2: CUSTOM PASSWORD (Generate Your Own Hash) -------------------------------------------------------------------------------- If you want to use a DIFFERENT password (not Admin@123): Step 1: Generate Password Hash ------------------------------- Open PowerShell/Command Prompt in: c:\xampp\htdocs\homnex Run: php generate_password_hash.php "YourCustomPassword" This will output a hashed password like: $2y$10$abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRS Step 2: Copy the Hash ---------------------- Copy the entire hash (starting with $2y$10$...) Step 3: Run SQL Query in phpMyAdmin ------------------------------------ UPDATE users SET password = 'PASTE_YOUR_HASH_HERE', status = 'active' WHERE user_type = 'superadmin' LIMIT 1; Replace 'PASTE_YOUR_HASH_HERE' with the hash you copied. ================================================================================ METHOD 3: VIEW ALL SUPERADMINS FIRST -------------------------------------------------------------------------------- If you're not sure which superadmin to reset, run this query first: SELECT id, email, full_name, user_type, status, created_at, last_login FROM users WHERE user_type = 'superadmin'; This will show you all superadmin accounts. Note the ID or email of the account you want to reset, then use METHOD 1 (Option B or C). ================================================================================ VERIFICATION QUERIES -------------------------------------------------------------------------------- After resetting, verify the update was successful: -- Check if password was updated SELECT id, email, full_name, user_type, status, LEFT(password, 20) as password_preview, updated_at FROM users WHERE user_type = 'superadmin'; -- Check specific user SELECT id, email, full_name, user_type, status, updated_at FROM users WHERE email = 'your-email@example.com'; ================================================================================ TROUBLESHOOTING -------------------------------------------------------------------------------- Problem: "0 rows affected" Solution: The query didn't find a matching user. - Check if a superadmin exists using METHOD 3 - Verify the email/ID is correct - Make sure user_type is exactly 'superadmin' (lowercase) Problem: Can't login after reset Solution: - Clear browser cache and cookies - Try incognito/private browsing mode - Verify the password hash was copied correctly (no extra spaces) - Check if account status is 'active' Problem: Account is locked/suspended Solution: Run this query to activate the account: UPDATE users SET status = 'active' WHERE user_type = 'superadmin' LIMIT 1; ================================================================================ SECURITY NOTES -------------------------------------------------------------------------------- 1. The password hash in METHOD 1 is for: Admin@123 This is a sample password - change it after logging in! 2. After successfully resetting your password, DELETE these files: - reset_superadmin_password.php - reset_password_cli.php - generate_password_hash.php - SQL_PASSWORD_RESET_GUIDE.txt (this file) 3. Always use strong passwords with: - At least 8 characters - Uppercase and lowercase letters - Numbers - Special characters (!@#$%^&*) 4. Change your password immediately after logging in: Go to: Admin Panel > Profile > Change Password ================================================================================ QUICK REFERENCE -------------------------------------------------------------------------------- Default Password (METHOD 1): Admin@123 Password Hash: $2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi Database: homnex_db Table: users Login URL: http://localhost/homnex/admin/login Generate Custom Hash: php generate_password_hash.php "YourPassword" ================================================================================