<?php
// check if classes are valid
$strKlasse = '';
function __autoload($strKlasse)
{ try { if(!preg_match('=^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$=m',$strKlasse))
{ throw new Exception("Class '$strKlasse' is not valid."); }
$strIncludeFile = 'classes/'.$strKlasse. '.class.php';
if (!file_exists($strIncludeFile))
{ throw new Exception("Include file <i>$strIncludeFile</i> not found.<br>"); }
require_once($strIncludeFile);
if(!class_exists($strKlasse))
{ throw new Exception("Include file <i>$strIncludeFile</i>
contains no class '$strKlasse'.<br>"); }
return true; }
catch(Exception $e)
{ die($e->getMessage()); }
}
// set class instance for login and error handling
$processlogin = new ServerLoginData();
$action = '';
$user = '';
$pw = '';
$account = '';
$ipaddress = '';
$action = $_POST['action'];
$user = $_POST['user'];
$pw = $_POST['pw'];
$account = $_POST['account'];
$acclength = strlen($account);
$ipaddress = $_POST['ipaddress'];
// determine action based on POST
if(isset($action)
&& $action == 'dologin'
&& (ctype_alnum($account))
&& $acclength == '13') {
// valid user login data
echo $processlogin->validUserLogin($user,$pw,$account,$ipaddress);
} else {
echo $processlogin->get_error();
}
?>