Newer
Older
flow-task / server / Kernel / Classes / Auth.php
@root root 20 days ago 755 bytes ---
<?php

namespace Kernel\Classes;

class Auth {
	public function __construct() {

	}

	protected function user_name_is_exists(String $uname) : bool {
		$user = new User();
		$sql = "SELECT COUNT(*) FROM `{$user -> get_tablename()}` WHERE `name`='{$uname}'";
		$result = app() -> db() -> query($sql);
		$d = $result -> fetch_assoc();
		return $d["COUNT(*)"] ? true : false;
	} 

	public function signup(String $uname, String $password): bool {
		$passhash = sha1($password);
		$uname = normalize_input_user_name($uname);

		$user = new User();
		$user -> name = $uname;
		$user -> passhash = $passhash;
		$user -> create_at = get_create_at_timestamp();

		return $user -> create_new();
	}

	public function signin() {

	}

	public function signout() {

	}
}