-
Analyzing your requirements and generating your website…
-
- Loading…
-
-
= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.
-
This page will update automatically as the plan is implemented.
-
Runtime: PHP = htmlspecialchars($phpVersion) ?> — UTC = htmlspecialchars($now) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Sélectionnez un canal pour commencer à discuter.
+
+
+
+
-
-
+
+
-
+
\ No newline at end of file
diff --git a/login.php b/login.php
new file mode 100644
index 0000000..df96634
--- /dev/null
+++ b/login.php
@@ -0,0 +1,96 @@
+prepare("SELECT * FROM users WHERE username = ?");
+ $stmt->execute([$username]);
+ $user = $stmt->fetch();
+
+ if ($user && password_verify($password, $user['password'])) {
+ // Password is correct, start session and redirect
+ session_regenerate_id(true);
+ $_SESSION['user_id'] = $user['id'];
+ $_SESSION['username'] = $user['username'];
+
+ // Explicitly redirect
+ header("Location: index.php");
+ // Fallback with JavaScript redirection
+ echo '';
+ exit();
+ } else {
+ $errors[] = 'Nom d\'utilisateur ou mot de passe incorrect.';
+ }
+ } catch (PDOException $e) {
+ error_log("Login Error: " . $e->getMessage());
+ $errors[] = 'Une erreur est survenue lors de la connexion. Veuillez réessayer.';
+ }
+ }
+}
+?>
+
+
+
+
+
+
Connexion - Discord V2
+
+
+
+
+
+
\ No newline at end of file
diff --git a/logout.php b/logout.php
new file mode 100644
index 0000000..ceaf227
--- /dev/null
+++ b/logout.php
@@ -0,0 +1,7 @@
+
\ No newline at end of file
diff --git a/register.php b/register.php
new file mode 100644
index 0000000..cac36be
--- /dev/null
+++ b/register.php
@@ -0,0 +1,114 @@
+prepare("SELECT COUNT(*) FROM users WHERE username = ?");
+ $stmt->execute([$username]);
+ if ($stmt->fetchColumn() > 0) {
+ $errors[] = 'Ce nom d\'utilisateur est déjà pris.';
+ } else {
+ // Generate unique IDs
+ $simple_id = generateSimpleId();
+ $ultra_id = generateUltraId();
+
+ // Hash password
+ $hashed_password = password_hash($password, PASSWORD_DEFAULT);
+
+ // Insert user
+ $stmt = $pdo->prepare("INSERT INTO users (username, password, simple_id, ultra_id) VALUES (?, ?, ?, ?)");
+ $stmt->execute([$username, $hashed_password, $simple_id, $ultra_id]);
+
+ // Get the new user's ID
+ $user_id = $pdo->lastInsertId();
+
+ // Log the user in
+ $_SESSION['user_id'] = $user_id;
+ $_SESSION['username'] = $username;
+
+ // Redirect to the main page
+ header("Location: index.php");
+ exit();
+ }
+ } catch (PDOException $e) {
+ error_log("Registration Error: " . $e->getMessage());
+ $errors[] = 'Une erreur est survenue lors de l\'inscription. Veuillez réessayer.';
+ }
+ }
+}
+?>
+
+
+
+
+
+
Inscription - Discord V2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Redirection vers la page de connexion...
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/send_message.php b/send_message.php
new file mode 100644
index 0000000..d5b3d33
--- /dev/null
+++ b/send_message.php
@@ -0,0 +1,68 @@
+ 'Unauthorized']);
+ exit();
+}
+
+if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
+ http_response_code(405);
+ echo json_encode(['error' => 'Method Not Allowed']);
+ exit();
+}
+
+$user_id = $_SESSION['user_id'];
+$data = json_decode(file_get_contents('php://input'), true);
+$channel_id = $data['channel_id'] ?? null;
+$content = $data['content'] ?? null;
+
+if (!$channel_id || !$content) {
+ http_response_code(400);
+ echo json_encode(['error' => 'Channel ID and content are required']);
+ exit();
+}
+
+$content = trim($content);
+if (empty($content)) {
+ http_response_code(400);
+ echo json_encode(['error' => 'Message content cannot be empty']);
+ exit();
+}
+
+try {
+ $pdo = db();
+
+ // Verify user has access to this channel's server
+ $stmt = $pdo->prepare("
+ SELECT c.id
+ FROM channels c
+ JOIN servers s ON c.server_id = s.id
+ JOIN server_members sm ON s.id = sm.server_id
+ WHERE c.id = ? AND sm.user_id = ?
+ ");
+ $stmt->execute([$channel_id, $user_id]);
+ if ($stmt->fetch() === false) {
+ http_response_code(403);
+ echo json_encode(['error' => 'Forbidden']);
+ exit();
+ }
+
+ // Insert message
+ $stmt = $pdo->prepare("
+ INSERT INTO messages (channel_id, user_id, content)
+ VALUES (?, ?, ?)
+ ");
+ $stmt->execute([$channel_id, $user_id, $content]);
+
+ header('Content-Type: application/json');
+ echo json_encode(['success' => true, 'message' => 'Message sent']);
+
+} catch (PDOException $e) {
+ error_log("Send Message Error: " . $e->getMessage());
+ http_response_code(500);
+ echo json_encode(['error' => 'Internal Server Error']);
+}
diff --git a/utils.php b/utils.php
new file mode 100644
index 0000000..91aa1a7
--- /dev/null
+++ b/utils.php
@@ -0,0 +1,17 @@
+
\ No newline at end of file