我已經做出了描述系統,但所有這些都無法正常工作是我的「搜索並刪除不需要的標籤」 - 系統...下面的代碼:如何搜索HTML標記,並刪除它
$mystring = $description;
$findme = '<';
$pos = strpos($mystring, $findme);
echo $pos;
if ($pos == false) {
$user = mysql_query("SELECT * FROM members WHERE username='$myusername' AND password='$mypassword'");
while($row=mysql_fetch_array($user)) {
mysql_query("UPDATE members SET description = '$description' WHERE username = '$myusername' AND password = '$mypassword'");
echo "<tr><td colspan='2'><span style='color:#0076c9;'>Your description has successfully been changed! Go back to your page to see the changes!</span></td></tr>";
}
} else {
echo "<tr><td colspan='2'><span style='color:#F00;'>Invalid input! Make sure that no other code than <br /> can be typed in!</span></td></tr>";
}
有沒有任何可能的方式做到這一點?我在YouTube上看過它,但太棒了!任何人知道如何做到這一點?
哦,我也注意到,我的功能只顯示第一個標籤的位置...並非所有的標籤,它不能看到<br />
(允許)和<img>
(不允許)之間的區別。
那麼
和是允許的標籤嗎?所有其他標籤都被禁止? – ZyteX
是的,其他所有人都被刪除 – Sedz