HardSoft-Viewer PHP_index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head><title>HardSoft-Viewer</title></head>
<body>

<?php
$link=mysql_connect(‘localhost‘,‘guest‘,‘guest‘) or die(mysql_error());
mysql_select_db(‘HardSoft‘,$link);
mysql_query(‘set names utf8‘,$link);

if ($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"])
{
$ip = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];
}
elseif ($HTTP_SERVER_VARS["HTTP_CLIENT_IP"])
{
$ip = $HTTP_SERVER_VARS["HTTP_CLIENT_IP"];
}
elseif ($HTTP_SERVER_VARS["REMOTE_ADDR"])
{
$ip = $HTTP_SERVER_VARS["REMOTE_ADDR"];
}
elseif (getenv("HTTP_X_FORWARDED_FOR"))
{
$ip = getenv("HTTP_X_FORWARDED_FOR");
}
elseif (getenv("HTTP_CLIENT_IP"))
{
$ip = getenv("HTTP_CLIENT_IP");
}
elseif (getenv("REMOTE_ADDR"))
{
$ip = getenv("REMOTE_ADDR");
}
else
{
$ip = "Unknown";
}

 
if (isset($_GET[‘id‘]) && $_GET[‘action‘]==‘getsoftlist‘){
    $sql="SELECT * FROM Software where id = ‘".trim($_GET[‘id‘])."‘";
//    mysql_query("set names latin1",$link);
    $result=mysql_query($sql);
    while ($row=mysql_fetch_array($result)){
        echo $row[‘SoftName‘]."<br>";    
    }
    echo "<br><br><a href=‘javascript:history.go(-1)‘ target=_self>返回</a>";
    exit();
}
echo ‘<br><br>‘;
?>

<div align=‘center‘>
<form name=‘search‘ action="" method="post" onsubmit="javascript:return check();">
<select name=‘type‘ id =‘type‘>
        <option value=‘id‘>財產編號</option>
        <option value=‘ip‘>IP地址</option>
</select>
<input name=‘class‘ type=‘text‘ id=‘class‘ size=40></input>
<br><input type=‘submit‘ name=‘submit‘ value="提交"></input>
<input type=‘reset‘ name=‘reset‘ value="重置"></input>
</form>
</div>
<?php
if ($_SERVER[‘REQUEST_METHOD‘]==‘POST‘)
{
if ($_POST[‘type‘]==‘id‘){
    $sql="SELECT * FROM Get_Scan_Info where id=‘".trim($_POST[‘class‘])."‘";
}
if ($_POST[‘type‘]==‘ip‘){
        $sql="SELECT * FROM Get_Scan_Info where IP_Address LIKE ‘%".trim($_POST[‘class‘])."%‘ ORDER BY IP_Address ASC LIMIT 1";
}
        $result=mysql_query($sql);
        while ($row=mysql_fetch_array($result))
        {
                 echo ‘<br><br>廠    別:‘.$row[‘Factory‘].‘<br>‘;
                 echo ‘部門:‘.$row[‘Depart‘].‘<br>‘;
                 echo ‘財產編號:‘.$row[‘id‘].‘<br>‘;
                 echo ‘工    號:‘.$row[‘Accound‘].‘<br>‘;
                 echo ‘姓    名:‘.$row[‘Owner‘].‘<br><br>‘;
                 echo ‘操作系統:‘.$row[‘OS‘].‘<br>‘;
                 echo ‘   CPU  :‘.$row[‘CPU‘].‘<br>‘;
                 echo ‘標準內存:‘.$row[‘STAND_Ram‘].‘<br>‘;
                 echo ‘顯    卡:‘.$row[‘Display_Card‘].‘<br>‘;
                 echo ‘主板型號:‘.$row[‘MotherBoard_Type‘].‘<br>‘;
                 echo ‘硬盤型號:‘.$row[‘HardDisk_Type‘].‘<br>‘;
                 echo ‘硬盤大小:‘.$row[‘STAND_HD_Size‘].‘<br>‘;
                 echo ‘網    卡:‘.$row[‘NetCard_Type‘].‘<br>‘;
                 echo ‘MAC:‘.$row[‘MAC_Address‘].‘<br>‘;
                 echo ‘IP:‘.$row[‘IP_Address‘].‘<br><br>‘;
                 echo ‘管理員:‘.$row[‘Admin‘].‘<br>‘;
                 echo ‘POWERUSER:‘.$row[‘Poweruser‘].‘<br>‘;
                 echo ‘USB:‘.$row[‘USB‘].‘<br><br>‘;
                 echo ‘標記:‘.$row[‘Mark‘].‘<br>‘;
                 echo ‘備註:‘.$row[‘Note‘].‘<br>‘;
                 $id=$row[‘id‘];
        }
        echo "<br><br>版權軟件信息:<br>";
        $softsql="SELECT * FROM Get_Soft WHERE id=‘".$id."‘";
        $softresult=mysql_query($softsql,$link);
        while ( $softrow=mysql_fetch_array($softresult))
        {
        //      print_r($softrow);
                 echo $softrow[‘SoftName‘].‘<br>‘;
        }

        echo "<br><br><a href=?id=$id&action=getsoftlist>獲取軟件安裝列表</a>";
        exit();
}


