james438
03-13-2010, 03:07 PM
Hi, just wondering if any malicious code can be entered into this code below. I really rather doubt it, but thought I might ask anyway.
<?php
$string=$_POST['data'];
$word1=$_POST['word1'];
$word2=$_POST['word2'];
$word1=stripslashes($word1);
$word2=stripslashes($word2);
$string=stripslashes($string);
$string=str_replace("$word1","$word2",$string);
$word1=htmlentities($word1);
$word2=htmlentities($word2);
?><body style='background-color:tan;'>
<form action=<?php echo $_SERVER['PHP_SELF']; ?> method="POST">
Enter text document here:
<br>
<textarea rows=40 cols=130 name="data"><?php print $string; ?></textarea>
<br><input type='text' size=75 name="word1" value="<?php print $word1; ?>"> < -- Remove this
<br><input type='text' size=75 name="word2" value="<?php print $word2; ?>"> < -- and replace it with this
<br><input type='submit' name="queryButton" value="Submit">
</form></body>
<?php
$string=$_POST['data'];
$word1=$_POST['word1'];
$word2=$_POST['word2'];
$word1=stripslashes($word1);
$word2=stripslashes($word2);
$string=stripslashes($string);
$string=str_replace("$word1","$word2",$string);
$word1=htmlentities($word1);
$word2=htmlentities($word2);
?><body style='background-color:tan;'>
<form action=<?php echo $_SERVER['PHP_SELF']; ?> method="POST">
Enter text document here:
<br>
<textarea rows=40 cols=130 name="data"><?php print $string; ?></textarea>
<br><input type='text' size=75 name="word1" value="<?php print $word1; ?>"> < -- Remove this
<br><input type='text' size=75 name="word2" value="<?php print $word2; ?>"> < -- and replace it with this
<br><input type='submit' name="queryButton" value="Submit">
</form></body>