<?php

require_once 'require/functions.php';
session_start();
$login_save = "";
$password_save = "";
$errors = array();
// errors table
$data = array('login' => '', 'password' => '');
// Verification of the existence of user and password
if (!empty($_POST) && isset($_POST["login"]) && !empty($_POST["login"])) {
    $_SESSION['login'] = $_POST['login'];
    $password = $_POST['password'];
    $data = sanetize_register($_POST);
    $errors = check_register($data);
    if (empty($errors)) {
        $prepare = $pdo->prepare('INSERT INTO password (login, password) VALUES (:login, :password)');
        // request preparation
        $prepare->bindValue(':login', $_SESSION["login"]);
        $prepare->bindValue(':password', hash('sha256', $password . SALT));
        $exec = $prepare->execute();
        // request execution
        if ($exec) {
            // if exec positive
            header("Location:chat.php");
        }
    } else {
        $login_save = $_POST['login'];
        $password_save = $_POST['password'];
    }
}
<?php

error_reporting(0);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    require_once 'RegisterFunctions.inc.php';
    require_once 'Connection.php';
    list($check, $data) = check_register($dbc, $_POST['Username'], $_POST['Email'], $_POST['Password'], $_POST['Password2']);
    if ($check) {
        setcookie('Username', $data['Username'], time() + 60 * 60 * 24 * 90, '/', '', 0, 0);
        header('Location: Login.php');
    } else {
        $errors = $data;
    }
}
include 'RegisterPage.inc.php';
Beispiel #3
0
function check_data($host, $author, $subject, $body, $email)
{
    global $lNoAuthor, $lNoSubject, $lNoBody, $lNoEmail, $lRegisteredName;
    global $Password, $ModPass, $email_reply;
    $IsError = '';
    if (!check_host($host)) {
        violation();
    }
    $author = @trim($author);
    if (empty($author)) {
        $IsError = $lNoAuthor;
    } elseif (!check_name($author)) {
        violation();
    } elseif (!check_register($author)) {
        $IsError = $lRegisteredName;
    }
    if (trim($subject) == "") {
        $IsError = $lNoSubject;
    }
    if (trim($body) == "") {
        $IsError = $lNoBody;
    }
    if (!empty($email)) {
        if (!eregi(".+@.+\\..+", $email) && $email != $Password && $email != $ModPass) {
            if ($email_reply) {
                $IsError = $lNoEmail;
            }
        } else {
            if (!check_email($email)) {
                violation();
            }
        }
    } elseif ($email_reply) {
        $IsError = $lNoEmail;
    }
    return $IsError;
}
Beispiel #4
0
 public function home($page = "")
 {
     if (!session()) {
         redirect("index.php/users/login");
     }
     if (!isset($_SESSION)) {
         return;
     }
     if (!file_exists(APPPATH . '/views/users/' . $_SESSION['user_type'] . '_home.php')) {
         // Whoops, we don't have a page for that!
         show_404();
     }
     $data = array();
     if ($_POST) {
         $data = escapedata($_POST);
         $check_result = check_register($data, true);
         if (!$check_result["passed"]) {
             $data = $_POST;
             $data['format_error'] = $check_result["error"];
         } else {
             if ($this->account->registerAdminAccount($data)) {
                 redirect("index.php/users/home");
             } else {
                 $data['db_error'] = true;
             }
         }
     }
     if ($_SESSION['user_type'] == 'admin') {
         $data["pending_forms"] = $this->form->getPendingForms();
     }
     $data['title'] = "Home - " . $_SESSION['user_type'];
     $this->load->view('users/' . $_SESSION['user_type'] . '_home', $data);
 }
<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    require_once 'CreatePublisherFunctions.inc.php';
    require_once 'Connection.php';
    list($check, $data) = check_register($dbc, $_POST['Publisher']);
    if ($check) {
        header('Location: index.php');
    } else {
        $errors = $data;
    }
}
include 'CreatePublisherPage.inc.php';