Download script
ik ben op zoek naar een download script die downloads neer zet als download.php?id=1 en een download stats der bij wie o wie kan mij helpen liefst zonder my sql maar als niet anders kan dan liever met mysql
Vertel even hoe je de downloads op wilt slaan... (neem aan gewoon in een map op de server, aangezien je liever geen MySQL (of andere DB?) gebruikt...
Elwin
ik heb nu download.php?id=test.zip maar ik zou graag willen download.php?id=1 ik gebruik een txt bestand nu
Als je laat zien wat je script nu is kunnen we kijken of het eenvoudig aan te passen is. Wat is er mis met de methode die je nu gebruikt trouwens?
<title></title>
Code (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
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
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
<?
$password = "admin"; // password for admin//
$inputpass = $HTTP_GET_VARS["inputpass"];
$file = $HTTP_GET_VARS["file"];
$config = file("config.txt");
$ipin = ereg_replace("(\r\n|\n|\r)", "", $config[2]);
$ip = $_SERVER['REMOTE_ADDR'];
if("$inputpass" !== "$password" && "$ipin" !== "$ip" && "$inputpass" !== ""){
echo "<center>Verkeerd password<br> Ga a.u.b <a href=admin.php>Terug</a> en probeer opnieuw
</center>";
}else{
if("$inputpass" == "$password" ){
$filename = "config.txt";
$file_content = file($filename);
$x = count($file_content);
$fp = fopen($filename, "w+");
$file_content[2] = "$ip
";
$y = 0;
while($y < $x)
{
fwrite($fp, $file_content[$y]);
$y++;
}
fclose($fp);
}
$ip = $_SERVER['REMOTE_ADDR'];
if ("$ipin" !== "$ip" && "$inputpass" == ""){
echo '
<form name="form1" method="get" action="admin.php">
<center><font size="2">Type Hier Je admin password</font><br>
<input name="inputpass" type="text" id="inputpass">
<input type="submit" name="Submit" value="ok"></center>
</form>';
}else{
$ip = $_SERVER['REMOTE_ADDR'];
$datafile = file("data.txt");
$linkscount = sizeof($datafile);
if(strpos($config[1], "+")){
$hour = str_replace('+', '', $config[1]);
$datenoww = (3600 * $hour);
$datenow = date("M d h:iA",time() + $datenoww);
}
if(strpos($config[1], "-")){
$hour = str_replace('-', '', $config[1]);
$datenoww = (3600 * $hour);
$datenow = date("M jS h:iA",time() - $datenoww);
}
$JD = join($datafile);
$thits = round(substr_count("$JD", "()"));
echo"
<table width=93% height=187 border=1 align=center cellpadding=0 cellspacing=0 bordercolor=#5C7583>
<tr>
<td height=109 <strong>
<center>
<p>Download Stats</p>
<table width=33% height=26 border=1 cellpadding=0 cellspacing=0 >
<tr>
<td><center><font size=2>Je bent ingelogt als <strong>$ip</strong><br> Date <strong>$datenow</strong> <br>Je hebt <strong>$linkscount</strong> Link(s)<br>
A Total of <strong>$thits</strong> download(s)
</center></font></td>
</tr>
</table>
<form name=form1 method=get action=admin.php>
<p><font size=2>Add nieuw download</font><br>
<input name=file type=text id=file value=\"Bestand die je online zet\" size=40>
<input type=submit name=Submit value=Add>
</p>
</p>
</form>
</center></strong></td>
</tr>
<tr>
<td height=45>
";
$addfile = $HTTP_GET_VARS["file"];
if(isset($addfile)){
foreach($datafile as $line){
$br = explode("^^",$line);
$pathtof = ereg_replace("(\r\n|\n|\r)", "", $br[0]);
if("$addfile" == "$pathtof"){
$error = "$addfile already has been added";
$addtog = "found";
}
}
if("$addtog" == ""){
$input = "$file^^$datenow^^\n";
$fp = fopen("data.txt","a+");
fputs($fp,$input);
fclose($fp);
echo "<meta http-equiv=refresh content=0;URL=admin.php>";
}
}
$delete = $HTTP_GET_VARS["delete"];
if(isset($delete)){
$file_content = file("data.txt");
$x = count($file_content);
$fp = fopen("data.txt", "w+");
$file_content[$delete] = "";
$y = 0;
while($y < $x)
{
fwrite($fp, $file_content[$y]);
$y++;
}
fclose($fp);
echo "<meta http-equiv=refresh content=0;URL=admin.php>";
}
foreach($datafile as $linenum => $line){
$br = explode("^^",$line);
$hits = (substr_count("$br[2]", "()") );
$hitaw = explode("()",$br[2]);
if ("$hitaw[0]" !== ""){
$end = "no downloads";
}else{
$end = end($hitaw);
$end = explode("|",$end);
$end = "$end[0]";
}
if(!isset($fileerror)){ $fileerror = "none"; }
echo "
<table width=100% border=1 cellspacing=0 cellpadding=0>
<td width=19% height=11>Bestand</td>
<td width=7%>Bestand gedownload</td>
<td width=15%>Het laatst Gedownload</td>
<td width=13%>Datum Geadd</td>
<td width=6% rowspan=2><div align=center><a href=log.php?log=$linenum target=_new>log</a> <font size=2> </font></div></td>
<td width=28%><font size=2><center><a href=\"log.php?viewcode=true&log=$br[0]\" target=_new>Counter Code<a/><br>Bestand link</center></font> </td>
<td width=4% rowspan=2><a href=admin.php?delete=$linenum><img src=del.gif border=0 alt=\"Verwijder link uit database\"></a></td>
</tr>
<td height=17><font size=2>$br[0]</font></td>
<td><font size=2>
<center>$hits</center></font></td>
<td><font size=2>$end</font></td>
<td><font size=2>$br[1]</font></td>
<td><font size=2><a href=\"download.php?file=$br[0]\">download.php?file=$br[0]<a/></font></td>
</tr>
</table>
<hr>
";
}
if(isset($error)){
echo "<script language='Javascript'>
alert (\"$error\")
</script> ";
}
}
}
?>
$password = "admin"; // password for admin//
$inputpass = $HTTP_GET_VARS["inputpass"];
$file = $HTTP_GET_VARS["file"];
$config = file("config.txt");
$ipin = ereg_replace("(\r\n|\n|\r)", "", $config[2]);
$ip = $_SERVER['REMOTE_ADDR'];
if("$inputpass" !== "$password" && "$ipin" !== "$ip" && "$inputpass" !== ""){
echo "<center>Verkeerd password<br> Ga a.u.b <a href=admin.php>Terug</a> en probeer opnieuw
</center>";
}else{
if("$inputpass" == "$password" ){
$filename = "config.txt";
$file_content = file($filename);
$x = count($file_content);
$fp = fopen($filename, "w+");
$file_content[2] = "$ip
";
$y = 0;
while($y < $x)
{
fwrite($fp, $file_content[$y]);
$y++;
}
fclose($fp);
}
$ip = $_SERVER['REMOTE_ADDR'];
if ("$ipin" !== "$ip" && "$inputpass" == ""){
echo '
<form name="form1" method="get" action="admin.php">
<center><font size="2">Type Hier Je admin password</font><br>
<input name="inputpass" type="text" id="inputpass">
<input type="submit" name="Submit" value="ok"></center>
</form>';
}else{
$ip = $_SERVER['REMOTE_ADDR'];
$datafile = file("data.txt");
$linkscount = sizeof($datafile);
if(strpos($config[1], "+")){
$hour = str_replace('+', '', $config[1]);
$datenoww = (3600 * $hour);
$datenow = date("M d h:iA",time() + $datenoww);
}
if(strpos($config[1], "-")){
$hour = str_replace('-', '', $config[1]);
$datenoww = (3600 * $hour);
$datenow = date("M jS h:iA",time() - $datenoww);
}
$JD = join($datafile);
$thits = round(substr_count("$JD", "()"));
echo"
<table width=93% height=187 border=1 align=center cellpadding=0 cellspacing=0 bordercolor=#5C7583>
<tr>
<td height=109 <strong>
<center>
<p>Download Stats</p>
<table width=33% height=26 border=1 cellpadding=0 cellspacing=0 >
<tr>
<td><center><font size=2>Je bent ingelogt als <strong>$ip</strong><br> Date <strong>$datenow</strong> <br>Je hebt <strong>$linkscount</strong> Link(s)<br>
A Total of <strong>$thits</strong> download(s)
</center></font></td>
</tr>
</table>
<form name=form1 method=get action=admin.php>
<p><font size=2>Add nieuw download</font><br>
<input name=file type=text id=file value=\"Bestand die je online zet\" size=40>
<input type=submit name=Submit value=Add>
</p>
</p>
</form>
</center></strong></td>
</tr>
<tr>
<td height=45>
";
$addfile = $HTTP_GET_VARS["file"];
if(isset($addfile)){
foreach($datafile as $line){
$br = explode("^^",$line);
$pathtof = ereg_replace("(\r\n|\n|\r)", "", $br[0]);
if("$addfile" == "$pathtof"){
$error = "$addfile already has been added";
$addtog = "found";
}
}
if("$addtog" == ""){
$input = "$file^^$datenow^^\n";
$fp = fopen("data.txt","a+");
fputs($fp,$input);
fclose($fp);
echo "<meta http-equiv=refresh content=0;URL=admin.php>";
}
}
$delete = $HTTP_GET_VARS["delete"];
if(isset($delete)){
$file_content = file("data.txt");
$x = count($file_content);
$fp = fopen("data.txt", "w+");
$file_content[$delete] = "";
$y = 0;
while($y < $x)
{
fwrite($fp, $file_content[$y]);
$y++;
}
fclose($fp);
echo "<meta http-equiv=refresh content=0;URL=admin.php>";
}
foreach($datafile as $linenum => $line){
$br = explode("^^",$line);
$hits = (substr_count("$br[2]", "()") );
$hitaw = explode("()",$br[2]);
if ("$hitaw[0]" !== ""){
$end = "no downloads";
}else{
$end = end($hitaw);
$end = explode("|",$end);
$end = "$end[0]";
}
if(!isset($fileerror)){ $fileerror = "none"; }
echo "
<table width=100% border=1 cellspacing=0 cellpadding=0>
<td width=19% height=11>Bestand</td>
<td width=7%>Bestand gedownload</td>
<td width=15%>Het laatst Gedownload</td>
<td width=13%>Datum Geadd</td>
<td width=6% rowspan=2><div align=center><a href=log.php?log=$linenum target=_new>log</a> <font size=2> </font></div></td>
<td width=28%><font size=2><center><a href=\"log.php?viewcode=true&log=$br[0]\" target=_new>Counter Code<a/><br>Bestand link</center></font> </td>
<td width=4% rowspan=2><a href=admin.php?delete=$linenum><img src=del.gif border=0 alt=\"Verwijder link uit database\"></a></td>
</tr>
<td height=17><font size=2>$br[0]</font></td>
<td><font size=2>
<center>$hits</center></font></td>
<td><font size=2>$end</font></td>
<td><font size=2>$br[1]</font></td>
<td><font size=2><a href=\"download.php?file=$br[0]\">download.php?file=$br[0]<a/></font></td>
</tr>
</table>
<hr>
";
}
if(isset($error)){
echo "<script language='Javascript'>
alert (\"$error\")
</script> ";
}
}
}
?>
</p></td>
</tr>
</table>
<style type="text/css">
<!--
body,td,th {
color: #FFFFCC;
}
body {
background-color: #000000;
}
a:link {
color: #FFCC99;
}
a:visited {
color: #FFCC99;
}
a:hover {
color: #FFCC99;
}
a:active {
color: #FFCC99;
}
-->
</style>
ik wil het via id=1 omdat ik het makkelijker vind voor op de irc server
$HTTP_GET_VARS is $_GET
ok die heb ik al verandert nu