. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 52.223.31.75 / Your IP : 172.31.6.220 [ Web Server : Apache/2.4.66 () OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux ip-172-31-14-81.eu-central-1.compute.internal 4.14.281-212.502.amzn2.x86_64 #1 SMP Thu May 26 09:52:17 UTC 2022 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE Domains : 4 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/ripara.co/lib/ |
Upload File : |
<?php
class UserManager
{
protected $db;
private $ragioneSociale;
private $telefono;
private $cellulare;
private $indirizzo;
private $codiceFiscale;
private $email;
private $citta;
private $password;
private $recruiting;
private $cap;
private $marketing;
function __construct($db){
$this->db = $db;
$this->ragioneSociale = null;
$this->telefono = null;
$this->cellulare = null;
$this->indirizzo = null;
$this->codiceFiscale = null;
$this->email = null;
$this->citta = null;
$this->password = null;
$this->marketing = null;
$this->cap = null;
$this->recruiting = null;
}
/*
* get User Details
*
* @param $id_user
* @return $mixed
* */
public function UserDetails($idcliente)
{
try {
$query = $this->db->prepare("SELECT * FROM cliente WHERE idcliente=:idcliente LIMIT 1");
$query->bindParam("idcliente", $idcliente, PDO::PARAM_INT);
$query->execute();
if ($query->rowCount() > 0) {
return $query->fetch(PDO::FETCH_OBJ);
}
} catch (PDOException $e) {
exit($e->getMessage());
}
}
public function annullaPagamento($idordine, $txn_id, $payment_status, $payer_email, $first_name, $last_name, $address_street, $address_city, $address_state, $address_zip){
}
public function iniziaPagamento($idordine, $tnx_id){
$query = $this->db->prepare("INSERT INTO transazioni (txn_id, idordine) VALUES (:txn_id, :idordine)");
$query->bindParam("txn_id", $txn_id, PDO::PARAM_STR);
$query->bindParam("idordine", $idordine, PDO::PARAM_STR);
$response = $query->execute();
// echo "\nPDOStatement::errorInfo():\n";
$arr = $query->errorInfo();
//print_r($arr);
if($arr[0]==00000 || $arr[0]="0" || $arr[0]=="00000"){
return $this->db->lastInsertId();
}
}
public function RegistraOrdine($atipopagamento, $aidstato, $aindirizzospedizione, $idcliente, $asconto, $aprodotti, $email)
{
try{
$query = $this->db->prepare("INSERT INTO ordine (idpagamento, idstato, indirizzospedizione, idcliente, sconto, prodotti) VALUES(:atipopagamento, :aidstato, :aindirizzospedizione, :idcliente, :asconto, :aprodotti)");
$query->bindParam("atipopagamento", $atipopagamento, PDO::PARAM_INT);
$query->bindParam("aidstato", $aidstato, PDO::PARAM_INT);
$query->bindParam("aindirizzospedizione", $aindirizzospedizione, PDO::PARAM_STR);
$query->bindParam("idcliente", $idcliente, PDO::PARAM_INT);
$query->bindParam("asconto", $asconto, PDO::PARAM_STR);
$query->bindParam("aprodotti", $aprodotti, PDO::PARAM_STR);
$response = $query->execute();
// echo "\nPDOStatement::errorInfo():\n";
$arr = $query->errorInfo();
//print_r($arr);
if($arr[0]==00000 || $arr[0]="0" || $arr[0]=="00000"){
$idInsertaPratica = $this->db->lastInsertId();
if($atipopagamento != 1 && $atipopagamento!=2){ //se non รจ paypal
$prod = json_decode($aprodotti,true);
foreach ($prod as $key => $value) {
$aquery = $this->db->prepare("UPDATE prodottoinvendita SET quantita=quantita-1 WHERE idprodotto=:aidprodotto");
$aquery->bindParam("aidprodotto", $value['idprodotto'], PDO::PARAM_STR);
$aquery->execute();
$arr = $query->errorInfo();
}
}
if($arr[0]==00000 || $arr[0]="0" || $arr[0]=="00000"){
return $idInsertaPratica;
}else{
return -1;
}
}else{
return -1;
}
// return $query->rowCount();
}catch(PDOException $e){
exit($e->getMessage());
}
}
public function UpdateProfile($idcliente)
{
try{
if($this->password){
$query = $this->db->prepare("UPDATE cliente SET ragioneSociale=:ragioneSociale, indirizzo=:indirizzo, citta=:citta, codiceFiscale=:codiceFiscale, telefono=:telefono, cellulare=:cellulare, password=:password, cap=:cap, marketing=:marketing WHERE idcliente=:idcliente");
$query->bindParam("password", $this->password, PDO::PARAM_STR);
}else{
$query = $this->db->prepare("UPDATE cliente SET ragioneSociale=:ragioneSociale, indirizzo=:indirizzo, citta=:citta, codiceFiscale=:codiceFiscale, telefono=:telefono, cellulare=:cellulare, cap=:cap, marketing=:marketing WHERE idcliente=:idcliente");
}
$query->bindParam("ragioneSociale", $this->ragioneSociale, PDO::PARAM_STR);
$query->bindParam("telefono", $this->telefono, PDO::PARAM_STR);
$query->bindParam("cellulare", $this->cellulare, PDO::PARAM_STR);
$query->bindParam("indirizzo", $this->indirizzo, PDO::PARAM_STR);
$query->bindParam("codiceFiscale", $this->codiceFiscale, PDO::PARAM_STR);
$query->bindParam("citta", $this->citta, PDO::PARAM_STR);
$query->bindParam("ragioneSociale", $this->ragioneSociale, PDO::PARAM_STR);
//$query->bindParam("recruiting", $this->recruiting, PDO::PARAM_STR);
$query->bindParam("cap", $this->cap, PDO::PARAM_STR);
$query->bindParam("marketing", $this->marketing, PDO::PARAM_STR);
$query->bindParam("idcliente", $idcliente, PDO::PARAM_INT);
$query->execute();
$arr = $query->errorInfo();
print_r($arr);
return $query->rowCount();
}catch(PDOException $e){
exit($e->getMessage());
}
}
public function setField($key, $value){
$this->$key = $value;
}
public function setPassword($password){
$this->password = md5($password);
}
public function GetOrders($idcliente)
{
try{
$query = $this->db->prepare("SELECT * from riparazione WHERE idcliente=:idcliente");
$query->bindParam("idcliente", $idcliente, PDO::PARAM_INT);
$query->execute();
if ($query->rowCount() > 0) {
return $query->fetchAll(PDO::FETCH_OBJ);
}
}catch(PDOException $e){
exit($e->getMessage());
}
}
public function GetOrdersById($idordine)
{
try{
$query = $this->db->prepare("SELECT * from ordine WHERE idordine=:idordine");
$query->bindParam("idordine", $idordine, PDO::PARAM_INT);
$query->execute();
if ($query->rowCount() > 0) {
return $query->fetchAll(PDO::FETCH_OBJ);
}
}catch(PDOException $e){
exit($e->getMessage());
}
}
}