Пример #1
0
include_once 'baza.class.php';
include_once 'dnevnik.php';
$baza = new baza();
if (isset($_GET['kod'])) {
    $kod = $_GET['kod'];
    $upit = "SELECT email FROM kod WHERE kljuc='{$kod}';";
    $rezultat = $baza->selectDB($upit);
    $red = mysqli_fetch_array($rezultat);
    $email = $red['email'];
    $upit = "SELECT zadnja_prijava,idkorisnik FROM korisnik WHERE email='{$email}';";
    $rezultat = $baza->selectDB($upit);
    $red = mysqli_fetch_array($rezultat);
    $vrijeme_prijave = strtotime($red['zadnja_prijava']);
    $id_kor = $red['idkorisnik'];
    $dan_prije = strtotime('-1 day');
    if ($vrijeme_prijave > $dan_prije) {
        $upit = "UPDATE korisnik SET zakljucan = 0 WHERE email='{$email}';";
        $rezultat = $baza->selectDB($upit);
        if ($rezultat) {
            $id = $_SESSION["ID"];
            Dnevnik::update($id_kor, $upit, 1);
            header("Location: ../pocetna.php");
        } else {
            header("Location: ../greske.php?id_greske=2");
        }
    } else {
        header("Location: ../greske.php?id_greske=9");
    }
} else {
    header("Location: ../registracija.php");
}
 * Date: 13.06.14.
 * Time: 23:54
 */
session_start();
include_once 'baza.class.php';
include_once 'dnevnik.php';
if (!isset($_SESSION["PzaWeb"])) {
    header("Location: greske.php?id_greske=12");
    exit;
}
if ($_SESSION["TIP"] != 1) {
    header("Location: greske.php?id_greske=13");
    exit;
}
$id = $_GET['id'];
$tip = $_GET['tip'];
if ($tip == 0) {
    $baza = new Baza();
    $upit = "update korisnik set zakljucan=1 where idkorisnik='{$id}'";
    $rezultat = $baza->selectDB($upit);
    $id = $_SESSION["ID"];
    Dnevnik::update($id, $upit, 1);
    header("Location: ../otkljucaj_korisnike.php");
} elseif ($tip == 1) {
    $baza = new Baza();
    $upit = "update korisnik set zakljucan=0 where idkorisnik='{$id}'";
    $rezultat = $baza->selectDB($upit);
    $id = $_SESSION["ID"];
    Dnevnik::update($id, $upit, 1);
    header("Location: ../otkljucaj_korisnike.php");
}