-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd.php
executable file
·131 lines (118 loc) · 3.97 KB
/
add.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
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
// include config file
include "config.php";
// ***----- Don't change below this line unless you know what you are doing -----***** \\
session_save_path("/home/users/web/b1814/as.sweetphp/phpsessions");
session_start();
// Process login from login.php
if($submit == "login") {
if($uname == $username && $pw == $password) {
$MyUsername = $username;
$MyPassword = $password;
$MyLogin = "true";
session_register("MyLogin");
session_register("MyUsername");
session_register("MyPassword");
}
else {
die("<div align=\"center\">Error: Username and password don't match.<br /><a href='javascript:history.back()'>Try Again</a></div>");
}
}
if($MyLogin != "true" || $MyUsername != $username || $MyPassword != $password) {
include "login.php";
die();
//die("<div align=\"center\">Error: You must be logged in to access this area.<br /><a href='login.php'>Go Login</a></div>");
}
$msg = "";
if(!empty($userfile)) {
// Copy extension icon to folder and delete tmp file
$newfile = $ext.".gif";
copy($userfile, "./icons/$newfile") or die("Can't upload file to that location");
unlink($userfile);
$msg = "New Extension Added Successfully";
// Add in the new extension to the switch statement
$filename = "functions.php";
$temp = 'case "'.$ext.'";
$type = "'.$dsc.'";
$image = "'.$newfile.'";
break;
//--- New Here---//';
$fcontents = implode('', file($filename));
$fcontents = ereg_replace("//--- New Here---//", $temp, $fcontents);
$fp = fopen($filename, "w+");
fwrite($fp, $fcontents);
fclose($fp);
}
echo "
<html>
<head>
<title>- Add Extension and Icon -</title>
<link rel=\"stylesheet\" type=\"text/css\" href=\"themes/".$ThemeFolder."style.css\">
</head>
<body class=\"body01\">
<table class=\"tbl01\">
<tr>
<td class=\"td08\" valign=\"top\"> </td>
</tr>
<tr>
<td width=\"100%\" align=\"center\" valign=\"middle\">
<br />
<p class=\"txt01\">".$msg."</p>
<form method=\"POST\" action=\"add.php\" enctype=\"multipart/form-data\">
<table class=\"tbl02\">
<tr>
<td width=\"100%\" class=\"td01\" align=\"center\" colspan=\"2\"><p class=\"txt01\">For best results, use 16 x 16 gif files for the icons.</td>
</tr>
<tr>
<td class=\"td09\" align=\"right\"> </td>
<td class=\"td09\"> </td>
</tr>
<tr>
<td class=\"td09\" align=\"right\"><p class=\"txt02\">Choose the icon image file:
<br />
(must be a gif file)
</td>
<td class=\"td09\" valign=\"top\"><input type=\"file\" name=\"userfile\" size=\"20\"></td>
</tr>
<tr>
<td class=\"td09\" align=\"right\"> </td>
<td class=\"td09\" valign=\"top\"> </td>
</tr>
<tr>
<td class=\"td09\" align=\"right\"><p class=\"txt02\">Type the extension for the file type: <br>
(ex: pdf) </td>
<td class=\"td09\" valign=\"top\"><input type=\"text\" name=\"ext\" size=\"5\"></td>
</tr>
<tr>
<td class=\"td09\" align=\"right\"> </td>
<td class=\"td09\" valign=\"top\"> </td>
</tr>
<tr>
<td class=\"td09\" align=\"right\"><p class=\"txt02\">Short file description: <br>
(ex: Acrobat File) </td>
<td class=\"td09\" valign=\"top\"><input type=\"text\" name=\"dsc\" size=\"20\"></td>
</tr>
<tr>
<td class=\"td09\" align=\"right\"> </td>
<td class=\"td09\"> </td>
</tr>
<tr>
<td class=\"td09\" align=\"right\"> </td>
<td class=\"td09\"><input type=\"submit\" name=\"submit\" value=\"add\"></td>
</tr>
<tr>
<td class=\"td09\" align=\"right\"> </td>
<td class=\"td09\" align=\"right\"><a href='login.php?action=logout' class=\"link01\">Logout</a> </td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td class=\"td08\" align=\"right\" valign=\"bottom\"> </td>
</tr>
</table>
</body>
</html>
";
?>