$task = JRequest::getVar("task", "", "get", "string"); switch ($task) { case "getplans": getPlainsByCourseIDSelectHTML(); break; case "getcoursecost": getCourseCost(); break; case "setpromo": setPromo(); break; case "setrenew": setRenew(); break; case "checkExistingUser": checkExistingUser(); break; case "checkCommissionPlan": checkCommissionPlan(); break; } function checkExistingUser() { $database = JFactory::getDBO(); $username = JRequest::getVar("username", ""); $email = JRequest::getVar("email", ""); $id = JRequest::getVar("id", "0"); if (intval($id) == 0) { // new user $sql = "select count(*) from #__users where `email`='" . addslashes(trim($email)) . "'"; $database->setQuery($sql);
$errorLogin = 2; } } } else { if (isset($_POST['newUserMail']) and isset($_POST['newUserName']) and isset($_POST['newUserPasswd'])) { if (strlen($_POST['newUserMail']) < 5 or strlen($_POST['newUserMail']) > 50) { $errorSubscription = $errorSubscription + 10; } if (strlen($_POST['newUserName']) < 3 or strlen($_POST['newUserName']) > 20) { $errorSubscription = $errorSubscription + 20; } if (strlen($_POST['newUserPasswd']) < 5 or strlen($_POST['newUserPasswd']) > 20 or strlen($_POST['newUserPasswdBis']) < 5 or strlen($_POST['newUserPasswdBis']) > 20) { $errorSubscription = $errorSubscription + 40; } if ($errorSubscription === 0) { $errorSubscription = checkExistingUser($_POST['newUserName'], $_POST['newUserMail']); if ($errorSubscription === 0) { registerUser($_POST['newUserName'], $_POST['newUserMail'], $_POST['newUserPasswd'], $salt); $_SESSION['userName'] = $_POST['newUserName']; setcookie('lastUserName', $_POST['newUserName'], time() + $expire); session_start(); header('Location: tasker.php'); } } } } //--------------------------------------------------------- // End //--------------------------------------------------------- ?>