Пример #1
0
 public function insertUser()
 {
     $a = user_class::checkAvalibility(mysql_real_escape_string($this->username));
     if ($a == 0) {
         return "Username id alredy exsist";
     } else {
         $con = getConnection::connectToDatabase();
         getConnection::selectDatabase($con);
         try {
             $this->password = sha1($this->password);
             $this->mysqlfor();
             $sql = "INSERT INTO `user` (`username`, `password`, `role_id`) VALUES ('{$this->username}', '{$this->password}', '{$this->role_id}');";
             if (!mysqli_query($con, $sql)) {
                 throw new Exception("Cannot Insert Data");
             } else {
                 return 1;
             }
         } catch (Exception $e) {
             return 'Message: ' . $e->getMessage();
         }
         getConnection::closeConnection($con);
     }
 }
Пример #2
0
<?php

if (!isset($_SERVER['HTTP_REFERER'])) {
    header("location: ../../access_denied.php?data=You don't have direct access to this page");
}
if (isset($_GET['uname']) && $_GET['uname'] != "") {
    require_once '../../db/user_class.php';
    $r = user_class::checkAvalibility($_GET['uname']);
    echo $r;
} else {
    die("Enter Username First.");
}
Пример #3
0
<?php

if (!isset($_SERVER['HTTP_REFERER'])) {
    header("location: ../../access_denied.php?data=You don't have direct access to this page");
}
require_once '../../db/user_class.php';
require_once '../../db/site_log_class.php';
require_once '../../db/user_class.php';
session_start();
define('INCLUDE_CHECK', true);
if (isset($_POST['userName'])) {
    $username = $_POST['userName'];
} else {
    die("Enter User Name");
}
$r = user_class::checkAvalibility($username);
if ($r == "0") {
    die("User-name is not available");
}
if (isset($_POST['password'])) {
    $password = $_POST['password'];
} else {
    die("Enter Password");
}
if (isset($_POST['confirmPassword'])) {
    $cpassword = $_POST['confirmPassword'];
} else {
    die("Enter Confirm Password");
}
if ($password != $cpassword) {
    die("Password mis-match");