A need help

Discussion in 'PHP' started by BromptonWeb, Dec 22, 2007.

  1. #1
    I need someone to help me out on my script.

    The script contain a index.php and a site.php

    http://www.miny.info/b1Pl606by

    My file index.php is catching what's in site.php

    I want to have on main page clickable links now it only show the text i add in site.php (
    $quotes[]='http://google.com';

    $quotes[]='http://gogole.ca.com'; )


    Where can i add in index.php or site.php a line of code that thoses random links showing on main page would be clickable

    Cheers
     
    BromptonWeb, Dec 22, 2007 IP
  2. LittleJonSupportSite

    LittleJonSupportSite Peon

    Messages:
    386
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can you please post your existing code so I may modify it?
     
    LittleJonSupportSite, Jan 3, 2008 IP
  3. papa_face

    papa_face Notable Member

    Messages:
    2,237
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    285
    #3
    <?php
    session_start();
    
    $links = array(
    "http://www.google.com",
    "http://www.msn.com",
    "http://forums.digitalpoint.com"
    );
    //add a new link for the banner to a new line in the same format as above
    
    $text = array(
    "Google",
    "MSN",
    "DP"
    );
    //add a new text in the same format as above
    //-------- DO NOT EDIT BELOW THIS LINE----------
    $count = count($links) -1;
    
    $randnum = mt_rand(0,$count);
    
    if	($randnum == $_SESSION['randnum'])
    	{
    	$randnum = mt_rand(0,$count);
    	}
    $_SESSION['randnum'] = $randnum;
    echo '<a href="'.$links[$randnum].'">'.$text[$randnum].'</a>';
    
    ?>
    Code (markup):
    That will do what you want. Code adapted from an image rotator in my blog ;)
     
    papa_face, Jan 3, 2008 IP