| Server IP : 195.130.67.5 / Your IP : 216.73.216.231 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/icd/msc/ |
Upload File : |
<?php
global $mCtrl, $docType, $docSubject, $docSender, $docRecipient, $docComments, $butSubmit, $showNewForm, $nextAI;
include_once 'lib/lib.php';
$mCtrl = new Controller("protocol", "@[PAGE_TITLE]");
$mCtrl->onlyForRole("protocol");
//$mCtrl->addToHead("");
$docType = Utils::vPost("docType", FALSE);
$docSubject = Utils::vPost("docSubject", FALSE);
$docSender = Utils::vPost("docSender", FALSE);
$docRecipient = Utils::vPost("docRecipient", FALSE);
$docComments = Utils::vPost("docComments", FALSE);
$butSubmit = Utils::vPost("butSubmit");
$showNewForm = FALSE;
if ($butSubmit){
$showNewForm = TRUE;
$check = strlen($docSubject) * strlen($docSender) * strlen($docRecipient);
if ($check == 0){
$mCtrl->setFlashWarning("Δε συμπληρώσατε όλα τα πεδία");
}else{
$remoteip = $_SERVER['REMOTE_ADDR'];
$remoteaddress = gethostbyname($remoteip);
$submittedon = Utils::dateStr();
$query = "INSERT INTO `msc_Applications` (`RemoteIP`, `RemoteAddress`, `SubmittedOn`, `docType`, `docSubject`, `docSender`, `docRecipient`, `docComments`) VALUES (";
$query .= DBUtils::getSQLString($remoteip);
$query .= "," . DBUtils::getSQLString($remoteaddress);
$query .= ",'{$submittedon}'";
$query .= ", {$docType}";
$query .= "," . DBUtils::getSQLString($docSubject);
$query .= "," . DBUtils::getSQLString($docSender);
$query .= "," . DBUtils::getSQLString($docRecipient);
$query .= "," . DBUtils::getSQLString($docComments);
$query .= ")";
//var_dump($query);
$res = DBUtils::execute_query_auto($query, $lastid);
if ($res) {
$showNewForm = FALSE;
$mCtrl->setFlashMessage("Το πρωτόκολλο καταχωρήθηκε επιτυχώς");
$docType = 1;
$docSubject = "";
$docSender = "";
$docRecipient = "";
$docComments = "";
}else{
$mCtrl->setFlashWarning("Σφάλμα κατά την καταχώρηση του πρωτοκόλλου");
}
}
}
$nextAI = DBUtils::getresult("SHOW TABLE STATUS LIKE 'msc_applications'", "Auto_increment");
$daysoff = 0;
$curd = getdate(time() + Config::TIMEOFF + 86400 * $daysoff);
$curYear = $curd["year"];
$yearDigits = strlen($curYear);
$protocolDigits = 4;
$totalDigits = $yearDigits + $protocolDigits;
$nextAIisOK = FALSE;
if (strlen($nextAI) >= $totalDigits){
$nextAIyear = (int)substr($nextAI, 0, $yearDigits);
if ($curYear == $nextAIyear){
$nextAIisOK = TRUE;
}
}
if (!$nextAIisOK){
DBUtils::execute_query("ALTER TABLE `msc_applications` AUTO_INCREMENT = {$curYear}0001");
$nextAI = DBUtils::getresult("SHOW TABLE STATUS LIKE 'msc_applications'", "Auto_increment");
$mCtrl->setFlashMessage("Ο επόμενος αριθμός πρωτοκόλλου προσαρμόστηκε για τη νέα χρονιά στον αριθμό: {$nextAI}");
}
$mCtrl->printHeaders();
$mCtrl->clearFlashWarning();
//$mCtrl->addSideBarBlock("δοκιμή", "δοκιμή", 300);
?>
<?php
//$mCtrl->includeSource("left_navigation");
$mCtrl->includeSource();
?>
<?php
$mCtrl->Close();
?>