是否有其他方法可以获取计算机的mac地址并能够重定向页面 我注意到,如果我删除获取mac地址的代码,重定向/标头工作
<?php
session_start();
include('dbConnect.php');
ob_start(); // Turn on output buffering
system(‘ipconfig /all’); //Execute external program to display output
$mycom=ob_get_contents(); // Capture the output into a variable
ob_clean(); // Clean (erase) the output buffer
$findme = “Physical”;
$pmac = strpos($mycom, $findme); // Find the position of Physical text
$mac=substr($mycom,($pmac+36),17); // Get Physical Address
$qry=("SELECT * FROM table_comp_list WHERE comp_mac = '$mac'");
$result=mysql_query($qry);
if($result)
{
if(mysql_num_rows($result) != 1)
{
header("Location: add.php");
die();
}
else
{
header("Location: edit.php");
die();
}
}?>
答案 0 :(得分:-1)
在代码开始时尝试此操作。在session_start();
之前添加@ <?php
@session_start();
// your code goes here -
?>