-
Notifications
You must be signed in to change notification settings - Fork 0
/
office.php
93 lines (81 loc) · 1.72 KB
/
office.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
<html>
<head>
<style>
h1{color:green;
}
a{text-decoration:none;
color:grey;
}
</style>
</head>
<body bgcolor="FFFFE0">
<script type="text/javascript">
function setImage(img) {
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("mydiv").innerHTML = xmlhttp.responseText;
}
}
try {
xmlhttp.open("GET", "office1.php?image="+img, true);
xmlhttp.send(null);
} catch (e) {
alert(e);
}
}
i=0;
function next(c)
{
i++;
if(i>=c){
alert("This is the last image");
i--;
}
else{
setImage(i);
}
}
function previous()
{
i--;
if(i<0){
alert("This is the first image");
}
else{
setImage(i);
}
}
</script>
<center>
<?php session_start(); ?>
<h1><?php echo $_SESSION['title']; ?></h1>
<?php
$imgpath="./photos/Office/";
$dirPath = dir($imgpath);
$imgArray = array();
while (($file = $dirPath->read()) !== false)
{
if(substr($file,-3)== "gif" || substr($file,-3)=="jpg" || substr($file,-4)=="jpeg" || substr($file,-3)=="png")
{
$imgArray[]=trim($file);
}
}
$dirPath->close();
sort($imgArray);
$c = count($imgArray);
?>
<div id="mydiv">
<?php echo '<img src="'. $imgpath.$imgArray[0].'" width=150 height=130 alt=image>';
echo "<br><br>";
echo $imgArray[0];
?>
</div><br>
<input type=button value=Previous onclick="javascript:previous()">
<input type=button value=Next onclick="javascript:next(<?php echo $c; ?>)">
<br><br>
<a href="rating.php" style="color:blue">Rate this Gallery</a>
<a href="home.php" style="color:blue" target=f2>Home</a>
</center>
</body>
</html>