diff --git a/db/migrations/001_create_users_table.sql b/db/migrations/001_create_users_table.sql new file mode 100644 index 0000000..3364118 --- /dev/null +++ b/db/migrations/001_create_users_table.sql @@ -0,0 +1,11 @@ +CREATE TABLE IF NOT EXISTS `users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `username` varchar(50) NOT NULL, + `password` varchar(255) NOT NULL, + `email` varchar(100) NOT NULL, + `role` enum('Admin','User/Member','Viewer','Auditor') NOT NULL DEFAULT 'User/Member', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `username` (`username`), + UNIQUE KEY `email` (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; diff --git a/includes/header.php b/includes/header.php index c745022..5581109 100644 --- a/includes/header.php +++ b/includes/header.php @@ -1,4 +1,4 @@ - + @@ -42,9 +42,18 @@ - + + + + + + diff --git a/index.php b/index.php index 59131f7..3475e8f 100644 --- a/index.php +++ b/index.php @@ -1,106 +1,153 @@ - -
-
-

Securely Share Your Documents

-

A professional, simple, and secure platform for sharing files with your team and clients.

- Get Started - Login -
-
- - -
-
-
-
-

Your Private Document Hub

-

CoffreFort provides a secure environment where you can upload, manage, and share your important files. Say goodbye to insecure email attachments and consumer-grade file sharing services.

-

Built for businesses and professionals who need control and visibility over their shared data. Manage users, set permissions, and track activity with ease.

+ + +
+

Welcome to your Dashboard, !

+

This is your private area. More features will be added soon.

+ + +
+ You are logged in as an Admin. You have full access to the system.
-
- A modern office environment with professionals collaborating. -
-
-
-
+ - -
-
-
-

Features Designed for Security and Ease of Use

-

Everything you need to collaborate securely.

-
-
-
-
+
+
+
- -

Admin User Creation

-

Admins have full control over user accounts, ensuring only authorized individuals can access the system. Self-registration is disabled to maintain a secure, private environment.

+
Documents
+

Manage your documents here.

+ Go to Documents
-
-
+
+
- -

Role-Based Access

-

Assign roles like Admin, User, Viewer, and Auditor to manage permissions effectively. Each role has specific capabilities, from full control to view-only access.

+
Users
+

Manage users here.

+ Go to Users
-
-
+
+
- -

Audit Logs & Alerts

-

Keep track of all activity with detailed audit logs. Receive automated alerts for important events like new user sign-ups and storage quotas nearing their limit.

+
Settings
+

System settings.

+ Go to Settings
-
- -
-
-
-
-

Get in Touch

-

Have questions? We'd love to hear from you. Fill out the form below and we'll get back to you as soon as possible.

-
-
-
-
- - -
A name is required.
-
-
-
-
- - -
A valid email is required.
-
-
-
-
- - -
A message is required.
-
-
-
- -
+ + + +
+
+

Securely Share Your Documents

+

A professional, simple, and secure platform for sharing files with your team and clients.

+ Get Started + Login +
+
+ + +
+
+
+
+

Your Private Document Hub

+

CoffreFort provides a secure environment where you can upload, manage, and share your important files. Say goodbye to insecure email attachments and consumer-grade file sharing services.

+

Built for businesses and professionals who need control and visibility over their shared data. Manage users, set permissions, and track activity with ease.

+
+
+ A modern office environment with professionals collaborating. +
-
-
+ - \ No newline at end of file + +
+
+
+

Features Designed for Security and Ease of Use

+

Everything you need to collaborate securely.

+
+
+
+
+
+ +

Admin User Creation

+

Admins have full control over user accounts, ensuring only authorized individuals can access the system. Self-registration is disabled to maintain a secure, private environment.

+
+
+
+
+
+
+ +

Role-Based Access

+

Assign roles like Admin, User, Viewer, and Auditor to manage permissions effectively. Each role has specific capabilities, from full control to view-only access.

+
+
+
+
+
+
+ +

Audit Logs & Alerts

+

Keep track of all activity with detailed audit logs. Receive automated alerts for important events like new user sign-ups and storage quotas nearing their limit.

+
+
+
+
+
+
+ + +
+
+
+
+

Get in Touch

+

Have questions? We'd love to hear from you. Fill out the form below and we'll get back to you as soon as possible.

+
+
+
+
+ + +
A name is required.
+
+
+
+
+ + +
A valid email is required.
+
+
+
+
+ + +
A message is required.
+
+
+
+ +
+
+
+
+
+ + + + diff --git a/login.php b/login.php new file mode 100644 index 0000000..f043aff --- /dev/null +++ b/login.php @@ -0,0 +1,62 @@ +prepare("SELECT * FROM users WHERE username = ?"); + $stmt->execute([$_POST['username']]); + $user = $stmt->fetch(); + + if ($user && password_verify($_POST['password'], $user['password'])) { + $_SESSION['user_id'] = $user['id']; + $_SESSION['username'] = $user['username']; + $_SESSION['role'] = $user['role']; + header('Location: index.php'); + exit; + } else { + $error = 'Invalid credentials.'; + } + } catch (PDOException $e) { + $error = "Database error: " . $e->getMessage(); + } + } +} + +include 'includes/header.php'; +?> + +
+
+
+
+
+

Login

+
+
+ +
+ +
+
+ + +
+
+ + +
+ +
+
+
+
+
+
+ + diff --git a/logout.php b/logout.php new file mode 100644 index 0000000..34d47c2 --- /dev/null +++ b/logout.php @@ -0,0 +1,7 @@ +