A little change to this unique visiter script...help?
Moderator: General Moderators
-
gaogier
- Forum Contributor
- Posts: 391
- Joined: Wed Mar 02, 2005 1:02 pm
- Location: Portsmouth, UK
- Contact:
A little change to this unique visiter script...help?
hello,
I wish to use, this script found in this tutorial
http://www.spoono.com/php/tutorials/tutorial.php?id=16
My only question, is, how can i make it so that it will put up all the users on the site, so the script wont show on all pages, just the main page?
This will go on different places on the site, forums, desktop, a game.
I wish to use, this script found in this tutorial
http://www.spoono.com/php/tutorials/tutorial.php?id=16
My only question, is, how can i make it so that it will put up all the users on the site, so the script wont show on all pages, just the main page?
This will go on different places on the site, forums, desktop, a game.
Last edited by gaogier on Sun Jun 17, 2007 9:07 am, edited 1 time in total.
I'm not sure I know exactly what you're asking. Try and give more details when you ask a question please. If I understand you correctly, you want to display how many users are on your site, but only on your home page. If that's what you're asking, it says in the second sentence on that page how to do it.My only question, is, how can i make it so that it will put up all the users on the site, so the script wont show on all pages, just the main page?
If you don't want it to show up on a certain page, don't put it on that page.This script will explain how to display the number of users online using your website. You have to put this on everypage you want it to appear.
I have to advise against this script though. It's very poorly written. Why?
For one, it requires register_globals to be turned on, which I try to never do unless absolutely necessary.
Also, this just $PHP_SELF right into the query, totally unchecked. Did you know that PHP_SELF contains user input? This opens you up to SQL injection. There are better methods of getting the current file, for example -- basename(__FILE__).
Code: Select all
//insert the values
$insert = mysql_db_query($database, "INSERT INTO useronline VALUES
('$timestamp','$REMOTE_ADDR','$PHP_SELF')");
if(!($insert)) {
print "Useronline Insert Failed > ";
}If you explain more about your website / application, maybe I can help you roll your own?
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Descriptive subjects
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.
-
gaogier
- Forum Contributor
- Posts: 391
- Joined: Wed Mar 02, 2005 1:02 pm
- Location: Portsmouth, UK
- Contact:
Re: Descriptive subjects
Sorry, i thought it was descriptive as much as i could think at the time.feyd wrote:[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.
Also, what im trying to do, is, show all the users who have gone on the site, even if there is no script.
I have forums, topsites, a RPG, and a site, which all uses, php's include files. so i can just put the file on the header, or footer.
But i dont want the script so show, on the RPG, Topsites, and the forums, just the main site, i know php wont show in the source, but can it not be shown in the page?
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
The only way to get great with php is to use it. You will never get any better at it by having people tell you how to do everything. Use the code you found in that tutorial, and rewrite it to do exactly what you want. We'll help you, but I don't see "I'm not that great with php" as a good enough reason why you can't write it on your own (with our guidance of course)gaogier wrote:im not that great with php
-
gaogier
- Forum Contributor
- Posts: 391
- Joined: Wed Mar 02, 2005 1:02 pm
- Location: Portsmouth, UK
- Contact:
a few of the scripts was created, and the rest was done by me.
Also, iv changed the name of this post.
Also, iv changed the name of this post.
thats what i want.superdezign wrote:But you have so much on your site?
What you want to do is have every page that you want counted to check who's visited and store it, and then just output it to the page you want to output it to. PHP only exists where you make it...
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm