PHP Classes

File: register.php

Recommend this page to a friend!
  Classes of Juan Camacho   Nano PHP Framework   register.php   Download  
File: register.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Nano PHP Framework
Build applications with the minimum amount of code
Author: By
Last change:
Date: 10 months ago
Size: 711 bytes
 

Contents

Class file image Download
<?php

require_once 'src/Config/Database.php';
require_once
'src/Controllers/AuthController.php';
require_once
'src/Models/User.php';

use
src\Controllers\AuthController;

// Handle form submission
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['username'], $_POST['password'], $_POST['email'])) {
   
$authController = new AuthController();

   
$username = $_POST['username'];
   
$password = $_POST['password'];
   
$email = $_POST['email'];

   
$authController->register($username, $password, $email);

   
// Redirect to a success page or handle the result accordingly
   
header('Location: protected_page.php');
    exit();
}

// Render the register view
include 'src/views/register.php';

?>