GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Simple Redirect Script - Recommendations? (https://gfy.com/showthread.php?t=645226)

darnit 08-16-2006 10:13 PM

Simple Redirect Script - Recommendations?
 
Hi,

Im seeking a free php based script that can covert outgoing links to something like this:

http://www.somedomain.com/target/?id=45

Anyone found a good one? This is low volume SE traffic so no need to handle massive volume :upsidedow

<disclaimer>

Yes ive googled the fuck out of it - just dont want to install some crap so looking for a tested one.

</disclaimer>

ablility to work over multiple domains a plus but not necessary

Thanks!

SmokeyTheBear 08-16-2006 10:35 PM

make a directory called "out" like yourserver.com/out/

in that folder make a file called link.txt

put your outgoing links seperated by "~" like this
http://site1.com~http://site2.com~http://site3.com

save this as index.php

Code:

<?php
$url = "link.txt";
$links = file_get_contents($url);
$link = explode('~',$links);
$go = $link[$out];
header("Location: $go");
?>


call it like http://yourserver.com/out/?out=2

Spud 08-16-2006 11:19 PM

Smokey! you kick ass :) :thumbsup :thumbsup

Dagwolf 08-17-2006 01:32 AM

Quote:

Originally Posted by Spud
Smokey! you kick ass :) :thumbsup :thumbsup

Yeah, I guess he kinda does sometimes. :winkwink:

Bro Media - BANNED FOR LIFE 08-17-2006 01:37 AM

or to make it cleaner, you can do this

http://www.site1.com
http://www.site2.com

then use this modified version of his script
Code:

<?php
$url = "link.txt";
$links = file_get_contents($url);
$link = explode('\n',$links);
$go = $link[$out];
header("Location: $go");
?>

that uses the line break code as the explode instead of ~ which makes it easier to edit your file and add/delete links

mrkris 08-17-2006 01:54 AM

Quote:

Originally Posted by SmokeyTheBear
make a directory called "out" like yourserver.com/out/

in that folder make a file called link.txt

put your outgoing links seperated by "~" like this
http://site1.com~http://site2.com~http://site3.com

save this as index.php

Code:

<?php
$url = "link.txt";
$links = file_get_contents($url);
$link = explode('~',$links);
$go = $link[$out];
header("Location: $go");
?>


call it like http://yourserver.com/out/?out=2

Register globals are the devil.

Nookster 08-17-2006 02:54 AM

Quote:

Originally Posted by mrkris
Register globals are the devil.

Code:

if (@ini_get('register_globals')) {
  foreach ($_REQUEST as $var_name => $void) {
      unset($$var_name);
  }
}

:thumbsup

GrouchyAdmin 08-17-2006 02:57 AM

You might also want to test for \r\n, FWIW.. edit that file in Mike-Rowe-Sawft Winders and that's going to be a very broken redirect script.

Bro Media - BANNED FOR LIFE 08-17-2006 11:36 AM

or better yet

Code:

<?php
$link[1] = "http://www.site.com";
$link[2] = "http://www.site2.com";

$id = $_GET['id'];
header("location: " . $link[$id]);
?>



All times are GMT -7. The time now is 05:34 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123