Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 允许用户在特定位置进入页面_Php_Geolocation - Fatal编程技术网

Php 允许用户在特定位置进入页面

Php 允许用户在特定位置进入页面,php,geolocation,Php,Geolocation,第一篇文章在这里,读了一本书 我是个新手,我用一些地理定位的东西撞到了墙上 我正在为我当地的手枪射击俱乐部建立一个页面,整个想法是只能在实际存在时使用它,因为该页面的主要目的是记录射击核心等。因此,为了防止骗子呆在家里,不射击就增加分数,我想添加一个地理位置的东西,以便只使用特定的功能如果有人在现场,则可用 我不知道如何解决这个问题,所以我正在和你们联系。我的计划是添加8个不同的lat和long来创建一个圆圈,并使用=来确定用户是否在该圆圈中。但我不能让它发生 <script type="

第一篇文章在这里,读了一本书

我是个新手,我用一些地理定位的东西撞到了墙上

我正在为我当地的手枪射击俱乐部建立一个页面,整个想法是只能在实际存在时使用它,因为该页面的主要目的是记录射击核心等。因此,为了防止骗子呆在家里,不射击就增加分数,我想添加一个地理位置的东西,以便只使用特定的功能如果有人在现场,则可用

我不知道如何解决这个问题,所以我正在和你们联系。我的计划是添加8个不同的lat和long来创建一个圆圈,并使用=来确定用户是否在该圆圈中。但我不能让它发生

<script type="text/javascript>
function showlocation() {
    if (navigator.geolocation)
    {
        navigator.geolocation.getCurrentPosition(showPosition, showError);
    }
    else
    {
        alert("Geolocation is not supported by this browser.");
    }
}
function showError(error)
{
    switch (error.code)
    {
        case error.PERMISSION_DENIED:
            alert("User denied the request for Geolocation.")
            break;
        case error.POSITION_UNAVAILABLE:
            alert("Location information is unavailable.")
            break;
        case error.TIMEOUT:
            alert("The request to get user location timed out.")
            break;
        case error.UNKNOWN_ERROR:
            alert("An unknown error occurred.")
            break;
    }
}

function showPosition(pos)
{
    if (pos.coords.longitude >= 12.035540 && pos.coords.longitude <= 12.035593 &&
            pos.coords.latitude <= 57.760657 && pos.coords.latitude >= 57.759410)
    //those are the gps coordinates that i have but they are only creating a straight line
    //not a circle and if I use them alone, it, will work, sometimes depending on the        
    //reception of the unit. I tried to add 2 sets of coordinates, but then it will not at     
    //all.

    {
        window.location = 'shootingSession.php'; //if i'm at the scene, send me to this page
    } else {
        window.location = 'cheater.php'; //if i'm a cheeter, send me to the dirthole
    }
}
</script>

用户是否正在访问现场设备以完成评分表?或者这可以通过移动设备访问吗?什么可以阻止“骗子”直接访问?看来你需要一些额外的安全措施。谢谢你的快速回复!非常感谢!对目前,可以通过输入shootingSession.php的地址来“绕过”系统。这就要改变了。目前,我的地理定位问题一直困扰着我。有人知道我怎么解决吗?使用带有大量if坐标的数据库?我想让“可访问”的区域大约是200米x200米(600英尺x600英尺),因此坐标量会很大。-------整个网页系统可以使用智能手机和计算机访问。对于这种目的,地理定位实际上是不可行的。最好在俱乐部安装web服务器,并使用路由器或其他东西通过本地Wifi网络为网站提供服务。只要依赖客户端信息(如f.e.geolocation),你想做的任何事情都很容易绕过。