- 114
I seem to be having some trouble with stripslashes.
For some reason when I am echoing out $row[0], it will remove the slashes just fine, but when I try to concatonate(sp) stripslashes($row[0]) with a URL, i always get "http://www.address.com/\". It only detects the first breaking character, and then its cuts out the rest of row[0]. To be more specific, lets say row[0] is \'\'\"\'\':
---------------------------------------
Any suggestions on this?
* please note in some of my code the URLs don't use stripslashes(), this is just for testing purposes, im not trying to be inconsistant
PHP:
while($row = mysql_fetch_array($result)){
if ($tog==0){
echo "<tr>";
if($_SESSION['acclevel']=="normal"){
if($row[0] == $_SESSION['username']){
echo "<td width='120'><a href='editform.php?edit=" . stripslashes($row[0]) . "&confirm=undecided'>Edit</a> | \n";
echo "<a href='deleteform.php?delete=" . stripslashes($row[0]) . "&confirm=undecided'>Delete</a> | \n";
echo "<a href='../viewform.php?view=" . stripslashes($row[0]) . "'>View</a></td>\n";
}
else {
echo "<td width='120'><font color='#888888'>Edit</font> | <font color='#888888'>Delete</font> | <a href='../viewform.php?view=" . stripslashes($row[0]) . "'>View</a></td>\n";
}
}
if($_SESSION['acclevel']=="admin"){
echo "<td width='120'><a href='editform.php?edit=" . $row[0] . "&confirm=undecided'>Edit</a> | \n";
echo "<a href='deleteform.php?delete=" . $row[0] . "&confirm=undecided'>Delete</a> | \n";
echo "<a href='../viewform.php?view=" . $row[0] . "'>View</a></td>\n";
}
echo "<td>" . $row[0] . "</td>\n";
echo "<td>" . $row[1] . "</td>\n";
echo "<td>" . $row[2] . "</td>\n";
echo "<td>" . $row[3] . "</td>\n";
echo "<td>" . $row[4] . "</td>\n";
echo "</tr>\n";
$tog=1;
}
else{
echo "<tr>";
if($_SESSION['acclevel']=="normal"){
if($row[0] == $_SESSION['username']){
echo "<td width='120' class='alternate'><a href='editform.php?edit=" . stripslashes($row[0]) . "&confirm=undecided'>Edit</a> | \n";
echo "<a href='deleteform.php?delete=" . stripslashes($row[0]) . "&confirm=undecided'>Delete</a> | \n";
echo "<a href='../viewform.php?view=" . stripslashes($row[0]) . "'>View</a></td>\n";
}
else {
echo "<td width='120' class='alternate'><font color='#888888'>Edit</font> | <font color='#888888'>Delete</font> | <a href='../viewform.php?view=" . stripslashes($row[0]) . "'>View</a></td>\n";
}
}
if($_SESSION['acclevel']=="admin"){
echo "<td width='120' class='alternate'><a href='editform.php?edit=" . $row[0] . "&confirm=undecided'>Edit</a> | \n";
echo "<a href='deleteform.php?delete=" . $row[0] . "&confirm=undecided'>Delete</a> | \n";
echo "<a href='../viewform.php?view=" . $row[0] . "'>View</a></td>\n";
}
echo "<td class='alternate'>" . $row[0]. "</td>\n";
echo "<td class='alternate'>" . $row[1] . "</td>\n";
echo "<td class='alternate'>" . $row[2] . "</td>\n";
echo "<td class='alternate'>" . $row[3] . "</td>\n";
echo "<td class='alternate'>" . $row[4] . "</td>\n";
echo "</tr>\n";
$tog=0;
}
}
For some reason when I am echoing out $row[0], it will remove the slashes just fine, but when I try to concatonate(sp) stripslashes($row[0]) with a URL, i always get "http://www.address.com/\". It only detects the first breaking character, and then its cuts out the rest of row[0]. To be more specific, lets say row[0] is \'\'\"\'\':
PHP:
This line of code....
echo "<td class='alternate'>" . stripslashes($row[0]) . "</td>\n";
Yeilds this output...
''"''
PHP:
Yet this line of code...
echo "<td width='120' class='alternate'><a href='editform.php?edit=" . stripslashes($row[0]) . "&confirm=undecided'>Edit</a> | \n";
Yeilds this URL...
http://www.blahblah.com/editform.php?edit=\&confirm=undecided
When it should be...
http://www.blahblah.com/editform.php?edit=''"''&confirm=undecided
Any suggestions on this?
* please note in some of my code the URLs don't use stripslashes(), this is just for testing purposes, im not trying to be inconsistant