Ik zoek leestekens. Zullen we elkaar helpen?
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
Link gekopieerd
?
Onbekende gebruiker
07-09-2004 21:49
ik heb nu download.php?id=test.zip maar ik zou graag willen download.php?id=1 ik gebruik een txt bestand nu
Link gekopieerd
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?
Link gekopieerd
?
Onbekende gebruiker
07-09-2004 22:13
¤¤¤¤ admin.php ¤¤¤¤
<title></title>
<?
$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
Link gekopieerd
Allereerst, je gebruikt oude superglobals.
$HTTP_GET_VARS is $_GET
Link gekopieerd
ok die heb ik al verandert nu
Link gekopieerd