<?php
/**
 * Created by PhpStorm.
 * User: jaskokoyn
 * Date: 2/21/2015
 * Time: 10:21 PM
 */

include( '../../inc/db.php' );
include( '../../inc/functions.php' );

if(!isset($_SESSION['loggedin']) || $user['mem_level'] != 2){
    die("AYYYYYY");
}

if( !isReady($_POST, array( "id", "name", "cmd" ) ) ){
    die( "EMPTY" );
}

$id     =   intval($_POST['id']);
$name   =   secure($_POST['name']);
$cmd    =   $_POST['cmd'];

$updateEmoteQuery    =   $db->prepare("UPDATE emotes
                                        SET e_cmd = :e, img_name = :i
                                        WHERE id = :id");
$updateEmoteQuery->execute(array(
    ":e"        =>  $cmd,
    ":i"       =>  $name,
    ":id"       =>  $id
));

die("SUCCESS");