🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.php
Article #243

Re: get.php i inne skrypty

#243
From: Marcin Gibuła
Date: Sun, 19 Aug 2001 16:45
33 lines
1823 bytes
> bądź bynajmniej wskazać źródło i dać trochę podpowiedzi, dzięki którym

Podpowiedzi? Moze byc :)
Masz dwa pliki z baza danych (np. gdbm);
W jednym kluczem jest skrot, a wartoscia rzeczywista nazwa pliku, w drugim
kluczem jest skrot, a wartoscia liczba sciagniec.

W pliku o nazwie np. get.php masz mniej wiecej cos takiego (tylko schemat
oczywiscie):

$name = $HTTP_GET_VARS['file'];

$counter_db = dba_open("count.db","c","gdbm");
$names_db = dba_open("names.db","c","gdbm");

$count = dba_fetch($counter_db,$name);
$path = dba_fetch($names_db,$name);

dba_replace($counter_db,++$count);
header("Location: $path");

dba_close($counter_db);
dba_close($names_db);

Wywolujesz jako get.php?file=costam, a w bazach masz np cos takiego:
w counter.db: costam => 2
w named.db: costam => pliki/cosik.zip

To mozna zrobic jeszcze na wiele sposobow, ten wymagal chyba najmniej
pisania :)

--
MG
Technical Details
Message-ID: <9loq46$b6m$1@news.tpi.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!pcmedia.com.pl!news.man.szczecin.pl!news.task.gda.pl!news.tpi.pl!not-for-mail
References: <9lon1k$nu$1@news.tpi.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!pcmedia.com.pl!news.man.szczecin.pl!news.task.gda.pl!news.tpi.pl!not-for-mail
From: Marcin Gibuła <sh@xcom.pl>
Newsgroups: pl.comp.lang.php
Subject: Re: get.php i inne skrypty
Date: Sun, 19 Aug 2001 18:45:46 +0200
Organization: tp.internet - http://www.tpi.pl
Lines: 35
Message-ID: <9loq46$b6m$1@news.tpi.pl>
References: <9lon1k$nu$1@news.tpi.pl>
NNTP-Posting-Host: pm70.wroclaw.sdi.tpnet.pl
X-Trace: news.tpi.pl 998239174 11478 217.96.156.70 (19 Aug 2001 16:39:34 GMT)
X-Complaints-To: usenet@tpi.pl
NNTP-Posting-Date: 19 Aug 2001 16:39:34 GMT
X-Newsreader: Microsoft Outlook Express 6.00.2462.0000
X-MSMail-Priority: Normal
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2462.0000
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit