function action_registration()
 {
     if (isset($_GET['recieve']) && $_GET['recieve'] == '1') {
         $model = new Model_registration();
         $err = $model->form_is_valid();
         if ($err == null) {
             $this->view->generate('registration_view.php', 'template_view.php');
         } else {
             $data = $err;
             $this->view->generate('registration_view.php', 'template_view.php', $data);
         }
     } else {
         $this->view->generate('registration_view.php', 'template_view.php');
     }
 }
 public function form_is_valid()
 {
     if (!empty($_POST)) {
         $err = array(0, 0, 0, 0, 0, 0);
         if (strlen($_POST['name']) < 4) {
             $err[0] = 1;
         }
         if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
             $err[1] = 1;
         }
         if (strlen($_POST['password']) < 5) {
             $err[2] = 1;
         }
         if ($_POST['password'] != $_POST['password2']) {
             $err[3] = 1;
         }
         $link = mysql_connect('localhost:3306', 'root', 'florian');
         mysql_select_db('disin');
         $email = $_POST['email'];
         $check = mysql_query("SELECT * FROM user WHERE Email='{$email}'");
         $assoc = mysql_fetch_array($check);
         if ($assoc['COUNT(*)'] != 0) {
             $err[4] = 1;
         }
         $q = "SELECT * FROM user WHERE Username = '******'username']}'";
         $tmp = mysql_query($q);
         $assoc = mysql_fetch_array($tmp);
         if ($assoc['COUNT(*)'] != 0) {
             $err[5] = 1;
         }
         if ($err[0] + $err[1] + $err[2] + $err[3] + $err[4] + $err[5] != 0) {
             return $err;
         } else {
             Model_registration::log_in();
             return null;
         }
     }
 }