<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title><%= siteTitle %></title>
<script src="/scripts/jQuery.js"></script>
<link href="/images/site_logo.png" rel="icon" ></link>
<link href="/fonts/setup.css" rel="stylesheet"></link>
<link href="/styles/global.css" rel="stylesheet"></link>
<link href="/styles/users/header.css" rel="stylesheet"></link>
</head>
<body>
<section class='Header'>
<header class='header region'>
<div class='title'>ទំព័រគ្រប់គ្រង</div>
<form action='/users/search' method='post'>
<select name='search-item'>
<option>ការផ្សាយ</option>
<option>ជំពូក</option>
<option>ទំព័រស្តាទិក</option>
<option>អ្នកប្រើប្រាស់</option>
</select>
<input type='text' name='q' required />
<input type='submit' value='ស្វែងរក' />
</form>
<div class='logout'><a href='/' >ទំព៏រដើម</a> | <a href='/users/logout'>ចេញក្រៅ</a></div>
</header>
</section>
.Header{
background: var(--background-dark);
}
.Header .header{
display: grid;
grid-template-columns: 25% auto 20%;
align-items: center;
}
.Header .header .title{
padding: 7px 0;
font: 30px/1.5 Limonf3, Oswald;
}
.Header .header form{
display: grid;
grid-template-columns: 20% auto 15%;
}
.Header .header form input,
.Header .header form select{
padding: 2px 10px;
}
.Header .header form input[type=submit],
.Header .header form select{
font: var(--body-font);
}
.Header .header .logout{
text-align: right;
font-size: 16px;
}
var express = require('express')
var router = express.Router()
router.get('/', async function(req, res, next) {
const settings = require('../settings')
settings.message = ''
if(req.session.user){
res.render('users/index', settings)
}else{
res.render('login', settings)
}
})
router.post('/', async function(req, res, next){
const settings = require('../settings')
const checkUser = require('../controllers/users/checkUser')
const result = await checkUser(req)
settings.message = result.message
if(result.success){
res.render('users/index', settings)
}else{
res.render('login', settings)
}
})
router.get('/logout', async function(req, res, next) {
req.session.destroy(function(err) {
console.log('Session was destroyed')
})
res.redirect('/')
})
module.exports = router
GitHub: https://github.com/Sokhavuth/tv
Vercel: https://tv-neon.vercel.app
Responsive: http://www.responsinator.com