示例#1
0
 /**
  * Add user to the database.
  * 
  * @param \model\User $user The user to be added to the database
  */
 public function add(User $user)
 {
     $sqli = $this->database->connect();
     $stmt = $sqli->prepare("INSERT INTO `users`(`username`, `password`) VALUES (?, ?)");
     if ($stmt === FALSE) {
         throw new Exception($sqli->error);
     }
     $username = $user->getUsername();
     $password = $user->getPassword();
     $stmt->bind_param('ss', $username, $password);
     $stmt->execute();
 }
示例#2
0
 /**
  * Update user information
  * @param  String $username 	The user that will be updated.
  * @param  String $info     	String in JSON-format to be stored in the database.
  */
 public function updateUser($username, $info)
 {
     $sqli = $this->database->connect();
     $stmt = $sqli->prepare("UPDATE " . $this->table . " SET " . $this->profileinfoCol . "='" . $info . "' WHERE " . $this->usernameCol . "='" . $username . "'");
     if ($stmt === FALSE) {
         throw new Exception($sqli->error);
     }
     $stmt->execute();
 }
示例#3
0
文件: index.php 项目: kennho/cs2102
<?php 
//require_once($_SERVER['DOCUMENT_ROOT'] . "/kenneth/cs2102_admin/model/admin.php");
//require_once($_SERVER['DOCUMENT_ROOT'] . "/kenneth/cs2102_admin/model/database.php");
//require_once($_SERVER['DOCUMENT_ROOT'] . "/kenneth/cs2102_admin/model/job_applicant.php");
//require_once($_SERVER['DOCUMENT_ROOT'] . "/kenneth/cs2102_admin/controller/admin/authentication/index.php");
require_once $_SERVER['DOCUMENT_ROOT'] . "/cs2102/model/admin.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/cs2102/model/database.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/cs2102/model/job_applicant.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/cs2102/controller/admin/authentication/index.php";
use model\Admin;
use model\Database;
use model\JobApplicant;
session_start();
AuthenticationController::authenticate();
$database = new Database();
$connection = $database->get_connection();
$job_applicants = JobApplicant::get_all_job_applicant($connection);
?>

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Management System</title>

		<!-- stylesheets -->
		<link href="../../../stylesheet/reset.css" rel="stylesheet" type="text/css">
		<link href="../../../stylesheet/icon.css" rel="stylesheet" type="text/css">
		<link href="../../../stylesheet/default.css" rel="stylesheet" type="text/css">
		<link href="../../../stylesheet/content.css" rel="stylesheet" type="text/css">
示例#4
0
use model\Location;
use model\Nationality;
use model\Industry;
use model\Position;
use model\Employer;
AuthenticationController::authenticate();
?>

<html>

	<head>
	</head>

	<body>
		<?php 
$database = new Database();
$connection = $database->get_connection();
$admin = Admin::get_admin("*****@*****.**", "dogssocute", $connection);
if (is_null($admin)) {
    echo "invalid email or password";
} else {
    echo $admin->get_email();
    echo "<br />";
    echo $admin->get_password();
    echo "<br />";
}
$locations = Location::get_all_location($connection);
for ($i = 0; $i < sizeof($locations); $i++) {
    echo $locations[$i]->get_name();
    echo "<br />";
}