function Insert()
{
    include './connector.php';
    $con = new Connector();
    $NameOfLogin = $_SESSION['NameOfLogin'];
    $SurnameOfLogin = $_SESSION['SurnameOfLogin'];
    $ProgrammThatUserClick = $_SESSION['ProgrammThatUserClick'];
    $res = $con->prepare("INSERT INTO history VALUES('{$NameOfLogin}', '{$SurnameOfLogin}', '{$ProgrammThatUserClick}','null')");
}
Ejemplo n.º 2
0
 public function getGroups($aDatabase, $aPrefix, $aUser, $aPass, $aThrow)
 {
     $Connector = new Connector(SQL_HOST, $aDatabase, $aUser, $aPass, $aThrow);
     if ($Connector != null) {
         // only test if we can read the user table
         $TestQuery = $Connector->prepare('SELECT user_id FROM `' . $aPrefix . 'users` LIMIT 1');
         $Connector->run($TestQuery, $aThrow);
     }
     return null;
 }
function Insert()
{
    include './connector.php';
    $con = new Connector();
    //Το όνομα του χρήστη που κάνει σύνδεση
    $NameOfLogin = $_SESSION['NameOfLogin'];
    //Το επώνυμο του χρήστη που κάνει σύνδεση
    $SurnameOfLogin = $_SESSION['SurnameOfLogin'];
    //Το πρόγραμμα που επέλεξε να χρησιμοποιήσει ο χρήστης
    $ProgrammThatUserClick = $_SESSION["ProgrammThatUserClick"];
    $res = $con->prepare("INSERT INTO history VALUES('{$NameOfLogin}', '{$SurnameOfLogin}', '{$ProgrammThatUserClick}','null')");
}
Ejemplo n.º 4
0
 public function getGroups($aDatabase, $aPrefix, $aUser, $aPass, $aThrow)
 {
     $Connector = new Connector(SQL_HOST, $aDatabase, $aUser, $aPass, $aThrow);
     if ($Connector != null) {
         $GroupQuery = $Connector->prepare('SELECT id, title FROM `' . $aPrefix . 'usergroups` ORDER BY title');
         $Groups = array();
         $GroupQuery->loop(function ($Group) use(&$Groups) {
             array_push($Groups, array('id' => $Group['id'], 'name' => $Group['title']));
         }, $aThrow);
         return $Groups;
     }
     return null;
 }
