Page Navigation
Many people have asked me how i got index2.php?page=link
Basically what happens, is where ever the following code is put on your main php page, is where the the page link.php will go.
| <?php if (! file_exists("$page.php")) { include("updates.php"); } else { include("$page.php"); } ?> |
So. This code should go where you would like the content of link.php to go, in your main php file.
After you have correctly done everything, if you get a '404' updates.php will show up by default, although you can change this.you do not have to have a file named page.php.
In the page which will be included, all of everything from the main php file will also be included there. EG - font tags.
Then just rename your links to (yourfile).php?page=whatever
Online Users
Quite a long script for such a small result.
Create a new file leave it blank, but save it as usersonline.txt
Now make a new file, and add the following script:
| <? $remote = $_SERVER["REMOTE_ADDR"]; $file = "usersonline.txt"; $timeoutseconds = 60; //how long the user stays on, before classed offline which can be changed $timestamp = time(); $timeout = ($timestamp-$timeoutseconds); $fp = fopen("$file", "a+"); $write = $remote."||".$timestamp."n"; fwrite($fp, $write); fclose($fp); $online_array = array(); $file_array = file($file); foreach($file_array as $newdata){ list($ip, $time) = explode("||", $newdata); if($time >= $timeout){ array_push($online_array, $ip); } } $online_array = array_unique($online_array); $online = count($online_array); if($online == "1"){ echo "Users Online: $online"; }else{ echo "Users Online: $online"; } ?> |
Save this as usersonline.php
Now, once you have uploaded both files, and chmoded usersonline.txt to 777. You should include the following script where you would like the number of users online to show up:
| <? include("usersonline.php"); ?> |
Chmod
Many people think chmod is really difficult and cant seem to realise how to do it. maybe this will help. If you see every collumn (goes up and down) as the first number. the seccond collumn as the 2nd number, and the 3rd collumn as the third number.

The top row of numbers is a 4. The middle is a 2. the bottom is a 1. so there i would have 644: 4+2 for the first letter. 4 for the next. and 4 for the last. so... based on the information ive just told you. what would the following CHMOD be?

The answer is 776
If you are stuck on why.. think about it. the first column. 4+2+1 = 7 the 2nd. 4+2+1 = 7 and the third 4+2 = 6
Related Articles
- Top Website Navigation TipsThe aim of a websites navigation is simply to allow users to get to the content they require. For sites that have a large number of sections and web pages (and information sites can be one of these) the navigation plan has to be properly researched and designed.
- PHP MessageboxEasily create a PHP Message Box, without using any mysql! Using this method, when your visitors post something, the simple script interprets it, and stores the message in a text document. It is also fully customizable with HTML.
- Good Website NavigationWebsite Navigation is defined as the science and skill applied to a web site that helps visitors move from one page to another. A good website navigation system is imperative for a successful and accessible website design.
- Uploading Files With PHPUpload an image or file to your server without using your FTP.
- 7 Reasons You Should Avoid JavaScript Dynamic NavigationThis informative article tells you 7 Reasons You Should Avoid JavaScript Dynamic Navigation. The author explains the technical reasons behind each of the 7, and provides excellent examples.
- Javascript Table RolloversHow you can get a table effect on rollover.
- Skip Navigation Links are ImportantProviding links that allow the user to skip directly to content, bypassing the navigation, enhances the accessibility of your web site. This is recommended for blind or visually impaired users, people who use screen readers, and also for text-browsers, mobile phones and PDAs...
- What is a site map and why do you need it? (Exclusive Tutorial)Navigational direction never hurt anyone. In fact, knowing where you are going is half the battle of getting there. So why not create a map for your site visitors?
- Top 10 Reasons to Understand Your Web TrafficSome companies improve Web site traffic and search engine marketing by relying on internal brainstorming sessions, intuition and sometimes even the latest fad. A few dont bother making changes at all.
- Simple Counter & Redirecting & Browser TypeThis is a really 2 file way of making a unique hit counter.
If you make a new file called counter.txt and just type the number 1 on the first line.
