PHP Coding Question

nam6641

Supreme Member
Nov 15, 2008
1,470
926
i want to set up a php rotator redirect... i tried modifying a code i found on here but it always keeps redirecting to Yah00 and never G00gle or Ask.

any clues from PHP coders?

Code:
<?php
//Add as many links you want
$mylink[] = header( 'Location: http://ask.com' ) ;

$mylink[] = header( 'Location: http://google.com' ) ;

$mylink[] = header( 'Location: http://yahoo.com' ) ;




// this will display the random link
echo $mylink[array_rand($mylink)];
?>
 
Try this
Code:
<?php
$mylink[0] = "http://ask.com";

$mylink[1] = "http://google.com";

$mylink[2] = "http://yahoo.com";
$lenght = count($mylink) - 1;
$i = rand(0, $lenght);
header('Location: '.$mylink[$i]);
?>
or this
Code:
<?php
	$i = rand(0, 2);
	if($i==0){
		header('Location:http://yahoo.com');
	}
	if($i==1){
		header('Location:http://google.com');
	}
	if($i==2){
		header('Location:http://ask.com');
	}
		
?>
 
Back
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features and essential functions on BlackHatWorld and other forums. These functions are unrelated to ads, such as internal links and images. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock