Error when trying to make a sub directory

Started by -Dave, March 15, 2012, 12:45:35 AM

Previous topic - Next topic

-Dave

hi gang was hoping for a hand i have this code which i use to pull usernames to irc but when i try  make a roomslist with this code

'menu_action' => array(
'title' => 'text for menu',
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
'sub_menu_action' => array(
'title' => 'text for sub-menu',
'href' => $scripturl . '?action=newaction',
'show' => true,
'is_last'=> true,
),
),
),


i get a error on line 32 on my index.php this is my index.php code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<meta name="author" content="Valentin Manthei - lightIRC.com" />
<title>Chatterzz Client</title>
<script type="text/javascript" src="swfobject.js"></script>
<?php
    $temp 
trim($_GET['nick']);
if(!empty($temp) && ctype_alnum($temp)) {
    $nick $temp;

$db_server 'localhost';
$db_name 'admin_xxx;
$db_user = '
admin_xxx';
$db_passwd = '
xxxxxxx';

$link = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db($db_name);

$qry = "SELECT id_member FROM `smf_members` WHERE member_name = '
$nick'";
$result = mysql_query($qry);

if(!mysql_num_rows($result) || mysql_num_rows($result) == 0) {
    redirectss();
}

mysql_close($link);
$bln = true;
} else {
    redirectss(); [color=red]This the trouble area  [/color]
}
?>


<script type="text/javascript">
var nickname = "<?php echo $nick?>";
</script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script type="text/javascript" src="config.js"></script>
<style type="text/css">
html { height: 100%; overflow: hidden; }
body { height:100%; margin:0; padding:0; background-color:#999; }
</style>
</head>

<body>
<?php if($bln) { ?>
<h1 style="margin: 0 auto; text-align:center;color:blue;">New Chatterzz Central </h1><center><a href="http://www.chatterzz.com/ncc" target="_blank">Home</a> <a href="http://www.chatterzz.com/ncc/index.php?action=forum" target="_blank">Forum</a></center>
<div id="lightIRC" style="height:89%; text-align:center;">
  <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
</div>
<script type="text/javascript">
swfobject.embedSWF("lightIRC.swf", "lightIRC", "100%", "89%", "10.0.0", "expressInstall.swf", params);
</script>
<?php ?>
</body>
</html>

kat

I'm no coder. So, this could be total bollox.

But, shouldn't:

} else {
    redirectss(); [color=red]This the trouble area  [/color]
}


be:

}
else {
    redirectss(); [color=red]This the trouble area  [/color]
}


???

Chen Zhen

Before I post code with some fixes please give some more details..

Which smf version are you using?
Is this an actual template file or is this page being displayed within another page on your forum or from a portal?
Is the database you are accessing the same as your forum where you are attempting to display this data?

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

MrPhil

$db_name = 'admin_xxx;
should be
$db_name = 'admin_xxx';

-Dave

Ty for the replies

Smf version 2.02
Simple portal 2.3.4

this is  a page being displayed external
the db is the db for forum

What i am trying to do is make a heading Chatrooms then a list of 4 to 5 rooms underneath so users just click the room they need, instead of using one room to access the other rooms

MrPhil

Quote from: K@ on March 15, 2012, 08:25:23 AM
I'm no coder. So, this could be total bollox.
Yes, it's total bollox.  :) 

It makes no difference whether the tokens are on the same line or different lines, so long as they're in the right order.

Note that the BBCode color tags didn't work within a code block.

-Dave

Its ok mr phil   its not total bollox  you probly know more than i  that is why i posted  how else are we suppose to learn

Chen Zhen

#7
Quote from: -Dave on March 15, 2012, 08:49:34 PM
Ty for the replies

Smf version 2.02
Simple portal 2.3.4

this is  a page being displayed external
the db is the db for forum

What i am trying to do is make a heading Chatrooms then a list of 4 to 5 rooms underneath so users just click the room they need, instead of using one room to access the other rooms

