Private
Public Access
1
0
Files
MineSeeker/src/Entity/Gamer.php

164 lines
3.1 KiB
PHP
Raw Normal View History

<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\GamerRepository")
*/
class Gamer
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var string|null
*
* @ORM\Column(name="user_name", type="string", length=100, nullable=false)
*/
private $userName;
/**
* @var string|null
*
* @ORM\Column(name="ip", type="string", length=20, nullable=true)
*/
private $ip;
/**
* TODO
* $ip='0.0.0.0';
* $ip=$_SERVER['REMOTE_ADDR'];
* $clientDetails = json_decode(file_get_contents("http://ipinfo.io/$ip/json"));
* echo "You're logged in from: <b>" . $clientDetails->country . "</b>";
*
* function GetIP()
* {
* if ( getenv("HTTP_CLIENT_IP") ) {
* $ip = getenv("HTTP_CLIENT_IP");
* } elseif ( getenv("HTTP_X_FORWARDED_FOR") ) {
* $ip = getenv("HTTP_X_FORWARDED_FOR");
* if ( strstr($ip, ',') ) {
* $tmp = explode(',', $ip);
* $ip = trim($tmp[0]);
* }
* } else {
* $ip = getenv("REMOTE_ADDR");
* }
* return $ip;
* }
*/
/**
* @var string
*
* @ORM\Column(name="country", type="string", length=100, nullable=true)
*/
private $country;
/**
* @var string
* @see http://symfony.com/doc/current/components/http_foundation.html
*
* @ORM\Column(name="user_agent", type="string", length=255, nullable=true)
*/
private $userAgent;
/**
* @var \DateTime
*
* @ORM\Column(name="conn_timestamp", type="datetime", nullable=false)
*/
private $connTimestamp;
public function getId(): ?int
{
return $this->id;
}
/**
* @return string|null
*/
public function getUserName(): ?string
{
return $this->userName;
}
/**
* @param string|null $userName
*/
public function setUserName(?string $userName): void
{
$this->userName = $userName;
}
/**
* @return string|null
*/
public function getIp(): ?string
{
return $this->ip;
}
/**
* @param string|null $ip
*/
public function setIp(?string $ip): void
{
$this->ip = $ip;
}
/**
* @return string
*/
public function getCountry(): string
{
return $this->country;
}
/**
* @param string $country
*/
public function setCountry(string $country): void
{
$this->country = $country;
}
/**
* @return string
*/
public function getUserAgent(): string
{
return $this->userAgent;
}
/**
* @param string $userAgent
*/
public function setUserAgent(string $userAgent): void
{
$this->userAgent = $userAgent;
}
/**
* @return \DateTime
*/
public function getConnTimestamp(): \DateTime
{
return $this->connTimestamp;
}
/**
* @param \DateTime $connTimestamp
*/
public function setConnTimestamp(\DateTime $connTimestamp): void
{
$this->connTimestamp = $connTimestamp;
}
}