Surprise Site Script

Discussion in 'Scripts' started by Harmony, May 27, 2006.

  1. #1
    I have seen sites who has this service.
    Does anyone have a script for like the main idea is you have a button in the page and when you click it a site shows up in another window. And to get listed as one of the "suprise sites", you have to pay $x for it.

    Anyone know a script like that?:p
     
    Harmony, May 27, 2006 IP
  2. EGS

    EGS Notable Member

    Messages:
    6,078
    Likes Received:
    438
    Best Answers:
    0
    Trophy Points:
    290
    #2
    I'm pretty sure that you can do this with free PHP and Javascripts available on the internet. I did it a few years ago with one of my old sites but that was for testing purposes. Try HotScripts.com and Javascript.Internet.com :D:D:D:D
     
    EGS, May 27, 2006 IP
  3. Harmony

    Harmony Well-Known Member

    Messages:
    1,846
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    120
    #3
    I tried looking for it on hotscripts, didn't know what search to do. Ill go browse the php and java section I guess then.
     
    Harmony, May 27, 2006 IP
  4. Harmony

    Harmony Well-Known Member

    Messages:
    1,846
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    120
    #4
    Harmony, May 28, 2006 IP
  5. sarahk

    sarahk iTamer Staff

    Messages:
    28,821
    Likes Received:
    4,539
    Best Answers:
    123
    Trophy Points:
    665
    #5
    It should just be a simple list with a script that selects from that list (order by rand() limit 1) and does a header() redirect to the new page. it's not hard but why on earth would anyone click on that?

    Sounds as ridiculous as those stumble type sites where you get served up sites of no interest.
     
    sarahk, May 28, 2006 IP
  6. Harmony

    Harmony Well-Known Member

    Messages:
    1,846
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    120
    #6
    Some people arent as good with php or java etc. as you think. If you don't like the idea, oh well. But I still need the script, so thank you for your post :rolleyes:
     
    Harmony, May 29, 2006 IP
  7. sarahk

    sarahk iTamer Staff

    Messages:
    28,821
    Likes Received:
    4,539
    Best Answers:
    123
    Trophy Points:
    665
    #7
    OK.

    are you comfortable entering sites into the database directly or do you need an admin section?
    lets say you have a table called surprise and it has
    * id (int)
    * url (varchar 100)
    * name (varchar 100)

    on your page you would have

    <a href='surprise.php'>Visit a random site</a>

    then in surprise.php

    <php
    //initialise the connection to the database if it's not already open
    $sql = "select `url`, `name`
    	from `surprise`
    	order by rand()
    	limit 1 ";
    $result = mysql_query($sql) or die( mysql_error(). '<br />' . $sql);
    $row = mysql_fetch_array($result);
    echo "<html>
    <head>
    <meta http-equiv='refresh' content='0;url={$row['url']}'>
    </head>
    <body>
    <p>We hope you enjoy your surprise visit to <a href='{$row['url']}'>{$row['name']}</a></p>
    </body>
    </html>";
    ?>
    Code (markup):
    and that's it, all done.

    ofcourse I'd add in a hit counter, number of hits that have been PURCHASED, expiry date all all that stuff
     
    sarahk, May 29, 2006 IP
  8. Harmony

    Harmony Well-Known Member

    Messages:
    1,846
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    120
    #8
    Hey, thanks for the code.

    Maybe I did it wrong, I made an indexed page with the
    <a href='surprise.php'>Visit a random site</a>

    Then in surprise.php I added the code you gave me.

    Thats all I did... gave me a server error when I clicked the link, sorry clueless about php =|
     
    Harmony, May 29, 2006 IP
  9. sarahk

    sarahk iTamer Staff

    Messages:
    28,821
    Likes Received:
    4,539
    Best Answers:
    123
    Trophy Points:
    665
    #9
    I wrote it in notepad. I'll have a look tonight and write something more robust. About time I submitted something to www.weberdev.com ;)
     
    sarahk, May 29, 2006 IP
  10. Harmony

    Harmony Well-Known Member

    Messages:
    1,846
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    120
    #10
    Alright, will be waiting for your reply :)
     
    Harmony, May 29, 2006 IP
  11. sarahk

    sarahk iTamer Staff

    Messages:
    28,821
    Likes Received:
    4,539
    Best Answers:
    123
    Trophy Points:
    665
    #11
    sarahk, May 30, 2006 IP