Fixes for load libraries using php autoload
This commit is contained in:
parent
0b21909a78
commit
47c7003e3b
4 changed files with 82 additions and 9 deletions
|
|
@ -1,10 +1,11 @@
|
|||
<?php
|
||||
|
||||
//use PhangoApp\PhaView\View;
|
||||
//use PhangoApp\WPDO\WPDO;
|
||||
use PhangoApp\WPDO\WPDO;
|
||||
use PhangoApp\PhaRouter\Url;
|
||||
//use PhangoApp\PhaModels\Webmodel;
|
||||
|
||||
include('./modules/admin/libraries/login.php');
|
||||
//include('./modules/admin/libraries/login.php');
|
||||
|
||||
include('modules/admin/libraries/tplcontroller.php');
|
||||
|
||||
|
|
@ -31,7 +32,19 @@ class AppController extends TplController{
|
|||
|
||||
case 'login':
|
||||
|
||||
echo 'login';
|
||||
$this->db->connect();
|
||||
|
||||
$c_user=$this->db->select_count('', []);
|
||||
|
||||
if(!$c_user) {
|
||||
|
||||
header('Location: '.Url::make_url('admin', 'app', ['signup']));
|
||||
|
||||
}
|
||||
|
||||
//print_r($this->db->table);
|
||||
|
||||
|
||||
|
||||
/*$conn=MySQL::get_pdo_connection();
|
||||
|
||||
|
|
@ -47,6 +60,12 @@ class AppController extends TplController{
|
|||
|
||||
echo View::load_view(['login' => 1], 'login');*/
|
||||
|
||||
break;
|
||||
|
||||
case 'signup':
|
||||
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'login_check':
|
||||
|
|
|
|||
38
modules/admin/libraries/tplcontroller.php
Normal file
38
modules/admin/libraries/tplcontroller.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
use PhangoApp\WPDO;
|
||||
use PhaTemplates\Templates;
|
||||
|
||||
class TplController {
|
||||
|
||||
public $tpl;
|
||||
public $db;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
session_start();
|
||||
|
||||
$table=new WPDO\WTable('useradmin', ['username', 'password', 'email']);
|
||||
|
||||
$this->db=new WPDO\WPDO($table);
|
||||
|
||||
$this->tpl=new Templates(['theme/admin/templates', 'modules/admin/templates']);
|
||||
|
||||
}
|
||||
|
||||
public function check_login() {
|
||||
|
||||
if(isset($_SESSION['admin_login'])) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue