fix
This commit is contained in:
@@ -56,7 +56,7 @@ C:\xampp\htdocs\pilates-platform\
|
|||||||
1. Apri phpMyAdmin (o il tuo client MySQL preferito)
|
1. Apri phpMyAdmin (o il tuo client MySQL preferito)
|
||||||
2. Esegui lo script `database/schema.sql`
|
2. Esegui lo script `database/schema.sql`
|
||||||
3. Questo creerà:
|
3. Questo creerà:
|
||||||
- Il database `pilates_platform`
|
- Il database `pilatesplatform`
|
||||||
- Tutte le tabelle necessarie
|
- Tutte le tabelle necessarie
|
||||||
- Un utente amministratore di default
|
- Un utente amministratore di default
|
||||||
- Alcune lezioni demo di esempio
|
- Alcune lezioni demo di esempio
|
||||||
@@ -72,7 +72,7 @@ Apri il file `includes/config.php` e modifica:
|
|||||||
#### Database
|
#### Database
|
||||||
```php
|
```php
|
||||||
define('DB_HOST', 'localhost'); // Host del database
|
define('DB_HOST', 'localhost'); // Host del database
|
||||||
define('DB_NAME', 'pilates_platform'); // Nome database
|
define('DB_NAME', 'pilatesplatform'); // Nome database
|
||||||
define('DB_USER', 'root'); // Username (es: root per localhost)
|
define('DB_USER', 'root'); // Username (es: root per localhost)
|
||||||
define('DB_PASS', ''); // Password database
|
define('DB_PASS', ''); // Password database
|
||||||
```
|
```
|
||||||
@@ -442,7 +442,7 @@ MySQL è dove vengono salvati i dati:
|
|||||||
### Backup Database
|
### Backup Database
|
||||||
Esegui regolarmente (es: settimanalmente):
|
Esegui regolarmente (es: settimanalmente):
|
||||||
```bash
|
```bash
|
||||||
mysqldump -u root -p pilates_platform > backup_$(date +%Y%m%d).sql
|
mysqldump -u root -p pilatesplatform > backup_$(date +%Y%m%d).sql
|
||||||
```
|
```
|
||||||
|
|
||||||
### Aggiornare PHP
|
### Aggiornare PHP
|
||||||
|
|||||||
45
database/reset_admin_password.sql
Normal file
45
database/reset_admin_password.sql
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
-- ============================================
|
||||||
|
-- RESET PASSWORD ADMIN
|
||||||
|
-- ============================================
|
||||||
|
-- Se hai problemi con la password admin, esegui questa query
|
||||||
|
-- per reimpostare la password a "admin123"
|
||||||
|
-- ============================================
|
||||||
|
|
||||||
|
-- Aggiorna la password dell'admin
|
||||||
|
UPDATE users
|
||||||
|
SET password = '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'
|
||||||
|
WHERE email = 'admin@pilatesstudio.com';
|
||||||
|
|
||||||
|
-- Verifica che l'utente admin esista
|
||||||
|
SELECT id, email, first_name, last_name, is_admin, created_at
|
||||||
|
FROM users
|
||||||
|
WHERE email = 'admin@pilatesstudio.com';
|
||||||
|
|
||||||
|
-- ============================================
|
||||||
|
-- OPPURE: Elimina e ricrea l'utente admin
|
||||||
|
-- ============================================
|
||||||
|
|
||||||
|
-- Elimina l'utente esistente (se esiste)
|
||||||
|
DELETE FROM users WHERE email = 'admin@pilatesstudio.com';
|
||||||
|
|
||||||
|
-- Ricrea l'utente admin
|
||||||
|
INSERT INTO users (email, password, first_name, last_name, is_admin, created_at)
|
||||||
|
VALUES (
|
||||||
|
'admin@pilatesstudio.com',
|
||||||
|
'$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',
|
||||||
|
'Admin',
|
||||||
|
'Pilates',
|
||||||
|
TRUE,
|
||||||
|
NOW()
|
||||||
|
);
|
||||||
|
|
||||||
|
-- ============================================
|
||||||
|
-- CREA PASSWORD PERSONALIZZATA
|
||||||
|
-- ============================================
|
||||||
|
-- Se vuoi creare una password personalizzata, usa questo script PHP:
|
||||||
|
--
|
||||||
|
-- <?php
|
||||||
|
-- echo password_hash('tua-password', PASSWORD_DEFAULT);
|
||||||
|
-- ?>
|
||||||
|
--
|
||||||
|
-- Poi sostituisci l'hash nella query UPDATE sopra
|
||||||
62
test_password.php
Normal file
62
test_password.php
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Test Password Hash
|
||||||
|
*
|
||||||
|
* Questo script ti permette di:
|
||||||
|
* 1. Generare un nuovo hash per una password
|
||||||
|
* 2. Verificare se una password corrisponde a un hash
|
||||||
|
*
|
||||||
|
* IMPORTANTE: Elimina questo file dopo l'uso per sicurezza!
|
||||||
|
*/
|
||||||
|
|
||||||
|
// ============================================
|
||||||
|
// GENERA NUOVO HASH
|
||||||
|
// ============================================
|
||||||
|
|
||||||
|
echo "<h2>Genera Hash Password</h2>";
|
||||||
|
|
||||||
|
// Cambia questa password con quella che desideri
|
||||||
|
$nuova_password = 'admin123';
|
||||||
|
$hash = password_hash($nuova_password, PASSWORD_DEFAULT);
|
||||||
|
|
||||||
|
echo "<p><strong>Password:</strong> " . htmlspecialchars($nuova_password) . "</p>";
|
||||||
|
echo "<p><strong>Hash generato:</strong></p>";
|
||||||
|
echo "<textarea style='width:100%; height:80px;'>" . htmlspecialchars($hash) . "</textarea>";
|
||||||
|
|
||||||
|
echo "<hr>";
|
||||||
|
|
||||||
|
// ============================================
|
||||||
|
// VERIFICA HASH
|
||||||
|
// ============================================
|
||||||
|
|
||||||
|
echo "<h2>Verifica Password</h2>";
|
||||||
|
|
||||||
|
// L'hash che hai nel database
|
||||||
|
$hash_database = '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi';
|
||||||
|
|
||||||
|
// La password che stai provando
|
||||||
|
$password_test = 'admin123';
|
||||||
|
|
||||||
|
if (password_verify($password_test, $hash_database)) {
|
||||||
|
echo "<p style='color: green;'><strong>✓ La password '$password_test' corrisponde all'hash!</strong></p>";
|
||||||
|
} else {
|
||||||
|
echo "<p style='color: red;'><strong>✗ La password '$password_test' NON corrisponde all'hash!</strong></p>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<hr>";
|
||||||
|
|
||||||
|
// ============================================
|
||||||
|
// QUERY SQL DA ESEGUIRE
|
||||||
|
// ============================================
|
||||||
|
|
||||||
|
echo "<h2>Query SQL da Eseguire</h2>";
|
||||||
|
echo "<p>Copia questa query e eseguila in phpMyAdmin per aggiornare la password:</p>";
|
||||||
|
echo "<textarea style='width:100%; height:120px;'>";
|
||||||
|
echo "UPDATE users \n";
|
||||||
|
echo "SET password = '" . $hash . "'\n";
|
||||||
|
echo "WHERE email = 'admin@pilatesstudio.com';";
|
||||||
|
echo "</textarea>";
|
||||||
|
|
||||||
|
echo "<hr>";
|
||||||
|
echo "<p style='color: red;'><strong>⚠️ IMPORTANTE: Elimina questo file (test_password.php) dopo l'uso!</strong></p>";
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user