Forum Moderators: coopster

Message Too Old, No Replies

TopSite?

         

cripplertd

4:32 pm on Sep 28, 2007 (gmt 0)

10+ Year Member



Is there any scripts out there that allow only the admin to add the sites?
basicly I want to have a list of links that are ordered by most popular each time the page is loaded, the only way I can think of doing this is with a top page like script, any ideas?

jatar_k

7:49 pm on Sep 28, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



just have a redirect script that tracks clicks, store the clicks in a table alongside the url and order them by clicks when you display them on the links page

cripplertd

12:55 am on Sep 29, 2007 (gmt 0)

10+ Year Member



you totally just lost me.

eelixduppy

1:04 am on Sep 29, 2007 (gmt 0)



What jatar is explaining is you should create a separate php file, such as redirect.php. Now each link on your site goes to that page. So something like this, maybe:

<a href="redirect.php?url=some_page.html">Link</a>

Now on your redirect page, you retrieve the url from the query string using the GET superglobal,

$_GET['url']
. Once you have this value you check to see if it exists in a database, if it doesn't then you can add the link to the table. If it does, then you increment a field in the table that tracks how many times that page has been clicked on within your site. Now, if you want to know how many times the page is requested, even from referrers outside of your site, then you would need to add a header to each page and increment the associative value in the database corresponding to that page. So you see the method really depends on what kind of information you are looking to sort it by.

We have a few threads in our library that help out with the mysql aspect of the coding if you want to take a peak at them as that part is basically the same for both solutions.

Here they are:
[webmasterworld.com...]
[webmasterworld.com...]

Good luck :)

cripplertd

5:14 am on Sep 29, 2007 (gmt 0)

10+ Year Member



any way to avoid msql? I cant seem to get that running.

eelixduppy

2:08 pm on Sep 29, 2007 (gmt 0)



You can use a CSV file. We have a good thread on the subject: [webmasterworld.com...]