Hello everybody,
I have a issue with my code and i tried my best to figure it out but i couldn't can any one check this and help me out...
System using :-
PHP :-5.2.0
MySQL client version: 5.0.27
Apache:-2.0

Error:- Warning: array_search() [function.array-search]: Wrong datatype for second argument in C:\wamp\www\admin\admin_issue_emergency.php on line 34

Here is code and i even attached a copy of it ..:-

<?PHP
include('checkpoweredusersession.php');
include('config.php');
include('connect.php');
include('getmodules.php');

if (strpos($HTTP_REFERER,'admin_issue_emergency.php') == FALSE)
{
$_SESSION['roomList'] = NULL;
$selfCall = 1;
}
else
$selfCall = 0;

global $roomList;
if ($action =='add')
{
$count = count ($target_list);
for ($i =0; $i<$count ; $i++)
{
$roomList[] = $target_list[$i];
$allocatedTerminals[] = $target_list[$i];
}
$_SESSION['roomList'] = $roomList;
if ($_SESSION['roomList'])
$_SESSION['roomList'] = array_unique($_SESSION['roomList']);
}
if ($action =='remove')
{

$count = count ($allocatedTerminals);
for ($i =0; $i<$count ; $i++)
{
$key = array_search($allocatedTerminals[$i], $_SESSION['roomList']);
unSet($_SESSION['roomList'][$key]);
$_SESSION['roomList'][$key] = '';
$key = 0;
}
$_SESSION['roomList'] = array_trim($_SESSION['roomList']);

}
$roomList = $_SESSION['roomList'];

$action =send;
if ($btnSend ==$action)
{
$pause = 5;
$sqlMsg = "SELECT * `".$DBTablesPrefix."_emergency_type`";
$Infos = mysql_query($sqlMsg) or die("Query Failed 55");
$j = 0;
while($Row_Infos = mysql_fetch_assoc($Infos))
{
$j++;
$Id =$Row_Infos["Id"];
$msg =$Row_Infos["name"];
if ($Id == $name)
{
$display_message = $msg;
}
}
$commandURL = "../emergency/simple_remote_control.php4?message=".urlencode(stripslashes($display_message));
$cmdOptions = "/PASSWORD \"".$aminoRemoteControlPassPhrase."\" /TIMEOUT 12 /THREADS 60 /PAUSE ".$pause." /QUIET";

//integration of STBremoteConf
$cmdCommand = "/LOADURL ".$FULL_UNRESTRICTED_PATH."simple_emergency_message.php"."?message=".urlencode(stripslashes($display_message));
//$cmdFile = "/FILE \"".$tIpListFiles[$TERM_TYPE_AMINET100][0]."\"";
if ($target_type == 'all')
{
$sqlTerminals ="SELECT IP, Room FROM `".$DBTablesPrefix."_stbs` "." WHERE Version='aminet110' "." ORDER BY (Room+0)";
$Infos = mysql_query($sqlTerminals) or die("Query Failed 76");
$i= 0;
while($Row_Infos = mysql_fetch_assoc($Infos))
{
$i++;
$termIP = $Row_Infos ["IP"];
$termRoom = $Row_Infos ["Room"];
$cmdLine = "STB_visualacfg.exe ".$cmdCommand." ".$cmdOptions." ".' TERMINALCHANGE '.$termIP;
exec( $cmdLine, $cmdOutput);
}
$termCount = $i;
}
else if ($target_type == 'room')
{

for ($i = 0; $i< count($roomList); $i++)
{
$sqlTerminals = "SELECT IP, Room FROM `".$DBTablesPrefix."_stbs` "." WHERE Room = '$roomList[$i]'";
$Infos = mysql_query($sqlTerminals) or die("Query Failed 94");
while($Row_Infos = mysql_fetch_assoc($Infos))
if ($i > 0)
{
$IP_terminal = $Row_Infos["IP"];

$cmdLine = "STB_visualacfg.exe ".$cmdCommand." ".$cmdOptions." ".' TERMINALCHANGE '.$IP_terminal;
//echo $cmdLine;
exec( $cmdLine, $cmdOutput );
}
}
}
}

