/
StoixeiaEpilegmenouIpalilouWithoutCSS.php
118 lines (105 loc) · 5.46 KB
/
StoixeiaEpilegmenouIpalilouWithoutCSS.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
include 'connector.php';
$doc = null;
$UploadFile = null;
$NewFileUpload = null;
$TeamBlood = null;
$ServerName = null;
session_start();
$con = new Connector();
$NameAndSurnameOfEmployee = array();
$NameAndSurnameOfEmployee = explode(" ", $_SESSION['WhomEmployee']);
$UploadFileArray = array();
$res = $con->prepare("SELECT PathOfEmployeeImageToSave,PathOfEmployeeImageToShow FROM kataxorisiuser "
."WHERE Surname=? AND Name=?",array($NameAndSurnameOfEmployee[0],$NameAndSurnameOfEmployee[1]));
while($row = $res->fetch())
{
$UploadFle = $row['PathOfEmployeeImageToSave'];
$UploaddFileToShow = $row['PathOfEmployeeImageToShow'];
}
$TeamBlood = $_COOKIE["TeamBlood"];
$ServerName = $_SERVER['SERVER_NAME'];
// echo "Upload file = ".$UploadFile."<br>";
// echo "http://$ServerName/Kataxorisis/$UploaddFileToShow"."<br>";
$CheckIfIndex = 0;
$IndexArrayOfTilesInGreek = 0;
$IndexArrayOfTiles = 0;
$ArrayOfTitles = array();
$ArrayOfTitlesInGreek = array();
$result = $con->prepare("SHOW COLUMNS FROM kataxorisiuser");
while($r = $result->fetch())
{
$ArrayOfTitles[$IndexArrayOfTiles] = $r['Field'];
$IndexArrayOfTiles++;
}
$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 "<script type='text/javascript'>window.location.href='StoixeiaEpilegmenouIpalilou.php';</script>";
?>