function AdminEkle(Admin $admin)
 {
     try {
         $sorgu = "insert into admin (username, ad, soyad, email, tel, dogumTarihi) values(?,?,?,?,?,?)";
         $admindeger = array($admin->getUsername(), $admin->getAd(), $admin->getSoyad(), $admin->getEmail(), $admin->getTel(), $admin->getDogumTarihi());
         $baglanti = new VeriTabaniBaglanti();
         $conn = $baglanti->pdo_baglanti();
         $ekle = $conn->prepare($sorgu);
         $sonuc = $ekle->execute($admindeger);
         if ($sonuc) {
             $kul = new KullaniciGiris();
             $kuldao = new KullaniciGirisDAO();
             $sifre = $admin->getAd() . $admin->getSoyad();
             $yeniSifre = $kuldao->sifreleme($sifre);
             $kul->setEmail($admin->getEmail());
             $kul->setSifre($yeniSifre);
             $kul->setYetkiId(1);
             echo '<p style="color: green;">Veriler Eklendi</p>';
             echo $kuldao->KullaniciEkle($kul);
         } else {
             echo '<p style="color: red;">Hata Oluştu</p>';
         }
     } catch (PDOException $exc) {
         echo $exc->getTraceAsString();
     }
 }
Beispiel #2
0
 public function login(Admin $admin)
 {
     $query = "SELECT * FROM administradores WHERE usuario = :email AND senha = :senha";
     $stmt = $this->conexao->prepare($query);
     $stmt->bindValue(":email", $admin->getEmail(), PDO::PARAM_STR);
     $stmt->bindValue(":senha", $admin->getSenha(), PDO::PARAM_STR);
     $stmt->execute();
     $rs_admin = $stmt->fetchAll(PDO::FETCH_ASSOC);
     $objAdmin = array();
     foreach ($rs_admin as $rs) {
         $admin = new Admin();
         $admin->setIdAdmin($rs['id_administrador']);
         $_SESSION['id_admin'] = $rs['id_administrador'];
         $_SESSION['email_admin'] = $rs['usuario'];
     }
     return $objAdmin;
 }
 /**
  * Rende persistenti le modifiche all'anagrafica di un admin sul db
  * @param Admin $a l'admin considerato
  * @param mysqli_stmt $stmt un prepared statement
  * @return int il numero di righe modificate
  */
 private function salvaAdmin(Admin $a, mysqli_stmt $stmt)
 {
     $query = " update admins set \n                    password = ?,\n                    nome = ?,\n                    cognome = ?,\n                    email = ?,\n                    where admins.id = ?\n                    ";
     $stmt->prepare($query);
     if (!$stmt) {
         error_log("[salvaAdmin] impossibile" . " inizializzare il prepared statement");
         return 0;
     }
     if (!$stmt->bind_param('ssssi', $a->getPassword(), $a->getNome(), $a->getCognome(), $a->getEmail(), $a->getId())) {
         error_log("[salvaAdmin] impossibile" . " effettuare il binding in input");
         return 0;
     }
     if (!$stmt->execute()) {
         error_log("[caricaRegistrati] impossibile" . " eseguire lo statement");
         return 0;
     }
     return $stmt->affected_rows;
 }
Beispiel #4
0
 public function login(Admin $admin)
 {
     $this->setAuthenticated(true);
     $this->setAttribute('mid', $admin->getMid(), 'admin');
     $this->setAttribute('email', $admin->getEmail(), 'admin');
 }
Beispiel #5
0
                                <h2><?php 
    echo $curUser->getFirstName() . " " . $curUser->getLastName();
    ?>
</h2>

                                <h4>Position: <?php 
    echo ucfirst($curUser->getUserType());
    ?>
</h4>

                                <hr/>


                                <ul class="icons-list">
                                    <li><i class="icon-li fa fa-envelope"></i> <?php 
    echo $curUser->getEmail();
    ?>
</li>
                                    <li>
                                        <i class="icon-li fa fa-phone"></i>Mobile: <?php 
    echo $curUser->getMobileNum();
    ?>
                                    </li>
                                </ul>
                                <?php 
    if ($curUser->isTutor()) {
        ?>

                                    Major: <strong><?php 
        echo $curUser->getMajorId();
        ?>
Beispiel #6
0
     } else {
         if (isBtnSubmitReplaceCourse()) {
             Tutor::updateTeachingCourse($curUser->getId(), $_POST['teachingCourse'], $_POST['hiddenUpdateCourseOldId'], $_POST['termId']);
             header('Location: ' . BASE_URL . 'staff/edit/' . $staffId . '/success');
             exit;
         }
     }
 }
 if (isSaveBttnProfilePressed()) {
     $newDataAdded = false;
     $newFirstName = $_POST['firstName'];
     $newLastName = $_POST['lastName'];
     $newEmail = $_POST['email'];
     $oldFirstName = $curUser->getFirstName();
     $oldLastName = $curUser->getLastName();
     $oldEmail = $curUser->getEmail();
     if (strcmp($newFirstName, $oldFirstName) !== 0) {
         $user->validateName($newFirstName);
         $user->updateInfo("f_name", "user", $newFirstName, $staffId);
         $newDataAdded = true;
     }
     if (strcmp($newLastName, $oldLastName) !== 0) {
         $user->validateName($newLastName);
         $user->updateInfo("l_name", "user", $newLastName, $staffId);
         $newDataAdded = true;
     }
     if (strcmp($newEmail, $oldEmail) !== 0) {
         Person::validateNewEmail($newEmail, User::DB_TABLE);
         $user->updateInfo("email", "user", $newEmail, $staffId);
         $newDataAdded = true;
     }
Beispiel #7
0
<?php

require_once 'User.php';
require_once 'Viewer.php';
require_once 'Admin.php';
$ingrid = new Admin("Ingrid", "*****@*****.**");
$hugo = new Viewer("Hugo", "*****@*****.**");
echo $ingrid->getType() . " " . $ingrid->getName() . " has permission level:" . $ingrid->getLevel() . "<br>";
echo $ingrid->getName() . "s email adres is " . $ingrid->getEmail() . "<br>";
echo $hugo->getType() . " " . $hugo->getName() . "was created on" . $hugo->getDate();