[PHP] 纯文本查看 复制代码
收集的一些东西$conn=mysqli_connect('127.0.0.1','root','');//数据库连接
mysqli_select_db($conn,"test");//选择数据库
$hash='select count(*) from artifact where type="hash"';
$tiquan='select count(*) from artifact where type="提权"';
$dict='select count(*) from artifact where type="字典"';
$inlan='select count(*) from artifact where type="内网"';
$web='select count(*) from artifact where type="web"';
$arr = array();
array_push($arr,$hash,$tiquan,$dict,$inlan,$web);//搜索语句放入数组
foreach ($arr as $key => $value) {
$query=mysqli_query($conn,$value);//执行sql语句
while($row = mysqli_fetch_array($query))
{
$re=preg_match('/type="(.*)"/',$value,$match);//匹配type
echo '
'.$match[1].'['.$row[0].']'.'';//打印输出}
}
?>
简介用途种类
$str1='';
if(!isset($_GET['type']))
{
$str1='';
}
else{
$str1= " where type='".addslashes($_GET['type'])."'";
}
$conn=mysqli_connect('127.0.0.1','root','');//连接数据库
mysqli_select_db($conn,"test");//选择数据库
$query=mysqli_query($conn,'select * from artifact'.$str1) or die('Error happens');//执行sql语句
while($row = mysqli_fetch_array($query))//循环输出
{
echo '
';echo '
'.$row['name'].''.$row['intro'].''.$row['type'].'';echo '
';}
?>