Simple, effective and easy to use script. In fact, to find out who is on site at the moment – impossible. But do not rush to close this article and a wide variety of swear words. There is a solution to this problem – to track who downloaded the pages for some time. This is what the script is engaged.
To identify a user uses his external / internal ip-address and data about the system. To start, create a file Fill in the name of the file online.php following content. Do not forget to read the comments: / / Number of minutes during which users are deemed to be 'online' $ time = 5, / / data area, the next line MUST pre-check = 0 ', FALSE); header (' Pragma: no-cache '); / / Defining internal and external ip-address $ ip 0 = $ _SERVER ' REMOTE_ADDR '; if (isset ($ _SERVER 'HTTP_X_FORWARDED_FOR')) $ ip 1 = $ _SERVER 'HTTP_X_FORWARDED_FOR'; else $ ip 1 =''; / / get the data browser $ browser = $ _SERVER 'HTTP_USER_AGENT'; / / Get hash of the user data $ user = md5 ($ ip 0. $ ip 1. $ browser); / / fasten to the hash of the last for 5 minutes.
Time can be changed in the file online.php. Connecting the script to the page: To integrate the script into your web site uses java-script. To insert the number of users – add to your page in the right place the following code: B result – in this space will be inserted digit for the number of users you can use code like this: As a result – in this space will be inserted figure and the word "user .." with the right ending.
Recently, often when describing the creation of a website mentions that using semantic markup. It is particularly a lot of new sites being developed with complete disregard of this approach that causes pain. So what is a semantic markup, and what advantages using it? For the layout of Web pages using HTML language or its more modern version, XHTML. The semantics of this language is determined by the semantic the value of his designs. For example, the h1 tag indicates the title of the highest level, and the tag li – a list item.
If all fit on the tag is used for the purposes for which they are intended, therefore, there is a semantic layout. For example, menu items are correctly represented in the form of list items and not – as a table row. If the markup elements are not being used as envisaged, then, the site does not apply semantic layout. The most common example of a derogation from the rules of semantic markup is a table layout, where the table tags are not for the formation of a regular table, but solely for the purposes of registration. So what are the advantages of semantic markup, and why it is recommended that you use it? First, the HTML code in the application of such a layout is more transparent and logical, it's easier to understand to any expert and, if necessary, change. Every developer knows what shall be used standard tags to HTML, but is not always possible to guess the appointment of any of the markup, if not used for semantic layout, and layout designer uses tags for other purposes. Of course, some developers are interested in sites that their child did not understand anybody, except them, but these would-be developers should not involve the creation of websites under any circumstances. Semantic markup is closely connected with the separation of data and presentation.