-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
login and session controls, home screen schanges
- Loading branch information
1 parent
fdd5c79
commit 54de104
Showing
10 changed files
with
162 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
|
||
session_destroy(); | ||
redirect('login'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
if ($process == 'login') { | ||
|
||
if (!$data['email']) { | ||
return [ | ||
'success' => false, | ||
'message' => 'E-mail address is required', | ||
'type' => 'danger' | ||
]; | ||
} | ||
if (!$data['password']) { | ||
return [ | ||
'success' => false, | ||
'message' => 'Password is required', | ||
'type' => 'danger' | ||
]; | ||
} | ||
|
||
$q = $db -> prepare("SELECT *, CONCAT(user_name, ' ', user_surname) as user_fullname FROM users WHERE user_email = ? AND user_password = ?"); | ||
$q -> execute([ | ||
$data['email'], | ||
hash('SHA512', $data['password']) | ||
]); | ||
|
||
if ($q -> rowCount()) { | ||
$user = $q -> fetch(PDO::FETCH_ASSOC); | ||
add_session('user_id', $user['user_id']); | ||
add_session('user_name', $user['user_name']); | ||
add_session('user_surname', $user['user_surname']); | ||
add_session('user_fullname', $user['user_fullname']); | ||
add_session('user_email', $user['user_email']); | ||
add_session('login', true); | ||
|
||
return [ | ||
'data' => $user, | ||
'success' => true, | ||
'message' => 'Login successful. Redirecting...', | ||
'type' => 'success', | ||
'redirect' => 'home' | ||
]; | ||
|
||
} else { | ||
|
||
return [ | ||
'success' => false, | ||
'message' => 'Login failed. Please check your credentials.', | ||
'type' => 'danger' | ||
]; | ||
|
||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# ToDo Project | ||
|
||
This is a simple ToDo project built with PHP using the Model-View-Controller (MVC) architectural pattern. | ||
|
||
## What I Did | ||
|
||
- Routing and Functionality of MVC Structure | ||
- Multilingual Support | ||
- Database Preparation | ||
- Login Operations | ||
- Profile and Password Update Operations | ||
- Todo Categories (Each session creates its own category) | ||
- Adding | ||
- Deleting | ||
- Updating | ||
- Listing | ||
- Todos (Each session creates its own list) | ||
- Adding | ||
- Updating | ||
- Deleting | ||
- Listing | ||
- In Progress - Completed | ||
- FullCalendarAPI Integration | ||
- Timeline Display | ||
- Statistics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
<?php | ||
|
||
// Set BASEDIR as the root directory of the project | ||
$basedir = dirname(__DIR__) . DIRECTORY_SEPARATOR; | ||
$basedir = dirname(__DIR__); | ||
define('BASEDIR', $basedir); | ||
|
||
|
||
// Set URL dynamically by checking folder name of the project | ||
$url = 'http://localhost/' . (basename(BASEDIR)); | ||
$url = 'http://localhost/' . (basename(BASEDIR) . '/'); | ||
define('URL', $url); | ||
echo BASEDIR . '<br>'; | ||
echo URL; | ||
|
||
const DEV_MODE = true; | ||
const DEV_MODE = true; | ||
|
||
// Database connection | ||
$host = 'bzoighyemc4n1alzqpup-mysql.services.clever-cloud.com'; | ||
$dbname = 'bzoighyemc4n1alzqpup'; | ||
$username = 'uzwnv0ianiryk6xp'; | ||
$password = 'ZuIKwJqDz5gyR9C2uMvF'; | ||
|
||
try { | ||
$db = new PDO("mysql:host=".$host.";dbname=".$dbname.";charset=utf8", $username, $password); | ||
} catch (PDOException $e) { | ||
die('Connection failed: ' . $e->getMessage()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters