View Full Version : [REQ]-no leech during race script
stLancer_2
04-15-2005, 04:59 AM
is there a script that prevent leecher from downloading staff during racing? :D
mr_F_2
04-15-2005, 09:48 AM
the best way to do this is check to see if a file exists in a given directory that is created after the race is complete. because the only way to tell if a race is over is to do the crc check, making that file should be a function of a zipscript. after that you just need a few lines of code to block users from downloading or allow it within that file,
something like (to be put on the retr event)
#define FILE_IDENTIFIER ".ioFTPD.race.over"
int
main(int argc, char **argv)
{
char *physical_path;
char *fpath;
FILE *handle;
physical_path = getenv("REALPATH");
fpath = malloc(sizeof(char) * (strlen(physical_path) + strlen(FILE_IDENTIFIER) + 1));
sprint(fpath,"%s\\%s",physical_path,FILE_IDENTIFIER);
if (!(handle=fopen(fpath,"r"))) //check if file exists
return 1; //prevents download
else
fclose (handle);
return 0; //allows download
}
if your zipscript creates a unique file when the release is complete or if you know how to add that code (if it's TCL or you have the C code) i can compile the above ^^^ for you i just need that filename so that it actually works :P
or glob for incomplete tag
mr_F_2
04-15-2005, 02:58 PM
HMM
gimme the syntax of your headers and if they are file or folder and i will compile you the script, it will check to see if *100%*complete* exists in whatever format your headers uses (folder or file) .. let me knokw if your completion headers look different from the above mentioned order (*percentage*complete*)
mr_F_2
04-15-2005, 04:43 PM
here, try this (attached file)
[FTP_Pre-Command_Events]
retr = EXEC ..\scripts\ionoDLrace\ionoDLrace.exe *COMPLETE*100%*
where *COMPLETE*100%* can be replaced by anything (file or directory) that can be found
in the directory ONLY after a race is complete
this is prettty much all the code (besides the wildcardmatch):
// script by mr_F http://nrscripts.staghosting.com
//
//
//
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <windows.h>
#include "wildcardmatch.h"
#define DEBUG 0
#define DEBUG_PATH "C:\\"
int raceover(char *the_path, char *blockvar);
int
main(int argc, char **argv)
{
char *physical_path;
char *skiplist[] ={"*.nfo","*.jpg","*.m3u","*.sfv","*.log","*.txt","*.avi","*.diz","*.mpg","*.mpeg",NULL};
int i;
#if (DEBUG)
physical_path = DEBUG_PATH;
#else
physical_path = getenv("REALPATH");
#endif
for (i=0; skiplist[i]!=NULL; i++)
if (wild_match(skiplist[i],argv[3]))
return 0;
if (raceover(physical_path, argv[1]))
return 0;
printf("550 %s: Permission denied. No downloading while this race is in progress.\n",argv[3]);
return 1;
}
int
raceover(char *the_path, char *blockvar)
{
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
char *pathonly;
pathonly = malloc(sizeof(char) * (strlen(the_path)+512));
hFind=NULL;
strcpy(pathonly,the_path);
strcat(pathonly,blockvar);
FindFileData.cFileName[0]=0;
hFind=FindFirstFile(pathonly, &FindFileData);
if (hFind!=0xffffffff)
return 1;
FindClose(hFind);
free(pathonly);
return(0);
}
source code included, minus, agian, the wildcard match. if you need it to compile your own let me know. the skiplist allows users to download sample files and stuff, dont know if it's complete enough for your liking
i think its good to add skip flag like 1N or something
skip pwd "/mp3/.pre/*", ...
if (ratio 0 and (not skip_flag or not skip_pwd))
block
mr_F_2
04-15-2005, 06:04 PM
it's exam time, i didn't have much time to spend on it.
things like that can be added very simply and will when i have $time :P
mr_F_2
04-15-2005, 08:55 PM
OK
changed syntax, and uploaded it to my server b/c mods here aren't allowing the attachment yet, and i can't find hte link to the script add page
setup:
add to
[FTP_Pre-Command_Events]
retr = EXEC ..\scripts\ionoDLrace\ionoDLrace.exe *COMPLETE*100%* "/pre/*" "/request/*"
parameters added after the complete tag will be directories that are skipped (you can dl from them when a race is happening). also flag N will allow user to download anything anytime (no race prevention)..
order is
- has N? YES ->allow download
- skip dir? YES -> allow download
- skip filename? YES ->allowdownload
- is the race going? YES -> deny
NO? allow
get it @ http://nrscripts.staghosting.com/getionoDLrace.php
peace (now time for the weakerthans constantines show!)
stLancer_2
04-17-2005, 08:27 PM
thank you very much. it works for me. :D
edit: could you please add one more setting? allow people to start leeching after X mins even if the race is not completed. this maybe helpful when some rls is never being completed becoz zip-script error or other fault.
M4Tr1x
05-07-2007, 02:53 PM
I have problems with this script!!
This is the Dir where release is complete :
[***] - ( 672M 47F - COMPLETE ) - [***]
In ioFTPD.ini i add :
retr = EXEC ..\scripts\ionoDLrace\ionoDLrace.exe *COMPLETE* "/!ADMiN/*" "/!PRiVATE/*" "/+PRE/*" "/requests/*"
When i download a file from that dir, i get :
[R] RETR ***-*****.r04
[R] 550 ***-*****.r04: Permission denied. Race in progress.
[R] Transfer Failed!
Which is the problem?? The "COMPLETE DIR" is present, and *COMPLETE* too...
Help me, plese!!
c0d3.us
06-28-2007, 08:16 AM
you don't have '100%' in your tag, so the exe will never find it and think it's complete, you need to add a unique identifier to your complete tag for the exe to look for. maybe '-complete-' if you don't want to use '100%' :cool:
vBulletin® v3.8.11 Alpha 3, Copyright ©2000-2024, vBulletin Solutions, Inc.