Implemented intval() and mysqli_real_escape_string() in ending.php for security reasons againist sql injections