0
私は、次のPHP/HTMLを持ってpagePHPトリム機能を適切
<html>
<head>
<title>DZ Prototype</title>
<link rel="icon" type="img/ico" href="images/favicon.jpg">
<meta http-equiv="refresh" content="30">
</head>
<body>
<center>
<h1>Welcome to DZ Prototype Testing Area!!</h1>
</center>
<p></p>
<p></p>
<p></p>
<p style="text-align:center"><img src="https://diasp.eu/uploads/images/scaled_full_122e075ce77580c93020.jpeg" alt="It works!!"></p>
<p></p>
<p></p>
<div align="center">
<?php
$filename = "cowrie.txt";
$line = file($filename);
echo $line[15];
if(file_exists($filename)){
echo "<h2>Read through file and</h2>";
}
else{
echo "<h2>Upload not successful</h2>";
}
echo trim($line[15]);
if (trim($line[15]) == "Correctly Classified Instances 0 0 %") {
echo "<h2><font color='red'>Last entry is a Possible Malicious Login Attempt</h2>";
} else {
echo "<h2><font color='green'>Status Green</h2>";
}
?>
</div>
</body>
</html>
を機能していないことは、トリム機能上の条件が守られていない場合と思われます。私は、ページ上のテキストファイルの行にトリム関数を表示してデバッグしています。本当に私は何が欠けているのか分からない。
これは私が問題だかわからないので、15行目では、症状の正確なラインである必要があり、テキストファイル
J48 pruned tree
------------------
AttemptsOnIP <= 6: 0 (9.0)
AttemptsOnIP > 6: 1 (20.0)
Number of Leaves : 2
Size of the tree : 3
=== Error on test data ===
Correctly Classified Instances 0 0 %
Incorrectly Classified Instances 1 100 %
Kappa statistic 0
Mean absolute error 1
Root mean squared error 1
Total Number of Instances 1
=== Detailed Accuracy By Class ===
TP Rate FP Rate Precision Recall F-Measure MCC ROC Area PRC Area Class
0.000 0.000 0.000 0.000 0.000 0.000 ? 1.000 0
0.000 1.000 0.000 0.000 0.000 0.000 ? ? 1
Weighted Avg. 0.000 0.000 0.000 0.000 0.000 0.000 0.000 1.000
=== Confusion Matrix ===
a b <-- classified as
0 1 | a = 0
0 0 | b = 1
です。
空白の数は、テキストファイルのように「正しく分類インスタンス0 0%」で同じではありません...それらがタブでない限り、あなたのIFも失敗するでしょう。 – Webomatik
はい、列を作るためにタブのように見えます。 'trim()'は最初と最後からトリムするだけです。 – AbraCadaver
行内の空白を置き換えたい場合は、 'trim()'ではなく 'preg_replace()'を使用してください。 – Barmar