सभी प्रकार के अलग-अलग दुर्भावनापूर्ण इरादों को रोकने के लिए, वेब रूपों के माध्यम से प्रस्तुत किए जाने वाले चर को हमेशा किसी भी तरह से उपयोग करने से पहले साफ / साफ किया जाना चाहिए।
तकनीक # 1
function clean($value) ( // If magic quotes not turned on add slashes. if(!get_magic_quotes_gpc()) // Adds the slashes. ( $value = addslashes($value); ) // Strip any tags from the value. $value = strip_tags($value); // Return the value out of the function. return $value; )
$sample = "test"; $sample = clean($sample); echo $sample;