public function login($post) { $email = strip_tags(htmlspecialchars($post['email_input_data'])); $email = filter_var($email, FILTER_SANITIZE_EMAIL); $email = filter_var($email, FILTER_VALIDATE_EMAIL); $password = strip_tags(htmlspecialchars($post['password_input_data'])); $password = filter_var($password, FILTER_SANITIZE_STRING); if (!$email) { $this->app->redirect($this->app->urlFor('admin-login') . '?attempt=1'); } if (Authentication::Authenticate($email, $password, 1000)) { $session = Utilities::getSession(); $action = '/admin/' . $session['username']; $this->app->redirect($action); } else { $this->app->redirect($this->app->urlFor('admin-login') . '?attempt=2'); } }
public function login(array $post) { //var_dump($post); $email = strip_tags(htmlspecialchars($post['email_input_data'])); $email = filter_var($post['email_input_data'], FILTER_SANITIZE_EMAIL); $email = filter_var($email, FILTER_VALIDATE_EMAIL); $password = strip_tags(htmlspecialchars($post['password_input_data'])); $password = filter_var($password, FILTER_SANITIZE_STRING); if (!$email) { $this->app->redirect($this->app->urlFor('login') . '?attempt=1'); } if (Authentication::Authenticate($email, $password, 10)) { $session = Utilities::getSession(); //var_dump($_SESSION['proceso']); if (isset($_SESSION['proceso'])) { $action = '/suscribirme/' . $_SESSION['proceso']['curso']; $this->app->redirect($action); } $this->app->redirect('/' . $session['username']); } else { $this->app->redirect($this->app->urlFor('login') . '?attempt=2'); } }
<?php include 'cd.php'; ini_set('max_execution_time', '3600'); $CurrentUser = Authentication::Authenticate(); if (!$CurrentUser->hasPermission(RIGHT_VIDEO_ADD) && !$CurrentUser->hasPermission(RIGHT_VIDEO_EDIT)) { $e = new Error(RIGHTS_ERR_USERNOTALLOWED); Error::AddError($e); HTMLstuff::RefererRedirect(); } $ModelID = Utils::SafeIntFromQS('model_id'); $SetID = Utils::SafeIntFromQS('set_id'); $Models = Model::GetModels(new ModelSearchParameters(is_null($ModelID) ? FALSE : $ModelID)); $Sets = Set::GetSets(new SetSearchParameters(is_null($SetID) ? FALSE : $SetID)); $Videos = Video::GetVideos(new VideoSearchParameters(FALSE, FALSE, is_null($SetID) ? FALSE : $SetID, FALSE, is_null($ModelID) ? FALSE : $ModelID)); $CacheImages = CacheImage::GetCacheImages(); if ($SetID) { $Set = $Sets[0]; $Models = array($Set->getModel()); } /* @var $Model Model */ for ($i = 0; $i < count($Models); $i++) { $Model = $Models[$i]; $VideoFolder = sprintf('%1$s/%2$s', CANDYPATH, $Model->GetFullName()); if (!file_exists($VideoFolder)) { continue; } /* @var $it RecursiveIteratorIterator */ $it = new RecursiveDirectoryIterator($VideoFolder, FileSystemIterator::SKIP_DOTS | FileSystemIterator::CURRENT_AS_FILEINFO); $itArray = array(); foreach ($it as $file) {
} if (is_null($password)) { $error[] = "Password"; $e_password = true; } if (is_null($email)) { $error[] = "Email"; $e_email = true; } if (count($error) > 0) { $loadfile = "login/login_error.tpl"; } else { $auth->setEmail($email); $auth->setUsername($username); $auth->setPassword($password); if ($auth->Authenticate()) { $loadfile = "login/login_successful.tpl"; $redirect = "/#1"; } else { $loadfile = "login/login_{$auth->getError()}.tpl"; switch ($auth->getError()) { case "email": $e_email = true; break; case "username": $e_username = true; break; case "password": $e_password = true; break; }