|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
unknown code inserted
Hi guys,
have two files with me.. a.php and b.php actually a.php file is a file that consist all db connection and fetch array stuff where as the b.php file is the template/theme file that used to display the info obtained from the query.. b is included in a.php file.. when i view the file from the browser, i found that my output only appeared after a few line breaks that were not inserted by myself.. code appeared when i view source from the browser : <p> </p> <p> </p> <html> ... could u guys give me an idea what actually caused this problem and what should i do to remove this code ??? it is caused by my php code or what ?? please advise. |
|
#2
|
|||
|
|||
|
This kind of thing is very hard to diagnose without seeing the code in question. If you could post your php files here (as attachments) I'm sure someone can take a look for you.
-KM- |
|
#3
|
||||
|
||||
|
THis looks to me like something that some sort of editing program might insert. Zend, for example, inserts linebreaks if you hit shift-return. It wouldn't surprise me to find out that Dreamweaver or similar programs do something similar and that you've inadvertently added such code to your files with a mistaken keystroke.
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
|
#4
|
|||
|
|||
|
for some reason. Sometimes. If there is linebreaks (/n - NOT <BR>) before the real code. (before the <?PHP ?> tag) this is interperted as a break <br> or <p/>.
- Pheifel |
|
#5
|
|||
|
|||
|
please check my code :
a.php Code:
<?
$exists = file_exists("name.php");
if ($exists) {
include("name.php");
$id = $i;
include("../include/db.php");
mysql_connect("", $user, $pass) or die("Unable to connect to database");
mysql_select_db("mysite_db") or die("Unable to connect to database");
$sql = mysql_query("SELECT * FROM general WHERE id = '$id'");
$myrow = mysql_fetch_array($sql);
$sql2 = mysql_query("SELECT * FROM home WHERE id = '$id'");
$myrow2 = mysql_fetch_array($sql2);
$sql3 = mysql_query("SELECT * FROM home WHERE id = '$id'");
$myrow3 = mysql_fetch_array($sql3);
$template = mysql_query("SELECT * FROM template WHERE id = '$id'");
$row = mysql_fetch_array($template);
mysql_close();
if ($myrow['activate'] == "") {
echo "<html><head><title>mysite.com</title></head><body>";
echo "<p><div align=\"center\">";
echo "Your account has not been activated yet.<br>";
echo "In the meanwhile, do feel free to browse our web site at ";
echo "<a href=\"http://mysite\">www.mysite.com</a>";
echo "</div></p></body></html>";
exit;
}
if ($myrow && $myrow2) {
if ($myrow['home_status'] == "Published") {
$theme = $myrow['overall_style'];
$style = $myrow2['style'];
$tracker = $myrow2['tracker'];
} else {
$theme = "default.php";
}
include("../../templates/theme/b.php");
} else {
echo "<b>Error: Home Page Database Not Found.</b><br>";
echo "Please contact the webmaster at ";
echo "<a href=\"mailto:enquiries@mysite.com?\">enquiries@mysite.com</a>";
}
} else {
echo "<b>Error HP: File Not Found.</b><br> Please contact the webmaster ";
echo "at <a href=\"mailto:enquiries@mysite.com?\">enquiries@mysite.com</a>";
}
?>
b.php Code:
<html> <head> <title><? echo $myrow['title']; ?></title> <meta name="description" content="<? echo $myrow['description']; ?>"> <meta name="keywords" content="<? echo $myrow['keywords']; ?>"> <meta name="author" content="<? echo $myrow['author']; ?>"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0"> .... whats wrong with my code ???? please advise. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > unknown code inserted |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|