-
Notifications
You must be signed in to change notification settings - Fork 0
/
addcard.php
46 lines (38 loc) · 1.15 KB
/
addcard.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
<?php
session_start();
$flag=0;
$allowed = array("jpg","jpeg","gif","png","JPG","JPEG","GIF","PNG"," ");
$ext1=end(explode(".", $_FILES["kurthiimg"]["name"]));
$ext2=end(explode(".", $_FILES["topsimg"]["name"]));
$ext3=end(explode(".", $_FILES["leggingsimg"]["name"]));
if(!empty($_FILES['kurthiimg']['name']))
{ unlink(glob("images/kurthi.*")[0]);
if((!(in_array($ext1, $allowed)))) {
$_SESSION["message"]=3;
$flag=1;
}
}
if(!empty($_FILES['topsimg']['name']))
{ unlink(glob("images/tops.*")[0]);
if((!(in_array($ext2, $allowed)))) {
$_SESSION["message"]=3;
$flag=1;
}
}
if(!empty($_FILES['leggingsimg']['name']))
{
unlink(glob("images/leggings.*")[0]);
if((!(in_array($ext3, $allowed)))) {
$_SESSION["message"]=3;
$flag=1;
}
}
if(!$flag)
{
move_uploaded_file($_FILES["kurthiimg"]["tmp_name"], "images/"."kurthi.".$ext1);
move_uploaded_file($_FILES["topsimg"]["tmp_name"], "images/"."tops.".$ext2);
move_uploaded_file($_FILES["leggingsimg"]["tmp_name"], "images/"."leggings.".$ext3);
$_SESSION["message"]=5;
}
echo "<meta http-equiv='refresh' content='2;url=admin.php'>";
?>