PDA

View Full Version : Undefined variables.. -and more


[GR] Cool K
06-03-2003, 09:02
At last - after months of "try-and-error" I got help from this forum and now my webpost works (almost).

When trying to join a channel from the webpost interface I get the following error in the join window:

Notice: Undefined variable: action in c:\xxx\xxx\login.php on line 20

Also, when trying to set up the ticker (by using the following hyperlink: http://wargamer.adsl.dk/ts2/ticker.php?showname=[GR] )the following errors occur:

Notice: Undefined variable: group in c:\xxx\xxx\ticker.php on line 26

Notice: Undefined variable: name in c:\xxx\xxx\ticker.php on line 30

Notice: Undefined variable: show in c:\xxx\xxx\ticker.php on line 35

And in the scrolling text the following error occurs (I still get to see the servers though):

Notice: Undefined variable: show in c:\xxx\xxx\ticker.php on line 57

Any suggestions (Please...)
:confused:

[GR] Cool K
10-03-2003, 12:05
hmmm - I'm still stuck :(

maletin
10-03-2003, 13:45
where can i see the source code?
watch all variables on line 26 of ticker.php

[GR] Cool K
10-03-2003, 13:55
This is the source code of ticker.php
I've marked line 26 with bold
Thx for your support...:

<?
/*
************************************************** ******************************
************************************************** ******************************
* *
* ************************************************** ************ *
* * Webpost2 for TeamSpeak 2 by Ryan Snook * *
* * www.thzclan.com/snooknet * *
* * * *
* * (c) Copyright TeamCom Team, Ralf Ludwig, Niels Werensteijn * *
* * All rights are reserved. * *
* * Copying or other reproduction of this * *
* * program except for archival purposes is prohibited without * *
* * the prior written consent of TC-Team. * *
* ************************************************** ************ *
* *
************************************************** ******************************
************************************************** ******************************
*/
include("db_inc.php");
clearinactive();

$tickermarg = 'topmargin="0" leftmargin="0" marginwidth="0" marginheight="0"';
$tickerrefresh = '<meta http-equiv="Refresh" content="30">';

if ($group) {
$show = "WHERE server_ispname='$group'";
$link = "&showgroup=$group";
}
if ($name) {
$show = "WHERE server_name='$name'";
$link = "&showgroup=";
}

$sql = query("SELECT * FROM $dbtable $show ORDER BY clients_current DESC LIMIT 1");

while ($data = mysql_fetch_row($sql)) {
if ($data[17] != '0') {
$online = 'on';
} else {
$online = 'off';
}
}

include("tpl_style.php");
?>

<table border="0" cellpadding="0" cellspacing="0" width="191" height="20">
<tr>
<td align="center" width="15"><a href="listing.php<?= $link ?>" target="_blank"><img src="images/<?= $online ?>.gif" alt="<?= $online ?>"></a></td>
<td valign="top">
<marquee direction="up" scrollAmount="1" style="width:170px; height:18px; border:0px solid white; padding:1px" onMouseover="this.scrollAmount=0" onMouseout="this.scrollAmount=1">
<table border="0" cellpadding="0" cellspacing="1" width="100%" bgcolor="<?= $bordercolor ?>" class="listfont">
<tr>
<td align="center" bgcolor="<?= $catrowcolor1 ?>" colspan="2" class="catagory" valign="middle"><b><a href="listing.php<?= $link ?>" target="spf_latest">TeamSpeak Servers</a></b></td>
</tr><?
$sql2 = query("SELECT * FROM $dbtable $show ORDER BY clients_current DESC");
while ($data2 = mysql_fetch_row($sql2)) {
if ($rowcolor == $rowcolor2) {
$rowcolor = $rowcolor1;
} else {
$rowcolor = $rowcolor2;
}

echo '
<tr>
<td align="center" bgcolor="'.$rowcolor.'" class="listing" nowrap><a href="listing.php?detail='.$data2[0].'" target="spf_latest">'.$data2[10].':'.$data2[11].'</a></td>
<td align="center" bgcolor="'.$rowcolor.'" class="listing">'.$data2[17].'</td>
</tr>';
}
?>

</table>
</marquee>
</td>
</tr>
</table>

</body>
</html>

maletin
10-03-2003, 14:46
Originally posted by [GR] Cool K
if ($group) {
$show = "WHERE server_ispname='$group'";
$link = "&showgroup=$group";
}
if ($name) {
$show = "WHERE server_name='$name'";
$link = "&showgroup=";
}

$sql = query("SELECT * FROM $dbtable $show ORDER BY clients_current DESC LIMIT 1");

To avoid the warnings you can try
if( isset( $group ) ) {
...
if( isset( $name ) ) {

and maybe you need
$sql = mysql_query( "SELECT...

[GR] Cool K
10-03-2003, 16:05
DANG - It works...

Thx a Zillion :D


Had to change the: & to ? in:

if ($group) {
$show = "WHERE server_ispname='$group'";
$link = "&showgroup=$group";
}
if ($name) {
$show = "WHERE server_name='$name'";
$link = "&showgroup=";
}

for the link to work... Is there a diff. (obvious there is) between & and ? - and when should they be used?

Thx again :cool:

maletin
10-03-2003, 21:43
Originally posted by [GR] Cool K
Had to change the: & to ? in:
for the link to work... Is there a diff. (obvious there is) between & and ? - and when should they be used?
a normal url has one ? after the filename, and the parameters are splitted by &.
teamspeak seems to parse the url in an easier manner. every parameter starts with ?.
there is a very old thread about this behavior.