Пример #1
0
 function test()
 {
     $this->load->helper('Common');
     $pwd = $this->input->get_post('pwd');
     $encrypt_pwd = my_crypt($pwd);
     log_message('info', 'The purpose of some variable is to provide some value.');
 }
Пример #2
0
function connect_admin($bdd2, $login, $password)
{
    $login = protect_sql($login, "none");
    $password = protect_sql($password, "none");
    $password = my_crypt($password, $login);
    $sql = "SELECT * FROM `administrators` WHERE login = '******'";
    if ($data = $bdd2->query_select($sql)) {
        if ($data[0]['password'] == $password) {
            $sql_2 = "SELECT * FROM `administrators_ranks` WHERE id_rank = " . $data[0]['id_ranks'] . "";
            if ($data_2 = $bdd2->query_select($sql_2)) {
                $data[0]['rank'] = $data_2[0]['name'];
                return $data[0];
            } else {
                return 0;
            }
        } else {
            return 0;
        }
    } else {
        return 0;
    }
}
Пример #3
0
function connect_user($bdd2, $login, $password)
{
    $login = protect_sql($login, "none");
    $password = protect_sql($password, "none");
    $password = my_crypt($password, $login);
    $sql = "SELECT id_player, login, email, nbr_points FROM `players` WHERE login = '******'";
    if ($data = $bdd2->query_select($sql)) {
        if (strcmp($data[0]['password'], $password)) {
            $sql_2 = "SELECT * FROM `players_grades` WHERE " . $data[0]['nbr_points'] . " BETWEEN min_points AND max_points";
            if ($data_2 = $bdd2->query_select($sql_2)) {
                $data[0]['grade'] = $data_2[0]['name'];
                return $data[0];
            } else {
                return 0;
            }
        } else {
            return 0;
        }
    } else {
        return 0;
    }
}
Пример #4
0
include "./functions.php";
session_start();
if ($_POST["mail"]) {
    if (preg_match("/.+\\@.+\\..+/", $_POST["lname"])) {
        $_SESSION["alert"] = "Wrong mail";
        header("Location: ./index.php");
        die;
    }
    $_SESSION["mail"] = $_POST["mail"];
    if (preg_match("/.*[\\.\\/\"\\'\\!\\?\\>\\<\\=\\*\$\\%\\|\\&\\(\\)\\]\\[\\}\\{\\~\\`\\_\\*\\#\\+\\=].*/", $_POST["pass"])) {
        $_SESSION["alert"] = "Wrong pass";
        header("Location: ./index.php");
        die;
    }
    if (strlen($_POST["pass"]) < 5) {
        $_SESSION["alert"] = "Passwd len";
        header("Location: ./index.php");
        die;
    }
    if (index_sql($_POST["mail"], my_crypt($_POST["pass"], $_POST["mail"]))) {
        header("Location: ./index.php");
        die;
    }
    unset($_SESSION["gender"], $_SESSION["mail"], $_SESSION["lname"], $_SESSION["fname"]);
    $_SESSION["alert"] = "SQL error";
    header("Location: ./index.php");
    die;
}
$_SESSION["alert"] = "No mail";
header("Location: ./index.php");
die;
Пример #5
0
         header("Location: ../index.php?pg=sign_in");
         die;
     }
     $_SESSION["mail"] = $_POST["mail"];
     if ($_POST["pass"] === $_POST["cpass"]) {
         if (preg_match("/.*[\\.\\/\"\\'\\!\\?\\>\\<\\=\\*\$\\%\\|\\&\\(\\)\\]\\[\\}\\{\\~\\`\\_\\*\\#\\+\\=].*/", $_POST["pass"])) {
             $_SESSION["alert"] = "Wrong pass";
             header("Location: ../index.php?pg=sign_in");
             die;
         }
         if (strlen($_POST["pass"]) < 5) {
             $_SESSION["alert"] = "Passwd len";
             header("Location: ../index.php?pg=sign_in");
             die;
         }
         if (signin_sql($_POST["gender"], $_POST["fname"], $_POST["lname"], $_POST["mail"], my_crypt($_POST["pass"], $_POST["mail"]))) {
             unset($_SESSION["gender"], $_SESSION["mail"], $_SESSION["lname"], $_SESSION["fname"], $_SESSION['alert']);
             header("Location: ../index.php");
             die;
         }
         unset($_SESSION["gender"], $_SESSION["mail"], $_SESSION["lname"], $_SESSION["fname"]);
         $_SESSION["alert"] = "SQL error";
         header("Location: ../index.php?pg=sign_in");
         die;
     }
     $_SESSION["alert"] = "Passwd diff";
     header("Location: ../index.php?pg=sign_in");
     die;
 }
 $_SESSION["alert"] = "No mail";
 header("Location: ../index.php?pg=sign_in");
Пример #6
0
include "../functions.php";
if ($_POST["mail"]) {
    if (preg_match("/.+\\@.+\\..+/", $_POST["lname"])) {
        $_SESSION["alert"] = "Wrong mail";
        header("Location: ../index.php");
        die;
    }
    $_SESSION["mail"] = $_POST["mail"];
    if (preg_match("/.*[\\.\\/\"\\'\\!\\?\\>\\<\\=\\*\$\\%\\|\\&\\(\\)\\]\\[\\}\\{\\~\\`\\_\\*\\#\\+\\=].*/", $_POST["pass"])) {
        $_SESSION["alert"] = "Wrong pass";
        header("Location: ../index.php");
        die;
    }
    if (strlen($_POST["pass"]) < 5) {
        $_SESSION["alert"] = "Passwd len";
        header("Location: ../index.php");
        die;
    }
    if (login_sql($_POST["mail"], my_crypt($_POST["pass"], $_POST["mail"]))) {
        unset($_SESSION["mail"]);
        header("Location: ../index.php");
        die;
    }
    unset($_SESSION["mail"]);
    $_SESSION["alert"] = "SQL error";
    header("Location: ../index.php");
    die;
}
$_SESSION["alert"] = "No mail";
header("Location: ../index.php");
die;
Пример #7
0
<?php

session_start();
require '../../functions.php';
if (isset($_POST['login_admin']) && isset($_POST['password_admin']) && isset($_POST['submit'])) {
    $login = $_POST['login_admin'];
    $passwd = my_crypt($_POST['password_admin'], $_POST['login_admin']);
    if (connect_adm_sql($login, $passwd)) {
        header("Location: ../admin_main.php");
        die;
    } else {
        $_SESSION['alert'] = "Mauvais identifiants.\n";
        header("Location: ../index.php");
        die;
    }
} else {
    $_SESSION['alert'] = "Veuillez entrez un nom d'utilisateur et un mot de passe\n";
    header("Location: ../index.php");
    die;
}