33 users online (1 members and 32 guests)  

Thread: Topsite script!


  Results 1 to 6 of 6

Related

  1. Replies: 8
  2. Replies: 0
  3. Topsite script problems    Forum: PHP Forum
    Replies: 0
  1. #1
    jinkazama's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2003
    Posts
    18

    Post Topsite script!

    i was looking around the net, adn i cant find a good topsite script. i woudl need a topsite script something that would not require MySQL DB, and that when ever somebody clicks on the topsite icon that people when register get, it counts towards their site populatiry. and when they reach mroe votes it bumps them mroe and more up on the topsite listing. if any1 knows any let me know.

    thx in advance

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Sorry, I had a good google. I could find loads of topsites scripts, but not without mySQL.

    have you considered upgrading your hosting?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    jinkazama's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2003
    Posts
    18
    Quote Originally Posted by QuietDean
    Sorry, I had a good google. I could find loads of topsites scripts, but not without mySQL.

    have you considered upgrading your hosting?

    ahem, what about the free sql, on the freesql.org or something like that, does that thing support it, and i have also made database on my own computer.... ehe but i never turn it off... so woudl that solve the problem? i dunno

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Turning your own computer into a server is a whole heap of new problems.

    any hosting you get with mySQL included will be able to run any mySQL script you care to mention.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  5. #5
    jinkazama's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2003
    Posts
    18
    Quote Originally Posted by QuietDean
    Turning your own computer into a server is a whole heap of new problems.

    any hosting you get with mySQL included will be able to run any mySQL script you care to mention.
    ya but as far as i know, some stuff is blocked on freesql.org... so i am just curious would it work for topsites... since i heard forums cant be ran on it

  6. #6
    christodd's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2003
    Location
    Tacoma, Washington
    Posts
    20
    Quote Originally Posted by jinkazama
    i was looking around the net, adn i cant find a good topsite script. i woudl need a topsite script something that would not require MySQL DB, and that when ever somebody clicks on the topsite icon that people when register get, it counts towards their site populatiry. and when they reach mroe votes it bumps them mroe and more up on the topsite listing. if any1 knows any let me know.

    thx in advance
    Maybe it's a cheap hack, but I'd just use filesizes to track something this simple. Just add a character to a file named the name of the site, and then use the filesize to see how many votes they got.

    Make a folder called "vote", and make sure it is world writable (or owned by the web user). I'm assuming that you voting form uses the variable name 'SITENAME', and you use the post method. Here is the voting function

    PHP Code:
    <?
    function vote_for($sitename)
    {
    $han=fopen("vote/".$sitename,"a");
    if (!
    $han) { die("Could not write to vote/$sitename"); }
    fwrite($han,".",1);
    fclose($han);
    }

    vote_for($HTTP_POST_VARS['SITENAME']);
    ?>
    Then, to get the top 10 list you would load an array with filename and sizes, and then sort by the size
    PHP Code:
    <?
     
    if ($handle opendir('votes')) {
        while (
    false !== ($file readdir($handle))) { 
        {
            
    $sites[$file]=filesize($file);
        }
        }
       
    closedir($handle); 

      
    asort($sites,SORT_NUMERIC);
      
    $i=10//or howmany to display
      
    while (list($s,$v)=each($sites)&&(--$i>0))
       {
        echo 
    "$s has $v votes<BR>\n";
       }
     }

    ?>
    Hope that helps.

    -Chris
    Last edited by HTML; 10-31-2003 at 05:05 PM.



Tags for this Thread