//$sql="SELECT * FROM data where IP like ‘%".$ip."%‘";
$sql="SELECT * FROM Get_Scan_Info WHERE IP_Address LIKE ‘%".$ip."%‘ ORDER BY IP_Address ASC LIMIT 1";
        $result=mysql_query($sql);
        while ($row=mysql_fetch_array($result))
        {
                 echo ‘<br><br>廠    別:‘.$row[‘Factory‘].‘<br>‘;
                 echo ‘部門:‘.$row[‘Depart‘].‘<br>‘;
                 echo ‘財產編號:‘.$row[‘id‘].‘<br>‘;
                 echo ‘工    號:‘.$row[‘Accound‘].‘<br>‘;
                 echo ‘姓    名:‘.$row[‘Owner‘].‘<br><br>‘;
                 echo ‘操作系統:‘.$row[‘OS‘].‘<br>‘;
                 echo ‘   CPU  :‘.$row[‘CPU‘].‘<br>‘;
                 echo ‘標準內存:‘.$row[‘STAND_Ram‘].‘<br>‘;
                 echo ‘顯    卡:‘.$row[‘Display_Card‘].‘<br>‘;
                 echo ‘主板型號:‘.$row[‘MotherBoard_Type‘].‘<br>‘;
                 echo ‘硬盤型號:‘.$row[‘HardDisk_Type‘].‘<br>‘;
                 echo ‘硬盤大小:‘.$row[‘STAND_HD_Size‘].‘<br>‘;
                 echo ‘網    卡:‘.$row[‘NetCard_Type‘].‘<br>‘;
                 echo ‘MAC:‘.$row[‘MAC_Address‘].‘<br>‘;
                 echo ‘IP:‘.$row[‘IP_Address‘].‘<br><br>‘;
                 echo ‘管理員:‘.$row[‘Admin‘].‘<br>‘;
                 echo ‘POWERUSER:‘.$row[‘Poweruser‘].‘<br>‘;
                 echo ‘USB:‘.$row[‘USB‘].‘<br><br>‘;
                 echo ‘標記:‘.$row[‘Mark‘].‘<br>‘;
                 echo ‘備註:‘.$row[‘Note‘].‘<br>‘;
                 $id=$row[‘id‘];
        }
        echo "<br><br>版權軟件信息:<br>";
        $softsql="SELECT * FROM Get_Soft WHERE id=‘".$id."‘";
        $softresult=mysql_query($softsql,$link);
        while ( $softrow=mysql_fetch_array($softresult))
        {
        //      print_r($softrow);
                 echo $softrow[‘SoftName‘].‘<br>‘;
        }

        echo "<br><br><a href=?id=$id&action=getsoftlist>獲取軟件安裝列表</a>";
?>


本文出自 “枫林晚” 博客,请务必保留此出处http://fengwan.blog.51cto.com/508652/1619691

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。