Ejemplo n.º 5
0
 public function getGroups($aDatabase, $aPrefix, $aUser, $aPass, $aThrow)
 {
     $Connector = new Connector(SQL_HOST, $aDatabase, $aUser, $aPass, $aThrow);
     if ($Connector != null) {
         $OptionsQuery = $Connector->prepare('SELECT option_value FROM `' . $aPrefix . 'options` WHERE option_name = "' . $aPrefix . 'user_roles" LIMIT 1');
         $Option = $OptionsQuery->fetchFirst($aThrow);
         $Groups = array();
         $Roles = unserialize($Option['option_value']);
         if (is_array($Roles)) {
             foreach ($Roles as $Role => $Options) {
                 array_push($Groups, array('id' => strtolower($Role), 'name' => $Role));
             }
         }
         return $Groups;
     }
     return null;
 }
}
$result = $con->prepare("SELECT * FROM nameoftext");
while ($r = $result->fetch()) {
    $ArrayOfTitlesInGreek[$IndexArrayOfTilesInGreek] = $r['Name'];
    $IndexArrayOfTilesInGreek++;
}
$ArrayOfTitles[0] = $NameAndSurnameOfEmployee[1];
$ArrayOfTitles[1] = $NameAndSurnameOfEmployee[0];
//            echo "ArrayOfTitles array"."<br>";
//            print_r($ArrayOfTitles);
//            echo "<br>ArrayOfTitlesInGreek array<br>";
//            print_r($ArrayOfTitlesInGreek);
$_SESSION["SurnameOfEmployee"] = $ArrayOfTitles[1];
$_SESSION["NameOfEmployee"] = $ArrayOfTitles[0];
$con = new Connector();
$result = $con->prepare("SELECT * FROM kataxorisiuser WHERE Surname=? AND Name=?", array($ArrayOfTitles[1], $ArrayOfTitles[0]));
$doc = "<html>" . "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n                              <link href=\"css/Table_Style.css\" rel=\"stylesheet\">\n                              <link href=\"css/Input_Buttons.css\" rel=\"stylesheet\">" . "<body>" . "<table border='1' style='border-collapse: collapse'>" . "<tr>" . "<th colspan='2'>" . "<font size='4'>Στοιχεία Υπαλλήλου</font>" . "</th>" . "<th>" . "<font size='4'>Φωτογραφία υπαλλήλου</font>" . "</th>" . "</tr>" . "<tr>" . "<td>" . "<strong>Επώνυμο</strong>" . "</td>" . "<td>" . $ArrayOfTitles[1] . "</td>" . "<td style='text-align:center; vertical-align:middle;' rowspan=" . count($ArrayOfTitles) . ">" . "<img align='center' src='http://{$ServerName}/Kataxorisis/{$UploaddFileToShow}' width='132' height='174' style='display:inline-block;'/>" . "</td>" . "</tr>" . "<tr>" . "<td>" . "<strong>Όνoμα</strong>" . "</td>" . "<td>" . $ArrayOfTitles[0] . "</td>" . "</tr>";
while ($row1 = $result->fetch()) {
    for ($i = 3; $i <= 25; $i++) {
        $doc = $doc . "<tr>" . "<td>" . "<strong>" . $ArrayOfTitlesInGreek[$CheckIfIndex] . "</strong>" . "</td>" . "<td>" . $row1[$ArrayOfTitles[$i]] . "</td>" . "</tr>";
        $CheckIfIndex++;
    }
}
$doc = $doc . "</table></body></html>";
echo $doc;
if (isset($_POST['PrintInfoOfEmployee'])) {
    //                header("Locaton: StoixeiaEpilegmenouIpalilouWithoutCSS.php");
    //                header("Content-Type: application/vnd.msword charset='utf-8'");
    //                header("Expires: 0");//no-cache
    //                header("Cache-Control: must-revalidate, post-check=0, pre-check=0");//no-cache
    //                header("content-disposition: attachment;filename=".$_SESSION["SurnameOfEmployee"]." ".$_SESSION["NameOfEmployee"].".doc");
<?php

include "{$_SERVER['DOCUMENT_ROOT']}/kataxorisis/connector.php";
$username = $_POST['username'];
$password = $_POST['password'];
var_dump($_POST);
$con = new Connector();
$res = $con->prepare('select * from login where UserName=? and Password=?', array($username, $password));
if ($row = $res->fetch()) {
    session_start();
    $_SESSION['username'] = $username;
    $_SESSION['password'] = $password;
    //header("Location:$_SERVER[DOCUMENT_ROOT]/kataxorisis/"); exit;
    echo "<script>window.location.replace('http://192.168.1.184/kataxorisis');</script>";
} else {
    echo "wrong";
    echo "<script>window.location.replace('http://192.168.1.184/kataxorisis/Login/index.php?error=1');</script>";
    //header("Location:$_SERVER[DOCUMENT_ROOT]/kataxorisis/Login?error=1");exit;
}
$NewBranch = null;
$TeamBlood = null;
$UploadFile = null;
$UploadFilePNG = null;
$NewFileUpload = null;
$DetectEncodeOfUploadFile = null;
$PathToSaveForegroundImage = null;
$PathToSaveBackgroundImage = null;
$UploadFileΤοToShow = null;
$LengthTeamBlood = 0;
$SurnameOfEmployee = $_SESSION["SurnameOfEmployee"];
$NameOfEmployee = $_SESSION["NameOfEmployee"];
//    echo "Surname Of Employee is: ".$SurnameOfEmployee."<br>Name Of Employee is: ".$NameOfEmployee."<br><br>";
$UploadFileSplit = array();
$UploadFileΤοToShowArray = array();
$res = $con->prepare("SELECT PathOfEmployeeImageToSave, PathOfEmployeeImageToShow FROM kataxorisiuser WHERE Surname='{$SurnameOfEmployee}' AND Name='{$NameOfEmployee}'");
$row = $res->fetch();
$TeamBlood = $_SESSION['TeamBlood'];
$UploadFile = $row['PathOfEmployeeImageToSave'];
$TypeOfFile = $_SESSION['TypeOfFile'];
$UploadFileΤοToShow = $row['PathOfEmployeeImageToShow'];
//    echo "UploadFile is: ".$UploadFile."<br>";
//    echo "UploadFile to show is: ".$UploadFileΤοToShow."<br>";
//    print_r($UploadFileSplit);
//    echo "<br>";
//echo strlen($TeamBlood);
$BranchArray = array();
//	echo $SurnameOfEmployee." ".$NameOfEmployee."<br>";
$OmadaAimatosGrammaKaiSimbolo = array();
if (mb_detect_encoding($TeamBlood) == 'UTF-8') {
    $LengthTeamBlood = mb_strlen($TeamBlood);
         echo '<span style="color:red;text-align:center;">Το πεδίο Τηλέφωνο πρέπει να έχει μήκος 10</span>' . "<br>";
     }
     if ($CTB->PhoneStirngFailed == true) {
         echo '<span style="color:red;text-align:center;">Το πεδίο Τηλέφωνο πρέπει να είναι συμβολοσειρά</span>' . "<br>";
     }
     if ($CTB->EmailFailed == true) {
         echo '<span style="color:red;text-align:center;">Εισάγετε ένα έγκυρο email</span>' . "<br>";
     }
     echo "<br>";
     die("<strong><font size='4'>Η εφαρμογή δεν μπορεί να συνεχίσει την λειτουργία της λόγω των παραπάνω προβλημάτων πουπαρουσιάστηκαν!Παρακαλώ για την σωστή λειτουργία της εφαρμογής πατήσε το κουμπί 'Επαναφώρτωση σελίδας' και επαναλάβεται την διαδικασία καταχώρησης</font></strong>");
 } else {
     if ($Situation == "Μετάταξη" && $Node != "Τίποτα" && $Service != "Τίποτα") {
         $IndexOfNodeArray = 0;
         for ($i = 0; $i < $LengthOfServicesArray; $i++) {
             if ($Service == $ServicesArray[$i]) {
                 $res = $con->prepare("SELECT * FROM services WHERE value=?", array($Service));
                 while ($row = $res->fetch()) {
                     $id = $row['id'];
                     $res = $con->prepare("SELECT services.value, select_service_table.value FROM services INNER JOIN select_service_table ON " . "services.id=select_service_table.id AND services.id='{$id}';");
                     while ($row1 = $res->fetch()) {
                         $WhichTable = $row1['value'];
                         $res = $con->prepare("SELECT * from " . $WhichTable);
                         while ($row2 = $res->fetch()) {
                             $NodeArray[$IndexOfNodeArray] = $row2['value'];
                             //Create array with Node for each Service users select
                             $IndexOfNodeArray++;
                         }
                     }
                 }
             }
         }
<?php

echo 'add Fields<br>';
include './connector.php';
session_start();
//Εμφάνηση ώρα Ελλάδος
date_default_timezone_set('Europe/Athens');
$Connector = new Connector();
$NumOfFieldsToAdd = 0;
$NameOfLogin = $_SESSION['NameOfLogin'];
$SurnameOfLogin = $_SESSION['SurnameOfLogin'];
$ProgrammThatUserClick = $_SESSION['ProgrammThatUserClick'];
$description = "Ο/Η χρήστης (ον) " . $_SESSION['NameOfLogin'] . " (επ) " . $_SESSION['SurnameOfLogin'] . " εκτέλεσε την λειτουργία " . "" . $_SESSION['AntistoixoKoumpi'] . " με την οποία πρόσθεσε " . $NumOfFieldsToAdd . " πεδία. . Η " . $_SESSION['AntistoixoKoumpi'] . " πραγματοποιήθηκε στις " . "" . ConvertEnglishDaysAndMonthToGreek(date("l jS \\of F Y")) . " και ώρα " . date("h:i:s") . "" . ". Ο χρήστης με (ον) " . $_SESSION['NameOfLogin'] . " και (επ) " . $_SESSION['SurnameOfLogin'] . " χαρακτιρίζεται ως " . CheckUser() . ".";
$res = $Connector->prepare("INSERT INTO history VALUES('{$NameOfLogin}', '{$SurnameOfLogin}', '{$ProgrammThatUserClick}','{$description}')");
function CheckUser()
{
    $User = null;
    if ($_SESSION['Permissions'] == 0) {
        $User = "******";
    }
    if ($_SESSION['Permissions'] == 1) {
        $User = "******";
    }
    if ($_SESSION['Permissions'] == 2) {
        $User = "******";
    }
    return $User;
}
function ConvertEnglishDaysAndMonthToGreek($date)
{
    $DaysOfWeekInGeekArray = array(0 => "Δευτέρα", 1 => "Τρίτη", 2 => "Τετάρτη", 3 => "Πέμπτη", 4 => "Παρασκευή", 5 => "Σάββατο", 6 => "Κυριακή");
                    <td>
                        <input type="text" id="SurnameOfEmployeeText" name="SurnameOfEmployeeText" required>
                    </td>
                </tr>
            </table>
            <br />
            <label  id="LabelToAsk" name="LabelToAsk"><strong>Επιλέξτε ενα ή περισσότερα πεδία απο τα παρακάτω, ώστε να μπορείτε να το επεξεργαστείτε.</strong></label>
            <?php 
$TitleInGreek = null;
$IndexArrayOfTiles = 0;
$i = 0;
$ArrayOfTitles = array();
$FieldsForChanging = array();
include 'connector.php';
$con = new Connector();
$result = $con->prepare("SHOW COLUMNS FROM kataxorisiuser");
while ($r = $result->fetch()) {
    if ($i >= 3) {
        $ArrayOfTitles[$IndexArrayOfTiles] = $r['Field'];
        $IndexArrayOfTiles++;
    }
    $i++;
}
$i = 0;
$f = 0;
echo "<br>";
$result = $con->prepare("SELECT * FROM nameoftext");
while ($r = $result->fetch()) {
    $TitleInGreek = $r['Name'];
    ?>
                    <input type="checkbox" id="<?php 
        <?php 
include 'connector.php';
$con = new Connector();
$Value = null;
$doc_body = null;
$SinolikesThesis = null;
$SinolikesThesisINT = 0;
$PiasmenesThesis = null;
$PiasmenesThesisINT = 0;
$ServiceSelectionTable = null;
$EleutheresThesis = null;
$EleutheresThesisINT = 0;
$ServiceSelection = $_COOKIE['ServiceSelection'];
//Set ServiceSelection from user choise
echo $ServiceSelection;
$result = $con->prepare("SELECT value FROM services");
//Return rows with Services
while ($row = $result->fetch()) {
    if ($ServiceSelection == $row['value']) {
        $result1 = $con->prepare("SELECT services.value, select_service_table.value FROM services INNER JOIN select_service_table ON services.id=select_service_table.id " . "AND services.value='{$ServiceSelection}';");
        while ($row1 = $result1->fetch()) {
            $ServiceSelectionTable = $row1['value'];
        }
        $result2 = $con->prepare("SELECT * FROM " . $ServiceSelectionTable);
        $doc_body = "<html>\n                                        <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>\n                                        <body>\n                                            <table border='1'>\n                                                <tr>\n                                                    <th colspan='4'>\n                                                        <div align='cente'>\n                                                            <h3><strong>" . $ServiceSelection . "</strong></h3>\n                                                        </div>\n                                                    </th>\n                                                </tr>\n                                                <tr>\n                                                    <td>\n                                                        <strong>Κλαδος</strong>\n                                                    </td>\n                                                    <td width='140' align='center'>\n                                                        <strong>Σύνολο οργανικών θέσεων</strong>\n                                                    </td>\n                                                    <td width='125' align='center'>\n                                                        <strong>Δεσμευμένες θέσεις</strong>\n                                                    </td>\n                                                    <td align='center'>\n                                                        <strong>Κενές θέσεις</strong>\n                                                    </td>\n                                                </tr>";
        while ($row2 = $result2->fetch()) {
            $Value = $row2['value'];
            $SinolikesThesis = $row2['sinolikes_thesis'];
            $PiasmenesThesis = $row2['piasmenes_thesis'];
            $EleutheresThesis = $row2['eleutheres_thesis'];
            $doc_body = $doc_body . "<tr>" . "<td>" . $Value . "</td>" . "<td align='center'>" . $SinolikesThesis . "</td>" . "<td align='center'>" . $PiasmenesThesis . "</td>" . "<td align='center'>" . $EleutheresThesis . "</td>" . "</tr>";
 $RelativePathToSaveImage = "images/" . $NameForFolderOfEmployee . "/";
 if ($_FILES['file']['type'] != "image/png") {
     if (file_exists($RelativePathToSaveImage . $CreateFileName)) {
         echo '<span style="color:red;text-align:center;">Το αρχείο που προσπαθείτε να ανεβάσετε υπάρχει ήδη στον φάκελο images </span>' . "<br>";
         die;
         exit;
     }
     move_uploaded_file($_FILES['file']['tmp_name'], $RelativePathToSaveImage . $CreateFileName);
     imagepng(imagecreatefromstring(file_get_contents($RelativePathToSaveImage . $CreateFileName)), $RelativePathToSaveImage . ConvertEncoding($temp[0]) . ".png");
     //$_SESSION['UploadFile'] = $RelativePathToSaveImage.ConvertEncoding($temp[0]).".png";
     $UploadFile = $RelativePathToSaveImage . ConvertEncoding($temp[0]) . ".png";
     $UploadFileToShow = str_replace(' ', '%20', "images/" . $_POST['SurnameOfEmployeeText'] . "/" . $_FILES['file']['name']);
     //                    echo str_replace(' ', '%20', "images/".$_POST['SurnameOfEmployeeText']."/".$_FILES['file']['name']);
     $UploadFileΤοToShow = $RelativePathToSaveImage . $_FILES['file']['name'];
     //                    echo $UploadFile."<br>";
     $res = $con->prepare("UPDATE kataxorisiuser SET PathOfEmployeeImageToSave=?, UploadImageTF=?," . " PathOfEmployeeImageToShow=? " . "WHERE Surname=? AND Name=?", array("images/" . $_POST['SurnameOfEmployeeText'] . "/" . $temp[0] . ".png", 'true', $UploadFileToShow, $SurnameOfEmployeeArray[0], $SurnameOfEmployeeArray[1]));
 } else {
     if (file_exists($RelativePathToSaveImage . $CreateFileName)) {
         echo '<span style="color:red;text-align:center;">Το αρχείο που προσπαθείτε να ανεβάσετε υπάρχει ήδη στον φάκελο images </span>' . "<br>";
         exit;
     }
     move_uploaded_file($_FILES['file']['tmp_name'], $RelativePathToSaveImage . $CreateFileName);
     //$_SESSION['UploadFile'] =$RelativePathToSaveImage.ConvertEncoding($temp[0]).".png";
     $UploadFile = $RelativePathToSaveImage . $CreateFileName;
     $UploadFileToShow = str_replace(' ', '%20', "images/" . $_POST['SurnameOfEmployeeText'] . "/" . $_FILES['file']['name']);
     //                    echo str_replace(' ', '%20', "images/".$_POST['SurnameOfEmployeeText']."/".$_FILES['file']['name'])."<br>";
     $UploadFileΤοToShow = $RelativePathToSaveImage . $_FILES['file']['name'];
     //                    echo $UploadFile."<br>";
     $res = $con->prepare("UPDATE kataxorisiuser SET PathOfEmployeeImageToSave=?, UploadImageTF=?," . " PathOfEmployeeImageToShow=? " . "WHERE Surname=? AND Name=?", array("images/" . $_POST['SurnameOfEmployeeText'] . "/" . $temp[0] . ".png", 'true', $UploadFileToShow, $SurnameOfEmployeeArray[0], $SurnameOfEmployeeArray[1]));
     if ($res) {
         echo "<strong><font size='4'>Επιτυχής καταχώρηση υπαλλήλου!!</font></strong>" . "<br>";
        foreach ($_POST['check_list'] as $selected) {
            //                    echo $selected."</br>";
            $SplitSelected = explode("_", $selected);
            $_SESSION['PediaGiaAllagi' . $i] = $SplitSelected[1];
            $i++;
            //                                echo $SplitSelected[0]."<br>";
            if ($SplitSelected[0] == "Situation") {
                ?>
                                    <tr>
                                        <td>
                                            <label  id="Κατάσταση" name="Κατάσταση"><strong>Κατάσταση</strong></label>
                                        </td>
                                        <td>
                                            <select name="Situation" id="Situation">
                                                <?php 
                $res = $con->prepare("SELECT * FROM selection_option");
                while ($r = $res->fetch()) {
                    if ($r['Situation'] == "null") {
                        continue;
                    }
                    ?>
                                                        <option value="<?php 
                    echo $r['Situation'];
                    ?>
"><?php 
                    echo $r['Situation'];
                    ?>
</option>
                                                <?php 
                }
                ?>
Ejemplo n.º 15
0
 public function getUsers($aDatabase, $aPrefix, $aUser, $aPass, $aThrow)
 {
     $Connector = new Connector(SQL_HOST, $aDatabase, $aUser, $aPass, $aThrow);
     if ($Connector != null) {
         $Users = array();
         $UserQuery = $Connector->prepare('SELECT userID, username FROM `wcf' . $aPrefix . '_user` ' . 'ORDER BY username');
         $UserQuery->loop(function ($User) use(&$Users) {
             array_push($Users, array('id' => $User['userID'], 'name' => $User['username']));
         }, $aThrow);
         return $Users;
     }
     return null;
 }
}
$result = $con->prepare("SELECT * FROM nameoftext");
while ($r = $result->fetch()) {
    $ArrayOfTitlesInGreek[$IndexArrayOfTilesInGreek] = $r['Name'];
    $IndexArrayOfTilesInGreek++;
}
$ArrayOfTitles[0] = $NameAndSurnameOfEmployee[1];
$ArrayOfTitles[1] = $NameAndSurnameOfEmployee[0];
//            echo "ArrayOfTitles array"."<br>";
//            print_r($ArrayOfTitles);
//            echo "<br>ArrayOfTitlesInGreek array<br>";
//            print_r($ArrayOfTitlesInGreek);
$_SESSION["SurnameOfEmployee"] = $ArrayOfTitles[1];
$_SESSION["NameOfEmployee"] = $ArrayOfTitles[0];
$con = new Connector();
$result = $con->prepare("SELECT * FROM kataxorisiuser WHERE Surname=? AND Name=?", array($ArrayOfTitles[1], $ArrayOfTitles[0]));
$doc = "<html>" . "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">" . "<body>" . "<table border='1' style='border-collapse: collapse'>" . "<tr>" . "<th colspan='2'>" . "<font size='4'>Στοιχεία Υπαλλήλου</font>" . "</th>" . "<th>" . "<font size='4'>Φωτογραφία υπαλλήλου</font>" . "</th>" . "</tr>" . "<tr>" . "<td>" . "<strong>Επώνυμο</strong>" . "</td>" . "<td>" . $ArrayOfTitles[1] . "</td>" . "<td style='text-align:center; vertical-align:middle;' rowspan=" . count($ArrayOfTitles) . ">" . "<img align='center' src='http://{$ServerName}/Kataxorisis/{$UploaddFileToShow}' width='132' height='174' style='display:inline-block;'/>" . "</td>" . "</tr>" . "<tr>" . "<td>" . "<strong>Όνoμα</strong>" . "</td>" . "<td>" . $ArrayOfTitles[0] . "</td>" . "</tr>";
while ($row1 = $result->fetch()) {
    for ($i = 3; $i <= 25; $i++) {
        $doc = $doc . "<tr>" . "<td>" . "<strong>" . $ArrayOfTitlesInGreek[$CheckIfIndex] . "</strong>" . "</td>" . "<td>" . $row1[$ArrayOfTitles[$i]] . "</td>" . "</tr>";
        $CheckIfIndex++;
    }
}
$doc = $doc . "</table></body></html>";
echo $doc;
header("Content-Type: application/vnd.msword charset='utf-8'");
header("Expires: 0");
//no-cache
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
//no-cache
header("content-disposition: attachment;filename=" . $_SESSION["SurnameOfEmployee"] . " " . $_SESSION["NameOfEmployee"] . ".doc");
         echo "<br>";
         break;
     }
     if ($CheckStringForSpaceOrPaula[$i] == "-") {
         $SurnameAndNameArray = explode("-", $_POST['SurnameOfEmployeeTextForDelete']);
         print_r($SurnameAndNameArray);
         echo "<br>";
         break;
     }
 }
 $Name = $SurnameAndNameArray[1];
 //Όνομα Υπαλλήλου για διαγραφή
 $Surname = $SurnameAndNameArray[0];
 //Επώνυμο Υπαλλήλου για διαγραφή
 echo "O Υπάλληλος " . $Name . " " . $Surname . " θα διαγραφή από το σύστημα<br>";
 $result = $Connector->prepare("SELECT Situation, branch, Service FROM kataxorisiuser WHERE Name='{$Name}' AND Surname='{$Surname}'");
 $row = $result->fetch();
 $Situation = $row['Situation'];
 $Branch = $row['branch'];
 $Service = $row['Service'];
 echo $Situation . "<br>" . $Branch . "<br>" . $Service . "<br>";
 if ($Situation == "Μετάταξη") {
     //Εκτέλεση εντολής sql η οποία επιστρέφει το πεδίο "id" της Υπηρεσίας στηνοποία βρίσκεται ο υπάλληλος προς διαγραφή
     $result = $Connector->prepare("SELECT id FROM services WHERE value='{$Service}'");
     $row = $result->fetch();
     //Εκχώρηση του πεδίου "id" που διαβάζεται στην μεταβλητή ID
     $ID = $row['id'];
     echo "ID = " . $ID . "<br>";
     //
     $result = $Connector->prepare("Select select_service_table.value AS 'value1', services.value AS 'value2' " . "FROM select_service_table INNER JOIN services ON select_service_table.id={$ID}");
     $row = $result->fetch();
$ValueOfBranchThatUserEnterPiasmenesThesis = 0;
$ValueOfBranchThatUserEnterBranchSinolikesThesis = 0;
$TableOfChangeService = null;
$TableOfServiceThatUserEnter = null;
$LengthOfArrayKeys = 0;
$LengthOfArrayWithInfoOE = 0;
$LengthArrayWithSelectTextOV = 0;
if (isset($_POST['submitGiveSomeFieldsToProcessingPage'])) {
    echo "<script type='text/javascript'>window.location.href='GiveSomeFieldsToProcessing.php'</script>";
}
if (isset($_POST['submit'])) {
    $Surname = $_SESSION['SurnameOE'];
    $Name = $_SESSION['NameOE'];
    $ArrayKeys = array_keys($_POST);
    $LengthOfArrayKeys = count($ArrayKeys);
    $result = $con->prepare("SHOW COLUMNS FROM kataxorisiuser");
    while ($r = $result->fetch()) {
        $ArrayOfTitles[$IndexArrayOfTitles] = $r['Field'];
        $IndexArrayOfTitles++;
    }
    //        echo "ArrayOfTitles: <br>";
    //        print_r($ArrayOfTitles);
    //        echo "<br><br>";
    $result = $con->prepare("SELECT * FROM kataxorisiuser WHERE Name='{$Name}' AND Surname='{$Surname}'");
    $row = $result->fetch();
    for ($i = 0; $i < $IndexArrayOfTitles; $i++) {
        $ArrayWithOldValues[$i] = $row[$ArrayOfTitles[$j]];
        $j++;
    }
    for ($i = 0; $i < $LengthOfArrayKeys; $i++) {
        if ($ArrayKeys[$i] == "Service") {
Ejemplo n.º 19
0
 public function getUsers($aDatabase, $aPrefix, $aUser, $aPass, $aThrow)
 {
     $Connector = new Connector(SQL_HOST, $aDatabase, $aUser, $aPass, $aThrow);
     if ($Connector != null) {
         $Users = array();
         $UserQuery = $Connector->prepare('SELECT user_id, username FROM `' . $aPrefix . 'users` ' . 'LEFT JOIN `' . $aPrefix . 'groups` USING(group_id) ' . 'WHERE group_name != "BOTS" ' . 'ORDER BY username');
         $UserQuery->loop(function ($User) use(&$Users) {
             array_push($Users, array('id' => $User['user_id'], 'name' => $User['username']));
         }, $aThrow);
         return $Users;
     }
     return null;
 }
Ejemplo n.º 20
0
function upgrade_100()
{
    echo "<div class=\"update_version\">" . L("UpdateFrom") . " 1.0.0 " . L("UpdateTo") . " 1.1.0";
    $SessionTableCreate = "CREATE TABLE `" . RP_TABLE_PREFIX . "Session` (\n            `SessionId` int(10) unsigned NOT NULL AUTO_INCREMENT,\n                `UserId` int(10) NOT NULL,\n                `SessionName` char(40) NOT NULL,\n                `IpAddress` char(40) NOT NULL,\n                `Expires` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n                `Data` text NOT NULL,\n                PRIMARY KEY (`SessionId`),\n                UNIQUE KEY `SessionName` (`SessionName`),\n                KEY `UserId` (`UserId`)\n        ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
    $Updates = array("Multi class support" => "ALTER TABLE `" . RP_TABLE_PREFIX . "Character` CHANGE `Class` `Class` VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;", "Class attendance" => "ALTER TABLE `" . RP_TABLE_PREFIX . "Attendance` ADD `Class` CHAR(3) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `Role`;", "User settings fix" => "ALTER TABLE `" . RP_TABLE_PREFIX . "UserSetting` DROP INDEX `Unique_Name`;", "Game bound locations" => "ALTER TABLE `" . RP_TABLE_PREFIX . "Location` ADD `Game` CHAR(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `LocationId`;", "Game bound characters" => "ALTER TABLE `" . RP_TABLE_PREFIX . "Character` ADD `Game` CHAR(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `UserId`;", "Raid column storage" => "ALTER TABLE `" . RP_TABLE_PREFIX . "Raid` ADD `SlotRoles` VARCHAR(24) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `Description`;" . "ALTER TABLE `" . RP_TABLE_PREFIX . "Raid` ADD `SlotCount` VARCHAR(12) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `SlotRoles`;", "Roles by identifier" => "ALTER TABLE `" . RP_TABLE_PREFIX . "Attendance` CHANGE `Role` `Role` CHAR(3) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;" . "ALTER TABLE `" . RP_TABLE_PREFIX . "Character` CHANGE `Role1` `Role1` CHAR(3) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;" . "ALTER TABLE `" . RP_TABLE_PREFIX . "Character` CHANGE `Role2` `Role2` CHAR(3) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;", "Performance" => "ALTER TABLE `" . RP_TABLE_PREFIX . "Raid` ADD INDEX (`Start`);" . "ALTER TABLE `" . RP_TABLE_PREFIX . "Location` ADD INDEX (`Game`);" . "ALTER TABLE `" . RP_TABLE_PREFIX . "Character` ADD INDEX (`Game`);", "ALTER TABLE `" . RP_TABLE_PREFIX . "Character` ADD INDEX GameUserId (`Game`,`UserId`);" . "ALTER TABLE `" . RP_TABLE_PREFIX . "Attendance` ADD INDEX (`Status`);" . "ALTER TABLE `" . RP_TABLE_PREFIX . "Attendance` ADD INDEX UserIdStatus (`UserId`,`Status`);" . "ALTER TABLE `" . RP_TABLE_PREFIX . "Attendance` ADD INDEX UserIdCharacterId (`UserId`,`CharacterId`);" . "ALTER TABLE `" . RP_TABLE_PREFIX . "Setting` DROP INDEX Name;" . "ALTER TABLE `" . RP_TABLE_PREFIX . "Setting` ADD INDEX (`Name`);" . "ALTER TABLE `" . RP_TABLE_PREFIX . "UserSetting` DROP INDEX Name;" . "ALTER TABLE `" . RP_TABLE_PREFIX . "UserSetting` ADD INDEX (`Name`);" . "ALTER TABLE `" . RP_TABLE_PREFIX . "UserSetting` ADD INDEX UserIdName (`UserId`,`Name`);", "New session handling" => "ALTER TABLE `" . RP_TABLE_PREFIX . "User` DROP SessionKey;" . "CREATE TABLE `" . RP_TABLE_PREFIX . "Session` (\n                                                        `SessionId` int(10) unsigned NOT NULL AUTO_INCREMENT,\n                                                        `UserId` int(10) NOT NULL,\n                                                        `SessionName` char(40) NOT NULL,\n                                                        `IpAddress` char(40) NOT NULL,\n                                                        `Expires` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n                                                        `Data` text NOT NULL,\n                                                        PRIMARY KEY (`SessionId`),\n                                                        UNIQUE KEY `SessionName` (`SessionName`),\n                                                        KEY `UserId` (`UserId`)\n                                                     ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;");
    // Timezone fix
    $Connector = Connector::getInstance();
    $ConnectorNonUTC = new Connector(SQL_HOST, RP_DATABASE, RP_USER, RP_PASS, false, false);
    $RaidDateQuery = $ConnectorNonUTC->prepare("SELECT UNIX_TIMESTAMP(Start) AS Timestamp FROM `" . RP_TABLE_PREFIX . "Raid` LIMIT 1");
    $RaidDateQuery->setErrorsAsHTML(true);
    $RaidNonUTC = $RaidDateQuery->fetchFirst();
    if ($RaidNonUTC != null) {
        $RaidDateQuery = $Connector->prepare("SELECT UNIX_TIMESTAMP(Start) AS Timestamp FROM `" . RP_TABLE_PREFIX . "Raid` LIMIT 1");
        $RaidDateQuery->setErrorsAsHTML(true);
        $Raid = $RaidDateQuery->fetchFirst();
        if ($Raid != null) {
            $Offset = $Raid["Timestamp"] - $RaidNonUTC["Timestamp"];
            $OffsetString = $Offset >= 0 ? "+" . $Offset : $Offset;
            $Updates["Timezone fix (" . $OffsetString . ")"] = "UPDATE `" . RP_TABLE_PREFIX . "Raid` SET Start = FROM_UNIXTIME(UNIX_TIMESTAMP(Start)" . $OffsetString . "), End = FROM_UNIXTIME(UNIX_TIMESTAMP(End)" . $OffsetString . ");";
        }
    }
    doUpgrade($Updates);
    // Default convert values
    $Game = "wow";
    $GameFile = "wow";
    $RoleIdxToId = array("tnk", "med", "dmg");
    $ClassNameToId = array("deathknight" => "dkt", "druid" => "dru", "hunter" => "hun", "mage" => "mag", "monk" => "mon", "paladin" => "pal", "priest" => "pri", "rogue" => "rog", "shaman" => "sha", "warlock" => "wlk", "warrior" => "war");
    // Gameconfig update
    echo "<div class=\"update_step\">Gameconfig update";
    $GameConfig = dirname(__FILE__) . "/../../lib/private/gameconfig.php";
    if (file_exists($GameConfig)) {
        if (UpdateGameConfig110($GameConfig, $ClassNameToId, $RoleIdxToId, $Game)) {
            echo "<div class=\"update_step_ok\">OK</div>";
            $GameFile = "legacy";
        } else {
            echo "<div class=\"database_error\">" . L("FailedGameconfig") . "</div>";
        }
    } else {
        echo "<div class=\"update_step_warning\">" . L("GameconfigNotFound") . " (lib/private/gameconfig.php).</div>";
    }
    echo "</div>";
    // Insert game setting
    echo "<div class=\"update_step\">Game setting";
    $GameSettingQuery = $Connector->prepare("INSERT INTO `" . RP_TABLE_PREFIX . "Setting` (Name,TextValue) VALUES ('GameConfig', :Game)");
    $GameSettingQuery->setErrorsAsHTML(true);
    $GameSettingQuery->bindValue(":Game", $GameFile, PDO::PARAM_STR);
    if ($GameSettingQuery->execute()) {
        echo "<div class=\"update_step_ok\">OK</div>";
    }
    echo "</div>";
    // Set location game, character game
    echo "<div class=\"update_step\">Game binding";
    $SetGameQuery = $Connector->prepare("UPDATE `" . RP_TABLE_PREFIX . "Location` SET Game = :Game; UPDATE `" . RP_TABLE_PREFIX . "Character` SET Game = :Game;");
    $SetGameQuery->setErrorsAsHTML(true);
    $SetGameQuery->bindValue(":Game", $Game, PDO::PARAM_STR);
    if ($SetGameQuery->execute()) {
        echo "<div class=\"update_step_ok\">OK</div>";
    }
    echo "</div>";
    // Convert roles
    echo "<div class=\"update_step\">New Role ids";
    $RoleQueryString = "";
    for ($i = 0; $i < count($RoleIdxToId); ++$i) {
        $RoleQueryString .= "UPDATE `" . RP_TABLE_PREFIX . "Character` SET Role1 = :Role" . $i . " WHERE Role1 = " . $i . ";";
        $RoleQueryString .= "UPDATE `" . RP_TABLE_PREFIX . "Character` SET Role2 = :Role" . $i . " WHERE Role2 = " . $i . ";";
        $RoleQueryString .= "UPDATE `" . RP_TABLE_PREFIX . "Attendance` SET Role = :Role" . $i . " WHERE Role = " . $i . ";";
    }
    $RolesQuery = $Connector->prepare($RoleQueryString);
    $RolesQuery->setErrorsAsHTML(true);
    for ($i = 0; $i < count($RoleIdxToId); ++$i) {
        $RolesQuery->bindValue(":Role" . $i, $RoleIdxToId[$i], PDO::PARAM_STR);
    }
    if ($RolesQuery->execute()) {
        echo "<div class=\"update_step_ok\">OK</div>";
    }
    echo "</div>";
    // Convert classes
    echo "<div class=\"update_step\">New class ids";
    $ClassQueryString = "";
    foreach ($ClassNameToId as $Name => $ClassId) {
        $ClassQueryString .= "UPDATE `" . RP_TABLE_PREFIX . "Character` SET Class = '" . $ClassId . "' WHERE Class = '" . $Name . "';";
    }
    $ClassQuery = $Connector->prepare($ClassQueryString);
    $ClassQuery->setErrorsAsHTML(true);
    if ($ClassQuery->execute()) {
        echo "<div class=\"update_step_ok\">OK</div>";
    }
    echo "</div>";
    // Convert raid slot data
    echo "<div class=\"update_step\">Convert old slot data";
    $AllRaidsQuery = $Connector->prepare("SELECT RaidId, SlotsRole1, SlotsRole2, SlotsRole3, SlotsRole4, SlotsRole5 FROM `" . RP_TABLE_PREFIX . "Raid`");
    $AllRaidsQuery->setErrorsAsHTML(true);
    $SlotRoles = implode(":", $RoleIdxToId);
    $NumErrors = 0;
    $AllRaidsQuery->loop(function ($aRaid) use(&$Connector, $RoleIdxToId, $SlotRoles, &$NumErrors) {
        $UpdateRaidQuery = $Connector->prepare("UPDATE `" . RP_TABLE_PREFIX . "Raid` SET SlotRoles = :Roles, SlotCount = :Count WHERE RaidId = :RaidId LIMIT 1");
        $SlotCount = array();
        for ($i = 0; $i < count($RoleIdxToId) && $i < 5; ++$i) {
            array_push($SlotCount, intval($aRaid["SlotsRole" . ($i + 1)]));
        }
        $UpdateRaidQuery->setErrorsAsHTML(true);
        $UpdateRaidQuery->bindValue(":Roles", $SlotRoles, PDO::PARAM_STR);
        $UpdateRaidQuery->bindValue(":Count", implode(":", $SlotCount), PDO::PARAM_STR);
        $UpdateRaidQuery->bindValue(":RaidId", $aRaid["RaidId"], PDO::PARAM_INT);
        if (!$UpdateRaidQuery->execute()) {
            ++$NumErrors;
        }
    });
    if ($NumErrors == 0) {
        echo "<div class=\"update_step_ok\">OK</div>";
    }
    echo "</div>";
    // Drop old slots
    echo "<div class=\"update_step\">Drop old slot data";
    $DropOldSlotsQuery = $Connector->prepare("ALTER TABLE `" . RP_TABLE_PREFIX . "Raid` DROP `SlotsRole1`, DROP `SlotsRole2`, DROP `SlotsRole3`, DROP `SlotsRole4`, DROP `SlotsRole5`;");
    $DropOldSlotsQuery->setErrorsAsHTML(true);
    if ($DropOldSlotsQuery->execute()) {
        echo "<div class=\"update_step_ok\">OK</div>";
    }
    echo "</div>";
    // Finish
    echo "</div>";
}
        <?php 
//            //Intialize array that have two values
//            //index 1 value red
//            //index 2 value orange
//            $a = array(1=>"red",2=>"orange");
//
//            //This function push in array $a two value
//            //index 3 value blue
//            //index 4 value yellow
//            array_push($a,"blue","yellow");
//            print_r($a);
include 'connector.php';
//        echo $_SESSION['AntistoixoKoumpi']."<br>";
$description = null;
$con = new Connector();
$result = $con->prepare("SELECT value FROM services");
?>
            <div id="main">
                <div id="first">
                    <table>
                        <tr>
                            <td align="center">
                                <select name="ServiceSelection" id="ServiceSelection">
                                    <?php 
while ($row = $result->fetch()) {
    $ValueOfServices = $row['value'];
    ?>
                                    <option value="<?php 
    echo $ValueOfServices;
    ?>
"><?php