From: Sam White Date: Sun, 24 Oct 2021 15:32:38 +0000 (+0000) Subject: Add simple login system. X-Git-Url: https://git.dalvak.com/public/?a=commitdiff_plain;h=2980be21864cc183d9b4a3fad0417685265cbf0d;p=ycra.git Add simple login system. --- diff --git a/public_html/includes/database.php b/public_html/includes/database.php index 4aa870f..e3a63d6 100644 --- a/public_html/includes/database.php +++ b/public_html/includes/database.php @@ -56,3 +56,9 @@ function insert_array($table, $fields) { . 'VALUES (' . implode(',', $values) . ')'; return run_sql($sql); } + +function fetch_record($table, $select, $where) { + $sql = "SELECT $select FROM $table WHERE $where"; + $result = run_sql($sql); + return mysqli_fetch_assoc($result); +} diff --git a/public_html/includes/fields.php b/public_html/includes/fields.php index 2419528..fe85168 100644 --- a/public_html/includes/fields.php +++ b/public_html/includes/fields.php @@ -43,6 +43,10 @@ function email_field($values, $name, $label, $attrs=[]) { general_field('email', $values, $name, $label, $attrs); } +function password_field($values, $name, $label, $attrs=[]) { + general_field('password', $values, $name, $label, $attrs); +} + function hidden_field($name, $value) { general_bare_field('hidden', [$name=>$value], $name); } diff --git a/public_html/login.php b/public_html/login.php new file mode 100644 index 0000000..022ddeb --- /dev/null +++ b/public_html/login.php @@ -0,0 +1,58 @@ + + +

Login

+ + + +
'']); + password_field($params, 'password', 'Password', ['required'=>'']);?> + +