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.
74 lines
2.3 KiB
74 lines
2.3 KiB
6 years ago
|
<?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);
|
||
|
///禁止非法访问
|
||
|
if ($result->num_rows > 0) {}else{echo "<script>alert('非法访问!');setTimeout(function(){top.location='../index/logout.php';},0)</script>";}
|
||
|
|
||
|
$row = $result->fetch_assoc();
|
||
|
///将用户信息导入php变量,以方便下文引用
|
||
|
$name= $row['name'];
|
||
|
$user=$row['username'];
|
||
|
$count=$row['count'];
|
||
|
$tel=$row['tel'];
|
||
|
$qq= $row['qq'];
|
||
|
$ip= $row['ip'];
|
||
|
$dev=$row['dev'];
|
||
|
$position= $row['position'];
|
||
|
?>
|
||
|
|
||
|
<?php
|
||
|
$name5=$_GET['name5'];
|
||
|
|
||
|
$hosttime=date('Y-m-d H:i:s',time());
|
||
|
|
||
|
$mydbhost = "localhost";
|
||
|
$mydbuser = "steel";
|
||
|
$mydbpass = '151515';
|
||
|
$conn = mysqli_connect($mydbhost, $mydbuser, $mydbpass);
|
||
|
if(! $conn){
|
||
|
die("connect error: " . mysqli_error($conn));
|
||
|
}
|
||
|
mysqli_select_db( $conn, 'steel');
|
||
|
|
||
|
$sql="UPDATE bug set host='$name', hosttime='$hosttime' where name='$name5'";
|
||
|
|
||
|
|
||
|
if ($conn->query($sql) === TRUE) {echo "<script>alert('认领成功!请尽快处理!');window.location.href='dev.php'</script>";
|
||
|
|
||
|
} else {
|
||
|
echo "Error: " . $sql . "<br>" . $conn->error;
|
||
|
}
|
||
|
|
||
|
mysqli_close($conn);
|
||
|
?>
|