ase $ACT_REGISTER :
// req structure
// 001Admin;spierdalaj;

;;;1;1;2;3/510/501/4/510/2/2/7/1/%3B
$npe = explode ( ";", $action_extra );
$nick = $npe [0];
$pass = $npe [1];
$email = urlencode(strtolower($npe [2]));
// var_dump($npe);
// break;
// nick & pass lenghts
if (strlen ( $nick ) < 3 || strlen ( $nick ) > 20) {
// throw error & break;
$ret = array (
$ERR_NAME_TOO_SHORT
);
break;
}
if ( preg_match("/[^-a-z0-9_]/i", $nick) )
{
// throw error & break;
$ret = array (
$ERR_NAME_EXISTS
);
break;
}
if (strlen ( $pass ) < 4) {
// throw error & break;
$ret = array (
$ERR_PASSWORD_TOO_SHORT
);
break;
}
if ( preg_match("/[^-a-z0-9_]/i", $pass) )
{
// throw error & break;
$ret = array (
$ERR_NAME_EXISTS
);
break;
}
$cmail = $npe [2];
if (filter_var($cmail, FILTER_VALIDATE_EMAIL) == FALSE)
{
$ret = array ( $ERR_EMAIL_WRONG );
break;
}
// check db for duplicates
$qry = $db->prepare ( "SELECT user_name, email FROM user_data
WHERE user_name = :name OR email = :email" );
$qry->bindParam ( ':name', $nick );
$qry->bindParam ( 'email', $email );
$qry->execute ();
// var_dump ( $qry->fetchAll ()[0] );
// exit ();
// if duplicates, throw error & break
if ($qry->rowCount () > 0) {
$duplicate = $qry->fetchAll ( PDO::FETCH_ASSOC );
$duplicate = $duplicate [0];
if (filter_var($cmail, FILTER_VALIDATE_EMAIL) == FALSE)//Check Email on Register
{
$ret = array ( $ERR_EMAIL_WRONG );
break;
}
if ($duplicate ['email'] == $email) {
// throw error & break;
$ret = array (
$ERR_EMAIL_EXISTS
);
break;
}
// throw error & break;
$ret = array (
$ERR_NAME_EXISTS
);
break;
}
// character looks
$looks = explode ( "/", $npe [8] );
$looks [1] = substr_replace ( $looks [1], "0", 1, 1 );
$looks [2] = substr_replace ( $looks [2], "0", 1, 1 );
$looks [4] = substr_replace ( $looks [4], "0", 1, 1 );
// var_dump($looks);
// break;
// class
$class = $npe [7];
// race
$race = $npe [5];
// gender
$gender = $npe [6];
// stats
$stats = loadDefaultStats ( $class, $race );
//hash password
$pass = md5($pass);
// Jessis Multi-Acc-fix v2
$ip = $_SERVER['REMOTE_ADDR'];
$ipc = $db->prepare ( "SELECT user_id FROM user_data WHERE last_ip = :ip" );
$ipc->bindParam ( ':ip', $ip );
$ipc->execute ();
if($ipc->rowCount () >= 3)
{
$ret = array (
$ERR_ACCOUNTS_PER_IP
);
break;
}
// End of Fix
// add new user to DB
$qry = $db->prepare ( "INSERT INTO user_data(user_name, password, email, last_ip, face1, face2, face3, face4, face5, face6, face7, face8, face9, face10, reg_date, class, race, gender, attr_str, attr_agi, attr_int, attr_wit, attr_luck)
VALUES(:name,

ass, :email, :lastip, :face1, :face2, :face3, :face4, :face5, :face6, :face7, :face8, :face9, :face10, :reg_date, :class, :race, :gender, :str, :agi, :int, :wit, :luck)" );
$qry->bindParam ( ':name', $nick );
$qry->bindParam ( ':lastip', $ip );
$qry->bindParam ( '

ass', $pass );
$qry->bindParam ( ':email', $email );
for($i = 1; $i < 11; $i ++) {
$qry->bindParam ( ':face' . $i, $looks [$i - 1] );
}
// timestmp
$time = new DateTime ();
$qry->bindParam ( ':reg_date', $time->getTimestamp () );
$qry->bindParam ( ':class', $class );
$qry->bindParam ( ':race', $race );
$qry->bindParam ( ':gender', $gender );
// default stats
$qry->bindParam ( ':str', $stats [0] );
$qry->bindParam ( ':agi', $stats [1] );
$qry->bindParam ( ':int', $stats [2] );
$qry->bindParam ( ':wit', $stats [3] );
$qry->bindParam ( ':luck', $stats [4] );
$qry->execute ();
// get user id
$qry = $db->prepare ( "SELECT user_id FROM user_data WHERE user_name = :name" );
$qry->bindParam ( ":name", $nick );
$qry->execute ();
$res = $qry->fetchAll ();
$a = $res [0] ['user_id'];
$ret = array (
$ACT_REGISTER . $a
);
break;