The Unreal Admins Page - Forums

The Unreal Admins Page - Forums (https://unrealadmin.org/forums/index.php)
-   Suggestions (https://unrealadmin.org/forums/forumdisplay.php?f=169)
-   -   Multiple redirect mutator (https://unrealadmin.org/forums/showthread.php?t=21554)

Taboen 5th April, 2007 02:37 PM

Multiple redirect mutator
 
I don't know if this is possible, but it would be great.
My store is, I have my own server, I use uz.gameservers.net as redirect server. The other day I found another redirect server, uz.unrealadmin.org, yours:D(of this site) So I've been trying to find a way of using multiple redirect server, seems that it's not possible.
Could you make one or it that impossible?

Wormbo 5th April, 2007 02:46 PM

First of all: uz.unrealadmin.org is not "my" redirect, just as unrealadmin.org is not "my" site. Secondly, I think the UnrealAdmin redirect already includes the GameServers.net redirect.

Taboen 6th April, 2007 01:01 PM

With yours I ment of this site. About the redirect, I didn't know, thank you!

back4more 21st March, 2012 03:39 AM

just wondering here but what would be involved in making ut capable of having multiple redirect capabilities?.. anyone?

surely it is possible.. what does someone have to do ?.. edit the ipdrv.dll and or some other core file?

medor 21st March, 2012 08:01 AM

which would be cool to It's allocated to the player can set to somes redirections on his UT :

If missing uz on the server the UT player can take on others redirections.With no mismatch.

Mc.Gugi 21st March, 2012 01:26 PM

In UT2004 it is possible to use multiple redirects by writing a mutator which overrides the OverrideDownload function.
This option doesn't exist in UT99 though (afaik).

PizzaMan 21st March, 2012 03:05 PM

Quote:

Originally Posted by back4more (Post 164824)
just wondering here but what would be involved in making ut capable of having multiple redirect capabilities?.. anyone?

You can work around it with a php script.. just remember that every file will be downloaded via the web server where the script is installed.

Here is something {OCA}INSANEroba made for my servers many years ago:

Code:

<?
// Setup your sources here (do NOT put ending / in any location)
// L for local files - path to directory with .uz files relative to script position
// H for http files - complete url of directory with .uz files
// F for ftp files - complete url of directory with .uz files (un/pw as part of url)
// $sources[X] - start with 0 as X and add +1 for each new source
// lower X = higher priority

$sources[0] = array('http://uz.gameservers.net','H');
$sources[1] = array('http://uz.ut-files.com','H');
$sources[2] = array('http://www.snakeservers-redirect.net','H');

// $sources[X] = array('ftp://username:[email protected]/path_to_remote_dir','F');

// ==============================

$file = $_SERVER["QUERY_STRING"];
$sent = false;
foreach ($sources as $source) {
  if (SendFile($source[0],$source[1])) {
      $sent = true;
      break;
      }
  else continue;
  }
if (!$sent) header('HTTP/1.1 404 Not Found');
exit();

function SendFile($location,$type) {
global $file,$urlsize;
$fileok = false;
if ($type == "L" and file_exists($location."/".$file.".uz")) $fileok = true;
elseif ($type == "H" and url_exists($location."/".$file.".uz")) $fileok = true;
elseif ($type == "F" and ftp_exists($location."/".$file.".uz")) $fileok = true;
if ($fileok) {
  header("HTTP/1.1 200 OK");
  header("Status: 200 OK");
  header("Content-Type: text/plain; charset=UTF-8");
  if ($type == "L") header('Content-Length: '.filesize($location."/".$file.".uz"));
  elseif ($type == "H" or $type == "F") header('Content-Length: '.$urlsize);
  $fp1 = fopen($location."/".$file.".uz","r");
  while(!feof($fp1)) echo fgets($fp1, 500000);
  fclose($fp1);
  return true;
  }
else return false;
}

function url_exists($url) {
global $urlsize;
$urlsize = 0;
$a_url = parse_url($url);
if (!isset($a_url['port'])) $a_url['port'] = 80;
$errno = 0;
$errstr = '';
$timeout = 30;
if(isset($a_url['host']) && $a_url['host']!=gethostbyname($a_url['host'])){
  $fid = fsockopen($a_url['host'], $a_url['port'], $errno, $errstr, $timeout);
  if (!$fid) return false;
  $page = isset($a_url['path'])  ?$a_url['path']:'';
  $page .= isset($a_url['query'])?'?'.$a_url['query']:'';
  fputs($fid, 'HEAD '.$page.' HTTP/1.0'."\r\n".'Host: '.$a_url['host']."\r\n\r\n");
  $head = fread($fid, 8192);
  fclose($fid);
  if (preg_match('#^HTTP/.*\s+[200|302]+\s#i', $head)) {
      preg_match('/Content-Length:\s([0-9].+?)\s/', $head, $matches);
      $urlsize = $matches[1];
      return true;
      }
  }
else {
  return false;
  }
}

function ftp_exists($url) {
global $urlsize;
$urlsize = 0;
$a_url = parse_url($url);
if (!isset($a_url['port'])) $a_url['port'] = 21;
$ftp = ftp_connect($a_url['host'],$a_url['post'],10);
if (!$ftp) return false;
if (!ftp_login($ftp, $a_url['user'], $a_url['pass'])) return false;
$ftpsize = ftp_size($ftp, $a_url['path']);
if ($ftpsize <= 0) return false;
else {
  $urlsize = $ftpsize;
  return true;
  }
}
?>


Stuff it in a file, and point your UT server to it. I used it for years with no problems.

UTrustedPlayer 21st March, 2012 04:49 PM

Very nice! It would be great if some of the larger UT groups would share linking into their redirects through something like this. We could effectively end the redirect problem forever.

back4more 21st March, 2012 08:21 PM

Quote:

Originally Posted by PizzaMan (Post 164828)
You can work around it with a php script.. just remember that every file will be downloaded via the web server where the script is installed.

Here is something {OCA}INSANEroba made for my servers many years ago:
.
.
.

Stuff it in a file, and point your UT server to it. I used it for years with no problems.

Thanks Man! , Really appreciate your contribution. Yes I read that there was a way of doing this through php and this could be the script that others have mentioned about the web.

perhaps if it was setup on say ut.files.com / unrealtournament.ut99.fr.free somewhere with a bunch of Redirect servers implemented it would save other less web savvy users the problem of setting it up?.. (just a thought)

Again Thanks :D

back4more 21st March, 2012 08:33 PM

Quote:

Originally Posted by PizzaMan (Post 164828)
Stuff it in a file, and point your UT server to it. I used it for years with no problems.

Just a Quick Query PizzaMan ;

what would be the RedirectToURL= (String) be in order to get this script to kick-in?

Cheers.

PizzaMan 21st March, 2012 08:59 PM

Quote:

Originally Posted by back4more (Post 164836)
what would be the RedirectToURL= (String) be in order to get this script to kick-in?

URL of the php script. Just paste the above code in a text file named "get.php" and host the file on a php enabled web server with the necessary permissions.

You probably also need a .htaccess file:

Code:

Options +FollowSymlinks All -Indexes
order deny,allow
RewriteEngine on
RewriteRule  ^(.*)\.uz$ get.php?$1 [PT]


back4more 21st March, 2012 09:00 PM

Also ... one other small question , how does this fair in regards to File Mismatches and such.. just browsing the code now , and am wondering if it first checks the version of FileX.xxx on the server against FileX.xxx on the Redirect before downloading ... or?.

Cheers.

back4more 21st March, 2012 09:02 PM

Quote:

Originally Posted by PizzaMan (Post 164838)
URL of the php script. Just paste the above code in a text file named "get.php" and host the file on a php enabled web server with the necessary permissions.

You probably also need a .htaccess file:

Code:

Options +FollowSymlinks All -Indexes
order deny,allow
RewriteEngine on
RewriteRule  ^(.*)\.uz$ get.php?$1 [PT]


Wicked :thumbup:

Awesome Man.

back4more 21st March, 2012 09:31 PM

Now Fully Functional.
 
Note: Made important Change , now works!
ok .. have done a quick info.txt and zipped it all up , hopefully this is the complete package with enough info to help anyone wishing to utilize this script;

info.txt
Quote:

UT99 Multi-Redirect Checker V1.0 {OCA}INSANEroba

Originally Posted by PizzaMan;
http://www.unrealadmin.org/forums/sh...834#post164834

This script allows the Admin of a server to utilize multiple redirect servers for clients to download files

from. If the file is not on sources[1] then it will proceed to check the next sources[x] in sequence and

retrieve files from there.

To add redirect URL's to script append to ;

$sources[0] = array('http://uz.gameservers.net','H');
$sources[1] = array('http://uz.ut-files.com','H');
$sources[2] = array('http://www.snakeservers-redirect.net','H');
$sources[3] = array('http://www.redirect_Server.com','X'); 'X' denotes [L]ocal, [H]ttp or [F]tp

for [F]tp un-comment ;
// $sources[X] = array('ftp://username:[email protected]/path_to_remote_dir','F');

and make changes as neccassary.

1. Make Changes above
2. Upload MultiRedir.php to your webserver
3. You may need to make a few changes to your .htaccess file below;
4. Make Changes to Unrealtournament.ini below;

UnrealTournament.ini;
RedirectToURL=http://www.redirect_server.com/

^Actual Path to MultiRedir Script also ending '/' is a must

You will also need a .htaccess file:

.htaccess

#---start---
Options +FollowSymlinks All -Indexes
order deny,allow
RewriteEngine on
RewriteRule ^(.*)\.uz$ MultiRedir.php?$1 [PT]
#----end----

^ create a file in the new directory named .htaccess
* copy and paste the code between the "#---start---" & "#---end---"
> and save to the same Directory as the MultiRedir.php file.

for example ;

www.myhost.com/ut
|- MultiRedir.php
|- .htaccess

small writeup by BFM.

Note: Atm does not contain fix for MisMatched Files

Gtr33tz/Thanks , {OCA}INSANEroba, PizzaMan, www.unrealadmin.org
Download MultiRedir.zip Mediafire.com

hopefully covered all the bases.

PizzaMan 21st March, 2012 10:00 PM

The file name must be the same as the one in the .htaccess file.

And yes you are still fucked if there is a mismatch.

back4more 21st March, 2012 10:50 PM

Quote:

Originally Posted by PizzaMan (Post 164843)
The file name must be the same as the one in the .htaccess file.

And yes you are still fucked if there is a mismatch.

Updated..

back4more 22nd March, 2012 12:22 AM

..maybe something like this could be used to fixed mismatches?..

http://stackoverflow.com/questions/7...for-comparison

2399Skillz 23rd March, 2012 06:09 AM

I suppose I could host this for everyone; I'd need a list of redirects willing to participate though.

iloveut99 23rd March, 2012 06:09 PM

That would be awesome skillz.

PizzaMan 23rd March, 2012 06:50 PM

Quote:

Originally Posted by back4more (Post 164845)
..maybe something like this could be used to fixed mismatches?..

http://stackoverflow.com/questions/7...for-comparison

But how would the script know the hash for the file that you want to download, or even the size? The UT server only requests the file by name. You can see it in-game when the download is finished before it reaches 100 % (where 100 % is the size of the uncompressed file).

You would need to write a mutator that does a quick CRC on the file on the UT server, and then talks to the script which in turn downloads each possible file to the web server, then uncompresses it, then performs a CRC on them all until it finds the correct file... and finally lets the client download it *pew*


All times are GMT +1. The time now is 07:54 AM.

 


All pages are copyright The Unreal Admins Page.
You may not copy any pages without our express permission.