PHP Classes

File: examples/example1.php

Recommend this page to a friend!
  Classes of Tyler Heshka   PHP Visitor Tracking   examples/example1.php   Download  
File: examples/example1.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Visitor Tracking
Track visitor location and details using MySQLi
Author: By
Last change:
Date: 9 years ago
Size: 2,360 bytes
 

Contents

Class file image Download
<!-- Example 1, display the current visit on a map. -->

<?php
   
/**
     * include database settings
     */
   
require_once( '../includes/db.php' );

   
/**
     * include the class
     */
   
require_once( '../includes/class.visitorTracking.php' );

   
/**
     * instance the class
     */
   
$visitors = new visitorTracking();
?>

<html>
    <head>
        <title>PHP + MySQLi - Visitor Tracking Class - Examples 1</title>
    </head>

    <body>
        <div style="float:left;"><a href="/demo/visitorTracking/">&larr; Demo</a></div>

        <br>

        <h2>This visit has been tracked.</h2>
        <pre><?php $visitors->displayThisVisit(); ?></pre>

        <iframe width="100%" height="325" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"
        src="https://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=<?php echo urlencode($visitors->getThisVisit()['visitor_city'] . ' ' . $visitors->getThisVisit()['visitor_state'] . ' ' . $visitors->getThisVisit()['visitor_country']);?>&output=embed"></iframe>

        <br><hr><br>
        <h2>Code:</h2>
        <XMP>

            < ?php
                /**
                 * include database settings
                 */
                require_once( '../includes/db.php' );

                /**
                 * include the class
                 */
                require_once( '../includes/class.visitorTracking.php' );

                /**
                 * instance the class
                 */
                $visitors = new visitorTracking();
            ? >

            <html>
                <head>
                    <title>PHP + MySQLi - Visitor Tracking Class - Examples 1</title>
                </head>

                <body>
                    <h2>This visit has been tracked.</h2>
                    <pre>< ?php print_r($visitors->getThisVisit()); ? ></pre>

                    <iframe width="100%" height="325" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"
                    src="https://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=< ? php echo urlencode($visitors->getThisVisit()['visitor_city'] . ' ' . $visitors->getThisVisit()['visitor_state'] . ' ' . $visitors->getThisVisit()['visitor_country']); ? >&output=embed"></iframe>

                </body>
            </html>

        </XMP>
    </body>
</html>