NameSilo

Help! Need a bit of code.

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Watch

Jeffler

Established Member
Impact
7
I need something that will redirect someone to a random page. So if they're at index.html/php/whatever, and the code has a list of a.com, b.com, or c.com, it picks a random one and redirects them to the site.
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Haven't tested, but should work:

PHP:
<?php
$domains = array('www.a.com', 'www.b.com', 'www.c.com');
$location = $domains[random(0, count($domains)-1)];
header('Location: http://' . $location);
?>
 
0
Close
Mikor said:
Haven't tested, but should work:

PHP:
<?php
$domains = array('www.a.com', 'www.b.com', 'www.c.com');
$location = $domains[random(0, count($domains)-1)];
header('Location: http://' . $location);
?>

Well how do you get it to redirect from there?
 
0
Close
0
Close
The only problem with that code is that the function is rand( and not random(.

:gl:
 
0
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

A browser tab with a favicon next to the page title
Search members
You can now search for members by name, company, location and more. Open the search at the top of any page and choose Members. You will...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back