Problem removing bad symbols in varible from file
Posted: Sat Jan 22, 2011 11:33 pm
Hello everyone im having problems with this script removing bad symbols before searching mysql database i tried using mysqli_real_escape but no luck heres the code i have and i still have no lucky removing the ' and " , and etc any help would be apperciated
$ip=$_SERVER['REMOTE_ADDR'];
$date = date(DATE_RFC822);
print "<p><center>Loged in as $ip The Date is $date</center></p>";
$data = file('/var/www/htdocs/mp32/playlist.lst', FILE_IGNORE_NEW_LINES);
$bad_symbols = array("'",","); // set bad symbols to remove
$linesgood = str_replace($bad_symbols,"",$data); // remove bad symbols but doesnt work.
print "<center><table border=1 frame=void cellpadding=1 cellspacing=0 align=center rules=all><tr><th>Song Position</th><th>Artist</th><th>Title</th><th>Genre</th><th>Action</th></tr>";
require('dbconfig1.php');
while($n < count($linesgood)) {
$query = mysqli_query($conn1, "SELECT * FROM mp_id3_tags WHERE filename LIKE '$linesgood[$n]'"); //query database for each one
while($row = mysqli_fetch_array($query)){
print "<tr><td>$n</td><td>{$row['artist']}</td><td>{$row['title']}</td><td>{$row['genre']}</td></td><td><a href=\"playlist.php?remove=$n\">Delete</a></td></tr>"; // print whats returned from mysql and print the number it is in the file read from
}
$n = $n + 1;
}
print "</table></center>";
$ip=$_SERVER['REMOTE_ADDR'];
$date = date(DATE_RFC822);
print "<p><center>Loged in as $ip The Date is $date</center></p>";
$data = file('/var/www/htdocs/mp32/playlist.lst', FILE_IGNORE_NEW_LINES);
$bad_symbols = array("'",","); // set bad symbols to remove
$linesgood = str_replace($bad_symbols,"",$data); // remove bad symbols but doesnt work.
print "<center><table border=1 frame=void cellpadding=1 cellspacing=0 align=center rules=all><tr><th>Song Position</th><th>Artist</th><th>Title</th><th>Genre</th><th>Action</th></tr>";
require('dbconfig1.php');
while($n < count($linesgood)) {
$query = mysqli_query($conn1, "SELECT * FROM mp_id3_tags WHERE filename LIKE '$linesgood[$n]'"); //query database for each one
while($row = mysqli_fetch_array($query)){
print "<tr><td>$n</td><td>{$row['artist']}</td><td>{$row['title']}</td><td>{$row['genre']}</td></td><td><a href=\"playlist.php?remove=$n\">Delete</a></td></tr>"; // print whats returned from mysql and print the number it is in the file read from
}
$n = $n + 1;
}
print "</table></center>";