Exemplo n.º 1
0
 /**
  * Регистрация пользователя 
  * @param string $username <p>Имя пользователя</p>
  * @param string $email <p>E-mail</p>
  * @param string $password <p>Пароль</p>
  * @param string $confirm_password <p>Повторить пароль</p>
  * @return boolean <p>Результат выполнения метода</p>
  */
 public function actionRegister()
 {
     // Переменные для формы
     $email = false;
     $password = false;
     $confirm_password = false;
     $username = false;
     $registration = false;
     // Обработка формы
     if (isset($_POST['submit'])) {
         // Если форма отправлена
         // Получаем данные из формы
         $email = $_POST['email'];
         $password = $_POST['password'];
         $confirm_password = $_POST['confirm_password'];
         $username = $_POST['user_name'];
         $dbh = Db::getConnection();
         $config = new PHPAuth\Config($dbh);
         $auth = new PHPAuth\Auth($dbh, $config, $language = "ru_RU");
         $registration = $auth->register($email, $password, $confirm_password, $username, $role = 'user', $params = array(), $captcha = NULL, $sendmail = TRUE);
     }
     require_once ROOT . '/views/user/register.php';
     return true;
 }
Exemplo n.º 2
0
    $current_line = 0;
    $readFile = fopen("{$UploadDirectory}/{$File_Name}", "r") or die("Unable to open file!");
    while (!feof($readFile)) {
        $current_line += 1;
        $line = fgets($readFile);
        if (trim($line) != '') {
            $line = explode(',', $line);
            $firstname = $line[0];
            $lastname = $line[1];
            $email = $line[2];
            $type = $line[3];
            $password = "******";
            $username = "******";
            //echo $firtname." ".$secondname." ".$email." ".$type."<br>";
            $params = array("firstName" => "{$firstname}", "Lastname" => "{$lastname}", "username" => "{$username}", "type" => "{$type}");
            $result = $auth->register($email, $password, $password, $params);
            if ($result['error']) {
                // if registration not complete
                $output = json_encode(array("typee" => 1, "resultt" => $result['message']));
                echo $output . "<br>";
            } else {
                $uid = $auth->getUID($email);
                $db->query("INSERT INTO recentlesson (user_id,lesson_id) VALUES (:uid, '0')", array("uid" => $uid));
                $output = json_encode(array("typee" => 0, "resultt" => $result['message']));
            }
        }
    }
} catch (Exception $e) {
    echo "Some thing wrong with txt file,Pleace check near line {$current_line}";
}
echo "Registration completed..";
Exemplo n.º 3
-1
<?php

// Data base connetion and Auth class
require "../../models/DB/Db.class.php";
$db = new Db();
$dbh = $db->getPurePodo();
include "../../models/PHPAuth/Config.php";
include "../../models/PHPAuth/Auth.php";
$config = new PHPAuth\Config($dbh);
$auth = new PHPAuth\Auth($dbh, $config);
$firstname = filter_var($_POST["First_Name"], FILTER_SANITIZE_STRING);
$lastname = filter_var($_POST["Last_Name"], FILTER_SANITIZE_STRING);
$username = filter_var($_POST["regUser_Name"], FILTER_SANITIZE_STRING);
$email = filter_var($_POST["E_mail"], FILTER_SANITIZE_STRING);
$password = filter_var($_POST["regPassword"], FILTER_SANITIZE_STRING);
$passwordconform = filter_var($_POST["password_again"], FILTER_SANITIZE_STRING);
$tems = filter_var(isset($_POST["terms"]));
$key = $_POST['g-recaptcha-response'];
$params = array("firstName" => "{$firstname}", "Lastname" => "{$lastname}", "username" => "{$username}", "type" => '1');
$result = $auth->register($email, $password, $passwordconform, $params, $sendmail = true);
if ($result['error']) {
    // if registration not complete
    $output = json_encode(array("typee" => 1, "resultt" => $result['message']));
} else {
    $uid = $auth->getUID($email);
    $db->query("INSERT INTO recentlesson (user_id,lesson_id) VALUES (:uid, '0')", array("uid" => $uid));
    $output = json_encode(array("typee" => 0, "resultt" => $result['message']));
}
//$output = json_encode(array("typee" => 1, "resultt" => "$key--$firstname -- $lastname --  $username --  $email -- $password -- $passwordconform -- $tems "));
die($output);