Пример #1
0
}
// Kolla om vi redirectats fr?n login-sidan
session_start();
if (validUser()) {
    // Jepp det har vi, skicka till n?t kul st?lle
    header("Location: " . $oConfiguration->getCustomValue("GoWhereAfterLogin"));
} else {
    // N? det har vi inte
    session_destroy();
}
if (strlen($_POST['Name']) < $oConfiguration->getCustomValue("NameMin") or strlen($_POST['Name']) > $oConfiguration->getCustomValue("NameMax") or strlen($_POST['RealName']) < $oConfiguration->getCustomValue("RealNameMin") or strlen($_POST['RealName']) > $oConfiguration->getCustomValue("RealNameMax") or strlen($_POST['Email']) < $oConfiguration->getCustomValue("EmailMin") or strlen($_POST['Email']) > $oConfiguration->getCustomValue("EmailMax") or strlen($_POST['Signature']) < $oConfiguration->getCustomValue("SignatureMin") or strlen($_POST['Signature']) > $oConfiguration->getCustomValue("SignatureMax") or $_POST['Age'] and !is_numeric($_POST['Age']) or $_POST['Age'] < $oConfiguration->getCustomValue("AgeMin") or $_POST['Age'] > $oConfiguration->getCustomValue("AgeMax") or strlen($_POST['HomePage']) < $oConfiguration->getCustomValue("HomepageMin") or strlen($_POST['HomePage']) > $oConfiguration->getCustomValue("HomepageMax") or strlen($_POST['Other']) < $oConfiguration->getCustomValue("OtherMin") or strlen($_POST['Other']) > $oConfiguration->getCustomValue("OtherMax")) {
    trigger_error("36", E_USER_ERROR);
}
// Annars, skapa användaren
$oUser = new User(0, $_POST['Name']);
$oUP = new UserPresentation($oUser, TRUE);
if ($sErrorMsg = $oUP->getErrorMsg()) {
    trigger_error("37: " . $sErrorMsg, E_USER_ERROR);
    die;
}
$oUP->setRealName(htmlspecialchars($_POST['RealName']));
$oUP->setEmail(htmlspecialchars($_POST['Email']));
$oUP->setSignature(htmlspecialchars($_POST['Signature']));
$oUP->setAge($_POST['Age']);
$oUP->setHomesite(htmlspecialchars($_POST['HomePage']));
$oUP->setOther(htmlspecialchars($_POST['Other']));
$oUP->setNumberThreads($oConfiguration->getCustomValue("DefaultNumberThreads"));
$oUP->setNumberPostsInThread($oConfiguration->getCustomValue("DefaultNumberPosts"));
if (!$oUP->createPasswordAndSend()) {
    trigger_error("39: " . $oUP->getErrorMsg(), E_USER_ERROR);
}
Пример #2
0
ini_set("include_path", "/home/daft/konferens/");
// Inkludera filer
require "Functions/function_errorHandler.php";
require "Classes/class_User.php";
require "Classes/class_Configuration.php";
require "Classes/class_ExternalStorage.php";
require "Classes/class_UserPresentation.php";
// Definiera felhanterare
// set_error_handler("error_handler");
// Kolla så att vi fått ett giltig user och ett giltigt pass
if (!($_POST['UserName'] and $_POST['Password'])) {
    trigger_error("36", E_USER_ERROR);
}
// Logga in
$oUser = new User(0, $_POST['UserName'], TRUE);
$oUP = new UserPresentation($oUser);
if ($sErrorMsg = $oUP->getErrorMsg()) {
    trigger_error("37: " . $sErrorMsg, E_USER_ERROR);
}
if (!$oUP->logOn($_POST['Password'])) {
    trigger_error("37: " . $oUP->getErrorMsg(), E_USER_ERROR);
}
// Det gick!
session_start();
// Fixa grejer
$_SESSION['oUser'] = $oUP;
$_SESSION['a_iOldThreads'] = array();
$oConfiguration = Configuration::createInstance();
$_SESSION['sIP'] = $_SERVER['REMOTE_ADDR'];
$_SESSION['iValidUntil'] = time() + $oConfiguration->getCustomValue("ValidTime") * 60;
// Redirekta