<?php

// Kickstart the framework
$kw=require('lib/base.php');
require_once __DIR__.'/tool.php';

$_tool = new Tool();
$localhost = $_tool->is_localhost();

if($localhost){
    $kw->set('DB', new DB\SQL('mysql:host=localhost;port=3306;dbname=mysqldb','root','mysql'));
}else{
    $kw->set('DB', new DB\SQL('mysql:host=xxxxxxxx;port=3306;dbname=xxxxxxxx','xxxxxxxx','xxxxxxxx'));
}

require_once('routes/index.php');
require_once('routes/admin.php');
    
$kw->run();

 

<?php
//controllers/admin/users/table.php

function table($kw){
    $sql = "CREATE TABLE IF NOT EXISTS users (
        id VARCHAR(250), 
        name VARCHAR(250),
        password VARCHAR(250),
        email VARCHAR(250),
        role VARCHAR(250),
        thumb TEXT,
        info TEXT,
        video TEXT,
        date VARCHAR(250)
    )";

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

    $user = $kw->get('DB')->exec('SELECT * FROM users LIMIT 1');
    
    if(!$user){
        $kw->get('DB')->exec('INSERT INTO users (email, password) VALUES("xxxx@tv.com", "xxxxxx")');
    }
}

 

Epizy: http://khmerweb.epizy.com