mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-27 09:36:15 +00:00
updated install, added create_Ticket function as wrapper!
This commit is contained in:
parent
9f623e3225
commit
371e83876c
9 changed files with 192 additions and 107 deletions
|
@ -10,6 +10,33 @@ class Ticket{
|
||||||
private $author;
|
private $author;
|
||||||
private $db;
|
private $db;
|
||||||
|
|
||||||
|
////////////////////////////////////////////Functions////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/*FUNCTION: create_Ticket()
|
||||||
|
* creates a ticket + first initial reply and fills in the content of it!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function create_Ticket( $title, $content, $category, $author, $db_data) {
|
||||||
|
|
||||||
|
$ticket = new Ticket($db_data);
|
||||||
|
$ticket->set($title,0,0,$category,$author);
|
||||||
|
$ticket->create();
|
||||||
|
$ticket_id = $ticket->getTId();
|
||||||
|
|
||||||
|
|
||||||
|
$ticket_content = new Ticket_Content($db_data);
|
||||||
|
$ticket_content->setContent($content);
|
||||||
|
$ticket_content->create();
|
||||||
|
$content_id = $ticket_content->getTContentId();
|
||||||
|
|
||||||
|
|
||||||
|
$ticket_reply = new Ticket_Reply($db_data);
|
||||||
|
$ticket_reply->set($ticket_id, $content_id, $author);
|
||||||
|
$ticket_reply->create();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
||||||
public function __construct($db_data) {
|
public function __construct($db_data) {
|
||||||
$this->db = $db_data;
|
$this->db = $db_data;
|
||||||
}
|
}
|
||||||
|
@ -55,13 +82,65 @@ class Ticket{
|
||||||
$statement = $dbl->execute($query, $values);
|
$statement = $dbl->execute($query, $values);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Getters
|
|
||||||
|
////////////////////////////////////////////Getters////////////////////////////////////////////////////
|
||||||
|
|
||||||
public function getTId(){
|
public function getTId(){
|
||||||
return $this->tId;
|
return $this->tId;
|
||||||
}
|
}
|
||||||
|
|
||||||
//setters
|
public function getTimestamp(){
|
||||||
|
return $this->timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitle(){
|
||||||
|
return $this->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatus(){
|
||||||
|
return $this->status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getQueue(){
|
||||||
|
return $this->queue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTicket_Category(){
|
||||||
|
return $this->ticket_category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAuthor(){
|
||||||
|
return $this->author;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////Setters////////////////////////////////////////////////////
|
||||||
|
|
||||||
public function setTId($id){
|
public function setTId($id){
|
||||||
$this->tId = $id;
|
$this->tId = $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setTimestamp($ts){
|
||||||
|
$this->timestamp = $ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTitle($t){
|
||||||
|
$this->title = $t;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStatus($s){
|
||||||
|
$this->status = $s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setQueue($q){
|
||||||
|
$this->queue = $q;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTicket_Category($tc){
|
||||||
|
$this->ticket_category = $tc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAuthor($a){
|
||||||
|
$this->author = $a;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -5,11 +5,9 @@ class Ticket_Category{
|
||||||
private $tCategoryId;
|
private $tCategoryId;
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
public function __construct($db_data) {
|
////////////////////////////////////////////Functions////////////////////////////////////////////////////
|
||||||
$this->db = $db_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Creates a ticket_Catergory in the DB
|
//Creates a ticket_Catergory in the DB
|
||||||
public static function createTicketCategory( $name ,$db ) {
|
public static function createTicketCategory( $name ,$db ) {
|
||||||
$dbl = new DBLayer($db);
|
$dbl = new DBLayer($db);
|
||||||
|
@ -41,7 +39,13 @@ class Ticket_Category{
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function __construct($db_data) {
|
||||||
|
$this->db = $db_data;
|
||||||
|
}
|
||||||
|
|
||||||
//return constructed element based on TCategoryId
|
//return constructed element based on TCategoryId
|
||||||
public function load_With_TCategoryId( $id) {
|
public function load_With_TCategoryId( $id) {
|
||||||
|
@ -61,7 +65,8 @@ class Ticket_Category{
|
||||||
$statement = $dbl->execute($query, $values);
|
$statement = $dbl->execute($query, $values);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Getters
|
////////////////////////////////////////////Getters////////////////////////////////////////////////////
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
if ($this->name == ""){
|
if ($this->name == ""){
|
||||||
$this->load_With_TCategoryId($this->tCategoryId);
|
$this->load_With_TCategoryId($this->tCategoryId);
|
||||||
|
@ -75,10 +80,15 @@ class Ticket_Category{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//setters
|
////////////////////////////////////////////Setters////////////////////////////////////////////////////
|
||||||
|
|
||||||
public function setName($n){
|
public function setName($n){
|
||||||
$this->name = $n;
|
$this->name = $n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setTCategoryId($id){
|
||||||
|
$this->tCategoryId = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -5,11 +5,23 @@ class Ticket_Content{
|
||||||
private $tContentId;
|
private $tContentId;
|
||||||
private $content;
|
private $content;
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////Functions////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//return constructed element based on TCategoryId
|
||||||
|
public static function constr_TContentId( $id, $db_data) {
|
||||||
|
$instance = new self($db_data);
|
||||||
|
$instance->setTContentId($id);
|
||||||
|
return $instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
||||||
|
|
||||||
public function __construct($db_data) {
|
public function __construct($db_data) {
|
||||||
$this->db = $db_data;
|
$this->db = $db_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Creates a ticket_content entry in the DB
|
//Creates a ticket_content entry in the DB
|
||||||
public function create() {
|
public function create() {
|
||||||
$dbl = new DBLayer($this->db);
|
$dbl = new DBLayer($this->db);
|
||||||
|
@ -18,13 +30,6 @@ class Ticket_Content{
|
||||||
$this->tContentId = $dbl->executeReturnId($query, $values); ;
|
$this->tContentId = $dbl->executeReturnId($query, $values); ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//return constructed element based on TCategoryId
|
|
||||||
public static function constr_TContentId( $id, $db_data) {
|
|
||||||
$instance = new self($db_data);
|
|
||||||
$instance->setTContentId($id);
|
|
||||||
return $instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
//return constructed element based on TContentId
|
//return constructed element based on TContentId
|
||||||
public function load_With_TContentId( $id) {
|
public function load_With_TContentId( $id) {
|
||||||
$dbl = new DBLayer($this->db);
|
$dbl = new DBLayer($this->db);
|
||||||
|
@ -42,7 +47,8 @@ class Ticket_Content{
|
||||||
$statement = $dbl->execute($query, $values);
|
$statement = $dbl->execute($query, $values);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Getters
|
////////////////////////////////////////////Getters////////////////////////////////////////////////////
|
||||||
|
|
||||||
public function getContent(){
|
public function getContent(){
|
||||||
if ($this->content == ""){
|
if ($this->content == ""){
|
||||||
$this->load_With_TContentId($this->tContentId);
|
$this->load_With_TContentId($this->tContentId);
|
||||||
|
@ -56,7 +62,8 @@ class Ticket_Content{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//setters
|
////////////////////////////////////////////Setters////////////////////////////////////////////////////
|
||||||
|
|
||||||
public function setContent($c){
|
public function setContent($c){
|
||||||
$this->content = $c;
|
$this->content = $c;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,16 @@ class Ticket_Reply{
|
||||||
private $timestamp;
|
private $timestamp;
|
||||||
private $db;
|
private $db;
|
||||||
|
|
||||||
//////////////////////////////////Methods/////////////////////////////////
|
////////////////////////////////////////////Functions////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//return constructed element based on TCategoryId
|
||||||
|
public static function constr_TReplyId( $id, $db_data) {
|
||||||
|
$instance = new self($db_data);
|
||||||
|
$instance->setTReplyId($id);
|
||||||
|
return $instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
||||||
|
|
||||||
public function __construct($db_data) {
|
public function __construct($db_data) {
|
||||||
$this->db = $db_data;
|
$this->db = $db_data;
|
||||||
|
@ -29,13 +38,6 @@ class Ticket_Reply{
|
||||||
$values = Array('ticket' => $this->ticket, 'content' => $this->content, 'author' => $this->author);
|
$values = Array('ticket' => $this->ticket, 'content' => $this->content, 'author' => $this->author);
|
||||||
$dbl->execute($query, $values);
|
$dbl->execute($query, $values);
|
||||||
}
|
}
|
||||||
|
|
||||||
//return constructed element based on TCategoryId
|
|
||||||
public static function constr_TReplyId( $id, $db_data) {
|
|
||||||
$instance = new self($db_data);
|
|
||||||
$instance->setTReplyId($id);
|
|
||||||
return $instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
//return constructed element based on TId
|
//return constructed element based on TId
|
||||||
public function load_With_TReplyId( $id) {
|
public function load_With_TReplyId( $id) {
|
||||||
|
@ -57,8 +59,8 @@ class Ticket_Reply{
|
||||||
$statement = $dbl->execute($query, $values);
|
$statement = $dbl->execute($query, $values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////Getters////////////////////////////////////////////////////
|
||||||
//////////////////////////////////Getters/////////////////////////////////
|
|
||||||
public function getTicket(){
|
public function getTicket(){
|
||||||
return $this->ticket;
|
return $this->ticket;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +84,8 @@ class Ticket_Reply{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////setters////////////////////////////////
|
////////////////////////////////////////////Setters////////////////////////////////////////////////////
|
||||||
|
|
||||||
public function setTicket($t){
|
public function setTicket($t){
|
||||||
$this->ticket = $t;
|
$this->ticket = $t;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,8 @@ class Ticket_User{
|
||||||
private $externId;
|
private $externId;
|
||||||
private $db;
|
private $db;
|
||||||
|
|
||||||
public function __construct($db_data) {
|
////////////////////////////////////////////Functions////////////////////////////////////////////////////
|
||||||
$this->db = $db_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Creates a ticket_user in the DB
|
//Creates a ticket_user in the DB
|
||||||
public static function createTicketUser( $extern_id, $permission,$db ) {
|
public static function createTicketUser( $extern_id, $permission,$db ) {
|
||||||
$dbl = new DBLayer($db);
|
$dbl = new DBLayer($db);
|
||||||
|
@ -29,18 +26,6 @@ class Ticket_User{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//return constructed element based on TUserId
|
|
||||||
public function load_With_TUserId( $id) {
|
|
||||||
$dbl = new DBLayer($this->db);
|
|
||||||
$statement = $dbl->execute("SELECT * FROM ticket_user WHERE TUserId=:id", array('id' => $id));
|
|
||||||
$row = $statement->fetch();
|
|
||||||
$instance->tUserId = $row['TUserId'];
|
|
||||||
$instance->permission = $row['Permission'];
|
|
||||||
$instance->externId = $row['ExternId'];
|
|
||||||
return $instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//return constructed element based on ExternId
|
//return constructed element based on ExternId
|
||||||
public static function constr_ExternId( $id, $db_data ) {
|
public static function constr_ExternId( $id, $db_data ) {
|
||||||
$instance = new self($db_data);
|
$instance = new self($db_data);
|
||||||
|
@ -55,6 +40,22 @@ class Ticket_User{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
||||||
|
public function __construct($db_data) {
|
||||||
|
$this->db = $db_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
//return constructed element based on TUserId
|
||||||
|
public function load_With_TUserId( $id) {
|
||||||
|
$dbl = new DBLayer($this->db);
|
||||||
|
$statement = $dbl->execute("SELECT * FROM ticket_user WHERE TUserId=:id", array('id' => $id));
|
||||||
|
$row = $statement->fetch();
|
||||||
|
$instance->tUserId = $row['TUserId'];
|
||||||
|
$instance->permission = $row['Permission'];
|
||||||
|
$instance->externId = $row['ExternId'];
|
||||||
|
return $instance;
|
||||||
|
}
|
||||||
|
|
||||||
//update private data to DB.
|
//update private data to DB.
|
||||||
public function update(){
|
public function update(){
|
||||||
$dbl = new DBLayer($this->db);
|
$dbl = new DBLayer($this->db);
|
||||||
|
@ -63,7 +64,8 @@ class Ticket_User{
|
||||||
$statement = $dbl->execute($query, $values);
|
$statement = $dbl->execute($query, $values);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Getters
|
////////////////////////////////////////////Getters////////////////////////////////////////////////////
|
||||||
|
|
||||||
public function getPermission(){
|
public function getPermission(){
|
||||||
if ($this->permission == ""){
|
if ($this->permission == ""){
|
||||||
$this->load_With_TUserId($this->tUserId);
|
$this->load_With_TUserId($this->tUserId);
|
||||||
|
@ -85,7 +87,8 @@ class Ticket_User{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//setters
|
////////////////////////////////////////////Setters////////////////////////////////////////////////////
|
||||||
|
|
||||||
public function setPermission($perm){
|
public function setPermission($perm){
|
||||||
$this->permission = $perm;
|
$this->permission = $perm;
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,13 +284,13 @@ class Users{
|
||||||
* @takes $array with name,pass and mail
|
* @takes $array with name,pass and mail
|
||||||
* @return ok if it's get correctly added to the shard, else return lib offline and put in libDB, if libDB is also offline return liboffline.
|
* @return ok if it's get correctly added to the shard, else return lib offline and put in libDB, if libDB is also offline return liboffline.
|
||||||
*/
|
*/
|
||||||
public function createUser($values){
|
public function createUser($values, $user_id){
|
||||||
try {
|
try {
|
||||||
//make connection with and put into shard db
|
//make connection with and put into shard db
|
||||||
global $cfg;
|
global $cfg;
|
||||||
$dbs = new DBLayer($cfg['db']['shard']);
|
$dbs = new DBLayer($cfg['db']['shard']);
|
||||||
$dbs->execute("INSERT INTO user (Login, Password, Email) VALUES (:name, :pass, :mail)",$values);
|
$dbs->execute("INSERT INTO user (Login, Password, Email) VALUES (:name, :pass, :mail)",$values);
|
||||||
ticket_user::createTicketUser( WebUsers::getId($values["name"]), 1, $cfg['db']['lib'] );
|
ticket_user::createTicketUser( $user_id , 1, $cfg['db']['lib'] );
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
catch (PDOException $e) {
|
catch (PDOException $e) {
|
||||||
|
@ -299,7 +299,7 @@ class Users{
|
||||||
$dbl = new DBLayer($cfg['db']['lib']);
|
$dbl = new DBLayer($cfg['db']['lib']);
|
||||||
$dbl->execute("INSERT INTO ams_querycache (type, query) VALUES (:type, :query)",array("type" => "createUser",
|
$dbl->execute("INSERT INTO ams_querycache (type, query) VALUES (:type, :query)",array("type" => "createUser",
|
||||||
"query" => json_encode(array($values["name"],$values["pass"],$values["mail"]))));
|
"query" => json_encode(array($values["name"],$values["pass"],$values["mail"]))));
|
||||||
ticket_user::createTicketUser( WebUsers::getId($values["name"]), 1, $cfg['db']['lib'] );
|
ticket_user::createTicketUser( $user_id , 1, $cfg['db']['lib'] );
|
||||||
return "shardoffline";
|
return "shardoffline";
|
||||||
}catch (PDOException $e) {
|
}catch (PDOException $e) {
|
||||||
print_r($e);
|
print_r($e);
|
||||||
|
|
|
@ -45,18 +45,17 @@ function write_user($newUser){
|
||||||
'pass' => $hashpass,
|
'pass' => $hashpass,
|
||||||
'mail' => $newUser["mail"]
|
'mail' => $newUser["mail"]
|
||||||
);
|
);
|
||||||
|
|
||||||
//Create the user on the shard + in case shard is offline put copy of query in query db
|
|
||||||
//returns: ok, shardoffline or liboffline
|
|
||||||
$result = WebUsers::createUser($params);
|
|
||||||
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
global $cfg;
|
global $cfg;
|
||||||
//make connection with web db and put it in there
|
//make connection with web db and put it in there
|
||||||
$dbw = new DBLayer($cfg['db']['web']);
|
$dbw = new DBLayer($cfg['db']['web']);
|
||||||
$dbw->execute("INSERT INTO ams_user (Login, Password, Email) VALUES (:name, :pass, :mail)",$params);
|
$user_id = $dbw->executeReturnId("INSERT INTO ams_user (Login, Password, Email) VALUES (:name, :pass, :mail)",$params);
|
||||||
//ticket_user::createTicketUser( WebUsers::getId($newUser["name"]), 1, $cfg['db']['lib'] );
|
|
||||||
|
//Create the user on the shard + in case shard is offline put copy of query in query db
|
||||||
|
//returns: ok, shardoffline or liboffline
|
||||||
|
$result = WebUsers::createUser($params, $user_id);
|
||||||
|
|
||||||
|
|
||||||
}catch (PDOException $e) {
|
}catch (PDOException $e) {
|
||||||
//go to error page or something, because can't access website db
|
//go to error page or something, because can't access website db
|
||||||
|
|
|
@ -1,64 +1,48 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function create_ticket(){
|
function create_ticket(){
|
||||||
try{
|
//if logged in
|
||||||
//if logged in
|
if(WebUsers::isLoggedIn() && isset($_SESSION['ticket_user'])){
|
||||||
if(WebUsers::isLoggedIn() && isset($_SESSION['ticket_user'])){
|
|
||||||
|
if(isset($_POST['target_id'])){
|
||||||
|
|
||||||
if(isset($_POST['target_id'])){
|
//if target_id is the same as session id or is admin
|
||||||
|
if( ($_POST['target_id'] == $_SESSION['id']) || WebUsers::isAdmin() ){
|
||||||
|
|
||||||
//if target_id is the same as session id or is admin
|
global $cfg;
|
||||||
if( ($_POST['target_id'] == $_SESSION['id']) || WebUsers::isAdmin() ){
|
$category = filter_var($_POST['Category'], FILTER_SANITIZE_NUMBER_INT);
|
||||||
|
$title = filter_var($_POST['Title'], FILTER_SANITIZE_STRING);
|
||||||
global $cfg;
|
$content = filter_var($_POST['Content'], FILTER_SANITIZE_STRING);
|
||||||
$category = filter_var($_POST['Category'], FILTER_SANITIZE_NUMBER_INT);
|
try{
|
||||||
$title = filter_var($_POST['Title'], FILTER_SANITIZE_STRING);
|
|
||||||
$content = filter_var($_POST['Content'], FILTER_SANITIZE_STRING);
|
|
||||||
if($_POST['target_id'] == $_SESSION['id']){
|
if($_POST['target_id'] == $_SESSION['id']){
|
||||||
$author = $_SESSION['ticket_user']->getTUserId();
|
$author = $_SESSION['ticket_user']->getTUserId();
|
||||||
}else{
|
}else{
|
||||||
$author= Ticket_User::constr_ExternId($_POST['target_id'], $cfg['db']['lib'])->getTUserId();
|
$author= Ticket_User::constr_ExternId($_POST['target_id'], $cfg['db']['lib'])->getTUserId();
|
||||||
}
|
}
|
||||||
|
Ticket::create_Ticket($title, $content, $category, $author, $cfg['db']['lib'] );
|
||||||
$ticket = new Ticket($cfg['db']['lib']);
|
}catch (PDOException $e) {
|
||||||
$ticket->set($title,0,0,$category,$author);
|
//ERROR: LIB DB is not online!
|
||||||
$ticket->create();
|
header("Location: index.php");
|
||||||
$ticket_id = $ticket->getTId();
|
|
||||||
|
|
||||||
|
|
||||||
$ticket_content = new Ticket_Content($cfg['db']['lib']);
|
|
||||||
$ticket_content->setContent($content);
|
|
||||||
$ticket_content->create();
|
|
||||||
$content_id = $ticket_content->getTContentId();
|
|
||||||
|
|
||||||
|
|
||||||
$ticket_reply = new Ticket_Reply($cfg['db']['lib']);
|
|
||||||
$ticket_reply->set($ticket_id, $content_id, $author);
|
|
||||||
$ticket_reply->create();
|
|
||||||
|
|
||||||
}else{
|
|
||||||
//ERROR: permission denied!
|
|
||||||
$_SESSION['error_code'] = "403";
|
|
||||||
header("Location: index.php?page=error");
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
//ERROR: The form was not filled in correclty
|
//ERROR: permission denied!
|
||||||
header("Location: index.php?page=settings");
|
$_SESSION['error_code'] = "403";
|
||||||
exit;
|
header("Location: index.php?page=error");
|
||||||
}
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
//ERROR: user is not logged in
|
//ERROR: The form was not filled in correclty
|
||||||
header("Location: index.php");
|
header("Location: index.php?page=settings");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
}catch (PDOException $e) {
|
//ERROR: user is not logged in
|
||||||
//go to error page or something, because can't access website db
|
header("Location: index.php");
|
||||||
print_r($e);
|
exit;
|
||||||
exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -256,7 +256,7 @@
|
||||||
'pass' => $hashpass,
|
'pass' => $hashpass,
|
||||||
'mail' => "admin@admin.com",
|
'mail' => "admin@admin.com",
|
||||||
);
|
);
|
||||||
Users::createUser($params);
|
Users::createUser($params, 1);
|
||||||
try{
|
try{
|
||||||
$params['permission'] = 2;
|
$params['permission'] = 2;
|
||||||
$dbw = new DBLayer($cfg['db']['web']);
|
$dbw = new DBLayer($cfg['db']['web']);
|
||||||
|
|
Loading…
Reference in a new issue