mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-06 23:39:06 +00:00
createticket template done + when registering: create ticket_user + when login make session object ticket_user
This commit is contained in:
parent
a9fca71b8d
commit
948794bff6
9 changed files with 25 additions and 14 deletions
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Ams_Tickets;
|
|
||||||
|
|
||||||
class Ticket{
|
class Ticket{
|
||||||
private $tId;
|
private $tId;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Ams_Tickets;
|
|
||||||
|
|
||||||
class Ticket_Category{
|
class Ticket_Category{
|
||||||
|
|
||||||
|
@ -34,9 +33,8 @@ class Ticket_Category{
|
||||||
$dbl = new DBLayer($this->db);
|
$dbl = new DBLayer($this->db);
|
||||||
$statement = $dbl->execute("SELECT * FROM ticket_category WHERE TCategoryId=:id", array('id' => $id));
|
$statement = $dbl->execute("SELECT * FROM ticket_category WHERE TCategoryId=:id", array('id' => $id));
|
||||||
$row = $statement->fetch();
|
$row = $statement->fetch();
|
||||||
$instance->tCategoryId = $row['TCategoryId'];
|
$this->tCategoryId = $row['TCategoryId'];
|
||||||
$instance->name = $row['Name'];
|
$this->name = $row['Name'];
|
||||||
return $instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//update private data to DB.
|
//update private data to DB.
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Ams_Tickets;
|
|
||||||
|
|
||||||
class Ticket_User{
|
class Ticket_User{
|
||||||
|
|
||||||
private $tUserId;
|
private $tUserId;
|
||||||
|
@ -46,7 +44,7 @@ class Ticket_User{
|
||||||
//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);
|
||||||
$dbl = new DBLayer($this->db);
|
$dbl = new DBLayer($instance->db);
|
||||||
$statement = $dbl->execute("SELECT * FROM ticket_user WHERE ExternId=:id", array('id' => $id));
|
$statement = $dbl->execute("SELECT * FROM ticket_user WHERE ExternId=:id", array('id' => $id));
|
||||||
$row = $statement->fetch();
|
$row = $statement->fetch();
|
||||||
$instance->tUserId = $row['TUserId'];
|
$instance->tUserId = $row['TUserId'];
|
||||||
|
|
|
@ -20,6 +20,9 @@ name = "Name"
|
||||||
email = "Email"
|
email = "Email"
|
||||||
action = "Action"
|
action = "Action"
|
||||||
|
|
||||||
|
|
||||||
|
[createticket]
|
||||||
|
|
||||||
[error]
|
[error]
|
||||||
title404 = "Not<br/>Found!"
|
title404 = "Not<br/>Found!"
|
||||||
title403 = "Forbidden!"
|
title403 = "Forbidden!"
|
||||||
|
|
|
@ -20,6 +20,9 @@ name = "Nom"
|
||||||
email = "Email"
|
email = "Email"
|
||||||
action = "Action"
|
action = "Action"
|
||||||
|
|
||||||
|
[createticket]
|
||||||
|
|
||||||
|
|
||||||
[error]
|
[error]
|
||||||
title404 = "Pas<br/>trouvez!"
|
title404 = "Pas<br/>trouvez!"
|
||||||
title403 = "Interdit!"
|
title403 = "Interdit!"
|
||||||
|
|
|
@ -50,6 +50,14 @@ class WebUsers extends Users{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getId($username){
|
||||||
|
global $cfg;
|
||||||
|
|
||||||
|
$dbw = new DBLayer($cfg['db']['web']);
|
||||||
|
$statement = $dbw->execute("SELECT * FROM ams_user WHERE Login=:username", array('username' => $username));
|
||||||
|
$row = $statement->fetch();
|
||||||
|
return $row['UId'];
|
||||||
|
}
|
||||||
|
|
||||||
public function getUsername($id){
|
public function getUsername($id){
|
||||||
global $cfg;
|
global $cfg;
|
||||||
|
|
|
@ -50,11 +50,13 @@ function write_user($newUser){
|
||||||
//returns: ok, shardoffline or liboffline
|
//returns: ok, shardoffline or liboffline
|
||||||
$result = WebUsers::createUser($params);
|
$result = WebUsers::createUser($params);
|
||||||
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
//make connection with web db and put it in there
|
|
||||||
global $cfg;
|
global $cfg;
|
||||||
|
//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);
|
$dbw->execute("INSERT INTO ams_user (Login, Password, Email) VALUES (:name, :pass, :mail)",$params);
|
||||||
|
ticket_user::createTicketUser( WebUsers::getId($newUser["name"]), 1, $cfg['db']['lib'] );
|
||||||
|
|
||||||
}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
|
||||||
|
|
|
@ -11,8 +11,8 @@ function login(){
|
||||||
$_SESSION['user'] = $_POST["Username"];
|
$_SESSION['user'] = $_POST["Username"];
|
||||||
$_SESSION['permission'] = $result['Permission'];
|
$_SESSION['permission'] = $result['Permission'];
|
||||||
$_SESSION['id'] = $result['UId'];
|
$_SESSION['id'] = $result['UId'];
|
||||||
print('id=');
|
$_SESSION['ticket_user'] = Ticket_User::constr_ExternId($result['UId'],$cfg['db']['lib']);
|
||||||
print($_SESSION['id']);
|
|
||||||
//go back to the index page.
|
//go back to the index page.
|
||||||
header( 'Location: index.php' );
|
header( 'Location: index.php' );
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -24,7 +24,7 @@ function settings(){
|
||||||
|
|
||||||
//Sanitize Data
|
//Sanitize Data
|
||||||
$result['current_mail'] = filter_var($result['current_mail'], FILTER_SANITIZE_EMAIL);
|
$result['current_mail'] = filter_var($result['current_mail'], FILTER_SANITIZE_EMAIL);
|
||||||
$result['Login'] = filter_var($result['Login'], FILTER_SANITIZE_STRING);
|
//$result['Login'] = filter_var($result['Login'], FILTER_SANITIZE_STRING);
|
||||||
$result['FirstName'] = filter_var($result['FirstName'], FILTER_SANITIZE_STRING);
|
$result['FirstName'] = filter_var($result['FirstName'], FILTER_SANITIZE_STRING);
|
||||||
$result['LastName'] = filter_var($result['LastName'], FILTER_SANITIZE_STRING);
|
$result['LastName'] = filter_var($result['LastName'], FILTER_SANITIZE_STRING);
|
||||||
$result['Country'] = filter_var($result['Country'], FILTER_SANITIZE_STRING);
|
$result['Country'] = filter_var($result['Country'], FILTER_SANITIZE_STRING);
|
||||||
|
|
Loading…
Reference in a new issue