Well I am still not positive exactly how you're attempting to render the page because I would write it a lot different then this with separate source & template files & using smf's $smcFunc for the db.
Anyhow, here is the code you posted but cleaned up a bit.

<?php
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="language" content="en" />
  <meta name="author" content="Valentin Manthei - lightIRC.com" />
  <title>Chatterzz Client</title>
  <script type="text/javascript" src="swfobject.js"></script>'
;

$temp trim(!empty($_REQUEST['nick']) ? $_REQUEST['nick'] : false);
$bln false;
if((
$temp) && ctype_alnum($temp))
{
$nick $temp;
$db_server 'localhost';
$db_name 'admin_xxx';
$db_user 'admin_xxx';
$db_passwd 'xxxxxxx';
$link mysql_connect($db_server$db_user$db_passwd);
mysql_select_db($db_name);

$qry "SELECT id_member FROM `smf_members` WHERE member_name = {$nick}";
$result mysql_query($qry);

if(!mysql_num_rows($result) || mysql_num_rows($result) == 0
redirectss();

mysql_close($link);
$bln true;
}
else
redirectss(); 

echo 
'
<script type="text/javascript">
var nickname = '
json_encode($nick),'
</script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script type="text/javascript" src="config.js"></script>
<style type="text/css">
html { height: 100%; overflow: hidden; }
body { height:100%;margin:0;padding:0; background-color:#999; }
</style>
</head>
<body>'
;
if(
$bln)

echo 
'
<h1 style="margin: 0 auto; text-align:center;color:blue;">New Chatterzz Central </h1>
<span style="text-align:center">
<a href="http://www.chatterzz.com/ncc" target="_blank">Home</a>
<a href="http://www.chatterzz.com/ncc/index.php?action=forum" target="_blank">Forum</a>
</span>
<div id="lightIRC" style="height:89%; text-align:center;">
<span>
<a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a>
</span>
</div>
<script type="text/javascript">
swfobject.embedSWF("lightIRC.swf", "lightIRC", "100%", "89%", "10.0.0", "expressInstall.swf", params);
</script>'
;

echo 
'
</body>
</html>'
;
?>



With that code I assume there is more to it because it calls a function that you didn't show nor does it include a file that may have it.
Also I do not see any js params variables being assigned that you're plugging into the swf file & the swf file has to be in the same directory unless you edit the above to be more specific.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

-Dave

Ty underdog for your reply what the above points to is another folder which is light irc chat which has config.js file which the param are set and 2 swf files

Chen Zhen

Quote from: -Dave on March 16, 2012, 04:32:54 AM
Ty underdog for your reply what the above points to is another folder which is light irc chat which has config.js file which the param are set and 2 swf files

OK I understand regarding the js params variable but the php function being called: redirectss(); has to be either in this same file or you have to use an include/require command to load up another file that contains it before calling it.

I also added: $bln = false; since your last post to thwart an undefined error.
Does it work as expected?

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

MrPhil

Quote from: -Dave on March 15, 2012, 10:49:23 PM
Its ok mr phil   its not total bollox  you probly know more than i  that is why i posted  how else are we suppose to learn
Actually, I was taking a gentle swipe at K@'s statement...


-Dave

Ty for the replies my problem being  it works when i hit chat tab  and it takes me to Help_desk in chat  but when i try and  make drop down menu i get error concerning redirects as i try and make a link for example  i have Chatrooms then nest link is help_desk with config
and index then lobby i have index1 and config1 and so on

Chen Zhen

#13
Quote from: -Dave on March 16, 2012, 05:24:12 PM
Ty for the replies my problem being  it works when i hit chat tab  and it takes me to Help_desk in chat  but when i try and  make drop down menu i get error concerning redirects as i try and make a link for example  i have Chatrooms then nest link is help_desk with config
and index then lobby i have index1 and config1 and so on

So your not having a problem with actually making the select/option drop down but the links it calls?

How are the folder/file directory tree's set up? Show me the directory tree's and show me your drop down (select/option) code.




My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Advertisement: