function process($parameters)
 {
     $registration = new Registration();
     if (!$registration->checkIfAdmin($_SESSION['id_user'])) {
         $this->redirect('error');
     }
     //catch registration (button is pressed)
     if (isset($_POST['sent'])) {
         $data = $registration->sanitize(["email" => $_POST['email'], "tariff" => $_POST['tariff'], "firstname" => $_POST['firstname'], "surname" => $_POST['surname'], "telephone" => $_POST['telephone'], 'address' => $_POST['address'], "startDate" => $_POST['startDate'], "ic" => $_POST['ic'], "p" => $registration->getRandomHash()]);
         $this->data = $data;
         //for autofilling from previous page
         $result = $registration->validateData($data);
         if ($result['s'] == 'success') {
             $fakturoid = new FakturoidWrapper();
             $newCustomer = $fakturoid->createCustomer($data);
             if ($newCustomer == false) {
                 $result = ['s' => 'error', 'cs' => 'Bohužel se nepovedlo uložit data do Faktuoidu; zkus to prosím za pár minut', 'en' => 'Sorry, we didn\'n safe your data into Fakturoid; try it again after a couple of minutes please'];
             } else {
                 //add fakturoid_id into data structure
                 $data['fakturoid_id'] = $newCustomer->id;
                 $result = $registration->registerUser($data, $this->language);
             }
         }
         //change success message for admin
         if ($result['s'] == 'success') {
             $result = ['s' => 'success', 'cs' => 'Nový uživatel je úspěšně zaregistrován', 'en' => 'New member is successfully registred'];
         }
         $this->messages[] = $result;
     }
     $this->header['title'] = ['cs' => 'Registrace nového uživatele', 'en' => 'Registration of new user'];
     $this->data['tariffs'] = $registration->returnTariffsData($this->language);
     $this->view = 'forceRegistration';
 }
 function process($parameters)
 {
     $registration = new Registration();
     if ($registration->checkLogin()) {
         $this->redirect('error');
     }
     //catch registration (button is pressed)
     if (isset($_POST['sent'])) {
         $data = $registration->sanitize(['email' => $_POST['email'], 'tariff' => $_POST['tariff'], 'firstname' => $_POST['firstname'], 'surname' => $_POST['surname'], 'telephone' => $_POST['telephone'], 'address' => $_POST['address'], 'startDate' => $_POST['startDate'], 'ic' => $_POST['ic'], 'p' => $_POST['p']]);
         $this->data = $data;
         //for autofilling from previous page
         $result = $registration->validateData($data);
         if ($result['s'] == 'success') {
             $fakturoid = new FakturoidWrapper();
             $newCustomer = $fakturoid->createCustomer($data);
             if ($newCustomer == false) {
                 $result = ['s' => 'error', 'cs' => 'Bohužel se nepovedlo uložit data do Faktuoidu; zkus to prosím za pár minut', 'en' => 'Sorry, we didn\'n safe your data into Fakturoid; try it again after a couple of minutes please'];
             } else {
                 //add fakturoid_id into data structure
                 $data['fakturoid_id'] = $newCustomer->id;
                 $result = $registration->registerUser($data, $this->language);
             }
         }
         $this->messages[] = $result;
         //if register success, show registration form no more
         if ($result['s'] == 'success') {
             $this->redirect('');
         }
     }
     $this->header['title'] = ['cs' => 'Registrace nového uživatele', 'en' => 'New user registration'];
     $this->data['tariffs'] = $registration->returnTariffsData($this->language);
     $this->view = 'registration';
 }
 function process($parameters)
 {
     $registration = new Registration();
     if ($registration->checkLogin()) {
         $this->redirect('error');
     }
     //catch registration (button is pressed)
     if (isset($_POST['sent'])) {
         $data = $registration->sanitize(['email' => $_POST['email'], 'tariff' => $_POST['tariff'], 'firstname' => $_POST['firstname'], 'surname' => $_POST['surname'], 'telephone' => $_POST['telephone'], 'address' => $_POST['address'], 'startDate' => $_POST['startDate'], 'ic' => $_POST['ic'], 'p' => $_POST['p']]);
         $this->data = $data;
         //for autofilling from previous page
         $result = $registration->validateData($data);
         if ($result['s'] == 'success') {
             $result = $registration->registerUser($data, $this->language);
         }
         $this->messages[] = $result;
         //if register success, show registration form no more
         if ($result['s'] == 'success') {
             $this->redirect('');
         }
     }
     $this->header['title'] = ['cs' => 'Registrace nového uživatele', 'en' => 'Registration of new user'];
     $this->data['tariffs'] = $registration->returnTariffsData($this->language);
     $this->view = 'registration';
 }
 function process($parameters)
 {
     $registration = new Registration();
     if (!$registration->checkIfAdmin($_SESSION['id_user'])) {
         $this->redirect('error');
     }
     //catch registration (button is pressed)
     if (isset($_POST['sent'])) {
         $data = $registration->sanitize(["email" => $_POST['email'], "tariff" => $_POST['tariff'], "firstname" => $_POST['firstname'], "surname" => $_POST['surname'], "telephone" => $_POST['telephone'], "startDate" => $_POST['startDate'], "ic" => $_POST['ic'], "p" => $registration->getRandomHash()]);
         $this->data = $data;
         //for autofilling from previous page
         $result = $registration->validateData($data);
         if ($result['s'] == 'success') {
             $result = $registration->registerUser($data, $this->language);
         }
         $this->messages[] = $result;
     }
     $this->header['title'] = ['cs' => 'Registrace nového uživatele', 'en' => 'Registration of new user'];
     $this->data['tariffs'] = $registration->returnTariffsData($this->language);
     $this->view = 'forceRegistration';
 }
Example #5
0
    if (isset($_POST["password"])) {
        $password = $_POST["password"];
    }
    if (isset($_POST["password2"])) {
        $password2 = $_POST["password2"];
    }
    if (isset($_POST["email"])) {
        $email = $_POST["email"];
    }
    if (!$password || !$password2) {
        $error = "Missing password, please retry";
        $app->render("register.html", array("error" => $error));
    } elseif (!$email) {
        $error = "Missing email, please retry";
        $app->render("register.html", array("error" => $error));
    } elseif ($password != $password2) {
        $error = "Passwords don't match, please retry";
        $app->render("register.html", array("error" => $error));
    } elseif (!$username) {
        $error = "Missing username, please retry";
        $app->render("register.html", array("error" => $error));
    } elseif ($username && $email && $password == $password2) {
        // Lets check if the user isn't already registered
        if (Registration::checkRegistration($username, $email) == NULL) {
            $message = Registration::registerUser($username, $password, $email);
            $app->render("register.html", array("type" => $message["type"], "message" => $message["message"]));
        }
    }
} else {
    $app->render("register.html");
}
Example #6
0
if (isset($_GET["register"])) {
    //create the registration object
    $reg = new Registration("db545467511.db.1and1.com", "dbo545467511", "Rage2167_robert", "db545467511");
    //set the username
    $reg->setUser($_POST["username"]);
    //set password
    $reg->setPass($_POST["password"]);
    //set repeat password
    $reg->setRepeatPass($_POST["rPassword"]);
    //check the username
    if ($reg->checkUser() == false) {
        //the username is okay! check that the passwords match
        if ($reg->checkPassword()) {
            //the passwords match continue
            //check to see if the user was successfully registered
            if ($reg->registerUser()) {
                echo "You are registered!!!";
            } else {
                echo "Nope! something went wrong....... ";
            }
        } else {
            echo "You must be drunk, the passwords don't match!";
        }
    } else {
        echo "that user name is already in use!";
    }
} else {
    ?>
        <form action="reg.php?register" method="post">
            Username: <input type="text" name="username"><br/>
            Password: <input type="password" name="password"><br/>