<?php
//routes/frontend/index.php

$f3->route('GET /', function(){
    echo 'Hello, world!';
});

require('login.php');

 

<?php
//routes/frontend/login.php

$f3->route('GET /login', function($f3){
    require('controllers/frontend/login/get.php');
    get($f3);
});

 

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

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

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

 

<?php
//setting.php

require_once('tool.php');

$_tool = new Tool();
date_default_timezone_set("Asia/Phnom_Penh");
$date = $_tool->getKhDate(date('Y/m/d'));

$setting = [];

$setting['date'] = $date;
$setting['siteTitle'] = 'ពហុ​ព័ត៌មាន';
$setting['description'] = 'ព័ត៌មាន ចំណេះដឹង វប្បធម៌ កំសាន្ត';
$setting['message'] = '';

 

<html>
    <head>
        <meta charset="UTF-8"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
        <title><?php echo $appName." - ".$pageTitle; ?></title>
        <script src="<?php echo $BASE ?>/public/scripts/jQuery.js"></script>
        <link href="<?php echo $BASE ?>/public/fonts/setup.css" rel="stylesheet" ></link>
        <link href="<?php echo $BASE ?>/public/images/site_logo.png" rel="icon" ></link>
        <link href="<?php echo $BASE ?>/public/styles/global.css" rel="stylesheet"></link>
        <link href="<?php echo $BASE ?>/public/styles/login.css" rel="stylesheet"></link>
    </head>
    <body>
        <div class='Login'>
            <div class='title'>ចុះ​ឈ្មោះ​ចូល​ទំព័រ​គ្រប់គ្រង</div>
            <form action='<?php echo $BASE ?>/login' method="post" >
                <span>Email: </span><input type='email' name='email' required />
                <span>ពាក្យ​សំងាត់: </span><input type='password' name='password' required />
                <span></span><input type='submit' value='បញ្ជូន' />
                <span></span><div class='info'><?php echo $message ?></div>
            </form>
        </div>
    </body>
</html>

 

/*static/styles/global.css*/
:root{
  --background: #787cb5;
  --background-dark: #474a8a;
  --background-light: #b0b3d6;
  --yellow: #ffd343;
  --body-font: 14px/1.75 Vidaloka, OdorMeanChey;
  --link: #eb79bf;
  --color: white;
}

*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

a{
  text-decoration: none;
  color: var(--link);
}

a:hover{
  opacity: .7;
}

.region{
  max-width: 1200px;
  margin: 0 auto;
}

body{
  color: var(--color);
  font: var(--body-font);
  background: var(--background-light);
}

 

.Login{
    width: 400px;
    margin: 60px auto;
    background: var(--background);
    color: var(--color);
}

.Login .title{
    font: 18px/1.5 Oswald, Moul;
    text-align: center;
    padding: 10px;
    border-bottom: 1px solid white;
}

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

.Login form span{
    text-align: right;
}

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

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

 

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

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