<?php
//routes/index.php

$kw->route('GET /', function($kw) {
    require_once('controllers/index.php');
    index($kw);
});

$kw->route('GET /login', function($kw) {
    require_once('controllers/login.php');
    login($kw);
});

 

<?php
//controllers/login.php

function login($kw){
    require_once __DIR__.'/../setting.php';

    $kw->mset([
        'appName'=>$setting['siteTitle'], 
        'title'=>'ទំព័រ​ចុះ​ឈ្មោះ', 
        'date'=>$setting['date'],
        'message'=>$setting['message']
    ]);

    $view=new View;
    echo $view->render('views/login.php');
}

 

<!--views/login.php-->

<?php require('partials/header.php') ?>
        
<link href='public/styles/login.css' rel='stylesheet' />

<div class='Login'>
    <div class='title'>ចុះ​ឈ្មោះ​ចូល​ទំព័រ​គ្រប់គ្រង</div>
    <form action='./login' method='post'>
        <a>Email: </a><input type='email' name='email' required placeholder='Email' />
        <a>ពាក្យ​សំងាត់: </a><input type='password' name='password' required />
        <a></a><input type='submit' value='បញ្ជូន' />
        <a></a><div class='message'><?php echo $message ?></div>
    </form>
</div>

<?php require('partials/footer.php') ?>

 

.Login{
    background: var(--background);
    margin: 20px auto 0;
    width: 450px;
}

.Login .title{
    font: 16px/1.5 Anton, Moul;
    text-align: center;
    padding: 10px;
    border-bottom: 1px solid lightgrey;
}

.Login form{
    padding: 20px;
    display: grid;
    grid-template-columns: 20% auto;
    grid-gap: 5px;
    align-items: center;
}

.Login form a{
    text-align: right;
    color: white;
}

.Login form input{
    font: var(--body-font);
    padding: 0 10px;
}

.Login form .message{
    text-align: center;
}

 

Epizy: http://khmerweb.epizy.com