Go Back   FlashFXP Forums > > > >

! Requests Need a script or some sort of cool .bat file ? Ask here!

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-15-2005, 04:59 AM   #1
stLancer_2
Member
 
Join Date: Aug 2003
Posts: 58
Default [FILLED]-no leech during race script

is there a script that prevent leecher from downloading staff during racing?
stLancer_2 is offline   Reply With Quote
Old 04-15-2005, 09:48 AM   #2
mr_F_2
Senior Member
 
Join Date: Jan 2004
Posts: 203
Default

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)

Code:
#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
mr_F_2 is offline   Reply With Quote
Old 04-15-2005, 01:34 PM   #3
deo
Banned
 
Join Date: Feb 2005
Posts: 46
Default

or glob for incomplete tag
deo is offline   Reply With Quote
Old 04-15-2005, 02:58 PM   #4
mr_F_2
Senior Member
 
Join Date: Jan 2004
Posts: 203
Default

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 is offline   Reply With Quote
Old 04-15-2005, 04:43 PM   #5
mr_F_2
Senior Member
 
Join Date: Jan 2004
Posts: 203
Default

here, try this (attached file)

Quote:
[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):

Code:
//     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
mr_F_2 is offline   Reply With Quote
Old 04-15-2005, 04:58 PM   #6
jeza
Senior Member
ioFTPD Scripter
 
jeza's Avatar
 
Join Date: May 2003
Posts: 530
Default

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
jeza is offline   Reply With Quote
Old 04-15-2005, 06:04 PM   #7
mr_F_2
Senior Member
 
Join Date: Jan 2004
Posts: 203
Default

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 is offline   Reply With Quote
Old 04-15-2005, 08:55 PM   #8
mr_F_2
Senior Member
 
Join Date: Jan 2004
Posts: 203
Default better version

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!)
mr_F_2 is offline   Reply With Quote
Old 04-17-2005, 08:27 PM   #9
stLancer_2
Member
 
Join Date: Aug 2003
Posts: 58
Post

thank you very much. it works for me.

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.
stLancer_2 is offline   Reply With Quote
Old 05-07-2007, 02:53 PM   #10
M4Tr1x
Junior Member
 
Join Date: Feb 2004
Posts: 9
Angry ioNoDLRace Error !!

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!!
M4Tr1x is offline   Reply With Quote
Old 06-28-2007, 08:16 AM   #11
c0d3.us
Junior Member
 
Join Date: Mar 2007
Posts: 10
Default

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%'
__________________
in no sense innocence
c0d3.us c0d3.biz c0d3.info
c0d3.us is offline   Reply With Quote
Reply

Tags
downloading, leecher, racing, script, staff

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Download grinding to a halt bruceh General Discussion 6 09-07-2004 08:29 AM


All times are GMT -5. The time now is 03:12 PM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)