You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.8 KiB
71 lines
1.8 KiB
|
|
<?php //验证是否登录 |
|
header("content-type:text/html;charset=utf-8"); ///规定php字符集为utf-8 |
|
|
|
if(!isset($_COOKIE['login']))///从cookie读取login值,判断是否存在 |
|
{ |
|
echo "<script>setTimeout(function(){top.location='../index/logout.php';},0)</script>"; |
|
} |
|
|
|
if($_COOKIE["login"]==15){}//判断login是否为15,否则服务器中断网页加载并提示500错误 |
|
//提取cookie中用户特征信息 |
|
$code=$_COOKIE['code']; |
|
//用户特征信息解密,并分解为code(数据库端调用的用户特征)与key(用户设备特征信息,用于判断cookie是否被移植) |
|
$key=base64_decode($code); |
|
$code= base64_decode(substr($key,0,8)); |
|
$key= substr($key,8,8); |
|
?> |
|
|
|
|
|
<?php //用户基础信息获取 |
|
$servername = "localhost"; |
|
$username = "steel"; |
|
$password = "151515"; |
|
$dbname = "steel"; |
|
|
|
// 创建连接 |
|
$conn = new mysqli($servername, $username, $password, $dbname); |
|
// Check connection |
|
if ($conn->connect_error) |
|
{ |
|
die("连接失败: " . $conn->connect_error); |
|
} |
|
///根据code用户特征调取指定用户信息 |
|
$sql = "SELECT * FROM login where code=$code"; |
|
|
|
$result = $conn->query($sql); |
|
|
|
$row = $result->fetch_assoc(); |
|
///将用户信息导入php变量,以方便下文引用 |
|
$name= $row['name']; |
|
$user=$row['username']; |
|
$count=$row['count']; |
|
$tel=$row['tel']; |
|
$qq= $row['qq']; |
|
$ip= $row['ip']; |
|
$position= $row['position']; |
|
?> |
|
|
|
<?php //更新数据库gps |
|
|
|
$sign=$_GET['sign']; |
|
$gps=$_GET['gps']; |
|
|
|
$sql="UPDATE log set gps='$gps' where sign='$sign' ";///更新日志 |
|
|
|
$sql1="UPDATE login set gps='$gps' where name='$name' ";//更新login |
|
|
|
if ($conn->query($sql1)&& $conn->query($sql)=== TRUE) {} |
|
else |
|
{ |
|
echo "Error: " . $sql . "<br>" . $conn->error; |
|
} |
|
|
|
$conn->close();//关闭数据库 |
|
|
|
echo "<script>window.close();</script>";///关闭窗口 |
|
?> |
|
|
|
|
|
|
|
|
|
|