Is this IP Downloading or not (How Does Rapidshare works)
Moderator: General Moderators
Is this IP Downloading or not (How Does Rapidshare works)
How does Rapidshare Works
How can I know wheather This IP is downloading from my site or not
How can I know wheather This IP is downloading from my site or not
Last edited by nwp on Sat Mar 03, 2007 12:33 pm, edited 2 times in total.
- neel_basu
- Forum Contributor
- Posts: 454
- Joined: Wed Dec 06, 2006 9:33 am
- Location: Picnic Garden, Kolkata, India
You Can't Do It Just With PHP OnlyApache Writes Log Messages On apache/logs/access.log When User/Visitors asks For A Files To Download.
Suppose Your Visitor Is Asking for a File Names Photo_Album.zip on your root Folder(http://localhost/Photo_Album.zip) with Filesize 4774381 Bites A Log Messege Like This
You Can Use fopen() , fread To Read The Log File also Use Can Use Shell Scripting To Read The Log File. And The Visitor's IP Is also written There.
Suppose Your Visitor Is Asking for a File Names Photo_Album.zip on your root Folder(http://localhost/Photo_Album.zip) with Filesize 4774381 Bites A Log Messege Like This
will get written By Apache Itself.access.log wrote:127.0.0.1 - - [03/Mar/2007:23:46:33 +0530] "GET /Photo_Album.zip HTTP/1.1" 200 4774381
You Can Use fopen() , fread To Read The Log File also Use Can Use Shell Scripting To Read The Log File. And The Visitor's IP Is also written There.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Have you found the function readfile()?
- neel_basu
- Forum Contributor
- Posts: 454
- Joined: Wed Dec 06, 2006 9:33 am
- Location: Picnic Garden, Kolkata, India
This Is How You can do something like rapidshare
-----------------------------------------------------------------
1.The User Requests For A File To download.php (POST/SESSION)
2.IF Request is not valid (invalid session or any error like 404 or 500) Send a HeaderAnd Then Write Your php Code
IF Request Is Valid Send a Header As I use Opera Browser I Prefer and then stream the files Using readfile().
3.But Just Before Starting Download Do Step 5 and if Passed log the visitor's IP Download Time and etc....
to a DB or csv Or log. then Start Downloading if Not passed Request Is not Valid
4.Remove that line from log after finishing the download (after compleating readfile())
5..And Now When the User Requests For another file Check from the log wheather that Visitors IP is Logged Or Not If Logged The request Not Valid return to Step1 else valid
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Safe Way Is to Keep The Files On a FTP Server (With Username and Password) and Pull The Files With readfile().
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
But Remember : May not Work Properly So You should use
-----------------------------------------------------------------
1.The User Requests For A File To download.php (POST/SESSION)
2.IF Request is not valid (invalid session or any error like 404 or 500) Send a Header
Code: Select all
header("Content-Type: text/html");IF Request Is Valid Send a Header
Code: Select all
header ("Content-Type: application/force-download; name=\"$filename\"");Code: Select all
header('Content-Type: application/octet-stream');3.But Just Before Starting Download Do Step 5 and if Passed log the visitor's IP Download Time and etc....
to a DB or csv Or log. then Start Downloading if Not passed Request Is not Valid
4.Remove that line from log after finishing the download (after compleating readfile())
5..And Now When the User Requests For another file Check from the log wheather that Visitors IP is Logged Or Not If Logged The request Not Valid return to Step1 else valid
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Safe Way Is to Keep The Files On a FTP Server (With Username and Password) and Pull The Files With readfile().
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
But Remember :
Code: Select all
readfile("ftp://" . "User_name" . ":" . "password" . "@domain.com/file.zip");Code: Select all
readfile(ftp_get($conn, $local_file, $server_file, FTP_BINARY));