Jump to content

bugfinder

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

About bugfinder

  • Birthday 02/22/1984

Profile Information

  • Gender
    Male
  • Location
    Kuwait

bugfinder's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sure function movein() { var target_list = document.getElementById('target_list');; var allocated_terminal = document.getElementById('allocatedTerminals'); var target_list_length = target_list.length; for(var j=0; j<target_list_length; j++) { if(target_list[j].selected) //this is where im getting error msg { var tmp = target_list.options[j].text; var tmp1 = target_list.options[j].value; target_list.remove(j); j--; var y=document.createElement('option'); y.text=tmp; try { allocated_terminal.add(y,null); } catch(ex) { allocated_terminal.add(y); } } } } function moveout() { var target_list = document.getElementById('target_list'); var allocated_terminal = document.getElementById('allocatedTerminals'); var allocated_terminal_length = allocated_terminal.length; for(var j=0; j<allocated_terminal_length; j++) { if(allocated_terminal[j].selected) //this is where im getting error msg { var tmp = allocated_terminal.options[j].text; var tmp1 = allocated_terminal.options[j].value; allocated_terminal.remove(j); j--; var y=document.createElement('option'); y.text=tmp; try { target_list.add(y,null); } catch(ex) { target_list.add(y); } } } } i commented the line 128 and 155
  2. Good day everybody, i guess i have issue with my code i get 'selected is null' or not an object error can some one help me out with this .. lines 128 and 155 <? include('config.php'); include('connect.php'); include('checkusersession.php'); if (!isset($target_type)) $target_type = 'all'; ?> <form name='form_allocate_terminals'> <table border="0" cellpadding="4" cellspacing="4" width="50%" align="center" class="tableForm"> <tr > <td align="left" valign="middle" width="3%" > <font color="#000000"><strong>Type:</strong></font> </td> <td align="left" valign="middle" colspan="5"> <select name="message" > <? $sqlMsg = "SELECT * FROM `".$DBTablesPrefix."_emergency_type`"; $Infos = mysql_query($sqlMsg) or die("Query Failed 1"); $j = 0; while($Row_Infos = mysql_fetch_assoc($Infos)) { $j++; $Id = $Row_Infos['Id']; $name = $Row_Infos['name']; echo "<option value='".$Id."' ".$strSelected.">".$name; } ?> </select> </td> </tr> <tr bgcolor="#ECECEC" > <td align="left" valign="middle" width="3%" colspan="4"> <input type="radio" name="target_type" value="all" <?=($target_type=="all")?"checked":""?> onClick="disableItems(this);"> <font color="#000000" size="2"><strong>All</strong></font> </td> </tr> <tr bgcolor="#ECECEC"> <td align="left" valign="middle" width="3%" colspan="4"> <input type="radio" name="target_type" value="room" <?=($target_type=="room")?"checked":""?> onClick="disableItems(this);"> <font color="#000000" size="2"><strong>Rooms</strong></font> </td> </tr> <tr > <td align="left" valign="middle" width="30%"> <select name="target_list[]" id ='target_list' size="3" multiple style="width:100 "> <? //terminal identification in multi-terminal rooms $query ="SELECT IP, Room FROM `".$DBTablesPrefix."_stbs`"."WHERE Version='aminet110' "." ORDER BY Room "; $Infos = mysql_query($query) or die("Query failed on line 188"); $i = 0; while($Row_Infos = mysql_fetch_array($Infos)) { $i++; $IP = $Row_Infos['IP']; $Room = $Row_Infos['Room']; $messRoom = Room; //echo "<option value='".$Room[$i]."' ".$strSelected.">".$Room."::".$IP."\r\n"; echo "<option value='".$Room[$i]."' ".$strSelected.">$messRoom ".$Room." \r\n"; } ?> </select> </td> <td width="10%" align="center" valign="middle"> <input type="hidden" name="action" value="add"> <table border="0"> <tr align="center" height="50%"> <td width="30%"> <? echo '<img src="../admin/img/right.gif" border="0"><img src="../admin/img/right.gif" border="0">'; ?> </td> <td> <input type="button" onClick='movein()' value="Add"> </td> <td width="30%"> <? echo '<img src="../admin/img/right.gif" border="0"><img src="../admin/img/right.gif" border="0">'; ?> </td> </tr> <tr align="center" height="50%"> <td width="30%"> <? echo '<img src="../admin/img/left.gif" border="0"><img src="../admin/img/left.gif" border="0">'; ?> </td> <td> <input type="button" onClick="moveout()" value="Remove"> </td> <td width="30%"><? echo '<img src="../admin/img/left.gif" border="0"><img src="../admin/img/left.gif" border="0">';?> </td> </tr> </table> </td> <td align="right" width="30%"> <select name="allocatedTerminals[]" id='allocatedTerminals' size="3" multiple style="width:100 " > </select> </td> </tr> <tr align="center" > <td colspan="4"><input type="button" name='btnSend' value="Send" onClick="sendemergency(form_allocate_terminals)"> <!-- <input name="btnsend" type="button" class="buttform" id="34" value="Send Emergency" onclick="pushpage()" />--></td> </tr> </table> </form> <script language="javascript"> var cmdLink = "EMERGENCY_execcommand.php?Emergency=<?php echo $name;?>&targetType=<?php echo $target_type;?>&ip=<?php echo $IP;?>"; function pushpage() { Link = cmdLink+" SEND"; //alert(Link); var msg = "Are you sure you want to delcare Emergency?"; if(confirm(msg)) document.location.href=""+Link; } function movein() { var target_list = document.getElementById('target_list');; var allocated_terminal = document.getElementById('allocatedTerminals'); var target_list_length = target_list.length; for(var j=0; j<target_list_length; j++) { if(target_list[j].selected) //this is where im getting error msg { var tmp = target_list.options[j].text; var tmp1 = target_list.options[j].value; target_list.remove(j); j--; var y=document.createElement('option'); y.text=tmp; try { allocated_terminal.add(y,null); } catch(ex) { allocated_terminal.add(y); } } } } function moveout() { var target_list = document.getElementById('target_list'); var allocated_terminal = document.getElementById('allocatedTerminals'); var allocated_terminal_length = allocated_terminal.length; for(var j=0; j<allocated_terminal_length; j++) { if(allocated_terminal[j].selected) //this is where im getting error msg { var tmp = allocated_terminal.options[j].text; var tmp1 = allocated_terminal.options[j].value; allocated_terminal.remove(j); j--; var y=document.createElement('option'); y.text=tmp; try { target_list.add(y,null); } catch(ex) { target_list.add(y); } } } } 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; } } function sendemergency() { var len =document.form_allocate_terminals.target_type.length; for (i=0;i<len;i++) { if(document.form_allocate_terminals.target_type.checked) { alert("Do you really want to send the emergency"); } } } </script> <?php $action =send; if ($btnSend ==$action) { $pause = 5; $sqlMsg = "SELECT * FROM `".$DBTablesPrefix."_emergency_type`"; $Infos = mysql_query($sqlMsg) or die("Query failed on line 55"); $j = 0; while($Row_Infos = mysql_fetch_assoc($Infos)) { $j++; $Id= $Row_Infos['Id']; $msg= $Row_Infos['message']; if ($Id == $message) { $display_message = $msg; } } $commandURL = "../emergency/simple_remote_control.php?message=".urlencode(stripslashes($display_message)); $cmdOptions = "/PASSWORD \"".$aminoRemoteControlPassPhrase."\" /TIMEOUT 12 /THREADS 60 /PAUSE ".$pause." /QUIET"; $cmdCommand = "/LOADURL ".EMERGENCY_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 on line 78"); $i = 0; while($Row_Infos = mysql_fetch_assoc($Infos)) { $i++; $termIP = $Row_Infos['IP']; $termRoom = $Row_Infos['Room']; $cmdLine = "AminoBatchControl.exe ".$cmdCommand." ".$cmdOptions." ".' TERMINALCHANGE '.$termIP; exec( $cmdLine, $cmdOutput); } } else if ($target_type == 'room') { for ($i = 0; $i< count($Room); $i++) { $sqlTerminals = "SELECT IP, Room FROM `".$DBTablesPrefix."_stbs` ". "WHERE `Room` = '$Room[$i]'"; $Infos = mysql_query($sqlTerminals) or die("Query failed in line 95"); if ($sqlTerminals > 0) while($Row_Infos = mysql_fetch_assoc($Infos)) { $IP_terminal = $Row_Infos['IP']; $cmdLine = "AminoBatchControl.exe ".$cmdCommand." ".$cmdOptions." ".' TERMINALCHANGE '.$IP_terminal; //echo $cmdLine; exec( $cmdLine, $cmdOutput ); } } } } ?>
  3. i checked what u told .. this happens when i try to remove the room number from the second box "allocatedTerminals" but this $roomList[] = $target_list[$i]; have to assign the value to the roomlist
  4. Hi All, this is driving nuts out of me ... can some one check this for me..??? Seems i have issue with the array but couldn't make it work ....the Concept of my code is to send emergency to selected room number vise-vase to all rooms error:- Warning: array_search() [function.array-search]: Wrong datatype for second argument in C:\wamp\www\admin\admin_issue_emergency.php on line 36 I attached the code for u guys to make it easy here is the code :- <?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; //$roomList = array(); 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']); print_r($_SESSION['roomList']); // to check the array value } 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']); //print_r($_SESSION['roomList']); /*to check the array value*/ } $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'; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- Base1 { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; line-height: normal; font-weight: bold; font-variant: normal; text-transform: none; color: #663300; } --> </style> <script language="javascript"> 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; } } </script> <link href="hoteltv.css" rel="stylesheet" type="text/css"> </head> <body background="img/bg.gif"> <table border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="FFFFFF" > <tr> <td> <?PHP include('head_servicesmanagement.php'); ?> </td> </tr> <tr ><td colspan=""><br> <?php echo'<p align="center"><font color="#666666" size="4" face="Verdana, Arial, Helvetica, sans-serif"><strong>' ; echo "Issue Emergency"; echo'</strong></font></p>'; ?> </td></tr> <tr><td><br> <form method='get' name='form_allocate_terminals'> <table border="0" cellpadding="1" cellspacing="0" width="50%" align="center" class="tableForm"> <tr> <td> <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"> <tr> <td align="left" valign="middle" width="3%" ><font size="2"><strong> Type:</strong></font> </td> <td align="left" valign="middle" colspan="3"> <select name="message" > <? $sqlMsg = "SELECT * FROM `".$DBTablesPrefix."_emergency_type`"; $Infos = mysql_query($sqlMsg) or die("Query failed on line 156"); $totalRows = mysql_num_rows($Infos); //$j =0; for ( $i = 0; $i < $totalRows; $i++ ) while($Row_Infos = mysql_fetch_assoc($Infos)) { //$j++; $type_ID = $Row_Infos["Id"]; $message = $Row_Infos["name"]; echo "<option value='".$type_ID."' ".$strSelected.">".$message; } ?> </select> </td> </tr> <tr> <td align="left" valign="middle" width="3%" colspan="4"> <input type="radio" name="target_type" value="all" <?=($target_type=="all")?"checked":""?> onClick="disableItems(this);"> <font size="2"><strong>All:</strong></font> </td> </tr> <tr> <td align="left" valign="middle" width="3%" colspan="4"> <input type="radio" name="target_type" value="room" <?=($target_type=="room")?"checked":""?> onClick="disableItems(this);"> <font size="2"><strong>Rooms:</strong></font></td> </tr> <tr> <td></td> <td align="left" valign="middle" width="10%"> <select name="target_list[]" id ='target_list' size="3" multiple onChange="/*document.form_allocate_terminals.target_type[0].checked=true*/" > <? //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"); $termCount = mysql_num_rows($Infos); for ( $i = 0; $i < $termCount; $i++ ) //$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 <br>"; if ($key != true) echo "<option value='".$termRoom."' ".$strSelected.">$messRoom ".$termRoom." \r\n"; } ?> </select> </td> <td width="10%" class="light" align="center" valign="middle"> <input type="hidden" name="action" value="add"> <table border="0"> <tr align="center" height="50%"> <td width="30%"> <? echo '<img src="../admin/img/right.gif" border="0"><img src="../admin/img/right.gif" border="0">'; ?> </td> <td><input type="submit" onClick="document.form_allocate_terminals.action.value='add'; return true;" value="Add"></td> <td width="30%"> <? echo '<img src="../admin/img/right.gif" border="0"><img src="../admin/img/right.gif" border="0">'; ?> </td> </tr> <tr align="center" height="50%"> <td width="30%"> <? echo '<img src="../admin/img/left.gif" border="0"><img src="../admin/img/left.gif" border="0">'; ?> </td> <td><input type="submit" onClick="document.form_allocate_terminals.action.value='remove'; return true;" value="Remove"></td> <td width="30%"> <? echo '<img src="../admin/img/left.gif" border="0"><img src="../admin/img/left.gif" border="0">'; ?> </td> </tr> </table> </td> <td width="30%"> <select name="allocatedTerminals[]" id='allocatedTerminals' size="3" multiple onDblClick="document.form_allocate_terminals.action.value='remove'; document.form_allocate_terminals.submit();"> <? $termCount = count($roomList); for ($i = 0; $i < $termCount; $i++) { $termRoom = $roomList[$i]; $messRoom = Room; //ROOM echo "<option value='".$termRoom."' ".$strSelected.">$messRoom ".$termRoom." \r\n"; } ?> </select> </td> </tr> <tr> <td colspan="4" align="center"><input type="submit" name='btnSend' value="Send"></td> </tr> </table> </td> </tr> </table> </form> <tr><td><?PHP include('tail.php'); ?></td></tr> </td></tr> </table> </body> </html> <? /** * 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..!!! [attachment deleted by admin]
  5. thanks for you reply and ur time...!! can u tell me how can i edit the code to make it work...
  6. hello everybody, i have a issue with my code i tried to figured it out but i couldn't can any one check this for me, any help will be greatly appreciated i attached code for u guys please help me out requirements using :- php:- 5.2.0 apache:-2.0.59.200 mysql :- 5.0.27 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 the code :- <?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']; if ($action =='btnSend') { $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 = "../unrestricted/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.php4"."?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 = $sqlTerminals->getRecord("IP", $i); $termRoom = $sqlTerminals->getRecord("Room", $i); $cmdLine = "..\\bin\\AminoBatchControl.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 = "..\\bin\\AminoBatchControl.exe ".$cmdCommand." ".$cmdOptions." ".' TERMINALCHANGE '.$IP_terminal; //echo $cmdLine; exec( $cmdLine, $cmdOutput ); } } } } if (!isset($target_type)) $target_type = 'all'; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- Base1 { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; line-height: normal; font-weight: bold; font-variant: normal; text-transform: none; color: #663300; } --> </style> <script language="javascript"> 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; } } </script> <link href="hoteltv.css" rel="stylesheet" type="text/css"> </head> <body background="img/bg.gif"> <table border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="FFFFFF" > <tr> <td> <?PHP include('head_servicesmanagement.php'); ?> </td> </tr> <tr ><td colspan=""> <?php echo'<p align="center"><font color="#666666" size="4" face="Verdana, Arial, Helvetica, sans-serif">' ; echo "Issue Emergency"; echo'</font></p>'; ?> </td></tr> <tr><td> <form method='get' name='form_allocate_terminals'> <table border="0" cellpadding="1" cellspacing="0" width="50%" align="center" class="tableForm"> <tr> <td> <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"> <tr> <td align="left" valign="middle" width="3%" ><font size="2"> Type:</font> </td> <td align="left" valign="middle" colspan="3"> <select name="message" > <? $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 "<option value='".$type_ID."' ".$strSelected.">".$message; } ?> </select> </td> </tr> <tr> <td align="left" valign="middle" width="3%" colspan="4"> <input type="radio" name="target_type" value="all" <?=($target_type=="all")?"checked":""?> onClick="disableItems(this);"> <font size="2">All:</font> </td> </tr> <tr> <td align="left" valign="middle" width="3%" colspan="4"> <input type="radio" name="target_type" value="room" <?=($target_type=="room")?"checked":""?> onClick="disableItems(this);"> <font size="2">Rooms:</font></td> </tr> <tr> <td></td> <td align="left" valign="middle" width="10%"> <select name="target_list[]" id ='target_list' size="3" multiple onChange="/*document.form_allocate_terminals.target_type[0].checked=true*/"> <? //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 "<option value='".$termRoom."' ".$strSelected.">$messRoom ".$termRoom." \r\n"; $termCount = $i; } ?> </select> </td> <td width="10%" class="light" align="center" valign="middle"> <input type="hidden" name="action" value="add"> <table border="0"> <tr align="center" height="50%"> <td width="30%"> <? echo '<img src="../admin/img/right.gif" border="0"><img src="../admin/img/right.gif" border="0">'; ?> </td> <td><input type="submit" onClick="document.form_allocate_terminals.action.value='add'; return true;" value="Add"></td> <td width="30%"> <? echo '<img src="../admin/img/right.gif" border="0"><img src="../admin/img/right.gif" border="0">'; ?> </td> </tr> <tr align="center" height="50%"> <td width="30%"> <? echo '<img src="../admin/img/left.gif" border="0"><img src="../admin/img/left.gif" border="0">'; ?> </td> <td><input type="submit" onClick="document.form_allocate_terminals.action.value='remove'; return true;" value="Remove"></td> <td width="30%"> <? echo '<img src="../admin/img/left.gif" border="0"><img src="../admin/img/left.gif" border="0">'; ?> </td> </tr> </table> </td> <td width="30%"> <select name="allocatedTerminals[]" id='allocatedTerminals' size="3" multiple onDblClick="document.form_allocate_terminals.action.value='remove'; document.form_allocate_terminals.submit();"> <? $termCount = count($roomList); for ($i = 0; $i < $termCount; $i++) { $termRoom = $roomList[$i]; $messRoom = Room; //ROOM echo "<option value='".$termRoom."' ".$strSelected.">$messRoom ".$termRoom." \r\n"; } ?> </select> </td> </tr> <tr> <td colspan="4" align="center"><input type="submit" name='btnSend' value="Send"></td> </tr> </table> </td> </tr> </table> </form> <tr><td><?PHP include('tail.php'); ?></td></tr> </td></tr> </table> </body> </html> <? /** * 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; } ?> [attachment deleted by admin]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.