Its not working. If you want to see the PHP component in action, check out http://famousmuslims.muslimonline.or...ion=com_mochat
As you can see, it is just bringing up the error message as defined in my config file, but what i wanted was all the chatrooms to come up when it is on the index page of this component, which explains why i used the
PHP Code:
if ((@$_GET['wrap'] == "") && (@$_GET['page'] == "")) {
I wanted the list to come up if nothing else comes up, and right now it isnt. here is the code so far:
PHP Code:
<?php
//* @version 1.0
// Copyright (C) 2006 Muslim Online (Sartaj Chowdhury)
// Based on Mambo Wrapper Component by Jason Murphy (http://www.jasonmurphy.net)
// All rights reserved.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// The "GNU General Public License" (GPL) is available at
// http://www.gnu.org/copyleft/gpl.html.
//
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
include ("administrator/components/com_mochat/mochat_config.php");
$my_id = $my->id;
if ((@$_GET['wrap'] == "") && (@$_GET['page'] == "")) {
$conn = @mysql_connect($server,$username,$password);
mysql_select_db($db);
$theLink = @mysql_query("SELECT * FROM `$table` WHERE `name`='$_GET[page]'"); //request the data from the SQL
$qry = @mysql_fetch_array($theLink);
echo '<a href="http://chat.muslimonline.org/schat/' . $qry[url] . '">' . $qry[name] . '</a>'; //echo the link
}
if (@$_GET['wrap'] == "") {
$wrap = "";
}
$wrap = str_replace(array( "JOIN", "' ", "WHERE" ),array( "", "", ""), $wrap);
if ($allowpage == "1" && @$_GET['page'] != "") {
$finalurl = $_GET['page'];
$wauto = "$resizepage";
} else {
$page = "";
$database->setQuery( "select url, width, height, scroll, auto, frame, wlink, showname from #__mochat where name='$wrap'" );
$results = $database->loadObjectList();
foreach ($results as $result){
$wurl = $result->url;
$wwidth = $result->width;
$wheight = $result->height;
$wscroll = $result->scroll;
$wauto = $result->auto;
$wframe = $result->frame;
$wlink = $result->wlink;
$wshowname = $result->showname;
}
if (!isset($wurl)){
$wurl = "";
}
$finalurl = "$wurl";
}
if ($my_id == "" && $regonly == "1") {
die($notauthtext);
} else {
if ($finalurl == "") {
echo $werror;
} else {
if (!(eregi("http://chat.muslimonline.org/schat/", $finalurl) || (eregi("https://",$finalurl)))) {
$finalurl = "http://chat.muslimonline.org/schat/".$finalurl;
}
if ($wauto == "1"){
//resize script
$xload = "iFrameHeight()";
?>
<script language="JavaScript">
function iFrameHeight() {
var h = 0;
if(document.getElementById && !(document.all))
{
h = document.getElementById('blockrandom').contentDocument.height;
document.getElementById('blockrandom').style.height = h + 60 + 'px';
}
else if(document.all)
{
h = document.frames('blockrandom').document.body.scrollHeight;
document.all.blockrandom.style.height = h + 20 + 'px';
}
}
</script>
<?php
} else {
$xload = "";
}
if (!isset($wheight)) {$wheight = $dheight; }
if (!isset($wwidth)) {$wwidth = $dwidth; }
if (!isset($wscroll)) {$wscroll = $dscroll; }
if (!isset($wframe)) {$wframe = $dframe; }
if (!isset($wshowname)) {$wshowname = $dshowname; }
if (!isset($wlink)) {$wlink = $dwlink; }
?>
<script language="JavaScript">
function blockError(){return true;}
window.onerror = blockError;
</script>
<IFRAME id="blockrandom"
onLoad="<?php echo $xload; ?>;"
SRC="<?php echo $finalurl; ?>"
width="<?php echo $wwidth; ?>" height="<?php echo $wheight; ?>" align=top scrolling=<?php echo $wscroll; ?> frameborder=<?php echo $wframe; ?>>Sorry, your Browser does NOT SUPPORT IFRAME.<br>You may want to Upgrade your Browser.<br><a href="<?php echo $finalurl; ?>" target="_blank">Click Here to see the page that was supposed to load.</a><?php echo $finalurl; ?></IFRAME> <a href="http://chat.muslimonline.org"> </a>
<div align="center">
<?php
if ($wshowname == "1") {
echo $finalurl;
}
?>
<br>
<?php
if ($wlink == "1") {
?>
<a href="<?php echo $finalurl; ?>" target="_blank">[<?php echo $newwindowtext; ?>]</a></div>
<?php
}
}
}
?>
btw, everything in the component is working except this index page, for example see a chatroom in action: http://famousmuslims.muslimonline.or...chat&wrap=test
Bookmarks