potential fix for active is required
Build and push / Pulling repo on server (push) Successful in 3s Details

This commit is contained in:
Chris 2023-10-30 22:36:18 +01:00
parent 242cf9583e
commit 604b0fbb74
3 changed files with 13 additions and 11 deletions

View File

@ -95,8 +95,10 @@ class Model {
* @param $value The value to search for
* @param string $field The field to search in. HAS to be marked as unique otherwise will throw error
*/
public function load($value,$field='id')
public function load($value=false,$field='id')
{
if(!$value)
$value = $this->id;
if($field!='id')
{
//sanity check. Check if $field is marked as unique

View File

@ -24,6 +24,7 @@ class User extends Model {
function login()
{
if(!$this->id) return false;
$this->load();
$this->last_login = $this->getDateTime();
$this->save();

View File

@ -14,15 +14,14 @@ class Profile extends Page {
{
$error = false;
$user = $_SESSION['user'];
$user->data['firstname'] = trim($_REQUEST['firstname']);
$user->data['lastname'] = trim($_REQUEST['lastname']);
//$user->data['email'] = $_REQUEST['email'];
$user->data['birthday'] = $_REQUEST['birthday'];
$user->data['club'] = trim($_REQUEST['club']);
//$user->data['timezone'] = $_REQUEST['timezone'];
$_SESSION['user']->data['firstname'] = trim($_REQUEST['firstname']);
$_SESSION['user']->data['lastname'] = trim($_REQUEST['lastname']);
//$_SESSION['user']->data['email'] = $_REQUEST['email'];
$_SESSION['user']->data['birthday'] = $_REQUEST['birthday'];
$_SESSION['user']->data['club'] = trim($_REQUEST['club']);
//$_SESSION['user']->data['timezone'] = $_REQUEST['timezone'];
if(!strtotime($user->data['birthday']))
if(!strtotime($_SESSION['user']->data['birthday']))
$error = 'Das Geburstdatum ist ungültig. Bitte die Eingabe prüfen';
$newphoto = false;
@ -61,9 +60,9 @@ class Profile extends Page {
}
if($newphoto)
$user->data['photo'] = $newphoto;
$_SESSION['user']->data['photo'] = $newphoto;
$user->save();
$_SESSION['user']->save();
$this->redirect('/profile');
}