if ($first_name === "") { $msgFirst_name = 'please fill in your first name'; $allOk = false; } // check last name if ($last_name === "") { $msgLast_name = 'please fill in your last name'; $allOk = false; } // check username if ($username === "") { $msgUsername = '******'; $allOk = false; } else { // User already exists if (User::existsUser($username) !== false) { $msgUsername = '******'; $allOk = false; } } // check mail if ($mail === "") { $msgMail = 'please fill in your mail address'; $allOk = false; } else { // check if is right format if (!SpoonFilter::isEmail($mail)) { $msgMail = 'please fill in a correct mail address'; $allOk = false; } }
ini_set("include_path", ".:../../library/"); // required classes require_once 'spoon/spoon.php'; require_once 'publicApp/publicApp.php'; $tpl = new SpoonTemplate(); $tpl->setForceCompile(true); $tpl->setCompileDirectory('./compiled_templates'); $tpl->assign('formaction', $_SERVER['PHP_SELF']); SpoonSession::start(); //Content layout if (SpoonSession::get('id') !== false) { SpoonHTTP::redirect('dashboard.php'); } $msgFault = ''; $username = SpoonFilter::getPostValue('username', null, ''); $password = SpoonFilter::getPostValue('password', null, ''); if (SpoonFilter::getPostValue('btnSignin', null, '') !== "") { $check = User::existsUser($username); if ($check !== false && $check->password === md5($password)) { SpoonSession::set('id', $check->user_id); SpoonHTTP::redirect('dashboard.php'); } else { $msgFault = 'Wrong combination'; } } $tpl->assign('username', $username); $tpl->assign('password', $password); $tpl->assign('msgFault', $msgFault); // show the output $tpl->assign('content', $tpl->getContent('templates/index.tpl')); $tpl->display('templates/template.tpl');
error_log($e); } } // facebook javascript $tpl->assign('appid', $facebook->getAppId()); $tpl->assign('session', json_encode($session)); // reeds ingelogd if (SpoonSession::exists('public_uid')) { SpoonHTTP::redirect('dashboard.php'); } // inloggen // momenteel enkel via username, moet ook via email kunnen!!! $email = SpoonFilter::getPostValue('email', null, null); $password = SpoonFilter::getPostValue('password', null, null); if ($email && $password) { $check = User::existsUser($email); if ($check && $check->password === md5($password)) { spoonSession::start(); SpoonSession::set('public_uid', $check->user_id); SpoonHTTP::redirect('dashboard.php'); } } /* * End the login magic * @joenmaes */ // show the output $tpl->assign('content', $tpl->getContent('templates/login.tpl')); $tpl->display('templates/layout.tpl'); ?>