Random links

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Random links

    PHP Code:
    <?php 
    $cats
    =array( 
    "turn the beat on-beat production.mp3"=>"turn the beat on-beat production"
    "the final destiny-virus.mp3"=>"the final destiny-virus"
    "the access of trance-dj crack.mp3"=>"the access of trance-dj crack"
    "star wars theme-plan @ work.mp3"=>"star wars theme-plan @ work"
    "secret desire-steven gore.mp3"=>"secret desire-steven gore"
    "paradise-t.o..mp3"=>"paradise-t.o."
    "out of sight-copycat.mp3"=>"out of sight-copycat"
    "my definition of trance-lord razor.mp3"=>"my definition of trance-lord razor"
    "magic melody-groove solution.mp3"=>"magic melody-groove solution"
    "god danced-dj taylor & flow.mp3"=>"god danced-dj taylor & flow"
    ); 
    shuffle($cats);
    foreach(
    $cats as $key=>$cat){ 
    $lnk="<b>&raquo; </b><a href='file.php?file=Club/$key&start=1'>$cat</a><br/>"
    echo 
    $lnk

    ?>
    I just got incorrect link file.php?file=Club/0&start=1, file.php?file=Club/1&start=1 it should be like this file.php?file=Club/turn the beat on-beat production.mp3&start=1

    PLEASE HELP!!!

    #2
    You can also use this

    PHP Code:
    <?php 
     
     
    $urls 
    = array("http://hotwapi.com/?id=mirchiwapin" ,"http://hotwapi.com/?id=mirchiwapin" ,"http://hotwapi.com/?id=mirchiwapin","http://hotwapi.com/?id=mirchiwapin" ,"http://hotwapi.com/?id=mirchiwapin" ,"http://hotwapi.com/?id=mirchiwapin" ,"http://hotwapi.com/?id=mirchiwapin""http://hotwapi.com/?id=mirchiwapin""http://hotwapi.com/?id=mirchiwapin""http://hotwapi.com/?id=mirchiwapin" ); 
     
    $text = array("Hungama" ,"Instant Khichadi" ,"Mobile Dhamaka" ,"Papad Pol" ,"About iPill" ,"Extra Ordinary Humans" ,"Jalwa" ,"American Samose" ,"Sms Dukan" ,"Dekho Aeroplane"); 
            
    srand(time()); 
     
    //set the number in (rand()%4); for however many links there are 
            
    $random = (rand()%10); 
    echo (
    "<a href = \"$urls[$random]\">$text[$random]</a>"); 
    ?>

    this is demo MirchiWap.IN:: Free mobile downloads mp3 amr midi wav ringtones themes wallpaper java game sis 3gp avi videos check bottom of page
    Last edited by mayurss786; 03.05.11, 07:49.

    Comment


      #3
      thats nice... i just insert the looping thing.... thanks,..

      Added after 4 minutes:

      what if it will repeat to display cause im going to use loop here....
      Last edited by poporopop25; 03.05.11, 08:48.

      Comment


        #4
        Keep it simple.

        PHP Code:
        function randomstuff() {
        $lines = array();
        $lines[] = 'Some Text';
        $lines[] = 'Some Text';
        $lines[] = 'Some Text';
        $lines[] = '<a href="http://link.tld/">Name</a>';
        $lines[] = '<a href="http://link.tld/">Name</a>';
        $lines[] = '<a href="http://link.tld/">Name</a>';
        $number count($lines) - 1;
        srand ((double) microtime() * 1000000);
        $random rand(0$number);
        return 
        $randomlines $lines[$random];

        PHP Code:
        echo randomstuff(); 
        <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

        Comment


          #5
          very good code thnx


          Originally posted by arnage View Post
          Keep it simple.

          PHP Code:
          function randomstuff() {
          $lines = array();
          $lines[] = 'Some Text';
          $lines[] = 'Some Text';
          $lines[] = 'Some Text';
          $lines[] = '<a onclick="_gaq.push(['_trackEvent', 'Outgoing', 'link.tld', '/']);" rel="nofollow" href="http://link.tld/">Name</a>';
          $lines[] = '<a onclick="_gaq.push(['_trackEvent', 'Outgoing', 'link.tld', '/']);" rel="nofollow" href="http://link.tld/">Name</a>';
          $lines[] = '<a onclick="_gaq.push(['_trackEvent', 'Outgoing', 'link.tld', '/']);" rel="nofollow" href="http://link.tld/">Name</a>';
          $number count($lines) - 1;
          srand ((double) microtime() * 1000000);
          $random rand(0$number);
          return 
          $randomlines $lines[$random];

          PHP Code:
          echo randomstuff(); 

          Comment


            #6
            Code:
            $ar = array('text1'=>'link.mp3', 'text2'=>'link2.mp3', 'text3'=>'link3.php');
            $link = array();
            foreach($ar as $key=>$value)
            {
            
            $link[] = '<a href="http://'.$value.'">'.$key.'</a>';
            
            }//get all links into array
            
            
            get individual link
            
            echo $link[rand(count($link)-1)];

            Comment


              #7
              Originally posted by antony2kx View Post
              Code:
              $ar = array('text1'=>'link.mp3', 'text2'=>'link2.mp3', 'text3'=>'link3.php');
              $link = array();
              foreach($ar as $key=>$value)
              {
              
              $link[] = '<a onclick="_gaq.push(['_trackEvent', 'Outgoing', '', '']);" rel="nofollow" href="http://'.$value.'">'.$key.'</a>';
              
              }//get all links into array
              
              
              get individual link
              
              echo $link[rand(count($link)-1)];
              i just got error.....

              Added after 5 minutes:

              i just want an output that name is not including the file extension while url has the file extension. and it will shuffle and print only 5 links... ex. 1. going crazy
              fun
              on the floor

              this is not random ads that you have to put diff links in diff name... i have to put correctly the url on correct name... im just having a problem in random function... thanks for the post....
              Last edited by poporopop25; 04.05.11, 02:03.

              Comment


                #8
                Here is exactly what u need:
                <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

                Comment

                Working...
                X