PHP Classes

PHP User Location Details: Find users' location and display it on Google Maps

Recommend this page to a friend!
  Info   View files Example   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 286 All time: 7,520 This week: 106Up
Version License PHP version Categories
puld 1.0.0The PHP License5Networking, PHP 5, Web services, Geog...
Description 

Author

This package can find users' location and display it on Google Maps.

It can take the current user IP address and determine the IP associated location.

The package can also generate static images or display interactive maps using Google Maps to display the user location.

Picture of zinsou A.A.E.Mo´se
  Performance   Level  
Name: zinsou A.A.E.Mo´se is available for providing paid consulting. Contact zinsou A.A.E.Mo´se .
Classes: 50 packages by
Country: Benin Benin
Age: 34
All time rank: 6811 in Benin Benin
Week rank: 142 Up1 in Benin Benin Equal
Innovation award
Innovation award
Nominee: 23x

Winner: 2x

Example

<?php
require_once('KnowMyUser.class.php');
//DATABASE DETAILS
//SET HOSTNAME
$hostname = "localhost";

//MYSQL USERNAME
$username ="root";

//MYSQL PASSWORD
$password="";

//MYSQL DATABASE NAME
$database="cms";
//DATABASE CONNECTION
try
{
$bdd=new PDO('mysql:host='.$hostname.';dbname='.$database,$username,$password,array(PDO::ATTR_ERRMODE=> PDO::ERRMODE_EXCEPTION));

}
catch(
Exception $e)
{
    die(
'Erreur:'.$e->getMessage());
}
// DATABASE CONNECTION CODE END


/*
 First Way : you can specify all your setting yourself by creating an instance
 yourself that will then have all the methods from VSIPD and MapBuilder
*/


$x=new KnowMyUser('66.84.41.158');//specify a specific IP address to work
echo $x->buffered_staticmap("9",'640x200',$bdd);//a way to load a buffered image as suggested by someone
// $x->GetjustBasics_Map($bdd);//this is a short cut method to load a dynamic map but you can set every thing this way:


/*
$x=new KnowMyUser(); //get user IP to work
$map=$this->seehim_onMap();//see this method statement to know the parameters needed here we use the defaults

//from here you can set yourself your map details as specified in the reference.txt file or in the numerous examples
//of the MapBuilder class package directory.An example could be from there :


// Set the default map type.
$map->setMapTypeId(MapBuilder::MAP_TYPE_ID_ROADMAP);

// Set width and height of the map.
$map->setSize(650, 450);

// Set default zoom level.
$map->setZoom(17);

// Set minimum and maximum zoom levels.
$map->setMinZoom(10);
$map->setMaxZoom(19);

// Disable mouse scroll wheel.
$map->setScrollwheel(false);

// Make the map draggable.
$map->setDraggable(true);

// Enable zooming by double click.
$map->setDisableDoubleClickZoom(false);

// Disable all on-map controls.
$map->setDisableDefaultUI(true);

// Display the map.
$map->show();

*/



/*
second way: use a short cut with predefined map settings
*/

KnowMyUser::Fastway('66.84.41.158',$bdd);// to know a specific ip location
// KnowMyUser::Fastway(null,$bdd);//to know the client IP address or even without database storage:
// KnowMyUser::Fastway();//to know the client IP address even without database storage
?>


Details

This package allows the user to use these three packages: PHP-IP: https://www.phpclasses.org/package/10484-PHP-Get-the-real-user-IP-address-even-behind-proxies.html, MapBuilder: https://www.phpclasses.org/package/7600-PHP-Display-maps-using-Google-Maps-API-v3.html and Very simple IP details : https://www.phpclasses.org/package/10436-PHP-Get-IP-address-location-and-Google-Maps-image.html, to find users location or specific IP location details and show the location on a google static or interactive map. The package just act as the glue that join the three packages so user need to download them separately to know more about all the available methods and how to optimally take advantage of the package. Please ,be sure to be patient while example file is loading google interactive map because it takes some time. Also be sure to let the browser development tools open to know the progress while testing. Finally you may got an API KEY issue while testing on localhost be sure to test it in this case online or try to get your own API KEY by following the directives in the main class source. For a basic how to use example see the file testKnowMyuser.php and read carefully the comments lines. For bug reporting,feedback and suggestion use this package's forum on other three package forums or contact me at leizmo@gmail.com;

  Files folder image Files  
File Role Description
Plain text file class.getIP.php Class class source
Plain text file class.ipdetails.php Class class source
Plain text file class.MapBuilder.php Class class source
Plain text file KnowMyUser.class.php Class main class source
Accessible without login Plain text file readme.txt Doc. readme
Accessible without login Plain text file testKnowMyUser.php Example example script

Downloadpuld-2017-11-01.zip 13KB
Downloadpuld-2017-11-01.tar.gz 12KB
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
Map Builder Download .zip .tar.gz license,documentation but also required because it is used to build and show interactive map from google based on user location Required
Very Simple IP Details Download .zip .tar.gz Know more about specific methods and required if you want to store details in database or work on it Required
PHP-Ip Download .zip .tar.gz license,documentation but also required because it is used to get user real ip even behind a proxy Required
 Version Control Unique User Downloads Download Rankings  
 0%
Total:286
This week:0
All time:7,520
This week:106Up