<?php

if(core::ifPost("event") AND core::ifPost("salarie")){
    
    db::query("INSERT INTO " . DB_T_EVENTS_INSCRITS . " (id_evenement, id_salarie, sel, id_user) VALUES (:id_evenement, :id_salarie, :sel, :id_user)");
    db::bind(':sel', md5(core::getPost("event")."-".time().rand(100000000000000, 999999999999999)));
    db::bind(':id_evenement', core::getPost("event"));
    db::bind(':id_salarie', core::getPost("salarie"));
    db::bind(':id_user', session::getId());
    db::execute();
    
    alert::recSuccess("Inscription de ". core::getPost("texte"));
    alert::recTab("salaries-tab");
    
    header("Location: /evenement-" . core::getPost("event").".html");
    exit();
}
