<?php
/**
 * Created by PhpStorm.
 * User: jaskokoyn
 * Date: 2/24/2015
 * Time: 1:57 PM
 */
include('../../inc/db.php');
include('../../inc/functions.php');

$params             =   getParams();
$output             =   array('status' => 1);

if(!isset($_SESSION['loggedin']) || !isReady($params, array('pass1', 'pass2'))){
    dj($output);
}

$pass1              =   secure($params['pass1'], true);
$pass2              =   secure($params['pass2'], true);

if($pass1 != $pass2){
    dj($output);
}

$userChangeQuery    =   $db->prepare("UPDATE users SET pass = :pass WHERE id = :uid");
$userChangeQuery->execute(array(
    ":pass"         =>  $pass1,
    ":uid"          =>  $_SESSION['uid']
));

$output['status'] =   2;
dj($output);
