sourcecodeofMESData

WBOY
發布: 2016-06-07 16:04:44
原創
1119 人瀏覽過

HTMLHEADTITLETELOGS/TITLE/HEADBODY?php/* command line parameters: wget http://localhost/query.php?action=querysn=123 -O get1.html */$act=$_GET[action];/* http://localhost/query.php?action=querysn=123 */if ($act == query){$serialnumber=$_GE

<HTML>
<HEAD>
<TITLE>TELOGS</TITLE>
</HEAD>
<BODY>
<?php
	/* command line parameters:  wget "http://localhost/query.php?action=query&sn=123" -O get1.html */

	$act=$_GET["action"];
	/* http://localhost/query.php?action=query&sn=123  */
	if ($act == "query"){
		$serialnumber=$_GET["sn"];
		
		$con = mysql_connect("localhost","root","123456");
		if (!$con){
			die(&#39;Could not connect: &#39; . mysql_error());
		}

		mysql_select_db("test", $con);
		$sql = "SELECT * FROM testlogs where Serial_number=&#39;".$serialnumber."&#39;";
		$result = mysql_query($sql);
		if (mysql_num_rows($result) != "0" ){
			while($row = mysql_fetch_array($result))
			{
				echo $row[&#39;Serial_number&#39;] . "|" . $row[&#39;Mac_addr&#39;]."|". $row[&#39;OA_KEY&#39;]."\n";
			}
		}else{
			echo "No data of this serial number=".$serialnumber;
		}
		mysql_close($con);
	}
?>

<?php
	/* http://localhost/query.php?action=add&sn=123&mac=eeee&oakey=123   */
	if ($act == "add"){

		$serialnumber=$_GET["sn"];
		$macaddr=$_GET["mac"];
		$oakey=$_GET["oakey"];
		
		$con = mysql_connect("localhost","root","123456");
		if (!$con){
			die(&#39;Could not connect: &#39; . mysql_error());
		}

		mysql_select_db("test", $con);
		$sql="INSERT INTO testlogs (Serial_number, Mac_addr, OA_KEY) values (&#39;".$serialnumber."&#39;,"."&#39;".$macaddr."&#39;,"."&#39;".$oakey."&#39;)";
		if(mysql_query($sql)){
			echo "Add data Passed";
		}else{
			echo "Add data failed";
		}
		mysql_close($con);
	}
?>
</BODY>
</HTML>
登入後複製

來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板