bestand-uploaden-weergeven-popup-mouseover

Gesponsorde koppelingen

PHP script bestanden

  1. bestand-uploaden-weergeven-popup-mouseover

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<html>
<head>
<title>|| Ngin || Upload ||</title>
<style>
img {
border:0;
}

.headerafb {

font-size:16px;
}

a.borderstyle {
border:1px solid #707070;
}

a.borderstyle:hover {
border:1px solid #6b140e;
}

#div_popupimg {
    z-index: 2;
    position: relative;
    vertical-align:bottom;
    text-align:center;
    border: 1px solid #DEE6EF;
    width: 80px;
    height: 70px;
}

ul {
    list-style-image: url('ul-ruit.GIF') square;
    }

li {
    list-style-image: url('ul-ruit.GIF') square;
    }

</style>


</head>

<body>
<DIV ID="thumbblok"></DIV>

<SCRIPT TYPE="text/javascript">
<!--

Xoffset= 20;
Yoffset= -30;

var old,skn,iex=(document.all),yyy=-1000;

var ns4=document.layers
var ns6=document.getElementById&&!document.all
var ie4=document.all

if (ns4)
skn=document.thumbblok
else if (ns6)
skn=document.getElementById("thumbblok").style
else if (ie4)
skn=document.all.thumbblok.style
if(ns4)document.captureEvents(Event.MOUSEMOVE);
else{
skn.visibility="visible"
skn.display="none"
}
document.onmousemove=get_mouse;

function popup(msg,bak){
var content="<TABLE WIDTH=1 BORDER=1 bordercolor=#6b140e  CELLPADDING=0 CELLSPACING=0><TD ALIGN=center><FONT COLOR=black SIZE=0>"+msg+"</FONT></TD></TABLE>";
yyy=Yoffset;
if(ns4){skn.document.write(content);skn.document.close();skn.visibility="visible"}
if(ns6){document.getElementById("thumbblok").innerHTML=content;skn.display=''}
if(ie4){document.all("thumbblok").innerHTML=content;skn.display=''}
}

function get_mouse(e){
var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
skn.left=x+Xoffset;
var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
skn.top=y+yyy;
}

function stopthumb(){
yyy=-1000;
if(ns4){skn.visibility="hidden";}
else if (ns6||ie4)
skn.display="none"
}

//-->
</SCRIPT>

<SCRIPT LANGUAGE='JAVASCRIPT' TYPE='TEXT/JAVASCRIPT'>
 <!--
var win=null;
function NewWindow(mypage,myname,w,h,pos,infocus){
if(GetCookie("sid") == "999"){return;}
document.cookie="sid=999; Path=/; Expires= " + getFuture(1);
if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}

win.focus();}
function getFuture(f){
var d = new Date();
d.setTime(d.getTime() + (86400000 * f));
return d;
}

function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
  var j = i + alen;
  if (document.cookie.substring(i, j) == arg)
  return getCookieVal (j);
  i = document.cookie.indexOf(" ", i) + 1;
  if (i == 0) break;
  }
  return null;
  }

function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
  endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
// -->
</script>

<table width="453" class="pages" valign="middle" align="center">
            <tr>
            <td style="background-image:url('shadowpage.jpg'); background-repeat:repeat-x;" height="7"></td>
            
            </tr>
            
            <tr><td valign="top">

<table class="style1" height="464" width="453">
<tr><td align="center">
Upload hier een foto of een bestand (onbeperkt)!
</td></tr>
<tr><td align="center">
<font size="164" color="#6b140e">NGIN</font>
<p>

<?php

############
#       NGIN        #
############

$map = "uploadmap/";  //map waar naar geupload moet worden

$max = "10000000000";  //max bytes

$ext = "jpg JPG gif GIF png PNG exe EXE zip ZIP htm HTM html HTML rar RAR mp3 MP3 WMA wma AVI avi MPG mpg MPEG mpeg BMP bmp";  //toegestaande extensies


if ($_POST['Uploaden'])
{
  
    if (!$_FILES['bestand'])  
        print ("Geef een bestand op!");
    else
    {  

        $bestand2 = explode("\\", $_FILES['bestand']['name']);  
        $laatste = count($bestand2) - 1;  
        $bestand2 = "$bestand2[$laatste]";  
        $bestand2 = str_replace(" ", "", "$bestand2");
        $bestand2 = strtolower($bestand2);

        
        $bestand3 = explode(".", $bestand2);  
        $laatste = count($bestand3) - 1;  
        $bestand3 = "$bestand3[$laatste]";  
        $bestand3 = strtolower($bestand3);  
            
        $ext = strtolower($ext);  
        $ext = explode(" ", $ext);  
        $aantal = count($ext);  
        
        for ($tel = 0;$tel < $aantal; $tel++)
        {
  
            if ($bestand3 == $ext[$tel])
            {
  
                $extfout = "nee";  
            }
        }
  
    
        if (!$extfout)
        {
  
            print ("Het bestand <b>$bestand2</b> kan niet worden geupload omdat de extensie niet is toegestaan!, mail ff welke extensie 't is!");  
        }
  
        else  
        {  
            if ($_FILES['bestand']['size'] > $max)  
                print ("Het bestand <b>$bestand2</b> is groter dan $max bytes!");  
            else  
            {  
                $file = $map ."". $bestand2;
                move_uploaded_file($_FILES['bestand']['tmp_name'], "$file");  
                print ("Het bestand <b>\"$bestand2\"</b> is met succes geupload!<br>");
                print ("Het bestand kun je terug vinden voor forums met deze link:<p>");
                print ("<a href='$file'><b>http://student.waerdenborch.nl/9106/$file</b></a>"); //moet uiteraard ipv http://student.waerdenborch.nl/9106/  je eigen adres ervoor!
            }  
        }
    }
}
  

print ("<form method=post action=" . $_SERVER['PHP_SELF'] . " enctype=multipart/form-data>
Bestand: <input type=\"file\" name=\"bestand\"><br>
<input type=\"submit\" name=\"Uploaden\" value=\"Uploaden\"></form>"
);

 ?>


<hr color="6b140e" width="100%">




<!-----------------------------------------------------------READDIR--------------------------------------------------->




De bestanden die al reeds zijn geupload:<br>
<font size="1">(Bij PNG formaten is de achtergrond blauw)</font><p>
<table><tr><td align="left" class="style1">
<div id="ul">
<?php

$dir
= "uploadmap/";  // dezelfde map als bij het uploaden
$exten = array('jpg', 'JPG', 'gif', 'GIF', 'png', 'PNG', 'exe', 'EXE', 'zip', 'ZIP', 'htm', 'HTM', 'html', 'HTML', 'rar', 'RAR', 'mp3', 'MP3', 'WMA', 'wma', 'AVI', 'avi', 'MPG', 'mpg', 'MPEG', 'mpeg', 'BMP', 'bmp');  // de toegestaande extensies
if ($handle = opendir($dir))
{

    while (false !== ($file = readdir($handle))) {
        $bestand = $dir ."". $file ;
        $ext = pathinfo($bestand);
        if(in_array($ext['extension'], $exten))
        {

        for($i=1; $i<=$count-2; $i++)
            $suffix .= '' . $temp[$i];
                 print(ucfirst("-- <a href='$dir". $file ."' onmouseover=\"popup('<img src=$bestand height=100 />','0')\"; onmouseout=\"stopthumb()\"> ".substr($file, 0, strlen($file) - (strlen($file) - strrpos($file, ".")))." </a> --<br>"));
        }
    }

    if (empty($handle))
    {

    
        echo "Nog geen bestanden geupload";
        
    }

    closedir($handle);
}


?>

</div>

</td></tr>
</table>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.