<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><?phpclassmysql{private$DBHOST='localhost';private$DBUSER='HardSoft';private$DBPASS='HardSoft-Viewer';private$DBNAME='HardSoft';private$CONN;publicfunction__construct(){try{$conn=@mysql_connect($this->DBHOST,$this->DBUSER,$this->DBPASS);}catch(Exception$e){echo$e;}try{mysql_select_db($this->DBNAME,$conn);}catch(Exception$e){echo$e;}$this->CONN=$conn;mysql_query("SETNAMESUTF8");}publicfunctionselect($sql=""){if(empty($sql))returnfalse;if(empty($this->CONN))returnfalse;try{$result=mysql_query($sql,$this->CONN);}catch(Exception$e){echo$e;}if((!$result)or(empty($result))){@mysql_free_result($result);returnfalse;}$count=0;$data=array();while($row=@mysql_fetch_array($result)){$data[$count]=$row;$count++;}@mysql_free_result($result);return$data;}publicfunctioninsert($sql=""){if(empty($sql))returnfalse;if(empty($this->CONN))returnfalse;try{$result=mysql_query($sql,$this->CONN);}catch(Exception$e){echo$e;}if(!$result){return0;}else{return@mysql_insert_id($this->CONN);}}publicfunctionupdate($sql=""){if(empty($sql))returnfalse;if(empty($this->CONN))returnfalse;try{$result=mysql_query($sql,$this->CONN);}catch(Exception$e){echo$e;}return$result;}publicfunctiondelete($sql=""){if(empty($sql))returnfalse;if(empty($this->CONN))returnfalse;try{$result=mysql_query($sql,$this->CONN);}catch(Exception$e){echo$e;}return$result;}}?><htmlxmlns="http://www.w3.org/1999/xhtml"lang="zh-CN"><head><metahttp-equiv="Content-Type"content="text/html;charset=utf8"/><title>HardSoft-Viewer</title><styletype="text/css"><!--body{font-family:SimSun,Arial,Helvetica,sans-serif;font-size:14px;color:#666666;background:#fff;text-align:center;}*{margin:0;padding:0;}a{color:#1E7ACE;text-decoration:none;}a:hover{color:#000;text-decoration:underline;}h4{font-size:14px;font-weight:bold;}pre,p{color:#1E7ACE;margin:4px;}input,select,textarea{padding:2px;margin:3px;font-size:12px;}.buttom{padding:1px10px;font-size:12px;border:1px#1E7ACEsolid;background:#D0F0FF;}#formwrapper{width:700px;margin:15pxauto;padding:20px;text-align:left;border:1pxsolid#A4CDF2;}fieldset{padding:10px;margin-top:5px;border:1pxsolid#A4CDF2;background:#fff;}fieldsetlegend{color:#1E7ACE;font-weight:bold;padding:3px20px3px20px;border:1pxsolid#A4CDF2;background:#fff;}fieldsetlabel{float:left;width:650px;text-align:left;padding:3px;margin:1px;}#edit{float:left;width:50px;text-align:left;padding:3px;margin:1px;}fieldsetdiv{clear:left;margin-bottom:2px;}.enter{text-align:center;}.clear{clear:both;}--></style></head><body><?phpif(($_GET['action']!="getsoftlist")and($_GET['action']!="editinfo")){?><br><center><formname='search'action=""method="post"><selectname='type'id='type'><optionvalue='id'>按財編</option><optionvalue='ip'>按IP</option></select><inputtype='hidden'name='action'value='select'></input><inputname='class'type='text'id='class'size=30/><inputname="select"type="button"class="buttom"value="搜尋"/></form></center><?php}?><?php$conn=newmysql();$ip=$_SERVER['REMOTE_ADDR'];if($_SERVER['REQUEST_METHOD']=='POST'){if($_POST['action']=='select'){switch($_POST['type']){case'id':$sql="SELECT*FROMGet_Scan_Infowhereid='".trim($_POST['class'])."'";break;case'ip':$sql="SELECT*FROMGet_Scan_InfowhereIP_AddressLIKE'%".trim($_POST['class'])."%'ORDERBYIP_AddressASCLIMIT1";break;default:echo"InputError!";exit();}$data=$conn->select($sql);if($data){foreach($dataas$key=>$value){?><divid="formwrapper"><divalign='center'><h4>ASC硬件管理系統</h4></div><fieldset><legend>用戶信息</legend><div><labelfor="Name">廠別:<?phpecho$value['Factory'];?></label><br/></div><div><labelfor="Name">部門:<?phpecho$value['Depart'];?></label><br/></div><div><labelfor="Name">財編:<?phpecho$value['id'];?></label><br/></div><div><labelfor="Name">工號:<?phpecho$value['Account'];?></label><br/></div><div><labelfor="Name">用戶:<?phpecho$value['Owner'];?></label><br/></div><div><labelfor="Name">位置:<?phpecho$value['Locate'];?></label><br/></div><div><labelfor="Name">標記:<?phpecho$value['Mark'];?></label><br/></div><div><labelfor="Name">備註:<?phpecho$value['Note'];?></label><br/></div><inputname="edit"type="button"class="buttom"value="編輯"onclick="location.href='?id=<?phpecho$value['id'];?>&action=editinfo'"/></fieldset><br/><fieldset><legend>配置信息</legend><div><labelfor="Name">系統:<?phpecho$value['OS'];?></label><br/></div><div><labelfor="Name">CPU:<?phpecho$value['CPU'];?></label><br/></div><div><labelfor="Name">內存:<?phpecho$value['STAND_Ram'];?></label><br/></div><div><labelfor="Name">顯卡:<?phpecho$value['Display_Card'];?></label><br/></div><div><labelfor="Name">主板:<?phpecho$value['MotherBoard_Type'];?></label><br/></div><div><labelfor="Name">硬盤:<?phpecho$value['HardDisk_Type'];?></label><br/></div><div><labelfor="Name">大小:<?phpecho$value['STAND_HD_Size'];?></label><br/></div><div><labelfor="Name">網卡:<?phpecho$value['NetCard_Type'];?></label><br/></div><div><labelfor="Name">MAC:<?phpecho$value['MAC_Address'];?></label><br/></div><div><labelfor="Name">IP:<?phpecho$value['IP_Address'];?></label><br/></div></fieldset><br/><fieldset><legend>權限信息</legend><div><labelfor="Name">管理員組:<?phpecho$value['Admin'];?></label><br/></div><div><labelfor="Name">PowerUser:<?phpecho$value['Poweruser'];?></label><br/></div><div><labelfor="Name">USB存儲:<?phpecho$value['USB'];?></label><br/></div></fieldset><br/><fieldset><legend>版權軟件信息</legend><?php$softsql="SELECT*FROMGet_SoftWHEREid='".$value['id']."'";$soft=$conn->select($softsql);if($soft){foreach($softas$k=>$v){?><div><labelfor="Name"><?phpecho($k+1).'、'.$v['SoftName'];?></label><br/></div><?php}}?><inputname="select"type="button"class="buttom"value="所有軟件"onclick="location.href='?id=<?phpecho$value['id'];?>&action=getsoftlist'"/></fieldset><br/></div><?php}}else{echo'<br/>未搜尋到相關信息!';}exit();}elseif($_POST['action']=='edit'){$id=mysql_real_escape_string($_POST['id']);$Factory=mysql_real_escape_string($_POST['Factory']);$Depart=mysql_real_escape_string($_POST['Depart']);$Owner=mysql_real_escape_string($_POST['Owner']);$Account=mysql_real_escape_string($_POST['Account']);$Locate=mysql_real_escape_string($_POST['Locate']);$Mark=mysql_real_escape_string($_POST['Mark']);$Note=mysql_real_escape_string($_POST['Note']);if(empty($id)){echo"<scriptlanguage='javascript'>";echo"alert('財產編號不能為空,請檢查!');";echo"history.back()";echo"</script>";exit();}if(empty($Factory)){echo"<scriptlanguage='javascript'>";echo"alert('廠別不能為空,請檢查!');";echo"history.back()";echo"</script>";exit();}if(empty($Depart)){echo"<scriptlanguage='javascript'>";echo"alert('部門不能為空,請檢查!');";echo"history.back()";echo"</script>";exit();}if(empty($Locate)){echo"<scriptlanguage='javascript'>";echo"alert('存放位置不能為空,請檢查!');";echo"history.back()";echo"</script>";exit();}//查詢是否存在傳遞過來財產編號$sql="SELECTidfromComputerswhereid='".$id."'";$result=mysql_query($sql);if(empty($result)){echo"<scriptlanguage='javascript'>";echo"alert('無法查找到".$_POST['id']."這個財產編號,請檢查確認!');";echo"history.back()";echo"</script>";exit();}//對用戶使用信息進行更改$sql="UPDATEComputersSETFactory='".$Factory."',Depart='".$Depart."',Owner='".$Owner."',Account='".$Account."',Locate='".$Locate."',Mark='".$Mark."',Note='".$Note."'WHEREid='".$id."'";$result=$conn->update($sql);switch(mysql_affected_rows()){case1:echo"<scriptlanguage='javascript'>";echo"alert('".$_POST['id']."修改成功');";echo"history.back()";echo"</script>";break;case0:echo"<scriptlanguage='javascript'>";echo"alert('未修改".$_POST['id']."財產的信息');";echo"history.back(-1)";echo"</script>";break;case-1:echo"<scriptlanguage='javascript'>";echo"alert('修改".$_POST['id']."失敗,請檢查確認!');";echo"history.back()";echo"</script>";break;default:echo"<scriptlanguage='javascript'>";echo"alert('未知錯誤');";echo"history.back()";echo"</script>";}exit();}}?><?php//根據動作名稱為getsoftlist查詢$id的软件列表if(isset($_GET['id'])&&$_GET['action']=='getsoftlist'){$sql="SELECT*FROMSoftwarewhereid='".trim($_GET['id'])."'";$softlist=$conn->select($sql);if($softlist){echo'<br/><inputname="back"type="button"class="buttom"value="返回"onclick="location.href=\'javascript:history.go(-1);\'"></input>';echo"<divid='formwrapper'><fieldset><legend>".$_GET['id'].'主機軟件列表</legend>';foreach($softlistas$key=>$value){echo"<div><labelfor='Name'>".($key+1).'、'.$value['SoftName'].'</label><br/></div>';}echo'<inputname="back"type="button"class="buttom"value="返回"onclick="location.href=\'javascript:history.go(-1);\'"></input>';echo'</fieldset></div>';}else{echo'無財產編號為'.$_GET['id'].'的軟件安裝列表!';}exit();}if(isset($_GET['id'])&&$_GET['action']=='editinfo'){$sql="SELECT*FROMComputersWHEREid='".trim($_GET['id'])."'";$info=$conn->select($sql);if($info){echo"<divid='formwrapper'><fieldset><legend>".$_GET['id'].'主機用戶信息編輯</legend>';foreach($infoas$key=>$value){?><formaction=''method='post'><inputtype='hidden'name='action'value='edit'></input><br/><div><divid="edit">財編:</div><inputtype="text"name="id"size="20"readonly="readonly"value='<?phpecho$value['id'];?>'/><br/></div><div><divid="edit">廠別:</div><inputtype="text"name="Factory"size="20"value='<?phpecho$value['Factory'];?>'/><br/></div><div><divid="edit">部門:</div><inputtype="text"name="Depart"size="20"value='<?phpecho$value['Depart'];?>'/><br/></div><div><divid="edit">用戶:</div><inputtype="text"name="Owner"size="20"value='<?phpecho$value['Owner'];?>'/><br/></div><div><divid="edit">賬號:</div><inputtype="text"name="Account"size="20"value='<?phpecho$value['Account'];?>'/><br/></div><div><divid="edit">位置:</div><inputtype="text"name="Locate"size="20"value='<?phpecho$value['Locate'];?>'/><br/></div><div><divid="edit">標記:</div><inputtype="text"name="Mark"size="20"value='<?phpecho$value['Mark'];?>'/><br/></div><div><divid="edit">備註:</div><textarearow=3cols=20name='Note'><?phpecho$value['Note'];?></textarea><br/></div><?php}?><inputtype="submit"class="buttom"value="確定"></input>&nbsp<inputtype="button"class="buttom"value="返回"onclick="location.href='javascript:history.go(-1);'"></input></form></fieldset></div><?php}exit();}//默認動作,根據IP查詢主機相關信息$sql="SELECT*FROMGet_Scan_InfoWHEREIP_AddressLIKE'%".$ip."%'ORDERBYIP_AddressASCLIMIT1";$data=$conn->select($sql);if($data){foreach($dataas$key=>$value){?><divid="formwrapper"><divalign='center'><h4>寶成國際集團硬件管理系統</h4></div><fieldset><legend>用戶信息</legend><div><labelfor="Name">廠別:<?phpecho$value['Factory'];?></label><br/></div><div><labelfor="Name">部門:<?phpecho$value['Depart'];?></label><br/></div><div><labelfor="Name">財編:<?phpecho$value['id'];?></label><br/></div><div><labelfor="Name">用戶:<?phpecho$value['Owner'];?></label><br/></div><div><labelfor="Name">工號:<?phpecho$value['Account'];?></label><br/></div><div><labelfor="Name">位置:<?phpecho$value['Locate'];?></label><br/></div><div><labelfor="Name">標記:<?phpecho$value['Mark'];?></label><br/></div><div><labelfor="Name">備註:<?phpecho$value['Note'];?></label><br/></div><inputname="edit"type="button"class="buttom"value="編輯"onclick="location.href='?id=<?phpecho$value['id'];?>&action=editinfo'"/></fieldset><br/><fieldset><legend>配置信息</legend><div><labelfor="Name">系統:<?phpecho$value['OS'];?></label><br/></div><div><labelfor="Name">CPU:<?phpecho$value['CPU'];?></label><br/></div><div><labelfor="Name">內存:<?phpecho$value['STAND_Ram'];?></label><br/></div><div><labelfor="Name">顯卡:<?phpecho$value['Display_Card'];?></label><br/></div><div><labelfor="Name">主板:<?phpecho$value['MotherBoard_Type'];?></label><br/></div><div><labelfor="Name">硬盤:<?phpecho$value['HardDisk_Type'];?></label><br/></div><div><labelfor="Name">大小:<?phpecho$value['STAND_HD_Size'];?></label><br/></div><div><labelfor="Name">網卡:<?phpecho$value['NetCard_Type'];?></label><br/></div><div><labelfor="Name">MAC:<?phpecho$value['MAC_Address'];?></label><br/></div><div><labelfor="Name">IP:<?phpecho$value['IP_Address'];?></label><br/></div></fieldset><br/><fieldset><legend>權限信息</legend><div><labelfor="Name">管理員組:<?phpecho$value['Admin'];?></label><br/></div><div><labelfor="Name">PowerUser:<?phpecho$value['Poweruser'];?></label><br/></div><div><labelfor="Name">USB存儲:<?phpecho$value['USB'];?></label><br/></div></fieldset><br/><fieldset><legend>版權軟件信息</legend><?php$softsql="SELECT*FROMGet_SoftWHEREid='".$value['id']."'";$soft=$conn->select($softsql);if($soft){foreach($softas$k=>$v){?><div><labelfor="Name"><?phpecho($k+1).'、'.$v['SoftName'];?></label><br/></div><?php}}?><inputname="select"type="button"class="buttom"value="所有軟件"onclick="location.href='?id=<?phpecho$value['id'];?>&action=getsoftlist'"/></fieldset></div><?php}}else{echo"無此主機相關信息";}?></body></html>