Jump to content
php.lv forumi

Download skaitītājs un tabula lūdzu palīdziet.


Snaip3Rs

Recommended Posts

es skatos forumā ir parādijušies daudz palīgi lūdzu palīdziet man ar download man vajag lai visi faili stabiņā stāv un rāda cik jau download ir šim failam bijis. Lūdzu izpalīdziet cilvēki mīļie!

Edited by Snaip3Rs
Link to comment
Share on other sites

tiesam nav , bet tavu domu sapratu

 

izdari shadi,

 

1. Faila lejupielades linku noradi uz kadu .php failu, teiksim "download.php"

<a href="download.php?file=edgarsa.png">EdgarsA.png</a><br>
<a href="download.php?file=kein.png">Kein.png</a><br>
<a href="download.php?file=googleearth.exe">GoogleEarth.exe</a>

2. izveido download.php ar saturu

<?php
$file=stripslashes(htmlspecialchars($_GET["file"]));
if(is_file("mani_faili/$file")) {
 $contents=@file_get_contents("download_logs/$file.log");
 $saturs="Downloaded at ".date("Y-m-d")." from ip: ".$_SERVER["REMOTE_ADDR"]."\n".($contents ? $contents : "");
 $f=fopen("download_logs/$file.log");
 fwrite($f,$saturs);
 fclose($f);
 header("Location: mani_faili/$file");
}else{
  die("File not found");
} 

?>

3. Lai attelotu skaitu dari shadi

<?php
function getCount($file) {
 $count = 0;
 if(is_file("download_logs/$file.log")) {
  $f = fopen("download_logs/$file.log","r");
  while(fgets($f)) {
$count++;
  }
  fclose($f);
 }
 return $count;
}
?>

EdgarsA.png (Lejupielādēts <?php echo getCount("edgarsa.png"); ?> reizes)<br>
Kein.png (Lejupielādēts <?php echo getCount("kein.png"); ?> reizes)<br>
GoogleEarth.exe (Lejupielādēts <?php echo getCount("googleearth.exe"); ?> reizes)<br>

 

 

 

Nu luuk, kka šādi :), ceru ka palīdzēs, protams ir vēl visādi citādi varianti ar sql, bet tā kā paskaidrot to laikam tev būs pārāk sarežģīti piedāvāju šo

Ā, un :) mapīti "download_logs" chmod (777) ;)

Link to comment
Share on other sites

liels paldies! :) A kur man likt lai attēlotu to skaitu ?

 

AAA un velviena lieta a ka uzlikt lai lejuplādēt varētu tikai ipb lietotāji?

 

$reg = mysql_query("SELECT * FROM ibf_members");

 

Kas vēl klāt jaraksta? vai k\a tur ir?

Edited by Snaip3Rs
Link to comment
Share on other sites

kkur nesi kljuudijies ?

es dabonu shadu te kad uzspiezu lejupladet failu

Warning: fopen() expects at least 2 parameters, 1 given in C:\AppServ\www\download.php on line 6

Warning: fwrite(): supplied argument is not a valid stream resource in C:\AppServ\www\download.php on line 7

Warning: fclose(): supplied argument is not a valid stream resource in C:\AppServ\www\download.php on line 8

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\download.php:6) in C:\AppServ\www\download.php on line 9

Edited by GeRik
Link to comment
Share on other sites

  • 3 months later...

Strādāt no sakuka strādāja bet kad spiedu lejuplādēt uzmetās tāds kāds var sataisīt to skriptu?

Warning: fopen() expects at least 2 parameters, 1 given in C:\hack\AppServ\www\download.php on line 6

 

Warning: fwrite(): supplied argument is not a valid stream resource in C:\hack\AppServ\www\download.php on line 7

 

Warning: fclose(): supplied argument is not a valid stream resource in C:\hack\AppServ\www\download.php on line 8

 

Warning: Cannot modify header information - headers already sent by (output started at C:\hack\AppServ\www\download.php:6) in C:\hack\AppServ\www\download.php on line 9

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...