<?php
//controllers/frontend/login/get.php

function get($f3){
    require('setting.php');
    
    $f3->mset([
        'appName'=>$setting['siteTitle'], 
        'pageTitle'=>'ទំព័រ​ចុះ​ឈ្មោះ', 
        'date'=>$setting['date'],
        'message'=>$setting['message']
    ]);

    require  __DIR__.'/createUserTable.php';
    createUserTable($f3);

    echo View::instance()->render('views/frontend/login.html');
}

 

<?php
//controllers/frontend/login/createUserTable.php

function createUserTable($f3){
    $sql = "CREATE TABLE IF NOT EXISTS users (
        userID TEXT,
        email TEXT,
        username TEXT,
        password TEXT,
        role TEXT,
        thumb TEXT,
        info TEXT,
        video TEXT,
        date TEXT
    )";

    $f3->get('DB')->exec($sql);

    $user = new DB\SQL\Mapper($f3->get('DB'),'users');
    $user->userID = uniqid();
    $user->email = 'root@khmerweb.app';
    $user->username = 'root';
    $user->password = md5('password');
    $user->role = 'admin';
    $user->thumb = '';
    $user->info = '';
    $user->video = '';
    $user->date = '';
    $user->save();
}

 

https://github.com/Sokhavuth/PHP-REST-API

http://khmerweb.epizy.com/media/