Neroml / Templates /NB+DT+SVM.html
deedrop1140's picture
Upload 69 files
6491927 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hybrid URL Spam Checker</title>
<style>
body {
font-family: Arial, sans-serif;
background: #f7f9fc;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
background: #ffffff;
padding: 30px;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
width: 400px;
text-align: center;
}
input {
padding: 10px;
width: 90%;
margin-bottom: 15px;
border-radius: 6px;
border: 1px solid #ccc;
}
button {
padding: 10px 20px;
border: none;
background-color: #007BFF;
color: white;
border-radius: 6px;
cursor: pointer;
}
.result {
margin-top: 20px;
font-size: 16px;
font-weight: bold;
}
.safe {
color: green;
}
.spam {
color: red;
}
</style>
</head>
<body>
<div class="container">
<h2>πŸ” Hybrid URL Spam Checker (NB + DT + SVM)</h2>
<input type="text" id="urlInput" placeholder="Enter URL to check" />
<button onclick="checkURL()">Check</button>
<div class="result" id="resultText"></div>
</div>
<script>
async function checkURL() {
const url = document.getElementById("urlInput").value;
const resultText = document.getElementById("resultText");
if (!url) {
resultText.innerHTML = "❌ Please enter a URL.";
resultText.className = "result spam";
return;
}
resultText.innerHTML = "⏳ Checking...";
resultText.className = "result";
try {
const response = await fetch("/predict", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ url: url })
});
const data = await response.json();
if (data.error) {
resultText.innerHTML = `❌ Error: ${data.error}`;
resultText.className = "result spam";
} else if (data.prediction === 1) {
resultText.innerHTML = `🚫 SPAM / PHISHING<br>πŸ“„ Reason: ${data.reason}`;
resultText.className = "result spam";
} else {
resultText.innerHTML = `βœ… SAFE<br>πŸ“„ Reason: ${data.reason}`;
resultText.className = "result safe";
}
} catch (error) {
resultText.innerHTML = `❌ Server Error: ${error}`;
resultText.className = "result spam";
}
}
</script>
</body>
</html>