if (!isset($target_type))
$target_type = 'all';
?>




function disableItems(selectedItem) { if (selectedItem.value =='all') { document.getElementById("target_list").disabled = true; document.getElementById("allocatedTerminals").disabled = true; } else if (selectedItem.value =='room') { document.getElementById("target_list").disabled = false; document.getElementById("allocatedTerminals").disabled = false; } } window.onload=function() { var targetType = '<? echo $target_type;?>'; if (targetType =='all') { document.getElementById("target_list").disabled = true; document.getElementById("allocatedTerminals").disabled = true; } else if (targetType =='room') { document.getElementById("target_list").disabled = false; document.getElementById("allocatedTerminals").disabled = false; } }
<?PHP include('head_servicesmanagement.php'); ?>

echo'<p align="center"><font color="#666666" size="4" face="Verdana, Arial, Helvetica, sans-serif"><strong>' ;
			echo "Issue Emergency";
			echo'</strong></font></p>';



Type:
<?
$sqlMsg = "SELECT * FROM `".$DBTablesPrefix."_emergency_type`";
$Infos = mysql_query($sqlMsg) or die("Query failed on line 156");
$j = 0;
while($Row_Infos = mysql_fetch_assoc($Infos))
{
$j++;
$type_ID = $Row_Infos["Id"];
$message = $Row_Infos["name"];
echo "".$message;
}
?>
onClick="disableItems(this);">
All:
onClick="disableItems(this);">
Rooms:
<?
//terminal identification in multi-terminal rooms
$sqlTerminals ="SELECT IP, Room FROM `".$DBTablesPrefix."_stbs` "." WHERE (Version='aminet110') "." ORDER BY (Room+0)";
$Infos = mysql_query($sqlTerminals) or die("Query failed on line 188");
$i = 0;
while($Row_Infos = mysql_fetch_assoc($Infos))

{
$i++;
$termIP = $Row_Infos["IP"];
$termRoom = $Row_Infos["Room"];
$messRoom = Room; //Room

//terminal identification in multi-terminal rooms
if ($roomList)
{
//$key = array_search($termRoom, $roomList); // $key = 2;
$key = in_array($termRoom, $roomList);
}
//echo 'R '. $termRoom . $key." k
";
if ($key != true)
echo "$messRoom ".$termRoom." \r\n";
}
$termCount = $i;
?>

<?
echo 'Only local images are allowed.Only local images are allowed.';
?>
<?
echo 'Only local images are allowed.Only local images are allowed.';
?>
<?
echo 'Only local images are allowed.Only local images are allowed.';
?>
<?
echo 'Only local images are allowed.Only local images are allowed.';
?>
<?
$termCount = count($roomList);
for ($i = 0; $i < $termCount; $i++)
{
$termRoom = $roomList[$i];
$messRoom = Room; //ROOM
echo "$messRoom ".$termRoom." \r\n";
}
?>
<?PHP include('tail.php'); ?>



<?
/**
* Trims an array from empty elements.
*
* @param $a the array to trim.
* @return a new array with the empty elements removed.
*/
function array_trim($a)
{
$j = 0;
for ($i = 0; $i < count($a); $i++)
{
if ($a[$i] != "")
{
$b[$j++] = $a[$i];
}
}
return $b;
}
?>

Any help will be greatly Appreciated, Thanks again .

CommentFileSizeAuthor
emergency.txt9.63 KBandylonger

Comments

vm’s picture

Assigned: andylonger » Unassigned
Category: bug » support
Priority: Critical » Normal
Status: Needs work » Closed (won't fix)

This has nothing to do with drupals forum.module

nevets’s picture

It does not even look Drupal related.