Okay this is some small link generator which i use on my personal website
Lets start with creating an array.. and put out few sites..
Code:
<?php
$links = array();
$links[] = "http://www.gfxvoid.com;GFXvoid";
$links[] = "http://www.eagleimg.com;EagleImg";
$links[] = "http://www.imageshack.us;ImageShack;";
$links[] = "http://www.imghost.com;ImgHost";
$links[] = "http://www.ebaumsworld.com;eBaum's World";
$links[] = "http://www.afterdawn.com;AfterDawn";
$links[] = "http://www.letssingit.com;LetsSingIt";
$links[] = "http://www.sourceforge.net;SourceForge";
$links[] = "http://www.good-tutorials.com/;Good-Tutorials";
$links[] = "http://www.pixel2life.com;Pixel2Life";
$links[] = "http://www.big-boys.com/;Big-Boys";
now as you can see we have list of websites and their title..
next up we are going to pick randomly one of those using array_rand command
Code:
$random = array_rand($links);
now $random stands for a random link line from list above
next we need to separate URL from the title.. and as you can see there is ";" between em.. so we explode ";"
Code:
$first_rlink = explode(";", $links[$random1]);
now we need to output the result...or random link anyhow..
Code:
echo "<a href='$first_rlink[0]'>$first_rlink[1]</a>";
?>
Now this is done I'll show the full code below.. you can make this different like random 2 different link but remember it can output same link.. actually i have 2 link gen on my site and those can't be the same.. but i ain't gonna show how it's do
Author: NightStalker
Difficulty: Easy
Code:
<?php
$links = array();
$links[] = "http://www.gfxvoid.com;GFXvoid";
$links[] = "http://www.eagleimg.com;EagleImg";
$links[] = "http://www.imageshack.us;ImageShack;";
$links[] = "http://www.imghost.com;ImgHost";
$links[] = "http://www.ebaumsworld.com;eBaum's World";
$links[] = "http://www.afterdawn.com;AfterDawn";
$links[] = "http://www.letssingit.com;LetsSingIt";
$links[] = "http://www.sourceforge.net;SourceForge";
$links[] = "http://www.good-tutorials.com/;Good-Tutorials";
$links[] = "http://www.pixel2life.com;Pixel2Life";
$links[] = "http://www.big-boys.com/;Big-Boys";
$random = array_rand($links);
$first_rlink = explode(";", $links[$random1]);
echo "<a href='$first_rlink[0]'>$first_rlink[1]</a>";
?>