Engineer Menu demo
On screen demo Engineer menu navigation. [Screen Shot]
Panels: Agility, LightSYS2, ProSYS Plus.
Keypads: Agility, Panda, Elegant
$font1="verdana";
//$clicked_menu="0";
$panel_type="0";
$panel_name="X";
$data_file="none";
$thisfilename="keypads.php";
$split_define="";
$split_define_len=3;
$c_background="7f0007";
$navigation=0;
$keypad=0; //0=Agility, 1=Panda, 2=Elegant White, 3=Elegant Black
$line_one_text=0;
$line_two_text=999;
$previous=1; //System
$engr_code="none";
$engineer_filename="rkeypad/engineer_c.dat";
$engr_code_file="";
$debug=0; //*********D*E*B*U*G******ON/OFF********************************
if (isset ($_GET['engineer'])){
$engr_code=$_GET['engineer'];
}
//####### Show Engr Code ### if password used
if ($engr_code=="Ri\$c0"){
$myFile = "rkeypad/engineer_c.dat";
$fh = fopen($myFile, 'r');
$theData = fread($fh, 4);
fclose($fh);
echo "Engineer Code is currently this > ".$theData." ";
exit;
}
//##########################
if (isset ($_GET['keypad'])){
$keypad=$_GET['keypad'];
}
if (isset ($_GET['panel_type'])){
$panel_type=$_GET['panel_type'];
}
if (isset ($_GET['navigation'])){
$navigation=$_GET['navigation'];
}
if (isset ($_GET['previous'])){
$previous=$_GET['previous'];
}
switch ($panel_type){ //Start chosen panel
case "0":
$panel_name="Agility4";
$data_file="rkeypad/eng_a3.h";
$split_define="ITM";
$split_define_len=3;
break;
case "1":
$panel_name="LightSYS2";
$data_file="rkeypad/eng_ls.h";
$split_define="STR_ITM";
$split_define_len=7;
break;
case "2":
$panel_name="ProSYS Plus";
$data_file="rkeypad/eng_pp.h";
$split_define="STR_ITM";
$split_define_len=7;
break;
default:
$panel_name="Agility4";
$data_file="rkeypad/eng_a3.h";
$split_define="ITM";
$split_define_len=3;
break;
} //End chosen panel
$thisname=$panel_name." Engineer Menu";
echo "";
//############## DO ENGINEER CODE FILE ################################
if (file_exists($engineer_filename)){
if (time()-filemtime($engineer_filename)>43200){unlink($engineer_filename);} //Delete after ? seconds)
}
if (file_exists($engineer_filename)){
$fp = fopen($engineer_filename, 'r');
$engr_code_file = fgets($fp);
fclose($fp);
//echo "Save Engineer Code = ".substr(time(), -4)."
"; }else{ //Must have been deleted - Let's make a new code $fp = fopen($engineer_filename, 'w'); fwrite($fp, substr(time(), -4)); fclose($fp); header( "Location: ".$thisfilename); } //echo time()."
"; //echo date('d.m.Y',strtotime("-1 days"))."
"; //##################################################################### //############## DO ENGR CODE ###################################################### if (empty ($_GET['engineer']) || (!isset ($_GET['engineer']) ) ) { // Engineer no code then... ?> Please enter current Demo Engineer Code:
echo "To obtain the current Engineer Code to try this demo, please contact your RISCO Technical representative.
"; //echo "SPECIAL ACCESS ONLY > Enter 'Ri\$c0' in the box! (That's 'Ri' dollar 'c' zero) ";
exit;
}else{
$engr_code = $_GET['engineer'];
}
//echo "Must be set
"; //echo "Engineer Code entered = ".$engr_code."
"; if (!($engr_code==$engr_code_file)){ $engr_code=""; header( "Location: ".$thisfilename); } //################################################################################# if (!isset ($_GET['panel_type']) ){ // if just index.php without ? then... echo "";
echo "
";
exit();
}
if (!isset ($_GET['keypad']) ){ // if no keypad chosen then...
echo "";
echo "
";
}else{
echo "Agility ";
echo "";
}
echo "
"; exit(); } echo "".$thisname."
";
$record = file($data_file);
$NumOfLines = count($record);
//echo "Number of options=".$NumOfLines." ~ ".$clicked_menu."\n
"; echo "";
echo "
";
echo "Current Engineer Code will expire in: ".(time()-filemtime($engineer_filename)-43200)." seconds";
echo "
"; $real_row=0; $real_row_text=""; $ignore_first_real_row="1"; $ignore_remmed="0"; for ($i=0; $i<$NumOfLines; $i++) { skp: if ((substr($record[$i],0,2)) =='/*'){ $ignore_remmed="1"; // if I find "/*" then set remmed flag to positive //echo $ignore_remmed.">".".$record[$i].
"; } if (strstr($record[$i], '*/')){ $ignore_remmed="0"; // if I find "*/" then set remmed flag to negative //echo $ignore_remmed.">".".$record[$i].
"; } if ((substr($record[$i],8,$split_define_len)==$split_define) & ($ignore_remmed=="0")) { //Check for real wanted line if (($ignore_first_real_row=="0")) { // if not 00 Programming $real_row_text = explode("\n",$record[$i]); $lne = explode($split_define,$real_row_text[0]); //Left="#define ", Right= the rest $menu = explode(" ",$lne[1]); //SKIP if I see a letter in the Quick Key number if (preg_match('/[a-zA-Z]/', $menu[0])){ $i++; goto skp; } if (strpos($lne[1],',')){ $txt = explode(",",$lne[1]); }else{ $txt=explode("\"",$lne[1]); //If no comma, then explode the space } if ($debug==1){ //*********D*E*B*U*G************************************** echo "i = ".$i."
"; echo "txt[0]= ".$txt[0]."
"; echo "txt[1]= ".$txt[1]."
"; echo "real_row_text[0]= ".$real_row_text[0]."
"; echo "lne[0]= ".$lne[0]."
"; echo "lne[1]= ".$lne[1]."
"; echo "menu[0]= ".$menu[0]."
"; echo "menu[1]= ".$menu[1]."
"; } //*********D*E*B*U*G************************************** $myquick = $menu[0]; if (strpos($txt[1],')')){ $mytext = str_replace(")","",$txt[1]); }else{ $mytext=$txt[1]; } if (preg_match('/"/', $mytext)){ $mytext = str_replace("\"","",$mytext); } $pos = strpos($mytext, '//'); // Take away the notes at the end of the line in some cases // if ($pos !== false) { // strpos returns false if there is no needle in the haystack $mytext = substr($mytext, 0, $pos); // String UP-TO the slashes } if ($debug==1){ //*********D*E*B*U*G************************************** echo "mytext = ".$mytext."
"; echo "
"; } //*********D*E*B*U*G************************************** $final_option[$real_row] = $mytext; $final_quick[$real_row] = $myquick;//substr($myquick,1); //Remove the first "1" $real_row++; if ($debug==1 & $real_row>20) { //*********D*E*B*U*G************************************** exit(); } //*********D*E*B*U*G************************************** }else{//If it is 00 Prog (first one found) then set var to 0 $ignore_first_real_row="0"; } //Only if not 00 Programming } // End if check for real wanted line } //@@@@@@@@@@@@@@@@@@@@@@ Begin Special @@@@@@@@@@@@@@@@@@@@@@@ err: for ($quick=0;$quick1 && $final_quick[$quick]==substr($navigation,0,strlen($navigation)-1)){
$line_one_text=$quick;
}
if (strlen($navigation)==1 && $final_quick[$quick]==$navigation){
$line_one_text=$quick;
}
if ($final_quick[$quick]==$navigation){
$line_two_text=$quick;
}
}
if ($line_two_text >998){
$navigation=$previous;
goto err;
//Redirects below don't work! So, fixed it with goto - Pfft!
//header( "Location: ".$thisfilename."?engineer=".$engr_code."&panel_type=".$panel_type."&navigation=".$previous.'&keypad='.$keypad );
//echo "
"; }else{ //Must have been deleted - Let's make a new code $fp = fopen($engineer_filename, 'w'); fwrite($fp, substr(time(), -4)); fclose($fp); header( "Location: ".$thisfilename); } //echo time()."
"; //echo date('d.m.Y',strtotime("-1 days"))."
"; //##################################################################### //############## DO ENGR CODE ###################################################### if (empty ($_GET['engineer']) || (!isset ($_GET['engineer']) ) ) { // Engineer no code then... ?> Please enter current Demo Engineer Code:
echo "
"; //echo "
"; //echo "Engineer Code entered = ".$engr_code."
"; if (!($engr_code==$engr_code_file)){ $engr_code=""; header( "Location: ".$thisfilename); } //################################################################################# if (!isset ($_GET['panel_type']) ){ // if just index.php without ? then... echo "
| Select Panel: | "; echo "Agility4 | "; echo "LightSYS2 | "; echo "ProSYS Plus | "; echo "
| Select Keypad: | "; //echo "Agility | "; echo "Panda | "; if (!$panel_type==0){ // If not Agility echo "Elegant White | "; echo "Elegant Black |
"; exit(); } echo "
"; echo "
| START AGAIN | "; //echo "|||
| Change Keypad: -> | "; echo "Panda | "; echo "Elegant White | "; echo "Elegant Black | "; echo "
| Change Keypad: -> | "; echo "Panda | "; echo "Agility | "; echo "
"; $real_row=0; $real_row_text=""; $ignore_first_real_row="1"; $ignore_remmed="0"; for ($i=0; $i<$NumOfLines; $i++) { skp: if ((substr($record[$i],0,2)) =='/*'){ $ignore_remmed="1"; // if I find "/*" then set remmed flag to positive //echo $ignore_remmed.">".".$record[$i].
"; } if (strstr($record[$i], '*/')){ $ignore_remmed="0"; // if I find "*/" then set remmed flag to negative //echo $ignore_remmed.">".".$record[$i].
"; } if ((substr($record[$i],8,$split_define_len)==$split_define) & ($ignore_remmed=="0")) { //Check for real wanted line if (($ignore_first_real_row=="0")) { // if not 00 Programming $real_row_text = explode("\n",$record[$i]); $lne = explode($split_define,$real_row_text[0]); //Left="#define ", Right= the rest $menu = explode(" ",$lne[1]); //SKIP if I see a letter in the Quick Key number if (preg_match('/[a-zA-Z]/', $menu[0])){ $i++; goto skp; } if (strpos($lne[1],',')){ $txt = explode(",",$lne[1]); }else{ $txt=explode("\"",$lne[1]); //If no comma, then explode the space } if ($debug==1){ //*********D*E*B*U*G************************************** echo "i = ".$i."
"; echo "txt[0]= ".$txt[0]."
"; echo "txt[1]= ".$txt[1]."
"; echo "real_row_text[0]= ".$real_row_text[0]."
"; echo "lne[0]= ".$lne[0]."
"; echo "lne[1]= ".$lne[1]."
"; echo "menu[0]= ".$menu[0]."
"; echo "menu[1]= ".$menu[1]."
"; } //*********D*E*B*U*G************************************** $myquick = $menu[0]; if (strpos($txt[1],')')){ $mytext = str_replace(")","",$txt[1]); }else{ $mytext=$txt[1]; } if (preg_match('/"/', $mytext)){ $mytext = str_replace("\"","",$mytext); } $pos = strpos($mytext, '//'); // Take away the notes at the end of the line in some cases // if ($pos !== false) { // strpos returns false if there is no needle in the haystack $mytext = substr($mytext, 0, $pos); // String UP-TO the slashes } if ($debug==1){ //*********D*E*B*U*G************************************** echo "mytext = ".$mytext."
"; echo "
"; } //*********D*E*B*U*G************************************** $final_option[$real_row] = $mytext; $final_quick[$real_row] = $myquick;//substr($myquick,1); //Remove the first "1" $real_row++; if ($debug==1 & $real_row>20) { //*********D*E*B*U*G************************************** exit(); } //*********D*E*B*U*G************************************** }else{//If it is 00 Prog (first one found) then set var to 0 $ignore_first_real_row="0"; } //Only if not 00 Programming } // End if check for real wanted line } //@@@@@@@@@@@@@@@@@@@@@@ Begin Special @@@@@@@@@@@@@@@@@@@@@@@ err: for ($quick=0;$quick