<?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 error handling
$processlogin = new ServerLoginData();
$action = '';
$datum = '';
$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 == 'doadd'
&& (ctype_alnum($account))
&& $acclength == '13') {
// set variable for specific submission action and class instance
$storedata = new ServerActiveRecord($id = 0,$delid = 0,$user,$pw,
$account,$ipaddress);
$storedata->prepareData();
$storedata->store();
} else {
echo $processlogin->get_error();
}
?>