1
ccdoss
Block Interferes with Login/User Menu
  • 2007/5/16 19:53

  • ccdoss

  • Just popping in

  • Posts: 9

  • Since: 2006/12/21


I created a php block and was doing some testing. I simulated it being unable to access a database in MySQL that is unrelated to xoops. I wanted it to display a default message indicating the table was unavailable. I loaded the page, and found the default message there. However, I also saw that the login and user menu blocks, located in a separate region (left) were both empty. Their titles were there, but there was no spot to login (for anonymous users), and no way to access the user menu (for registered users). I moved a couple of multimenu blocks to the front page, and they worked fine, as did all other blocks. It only appears the system blocks were affected. Why would this happen? The php code for my block is:
$dbcnx = @mysql_connect("localhost", "username", "password"); // this user doesn't have access
if (!$dbcnx) {
echo( "

No Information for Today!!!

" ); //Executed, since it didn't connect
}
if (! @mysql_select_db("MyTable") ) { // Should fail, since it didn't connect
echo( "

Unable to locate the " .
"database at this time.

" );
}
$sql = 'SELECT * MyTable';
$result = mysql_query($sql);
if (!$result) {
echo("

Error performing query: " .
mysql_error() . "

");
}

$htoutput = "".
"".
"".
"".
"".
"";
echo($htoutput);

$i=0;
while ( ($row = mysql_fetch_array($result)) and ($i<5) ) {
// process the row...
$htoutput = "".
"".
"".
"".
"";
echo($htoutput);
$i = $i + 1;
}
echo("
Item 1Item 2Item 3
" . $row["Item1"] . "" . $row["Item2"] . "" . $row["Item3"] . "
");
echo("

Updated daily at 7:00 pm Eastern

");

Login

Who's Online

173 user(s) are online (156 user(s) are browsing Support Forums)


Members: 0


Guests: 173


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Dec 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits