Esempio n. 1
0
 public function saveUser(DUser $client)
 {
     $birth = $client->getBirth()->format("Y-m-d");
     $status = intval($client->getStatus());
     $n = $client->getName();
     $s = $client->getSurname();
     $SSN = $client->getSSN();
     $p = $client->getPhone();
     $m = $client->getMail();
     $pass = $client->getPassword();
     $type = $client->getType();
     $code = $client->getCode();
     $already_in = $this->loadClient($SSN);
     if ($already_in) {
         $query = "UPDATE person SET MAIL = '{$m}', PASSWORD ='******', TYPE = '{$type}', CODE = '{$code}'\n\t\t\tWHERE SSN = '{$SSN}';";
     } else {
         $query = "INSERT INTO person(name, surname, SSN, phone, mail, birth, password, status,code, type) \n\t\t\tVALUES ('{$n}','{$s}','{$SSN}','{$p}','{$m}','{$birth}','{$pass}',{$status},'{$code}',{$type});";
     }
     $temp = $this->db->query($query);
     if (!$temp) {
         throw new Exception("Query Failed saveClient FUser");
     } else {
         return true;
     }
 }
Esempio n. 2
0
 public function sign()
 {
     $errors = array();
     $VLog = new VLog();
     $data = $VLog->getSignData();
     if ($data) {
         $bool = true;
         foreach ($data as $elem) {
             if ($elem == "" && $bool) {
                 $errors[] = 1;
                 $bool = false;
             }
         }
         if ($data['password'] != $data['r_password']) {
             $errors[] = 2;
             $bool = false;
         }
         if ($bool) {
             $n = ucfirst($data['name']);
             $s = ucfirst($data['surname']);
             $SSN = strtoupper($data['ssn']);
             $p = $data['phone'];
             $m = strtolower($data['mail']);
             $pass = $data['password'];
             try {
                 $b = new DateTime($data['birth']);
                 $now = new DateTime();
                 $diff = $now->diff($b);
                 if (intval($diff->format('%Y')) < 18) {
                     $errors[] = 6;
                     $bool = false;
                 } else {
                     $new_user = new DUser($n, $s, $SSN, $p, $m, $b, $pass);
                 }
             } catch (Exception $e) {
                 $errors[] = 3;
                 $bool = false;
             }
         }
     } else {
         $errors[] = 1;
     }
     $n_errors = count($errors);
     if ($n_errors == 0) {
         $FUser = new FUser();
         $hypS = $FUser->is_a_user($SSN);
         //controlla se c'è già un utente con quel codice fiscale
         if ($hypS) {
             $errors[] = 4;
             $bool = false;
         }
         $hypM = $FUser->mail_in($m);
         if ($hypM) {
             $errors[] = 7;
             $bool = false;
         }
         if (!$hypS && !$hypM) {
             try {
                 global $config;
                 $Mailer = new UEmail();
                 $VMail = new VMail();
                 $VMail->setLayout("confirmation");
                 $VMail->setDest("{$n} {$s}");
                 $VMail->setCode($new_user->getCode());
                 $message = $VMail->processTemplate();
                 if ($Mailer->send_mail($m, $n, $config['name'] . " confirmation mail", $message, true)) {
                     $FUser->saveUser($new_user);
                     //salva il nuovo utente (o aggiorna i campi nelle tabella person per un cliente ancora non utente)
                 } else {
                     $errors[] = 5;
                     $bool = false;
                 }
             } catch (Exception $e) {
                 $errors[] = 5;
                 $bool = false;
             }
         }
     }
     if ($bool) {
         return $this->show('sign_outcome', false);
     } else {
         return $this->show('sign_outcome', $errors);
     }
 }
Esempio n. 3
0
<?php

include_once "/var/www/web_classes/DUser.php";
include_once "/var/www/php/sql_connect.php";
$user = new DUser($_COOKIE["token"]);
error_log($user->Email());
if ($user->Perms() == 1) {
    $string = $_POST["query"];
    if (isset($_POST["query"])) {
        $query = $_POST["query"];
        $string = db_find($query);
    }
    ?>
<!DOCTYPE html>


<html lang="en">
    <head>
     <meta name="theme-color" content="#FF8800">
        <meta charset="utf-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
                <meta name="viewport" content="width=device-width, initial-scale=1">
                    <meta name="description" content="The Official Oregon Tech Gaming Community Website. The place to find event times, locations, and announcements.">
                        <meta name="author" content="Ian Murphy">
                            <link rel="icon" href="/assets/media/cog128.png">
                                
                                <title>Administration - oitgaming.com</title>
                                
                                <!-- Bootstrap core CSS -->
                                <link href="/assets/stylesheets/bootstrap.min.css" rel="stylesheet">
                                <link href="/assets/stylesheets/add.css" rel="stylesheet">