Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php/sql] Skrypt --- pomocy -> wywala błędy
sniffer
post
Post #1





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 24.01.2003
Skąd: POland

Ostrzeżenie: (0%)
-----


Poniżej mam kawałek kodu mojej stronki, który chciałem zmodyfikować lecz nie wiem czemu cały czas wywala mi błędy typu:

Parse error: parse error, unexpected T_IF in d:...index.php on line 38

oraz

Parse error: parse error, unexpected '{' in d:...index.php on line 92
<BR>
A oto ten kod:

<?
include ("config.inc.php");
// Variables
$page_name = "index";
if ($page == "news") {
$page_code = LANG_H_NEWS;
} else if ($page == "annoucements") {
$page_code = LANG_B_ANNS;

...

} else {
$page_code = $cid;
}
echo PrintTheme("header");

// Print home page
if (!isset($page)) {
if (!isset($cid)) {
$cid = "0";
}
// Print new contents
$new_contents = OpenTable("1", "0", "");
$new_contents .= "<tr>";
$connection = @mysql_connect($dbhost, $dbuser, $dbpass)
or die ("Can not connect to database");
$db = @mysql_select_db($dbname, $connection)
or die ("Can not select database.");
$sql = "SELECT id, name FROM $t_cats WHERE cat_id = '$cid' ORDER BY sort, name";
$result = mysql_query($sql);
$i = 0;
$td_width = 100/$index_cols;
while (list($cat_id, $cat_name)=mysql_fetch_row($result)) {
$sql_count = mysql_query("SELECT id FROM $t_contents WHERE cat_id = '$cat_id' AND active = '1'");
$cat_contents = mysql_num_rows($sql_count);
if ($cat_contents >0 ) {
$cat_name = stripslashes($cat_name);
$new_contents .= "<td width="$td_width%" valign="top">";
$new_contents .= OpenTable("0", "0", "");
$new_contents .= "<tr><td bgcolor="#000000"><img src=spc.gif height=1 width=1></td></tr>";
$new_contents .= "<tr>";
$new_contents .= "<td width=100% class="plr2" bgcolor="$light_bg">";
$new_contents .= "<a href="$root_url/index.php?cid=$cat_id" class="black">".Translator($cat_id, "cat", $user_lang, "subject", $cat_name)."</a>";
$new_contents .= "</td>";
$new_contents .= "</tr>";
$new_contents .= "<tr><td bgcolor="#000000"><img src=spc.gif height=1 width=1></td></tr>";
$new_contents .= SelectContentSummary($cat_id);
$new_contents .= CloseTable();
$new_contents .= "</td>";
$i++;
if (is_int($i/$index_cols)) {
$new_contents .= "</tr>
<tr>";
}
}
}
$new_contents .= "</tr>";
$new_contents .= CloseTable();
// Select category contents
$cat_contents = OpenTable("0", "0", "");
$cat_contents .= "<tr><td bgcolor="#FFFFFF"><img src=spc.gif height=2 width=5></td></tr>";
$cat_contents .= "<tr><td bgcolor="#000000"><img src=spc.gif height=1 width=1></td></tr>";
$cat_contents .= "<tr>";
$cat_contents .= "<td class="plr2" bgcolor="$subject_bg">".SelectTopContentCat($cid)."</td>";
$cat_contents .= "</tr>";
$cat_contents .= "<tr><td bgcolor="#000000"><img src=spc.gif height=1 width=1></td></tr>";
$cat_contents .= SelectContentSummary($cid);
$cat_contents .= CloseTable();
@mysql_close($connection)
or die("Can not close connection");
// Convert index.htm
if($cid == 0) {
$filename = "$theme_root/$user_theme/index.htm";
} else if($cid !== 0) {
$filename = "$theme_root/$user_theme/category.htm";
}
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
$contents = eregi_replace ("images", "$theme_url/$user_theme/images", $contents);
if ($cid != 0) {
$contents = eregi_replace ("---CATCONTENTS---", $cat_contents, $contents);
} else {
$contents = eregi_replace ("---CATCONTENTS---", "", $contents);
}
$contents = eregi_replace ("---CONTENTS---", $new_contents, $contents);
$contents = eregi_replace ("---LANG_B_LINKS---", LANG_B_LINKS, $contents);
$contents = eregi_replace ("---LANG_B_FORUM---", LANG_B_FORUM, $contents);
$contents = eregi_replace ("---LINKS---", SelectLinks($cid), $contents);
$contents = eregi_replace ("---FORUM---", PrintForums(), $contents);
echo $contents;


} else if ....


Czy ktoś może pomóc??
Linijki, w których rzekomo jest ten błąd zaznaczyłem na czerwono.

Pozdrawiam i z góry big thx,
Łukasz
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
kurtz
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 786
Pomógł: 0
Dołączył: 18.03.2002
Skąd: Wroclaw/Warszawa

Ostrzeżenie: (0%)
-----


Cytat
Według mnie to może być coś innego, poniwearz kiedy bezpośrednio klikne na link prowadzącydo tej strony wyskakuje błąd, ale gdy dam odśwież lub przejdź strona wyświetla się poprawnie, bez żadnych błędów.
bledow nie widac != bledow nie ma.
MSIE np moze nie pokazac niektorych wpadek praogamistow bo zinterpretuje kawalek kodu php jako naciaganego htmla
Cytat
Jesto to wszystko troche dziwne ponieważ w kodzie znajduje błędy typu unexpected '{', ale bez tego nawiasu wogóle niemógłbym rozpocząć funkcji.
ja nadal obstawiam moje - liteorwka ;)

pozdrawiam
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 26.09.2025 - 07:58