Wen ich das Script ausführe wird die hp weiß, also iwas ist falsch,
was ich aber gemerkt habe das es an "checkInput" liegt, ich
finden dein Fehler aber nicht und habs schon 1000mal geändert.
PHP Code:
<?php
class registration {
private $login;
private $password;
private $email;
private $rl_name;
private $social_id;
private $question1;
private $answer1;
public function __construct() {
$this->login = mysql_real_escape_string($_POST['login']);
$this->password = mysql_real_escape_string($_POST['password']);
$this->email = mysql_real_escape_string($_POST['email']);
$this->rl_name = mysql_real_escape_string($_POST['rl_name']);
$this->social_id = mysql_real_escape_string($_POST['social_id']);
$this->question1 = mysql_real_escape_string($_POST['question1']);
$this->answer1 = mysql_real_escape_string($_POST['answer1']);
}
public function checkUser() {
$checkId = mysql_num_rows(mysql_query("SELECT login FROM account.account WHERE login = '$this->login'"));
if($checkId == 0) {
return true;
} else {
return false;
}
}
public function ceckInput() {
if(empty($this->login) && strlen($this->login) < 7) {
$error = $error.'Der AccountID muss min. 7 Zeichen lang sein';
}
if(empty($this->password) && strlen($this->password) < 7) {
$error = $error.'Das Passwort muss min. 7 Zeichen lang sein';
}
if(!preg_match("/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/i", $this->email)) {
$error = $error.'Du hast eine inkorrekte Email angegeben';
}
if(empty($this->rl_name)) {
$error = $error.'Du hast deinen Namen nicht angegeben';
}
if(empty($this->social_id) && strlen($this->social_id) == 8) {
$error = $error.'Der Löschcode muss 7 Zeichen lang sein';
}
if(empty($$this->answer1)) {
$error = $error.'Du hast die Sicherheitsfrage nicht beantwortet';
}
if(!$this->checkUser()) {
$error = $error.'Der AccountID existiert bereits';
}
if(strlen($error) > 0) {
return true;
} else {
return false;
}
}
public function insertsql() {
$sqlInsert = mysql_query("INSERT INTO
account.account
(login,password,email,real_name,social_id,question1,answer1)
VALUES
('$this->login',PASSWORD('$this->password'),'$this->email','$this->rl_name','$this->social_id','$this->question1','$this->answer1')");
if($sqlInsert) {
return true;
} else {
return false;
}
}
public function process() {
if($this->ceckInput()) {
if($this->insertsql()) {
echo '<div id="succes">SUCCES: Du hast erfolgreich den Account <i>"'.$this->login.'"</i> erstellt</div>';
} else {
echo '<div id="error">ERROR: FATAL MYSQL ERROR</div> </ br>'.mysql_error();
}
} else {
echo $error.'<br />';
}
}
}
?>