12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php namespace App\Controllers;
- use CodeIgniter\Controller;
- //use \App\Andy\Setupmodel;
- use \App\Models\Setupmodel;
- class Setup extends BaseController
- {
- protected $userName;
- protected $password;
- protected $role;
- protected $myTime;
- public function __construct()
- {
- parent::__construct();
- $this->myTime = parent::getTime();
- $this->myDate= date("d/m/Y",$this->myTime);
-
- }
- public function setUpForm()
- {
-
- $data =[
- 'title'=>'admin set up',
- 'date'=>$this->myDate
- ];
-
- //echo view('header',$data);
- echo view('setUpAdmin',$data);
- //echo view('footer',$data);
- }
- public function process()
-
- {
- $this->userName= $this->request->getVar('name');
-
- $pass= $this->request->getVar('password');
- $this->password = password_hash($pass,PASSWORD_DEFAULT);
- $this->role= $this->request->getVar('list');
-
-
-
-
-
- $handle= new Setupmodel();
- $handle->adminUser($this->userName,$this->password,$this->role);
- echo "done";
-
- /* please note the way its set up you can only have one admin user because db select gets first entry,si wont see anything else */
-
- }
-
- }
|