Click to See Complete Forum and Search --> : Compare a client's directory to...


CraftyBarnardo
03-08-2003, 03:04 PM
Hello all,

Sorry if this type of question has been answered before, but I did not see it anywhere and the searches came up empty.

Here is what I am trying to do.

1) I have a text file on my webserver for each day of the week with the files needed to play on my game server for each day.
2) I want a user to be able to select his/her half-life directory from one of my webpages.
3) I want the script to seach the <modname> folder in the user's half-life directory that I specify in the script, and then compare the results of the search to the correct text file on the server.
4) Once the compare is done, I want the page to show the user what files he/she is missing and build a downloadable file that contains the needed files, or at least builds a page showing download links for the missing files based on my mySQL database.

I guess what I am thinking about here is a "windows update" kind of functionality for my regular players on my half-life game servers. I run over 110 custom maps on one server alone, and I thought it would be nice to build a button, on my custom status window for the server, that would allow the new user to grab only the map downloads they need instead of downloading 11 mappacks totalling over 300MB+.

Anyone have any clue how to do something like this? I have tried doing this with asp and php. I got farther on ASP than php, but I am now running linux on my webserver, and the asp doesn't work right anymore. I was told Javascript is the way to go, at least for the client directory search functions.

I appreciate any help that you guys could offer,
Jason (CB)
http://www.halflifemapping.com

AdamBrill
03-08-2003, 03:29 PM
Well, your first problem would be that javascript can't read .txt files. You would have to use PHP or something to do that(which you might have already known). After you read the .txt file, it shouldn't be that hard to check which ones they need and generate a page for them to download them. Here is something like what you should need:
<script language=javascript>
filesneeded = new Array("file.txt",
"file1.txt",
"file2.txt",
"file3.txt");
fileshave = new Array("file.txt",
"file1.txt");
x=0;
z=0;
neededlist = new Array();
while(filesneeded[x])
{
y=0;
found=false;
while(fileshave[y])
{
if(fileshave[y]==filesneeded[x])
{
found=true;
break;
}
y++;
}
if(found==false){
neededlist[z]=filesneeded[x];
z++;
}
x++;
}
</script>
Where filesneeded will be what is read out of the .txt file, and fileshave are the ones they already have. Then neededlist is an array with all the files that they need yet. Will something like that do?

CraftyBarnardo
03-08-2003, 04:01 PM
Yes Adam, that will probably get me started...

Dave, I know that JS will not work for the server-side stuff... I am running php for that. I just need to find a way to make the site "search" the client folder and "submit" the results to the php "results" of the server-side text file. I am asking if anyone has done anything like this, and what they suggest. :)

Thanks for the responses,
Jason

khalidali63
03-08-2003, 04:24 PM
Originally posted by Dave Clark
...I can supply you with an ActiveX Objects .....

Dave

As far as I know with that ActiveXControl every time when it accesses the file it pops up a prompt for the user to say yes or no..unless being a VB Guru as well dave have a hack around it.

:p

Khalid

khalidali63
03-08-2003, 04:29 PM
Would that be setting the security to lowest level?

Khalid

khalidali63
03-08-2003, 04:33 PM
Aah..great..

Cheers

Khalid

CraftyBarnardo
03-08-2003, 04:36 PM
Thanks Dave, that would be great.

I am only trying to search the tfc folder on their machine right now, but I need them to browse to their half-life directory since some of the users do not install half-life to the default directory.

I am also only trying to search for files ending in ".bsp".

Any help would definitely be appreciated.

Thanks!
Jason

CraftyBarnardo
03-08-2003, 09:14 PM
Thanks Dave. :)