AmericanWoman
08-02-2003, 07:08 PM
I've created a javascript-output content hack, and it was working FANTASTIC until I went nuts with assigning parameters...and now I'm totally baffled and irritated and tired from no sleep. :(
The code works fine if you serve the page directly:
www.acuraworld.com/forums/js.php
It USED to work fine when called from a < script > tag, like so:
<script language="javascript" src="http://www.acuraworld.com/forums/js.php"></script>
Now the script tag reference doesn't return anything, and I don't get an error.
Yes, I know there are a lot of extra document . write () statements, and I'm not sure where they're surfacing. Here's the page code that creates the javascript:
// lots of stuff prior to this, but not relevant
if (!isset($GET_VARS['limit']) || $GET_VARS['limit'] =="" || $GET_VARS['limit'] > "20") {
$limit = "5";
}
if (!isset($GET_VARS['offset']) || $GET_VARS['offset'] =="" || $GET_VARS['offset'] > "24") {
$offset = "0";
}
if (!isset($GET_VARS['bg']) || $GET_VARS['bg'] =="") {
$bg = "FFFFFF";
}
else {
$bg = $GET_VARS['bg'];
}
if (!isset($GET_VARS['thbg']) || $GET_VARS['thbg'] =="") {
$thbg = "FFFFFF";
}
else {
$thbg = $GET_VARS['thbg'];
}
if (!isset($GET_VARS['border']) || $GET_VARS['border'] =="") {
$border = "0";
}
else {
$border = $GET_VARS['border'];
}
if (!isset($GET_VARS['fcolor']) || $GET_VARS['fcolor'] =="") {
$fcolor = "000000";
}
else {
$fcolor = $GET_VARS['fcolor'];
}
if (!isset($GET_VARS['fsize']) || $GET_VARS['fsize'] == "") {
$fsize = "10";
}
else {
$fsize = $GET_VARS['fsize'];
}
if (!isset($GET_VARS['font']) || $GET_VARS['font'] == "") {
$font = "Verdana";
}
else {
$font = $GET_VARS['font'];
}
if (!isset($GET_VARS['width']) || $GET_VARS['width'] == "") {
$width = "100%";
}
else {
$width = $GET_VARS['width'];
}
if (!isset($GET_VARS['titlebg']) || $GET_VARS['titlebg'] == "") {
$titlebg = "C0C0C0";
}
else {
$titlebg = $GET_VARS['titlebg'];
}
if (!isset($GET_VARS['tdbg']) || $GET_VARS['tdbg'] == "") {
$tdbg = "FFFFFF";
}
else {
$tdbg = $GET_VARS['tdbg'];
}
if (!isset($GET_VARS['thalign']) || $GET_VARS['thalign'] == "") {
$thalign = "left";
}
else {
$thalign = $GET_VARS['thalign'];
}
if (!isset($GET_VARS['link']) || $GET_VARS['link'] == "") {
$link = "left";
}
else {
$link = $GET_VARS['link'];
}
if (!isset($GET_VARS['vlink']) || $GET_VARS['vlink'] == "") {
$vlink = $link;
}
else {
$vlink = $GET_VARS['vlink'];
}
if (!isset($GET_VARS['titlecolor']) || $GET_VARS['titlecolor'] == "") {
$titlecolor = 000000;
}
else {
$titlecolor = $GET_VARS['titlecolor'];
}
if (!isset($GET_VARS['bcolor']) || $GET_VARS['bcolor'] == "") {
$bcolor = 000000;
}
else {
$bcolor = $GET_VARS['bcolor'];
}
?>
document.write('<table style="font-size:<?php echo "$fsize"?>px; font-family: <?php echo "$font"?>; color: <?php echo "#$fcolor"?>" border="<?php echo "$border"?>" cellpadding="2" cellspacing="0" bordercolor="<?php echo "#$bcolor"?>" bgcolor="<?php echo "#$bg"?>" width="<?php echo "$width"?>">');
document.write(' <tr >');
document.write(' <td align="<?php echo "$thalign"?>" bgcolor="<?php echo "#$titlebg"?>" style="color: <?php echo "#$titlecolor"?>"><b>Beta - Acuraworld.com News Syndicate!</b></td>');
document.write(' </tr>');
// sql and whatnot here - not relevant
document.write(' <tr >');
document.write(' <td align="<?php echo "$thalign"?>" bgcolor="<?php echo "#$thbg"?>">');
document.write('<?php echo "<b><a style=\"color: #$link\" href=\"$bburl/showthread.php?threadid=$threadid&goto=newpost\">".htmlspecialchars($title)."</a></b>";?>');
document.write(' </td>');
document.write(' </tr>');
document.write(' <tr >');
document.write(' <td bgcolor="<?php echo "#$tdbg"?>">');
<?php
if ($mode == "lite") {
?>
document.write('<?php echo "<b>$lastposter</b> - $replies $replyword - $lastreplydate";?>');
document.write(' </td>');
document.write(' </tr>');
<?php
}
else {
?>
document.write('<?php echo "<b>$lastposter</b> - $replies $replyword - $lastreplydate<br><i>$lastpostshort</i>";?>');
document.write(' </td>');
document.write(' </tr>');
<?php
}
}
?>
document.write('</table>');
Other than realize it's quick and dirty and not particularly efficient, I really just need to figure out why in tarnation it all of a sudden stopped working when called as a script reference.
Any help would be appreciated!!!
The code works fine if you serve the page directly:
www.acuraworld.com/forums/js.php
It USED to work fine when called from a < script > tag, like so:
<script language="javascript" src="http://www.acuraworld.com/forums/js.php"></script>
Now the script tag reference doesn't return anything, and I don't get an error.
Yes, I know there are a lot of extra document . write () statements, and I'm not sure where they're surfacing. Here's the page code that creates the javascript:
// lots of stuff prior to this, but not relevant
if (!isset($GET_VARS['limit']) || $GET_VARS['limit'] =="" || $GET_VARS['limit'] > "20") {
$limit = "5";
}
if (!isset($GET_VARS['offset']) || $GET_VARS['offset'] =="" || $GET_VARS['offset'] > "24") {
$offset = "0";
}
if (!isset($GET_VARS['bg']) || $GET_VARS['bg'] =="") {
$bg = "FFFFFF";
}
else {
$bg = $GET_VARS['bg'];
}
if (!isset($GET_VARS['thbg']) || $GET_VARS['thbg'] =="") {
$thbg = "FFFFFF";
}
else {
$thbg = $GET_VARS['thbg'];
}
if (!isset($GET_VARS['border']) || $GET_VARS['border'] =="") {
$border = "0";
}
else {
$border = $GET_VARS['border'];
}
if (!isset($GET_VARS['fcolor']) || $GET_VARS['fcolor'] =="") {
$fcolor = "000000";
}
else {
$fcolor = $GET_VARS['fcolor'];
}
if (!isset($GET_VARS['fsize']) || $GET_VARS['fsize'] == "") {
$fsize = "10";
}
else {
$fsize = $GET_VARS['fsize'];
}
if (!isset($GET_VARS['font']) || $GET_VARS['font'] == "") {
$font = "Verdana";
}
else {
$font = $GET_VARS['font'];
}
if (!isset($GET_VARS['width']) || $GET_VARS['width'] == "") {
$width = "100%";
}
else {
$width = $GET_VARS['width'];
}
if (!isset($GET_VARS['titlebg']) || $GET_VARS['titlebg'] == "") {
$titlebg = "C0C0C0";
}
else {
$titlebg = $GET_VARS['titlebg'];
}
if (!isset($GET_VARS['tdbg']) || $GET_VARS['tdbg'] == "") {
$tdbg = "FFFFFF";
}
else {
$tdbg = $GET_VARS['tdbg'];
}
if (!isset($GET_VARS['thalign']) || $GET_VARS['thalign'] == "") {
$thalign = "left";
}
else {
$thalign = $GET_VARS['thalign'];
}
if (!isset($GET_VARS['link']) || $GET_VARS['link'] == "") {
$link = "left";
}
else {
$link = $GET_VARS['link'];
}
if (!isset($GET_VARS['vlink']) || $GET_VARS['vlink'] == "") {
$vlink = $link;
}
else {
$vlink = $GET_VARS['vlink'];
}
if (!isset($GET_VARS['titlecolor']) || $GET_VARS['titlecolor'] == "") {
$titlecolor = 000000;
}
else {
$titlecolor = $GET_VARS['titlecolor'];
}
if (!isset($GET_VARS['bcolor']) || $GET_VARS['bcolor'] == "") {
$bcolor = 000000;
}
else {
$bcolor = $GET_VARS['bcolor'];
}
?>
document.write('<table style="font-size:<?php echo "$fsize"?>px; font-family: <?php echo "$font"?>; color: <?php echo "#$fcolor"?>" border="<?php echo "$border"?>" cellpadding="2" cellspacing="0" bordercolor="<?php echo "#$bcolor"?>" bgcolor="<?php echo "#$bg"?>" width="<?php echo "$width"?>">');
document.write(' <tr >');
document.write(' <td align="<?php echo "$thalign"?>" bgcolor="<?php echo "#$titlebg"?>" style="color: <?php echo "#$titlecolor"?>"><b>Beta - Acuraworld.com News Syndicate!</b></td>');
document.write(' </tr>');
// sql and whatnot here - not relevant
document.write(' <tr >');
document.write(' <td align="<?php echo "$thalign"?>" bgcolor="<?php echo "#$thbg"?>">');
document.write('<?php echo "<b><a style=\"color: #$link\" href=\"$bburl/showthread.php?threadid=$threadid&goto=newpost\">".htmlspecialchars($title)."</a></b>";?>');
document.write(' </td>');
document.write(' </tr>');
document.write(' <tr >');
document.write(' <td bgcolor="<?php echo "#$tdbg"?>">');
<?php
if ($mode == "lite") {
?>
document.write('<?php echo "<b>$lastposter</b> - $replies $replyword - $lastreplydate";?>');
document.write(' </td>');
document.write(' </tr>');
<?php
}
else {
?>
document.write('<?php echo "<b>$lastposter</b> - $replies $replyword - $lastreplydate<br><i>$lastpostshort</i>";?>');
document.write(' </td>');
document.write(' </tr>');
<?php
}
}
?>
document.write('</table>');
Other than realize it's quick and dirty and not particularly efficient, I really just need to figure out why in tarnation it all of a sudden stopped working when called as a script reference.
Any help would be appreciated!!!