DIR : /home/kozerus/public_html/ko_center/ko_center_best.php
/home/kozerus/public_html/ko_center
<?php
/**
ko_center.php v0.67 0.66_20250325_1900 q=login debug
*/
// $fileSize = $_FILES['myFile']['size'];
// $tmpFile = $_FILES['myFile']['tmp_name'];
// $fileName = $_FILES['myFile']['name'];
// $contentType = $_FILES['myFile']['type'];
// $user = $_GET['user'];
/*
// .jpg image/jpeg`
// .gif image/gif
// .png image/png
// .wbmp image/vnd.wap.wbmp
// .txt text/plain
*/
startup();
function startup() {
// session_cache_limiter("must-revalidate");
// session_cache_limiter("public");
session_start();
error_reporting(0);
$progid="ko_center";
$dttm=date('Ymd_His');
$dttm_ip= sprintf( "%s.%s.%s.%s",
substr( $dttm, 0, 2 ),
substr( $dttm, 2, 2 ),
substr( $dttm, 4, 2 ),
substr( $dttm, 6, 2 ));
// $output = leds_about( $options );
// print( $output );
// print( "$php_self startup MSG: validate=[$validate] </br>\n" );
// print( "$php_self startup MSG: dttm_ip=[$dttm_ip] </br>\n" );
// print( "$php_self startup MSG: r_user=[".$row['user_code']."] </br>\n" );
// print( "$php_self startup MSG: r_role=[".$row['user_role']."] <br/>\n" );
// print( "$php_self startup MSG: s_id=[".$_SESSION['id']."] <br/>\n" );
// print( "$php_self startup MSG: s_user=[".$_SESSION['user']."] </br>\n" );
// print( "$php_self startup MSG: s_role=[".$_SESSION['role']."] <br/>\n" );
// print( "$php_self startup MSG: u=[$user][$pass] r=[$role] step=[step] sid=[$sid]<br/>\n" );
// print_r( $_SESSION );
$path_btn="/ko_center/imgs/btn";
$path_ani="/ko_center/imgs/ani";
/// phpinfo();
$document_root=$_SERVER['DOCUMENT_ROOT'];
// $GLOBALS['hosts_allow']="/etc/hosts.allow";
$GLOBALS['hosts_allow']="$document_root"."/../safer/hosts.allow";
$GLOBALS['kbfile']="$document_root/ko_center/db3/koaac_kb.db3";
$GLOBALS['kb_rootpath'] = "$document_root/ko_center/kb";
$GLOBALS['ko_center_certsfile'] = "$document_root/ko_center/db3/ko_center_certs.db3";
$GLOBALS['screenshots_pcharts'] = "";
$GLOBALS['kbpath'] = "$document_root/ko_center/kb";
$yyyymm=date('Ym');
$logfil_basename="$progid"."_"."$yyyymm".".log";
$logfil_rootpath="$document_root"."/../ko_safer";
$logfil="$logfil_rootpath/$logfil_basename";
$logfil="../../safer/".$logfil_basename;
$GLOBALS['logfil']=$logfil;
$GLOBALS['progid']=$progid;
$hostos="";
// $uname='uname -a';
// $uname='uname -a';
// $hostos="win";
//
// escapeshellarg()
// escapeshellcmd()
// exec()
// passthru()
// pcntl_exec()
// backtick operator
// $uname=system("uname -a 2>&1",$status);
$status=exec("uname -a 2>&1",$uname);
// printf( "BUGS_135a: status=[$status] uname=[$uname]<hr>\n" );
// $status=exec("ls -lat 2>&1",$files);
$dttm=date('Ymd_His');
// foreach(PDO::getAvailableDrivers() as $driver) {$html .= "$j $driver<br>\n"; $j++;}
// $allowflag_fields=explode( " ", $allowflag ); $kb_user = $allowflag_fields[2];
// foreach( $files as $file) {
// $html .= "$j $file<br>\n";
// printf( "BUGS_135b: $j file=$file status=[$status] lslat=[$lslat]<hr>\n" );
// $j++;
// }
// printf( "$html\n");
// printf( "BUGS_135b: status=[$status] lslat=[$lslat]<hr>\n" );
//
// $item_level=count( explode( "!", $item_levels ));
// $item_text=str_replace( "!", "", $item_levels );
$uname=`uname -a`;
if( preg_match( "/CYG/", $uname, $matches)) { $hostos = "win"; }
if( $hostos == "win" ) {
// $GLOBALS['kbfile'] = "L:\\xampp\\htdocs\\ko_center\\db3/koaac_kb.db3";
// $GLOBALS['kbrootpath'] = "L:\\xampp\\htdocs\\ko_center\\kb";
// $GLOBALS['dbfile'] = "L:\\xampp\\htdocs\\ko_center\\ko_center.db3";
// $GLOBALS['hosts_allow']="L:\\xampp\\htdocs\\ko_center\\hosts.allow";
$GLOBALS['kbfile'] = "S:\\xampp\\htdocs\\ko_center\\db3/koaac_kb.db3";
$GLOBALS['kbrootpath'] = "S:\\xampp\\htdocs\\ko_center\\kb";
$GLOBALS['dbfile'] = "S:\\xampp\\htdocs\\ko_center\\ko_center.db3";
$GLOBALS['hosts_allow']="S:\\xampp\\htdocs\\ko_center\\hosts.allow";
$GLOBALS['hosts_allow']="c:\\windows\\system32\\drivers\\etc\\hosts.allow";
$hosts_allow=$GLOBALS['hosts_allow'];
}
// $wc=`wc -l *.php`;
// printf( "BUGS_160 uname=[$uname] hosts_allow=[$hosts_allow]<hr>\n" );
if (!extension_loaded('gd') && !extension_loaded('gd2')) {
printf( "<hr><b>extension not loaded gd and gd2 </b><hr>\n" );
if(!extension_loaded('gd2')) {
printf( "<hr><b>extension not loaded gd2 </b><hr>\n" );
}
return;
}
// check REMOTE_ADDR ip against hosts.all
/// $filename="$document_root/ko_center/ko_center.db3";
/// $filename="/etc/hosts.allow";
// $filename="c:\\windows\\system32\\drivers\\etc\\hosts.allow";
/// $filename="c:/windows/system32/drivers/etc/hosts.allow";
$remote_addr=$_SERVER['REMOTE_ADDR'];
$php_self=$_SERVER['PHP_SELF'];
$allowflag="";
$hosts_allow = $GLOBALS['hosts_allow'];
$kbfile = $GLOBALS['kbfile'];
$kb_rootpath = $GLOBALS['kb_rootpath'];
$logrec="$progid|$dttm|bugs_0130_sitehit|$remote_addr|$user|$email||\n"; logwrite( $logfil, $logrec );
/// logdump( $logfil );
/// print( "<hr>BUGS_134 progid=$progid dttm=[$dttm] logfil=[$logfil]<hr>\n" );
/// return;
/// $path="/ko_center/kb/201208/20120810_130000";
/// ko_ls( $options, $path );
// $remote_addr="160.132.7.53"; # mouserk
// $remote_addr="10.200.82.186"; # wilsong
// $remote_addr="10.200.80.179"; # gospodarecsm
$db3file="ko_center.db3";
$db3tbl="hallo";
// printf( "BUGS_150 db3file=%s db3tbl=%s<br>", $db3file, $db3tbl );
$hallos=sql3_insert_hallo($db3file, $db3tbl);
// printf( "BUGS_161 hallos=%s<br>",$hallos );
$rows=sql3_select_hallo($db3file, $db3tbl, $ip );
// printf( "BUGS_162 rows_ip=%s<br>",$rows['ip'] );
// var_dump($rows);
if( file_exists( $hosts_allow )) {
// printf( "$progid $dttm MSG:_200: FOUND hosts_allow=[$hosts_allow][$remote_addr][$php_self]<br>\n" );
$fp = fopen( $hosts_allow, 'r' );
while( $bigline = fread($fp, 1024)) {
$image .= $bigline;
$lines = explode("\n", $bigline );
for( $j=0; $j < count($lines); $j++ ) {
$line=$lines[$j];
// printf( "$progid $dttm MSG:_150: $j line=[$line] [$remote_addr]<br>\n" );
// if( $remote_addr == $line ) { printf( "ALLOW<br>\n" ); }
if( preg_match( "/$remote_addr/", $line, $matches)) {
// $allowflag="true";
$allowflag=$line;
$GLOBALS['allowflag']=$line;
$GLOBALS['kb_ip']=$remote_addr;
break;
}
}
// printf( "$progid $dttm MSG_110: line=[$line]<br>\n" );
}
fclose( $fp );
}
// else {
// $logrec="$progid|$dttm|bugs_0161_notfound_hostsallow|$remote_addr|ERR_NOTFOUND_hosts_allow=$hosts_allow|\n"; logwrite( $logfil, $logrec );
// printf( "$progid $dttm ERR_211: NOTFOUND hosts_allow=[$hosts_allow][$remote_addr]<br>\n" );
// print( "$progid $dttm ERR_212: NOTFOUND remote_addr=$remote_addr<br>\n" );
// }
/// $allowflag=$GLOBALS['allowflag'];
/// $allowflag_fields=explode( "#", $allowflag );
/// $user=$allowflag_fields[3];
/// $allowflag="";
$allowflag="allow";
if( isset( $_REQUEST['ip'] )) { $allowflag = "allow"; }
// printf( "<hr>BUGS_170 hostos=[$hostos] allowflag=[$allowflag] form_request_access php_self=[https:/$php_self]<br>\n" );
if( "$allowflag" == "" ) {
printf( "BUGS_171 form_request_access php_self=[https:/$php_self]<br>\n" );
$html = "<html><title>$php_self $dttm DENIED $remote_addr</title>\n";
$html .= "<body bgcolor=lightblue>\n";
$html .= "<hr>$progid $dttm ERR_127: HOSTDENIED allowflag=[$allowflag] your_ip=[$remote_addr] userid=[] email=[] <hr>\n";
$html .= "<a href=\"mailto:joachim.kassil.ctr@mail.mil?subject=ko_center l1033 access: $remote_addr userid email org\" target=_blank>request access</a><br>\n";
$html .= "</body></html>\n";
printf( $html );
$logrec="$progid|$dttm|bugs_177_login_notallowd|$remote_addr|$user|$email|allowflag=$allowflag|\n"; logwrite( $logfil, $logrec );
// header( 'Location: https://147.238.94.126/ko_center/ko_center.php?q=form_request_access' );
/// header( 'Location: https://147.238.94.126/ko_center/ko_center.php?q=about' );
exit;
}
$logrec="$progid|$dttm|bugs_180_login_allowed|$remote_addr|$user|$email|\n"; logwrite( $logfil, $logrec );
// $sysid="fp";
$sysid="ko_center";
$tblname= "leds";
$dttm=date("Ymd_His");
$query_string_all=$_SERVER['QUERY_STRING'];
$query_strings = explode( "&", $query_string_all );
$query_string = $query_strings[0];
$user=$_POST['user'];
$pass=$_POST['pass'];
$step=$_POST['step'];
$step=$_POST['user'];
$step=$_POST['email'];
$php_self=$_SERVER['PHP_SELF'];
$http_host=$_SERVER['HTTP_HOST'];
$request_uri=$_SERVER['REQUEST_URI'];
$script_filename = $_SERVER['SCRIPT_FILENAME'];
$script_basename = basename( $script_filename );
$dbfile = str_replace( "php", "db3", $script_filename );
// $dbfile = str_replace( "index.db3", "$sysid.db3", $dbfile );
dbs_init($options);
$default_role="anon";
$default_role="";
// $default_role="admin";
if( ! $_SESSION['role'] ) { $_SESSION['role'] = $default_role; $role=$default_role; } else { $role=$_SESSION['role']; }
if( $_SESSION['role'] ) {$role=$_SESSION['role']; } else { $_SESSION['role'] = $default_role; }
// print( "BUGS_100 role=$role _SESSION['role'] = ".$_SESSION['role']."<br>\n" );
if(( $_SESSION['role'] != "" ) && ( $_SESSION['role'] != "anon" )) {
// print( "role=$role/".$_SESSION['role']."<hr>\n" );
$output .= "role=$role/".$_SESSION['role']."<hr>\n";
$logrec="$progid|$dttm|msg_0215_valid_session|$remote_addr|user=$user|email=$email|role=$role|\n"; logwrite( $logfil, $logrec );
}
// $themes = array( 'swanky', 'redmond', 'humanity', 'frog', 'swanky', 'darkness', 'lightness', 'sunny', 'mint' );
$themes = array( 'swanky', 'redmond', 'humanity', 'frog', 'darkness', 'lightness' );
$default_theme=$themes[0];
/// $GLOBALS['allowflag'] = "";
$GLOBALS['themes'] = $themes;
if(! $_SESSION['theme']) { $_SESSION['theme'] = $default_theme; }
$roles = $GLOBALS['roles'];
$dbfiles = $GLOBALS['dbfiles'];
$GLOBALS['dbs'] = $dbfiles[$role];
// $GLOBALS['dbs'] = $dbfiles;
$GLOBALS['version'] = "0.13_20120531_1320";
$GLOBALS['dbfile'] = $dbfile;
$GLOBALS['tblname'] = $tblname;
// $GLOBALS['media_path'] = "media/";
// $GLOBALS['media_path'] = "/var/www/inbox/";
$GLOBALS['media_path'] = "$document_root/inbox/";
$_SESSION['preview'] = "on";
// print( "$php_self startup MSG: sysid=$sysid [$script_basename] script_filename=[$script_filename] dbfile=[$dbfile]<br \>\n" );
// $dbfile = "C:/xampp/htdocs/hrc/hrc.db3";
// $GLOBALS['dbfile'] = "c:/xampp/htdocs/hrc/hrc.db3";
// print( "script_filename=[$script_filename] dbfile=[$dbfile]<br>\n" );
// phpinfo();
// print( "BUGS_380 dbfile=$dbfile<br>\n" );
$allowflag_fields=explode( " ", $allowflag ); $kb_user = $allowflag_fields[2];
$GLOBALS['kb_user']=$kb_user;
/// $allowflag_fields=explode( " ", $allowflag ); $user = $allowflag_fields[1];
/// print( "$progid $dttm MSG_168: startup: allowflag=[$allowflag] user=[$user]" );
// print( "startup: [$dttm] [$user][$pass][$step]<br> [$query_string] option=[$option] option1=[$option1] option2=[$option2]<br>\n" );
// print( "php_self=[$php_self]<br>\n" );
// print( "http_host=[$http_host]<br>\n" );
// print( "request_uri=[$request_uri]<br>\n" );
// print( "dbfile=[".$GLOBALS['dbfile'] ."]<br>\n" );
// phpinfo();
// parse_str( $query_string, $query_args );
// $args=explode( "/", $query_string );
// $args=explode( "/", $_REQUEST['q'] );
// $options=explode( "/", $query_string );
// $option=$args[0]; $option1=$args[1]; $option2=$args[2]; $option3=$args[3]; $option4=$args[4];
$options=explode( "/", $_REQUEST['q'] );
$dttm=date("Ymd_His");
// ------------------------------------------------------------------
// Handle form submission — set the leds_context
// ------------------------------------------------------------------
if( isset( $_POST['set_leds_context'] ) || isset( $_GET['leds_context'] ) ) {
$lc = "";
if( isset( $_POST['set_leds_context'] ) ) { $lc = $_POST['set_leds_context']; }
if( isset( $_GET['leds_context'] ) ) { $lc = $_GET['leds_context']; }
$lc = strtolower( trim( $lc ) );
// validate allowed values
$allowed = array( "ai", "us", "cab", "" );
if( in_array( $lc, $allowed ) ) {
exec_set_leds_context( $dbfile, $lc );
$GLOBALS['leds_context'] = $lc;
}
}
# if(isset($_POST['leds_context'])) {
# $GLOBALS['leds_context']=$_REQUESTS['set_leds_context'];
# $leds_context_global=$GLOBALS['leds_context'];
# $leds_context=$_REQUEST['leds_context'];
# print( "BUGS_325 set_leds_context leds_context=$leds_context globals=$leds_context_global<br>\n" );
# }
// ------------------------------------------------------------------
// Load current leds_context from the database
// ------------------------------------------------------------------
$GLOBALS['leds_context'] = exec_get_leds_context( $dbfile );
if( $_REQUEST['todo'] ) {
# main_todo();
startup_todo();
}
// print( "BUGS173: query_string=$query_string<br>\n" );
// print( "BUGS173: \$_REQUEST['q']=[".$_REQUEST['q']."]<br>\n" );
// print( "BUGS175: o0=$options[0]<br>\n" );
// print( "BUGS175: o1=$options[1]<br>\n" );
// print( "BUGS175: o2=$options[2]<br>\n" );
// print( "BUGS175: o3=$options[3]<br>\n" );
// print( "BUGS175: o4=$options[4]<br>\n" );
// print_r( $options );
// return;
// new install if no db3 file
// unlink( $dbfile );
if( ! file_exists( $GLOBALS['dbfile'] )) {
// print( "<hr>$php_self ERR: NOT INSTALLED<hr>\n" );
ob_start();
leds_install("new");
header( 'Location:'.$php_self );
ob_flush();
die();
// leds_show();
// return;
}
// $fp = "fp05";
// $xmlfile= "$fp"."_hotspots.xml";
// $options[1]="$fp";
// $xmltext= leds_zview_xmlnew( $options );
// if( ! file_exists( $xmlfile )) {
// print( "<hr>fp.php MSG: NEW xmlfile=[$xmlfile]<hr>\n" );
// $f = fopen( $xmlfile, "w" );
// fwrite( $f, $xmltext );
// for( $x=0; $x<count($xmltext); $x++ ){
// fputs($f, $xmltext[$x]);
// }
// fclose($f);
// }
//
// print( "<hr>xmltext=<hr>$xmltext<hr>\n" );
// return;
// session tests
if( $options[0] == "about" ) {
$output = leds_about( $options );
leds_show();
print( $output );
return;
}
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
$option3=$options[3];
$option4=$options[4];
$option5=$options[5];
// printf( "<hr>BUGS_290 o0=$option0 o1=$option1 o2=$option2<hr>\n" );
// return;
if( $options[0] == "ko_im" ) {
$html = html_header( $options );
$html .= html_btn_squares($options);
$html .= leds_show($options);
$html .= "<hr>\n";
if( $options[1] == "test1" ) {
$html .= "<hr><b>test1: $option2</b><hr>\n";
$html .= ko_im( $options );
$html .= html_footer($options);
print( $html );
return;
}
if( $options[1] == "test2" ) {
$html .= "<hr><b>test2: $option2</b><hr>\n";
$html .= ko_im( $options );
$html .= html_footer($options);
print( $html );
return;
}
if( $options[1] == "test3" ) {
$html .= "<hr><b>test2: $option2</b><hr>\n";
$html .= ko_im( $options );
$html .= html_footer($options);
print( $html );
return;
}
if( $options[1] == "test4" ) {
$html .= "<hr><b>test2: $option2</b><hr>\n";
$html .= ko_im( $options );
$html .= html_footer($options);
print( $html );
return;
}
print( $html );
return;
}
if( $options[0] == "ko_ajax" ) {
$html = html_header( $options );
$html .= html_btn_squares($options);
$html .= leds_show($options);
$html .= "<hr>\n";
if( $options[1] == "test1" ) {
$html .= "<hr><b>test1: $option2</b><hr>\n";
$html .= ko_ajax( $options );
$html .= html_footer($options);
print( $html );
return;
}
if( $options[1] == "test2" ) {
$html .= "<hr><b>test2: $option2</b><hr>\n";
$html .= ko_ajax( $options );
$html .= html_footer($options);
print( $html );
return;
}
}
if( $options[0] == "ko_dragdrop" ) {
$html = html_header( $options );
$html .= html_btn_squares($options);
$html .= leds_show($options);
$html .= "<hr>\n";
if( $options[1] == "test1" ) {
$html .= "<hr><b>test1: $option2</b><hr>\n";
$html .= ko_dragdrop( $options );
$html .= "<hr><b>test1: $option2</b><hr>\n";
$html .= html_footer($options);
print( $html );
return;
}
if( $options[1] == "test2" ) {
$html .= "<hr><b>test2: $option2</b><hr>\n";
$html .= ko_dragdrop( $options );
$html .= html_footer($options);
print( $html );
return;
}
if( $options[1] == "test3" ) {
$html .= "<hr><b>test2: $option2</b><hr>\n";
$html .= ko_dragdrop( $options );
$html .= html_footer($options);
print( $html );
return;
}
if( $options[1] == "test4" ) {
$html .= "<hr><b>test2: $option2</b><hr>\n";
$html .= ko_dragdrop( $options );
$html .= html_footer($options);
print( $html );
return;
}
print( $html );
return;
}
if( $options[0] == "reports" ) {
$dttm=date("Ymd_His");
// printf( "<hr>BUGS_1200 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n" );
$output = html_btn_squares( $options, "" );
$output .= leds_show( $options );
// $output .= leds_temp($options);
$output .= "<h3>ko_center reports detail </h3>\n";
$output .= "<a href=$php_self?q=reports/rpt ><img src=imgs/btn/report.png border=0 width=75></a>\n";
$output .= "<br>\n";
// $output .= "       ";
// $output .= "<a href=$php_self?q=reports/view >view</a>\n";
// $output .= "       ";
// $output .= "<a href=$php_self?q=db/grid/ko_center/periods >periods </a>\n";
// $output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center/ko_plans>ko_plans</a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center/ko_hw>ko_hw</a>\n";
$output .= "       ";
$output .= "<br>\n";
$output .= "<a href=$php_self?q=db/grid/ko_center/rpts >rpts</a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center/hw >hw </a>\n";
$output .= "       ";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center/defrag_plan >defrag_plan </a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center/defrag_plansum >defrag_plansum </a>\n";
$output .= "      ";
$output .= "<br>\n" ;
$output .= "<a href=$php_self?q=db/grid/ko_center/hrc_dc_unix>hrc_dc_unix</a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center/hrc_dc_win>hrc_dc_win </a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center/hrc_datacenters_equipment >hrc_datacenters_equipment </a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center/hrc_datacenters_equipment_defrag >hrc_datacenters_equipment_defrag </a>\n";
// $output .= "       ";
// $output .= "<a href=$php_self?q=db/grid/ko_center/jk >jk</a>\n";
// $output .= "       ";
// $output .= "<a href=$php_self?q=db/grid/ko_center/sm >sm</a>\n";
// $output .= "       ";
// $output .= "<a href=$php_self?q=db/grid/ko_center/bk >bk</a>\n";
// $output .= "       ";
// $output .= "<a href=$php_self?q=db/grid/ko_center/tmp >tmp</a>\n";
// $output .= "       ";
$output .= "       ";
$output .= "<hr>\n";
// $output .= leds_cons($options);
if( $options[1] == "" ) {
// $output .= "<hr>BUGS_1301 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
else {
//// if( $option1 == "new" ) {
//// $output .= ko_centeraac_kb_add_form();
//// print( "$output" );
//// return;
//// }
if( $option1 == "view" ) {
$cert_code=$option2;
$host_code=$option2;
$output .= leds_reports_view($options);
print( "$output" );
return;
}
if( $option1 == "rpt" ) {
/// $output .= leds_reports_rpt( $options );
$output .= leds_reports_rpt( $options );
print( "$output" );
return;
}
if( $option1 == "sql" ) {
$output .= leds_reports_sql( $options );
print( "$output" );
return;
}
if( $option1 == "mod" ) {
$cert_id=$option2;
$output = html_btn_squares( $options, "" );
$output .= leds_reports_view($options);
// $output .= "<hr>BUGS_1320 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
if( $option1 == "add" ) {
$output = html_btn_squares( $options, "" );
// $output .= leds_reports_view($options);
$output .= "<hr>BUGS_1330 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
if( $option1 == "search" ) {
$output = html_btn_squares( $options, "" );
$output .= leds_reports_view($options);
// $output .= "<hr>BUGS_1330 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
$output .= "<hr>BUGS_522 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( $output );
return;
}
$output .= "<hr>BUGS_1820 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( $output );
return;
}
if( $options[0] == "rptsxml" ) {
$html = html_header($options);
$html .= "<h4>rptsxml </h4>\n";
$html .= rptsxml($options);
$html .= "</body>\n";
$html .= "</html>\n";
print( $html );
return;
}
if( $options[0] == "hw" ) {
$html = html_header( $options );
$html .= html_btn_squares($options);
$html .= leds_show($options);
$html .= "<hr>\n";
if( $options[1] == "cab" ) {
$html .= "<hr><b>cabinet: $option2</b><hr>\n";
$html .= html_footer($options);
print( $html );
return;
}
if( $options[1] == "model" ) {
$html .= "<hr><b>model: $option2</b><hr>\n";
$html .= html_footer($options);
print( $html );
return;
}
if( $options[1] == "sn" ) {
$html .= "<hr><b>sn: $option2</b><hr>\n";
$html .= html_footer($options);
print( $html );
return;
}
if( $options[1] == "hrc_tag" ) {
$html .= "<hr><b>hrc_tag: $option2</b><hr>\n";
$html .= html_footer($options);
print( $html );
return;
}
if( $options[1] == "bluetag" ) {
$html .= "<hr><b>bluetag: $option2</b><hr>\n";
$html .= html_footer($options);
print( $html );
return;
}
hw($options); return;
}
if( $options[0] == "koaac_kb_new_form" ) { koaac_kb_new_form($options); return; }
if( $options[0] == "koaac_kb_add_form" ) { koaac_kb_add_form($options); return; }
if( $options[0] == "koaac_kb_mod_form" ) { koaac_kb_mod_form(); return; }
if( $options[0] == "koaac_kb_upd_form" ) { koaac_kb_upd_form(); return; }
if( $options[0] == "koaac_kb_view_form" ) { koaac_kb_view_form(); return; }
if( $options[0] == "phpinfo" ) { leds_phpinfo( $options ); return; }
if( $options[0] == "pdo_cr_dbs" ) { pdo_cr_dbs(); return; }
if( $options[0] == "pdo_cr_kb" ) { pdo_cr_kb(); return; }
if( $options[0] == "pdo_cr_flds" ) { pdo_cr_flds(); return; }
if( $options[0] == "pdo_cr_menus" ) { pdo_cr_menus(); return; }
if( $options[0] == "pdo_insert_menus" ) { pdo_insert_menus( $options ); return; }
if( $options[0] == "pdo_insert_dbs" ) { pdo_insert_dbs( $options ); return; }
// if( $options[0] == "fgmenu" ) { fgmenu_dyn( $options ); return; }
if( $options[0] == "fgmenu" ) { fgmenu_htm( $options ); return; }
if( $options[0] == "fgmenu_htm" ) { fgmenu_htm( $options ); return; }
if( $options[0] == "fgmenu_dyn" ) { fgmenu_dyn( $options ); return; }
if( $options[0] == "login" ) { leds_login_form( $options ); return; }
if( $options[0] == "login_validate" ) { leds_login_validate( $options ); return; }
if( $options[0] == "logout" ) { leds_logout( $options ); return; }
if( $options[0] == "konet" ) {
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show($options);
$html .= "<hr>\n";
$html .= "<img src=imgs/ko.png width=25 height=12><br>\n";
$html .= "joachim kassil<br>\n";
$html .= "1-502-613-0144 desk<br>\n";
$html .= "1-314-355-0144 mo<br>\n";
$html .= "1-270-998-1075 ky<br>\n";
$html .= "<a href=mailto:admin@konet.org?subject=hrc help konet>admin@konet.org</a><br>\n";
$html .= "<br>\n";
$html .= "lds 1-314-571-9505<br>\n";
$html .= "<a href=mailto:lds@focussolutions.us?subject=hrc help focussolutions hrc>lds@focussolutions.us</a><br>\n";
print( $html );
return;
}
if( $options[0] == "pdo" ) {
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show($options);
$j=1;
foreach(PDO::getAvailableDrivers() as $driver) {
$html .= "$j $driver<br>\n"; $j++;
}
print($html );
return;
}
if( $options[0] == "form_request_access" ) {
// form_login_access( $options );
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show($options);
$html .= "<h1>ko_center l1033 access request form</h1>\n";
$html .= "</body></html>\n";
return;
}
if( $options[0] == "ko_plans" ) {
$dttm=date("Ymd_His");
$html = html_header($options);
$html .= html_btn_squares( $options, "" );
$html .= leds_show( $options );
// $html .= leds_ko_center($options);
$html .= "<h3>ko_center ko_plans </h3>\n";
$html .= "<a href=$php_self?q=db/grid/ko_center/props >grid_search </a>\n";
$html .= "       ";
$html .= "<a href=$php_self?q=db/grid/ko_center/rpts >grid_rpts</a>\n";
$html .= "       ";
$html .= "<a href=$php_self?q=ko_plans/reports >reports</a>\n";
$html .= "       ";
$html .= "<a href=$php_self?q=ko_plans/view >view</a>\n";
$html .= "       ";
$html .= "<a href=$php_self?q=ko_plans/steps >step</a>\n";
$html .= "       ";
$html .= "<a href=$php_self?q=ko_plans/items >items</a>\n";
$html .= "       ";
$html .= "<hr>\n";
if( $options[1] == "" ) {
printf( $html );
return;
}
if( $options[1] == "steps" ) {
$html .= "<h1>ko_plans_steps</h1>\n";
$html .= ko_plans_steps($options);
printf( $html );
return;
}
if( $options[1] == "items" ) {
$html .= "<h1>ko_plans_items</h1>\n";
$html .= ko_plans_items($options);
printf( $html );
return;
}
// $html .= ko_plans($options);
// printf( $html );
if( $options[1] == "" ) {
// $output .= "<hr>BUGS_1301 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
$output .= ko_plans( $options );
$html .= $output;
print( "$html" );
return;
}
else {
/// if( $option1 == "new" ) {
/// $output .= ko_center_kb_add_form();
/// print( "$output" );
/// return;
/// }
if( $option1 == "view" ) {
$ko_centerd_code=$option2;
$output .= leds_ko_center($options);
print( "$output" );
return;
}
if( $option1 == "rpts" ) {
// $output .= "<h2>BUGS_1415 rpts</h2>\n";
$output .= leds_ko_center_rpts( $options );
print( "$output" );
return;
}
// if( $option1 == "mod" ) {
// $cert_id=$option2;
// $output = html_btn_squares( $options, "" );
// $output .= leds_certs($options);
// $output .= "<hr>BUGS_1320 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
// print( "$output" );
// return;
// }
// if( $option1 == "add" ) {
// $output = html_btn_squares( $options, "" );
// $output .= leds_certs($options);
// $output .= "<hr>BUGS_1330 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
// print( "$output" );
// return;
// }
// if( $option1 == "search" ) {
// $output = html_btn_squares( $options, "" );
// $output .= leds_kb($options);
// $output .= "<hr>BUGS_1330 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
// print( "$output" );
// return;
// }
$output .= "<hr>BUGS_s719 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( $output );
return;
}
$output .= "<hr>BUGS_600 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( $output );
return;
}
if( $options[0] == "ko_center1" ) {
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show( $options );
// $html .= "$progid $dttm MSG_470: ko_center $options[0] $options[1] $option2[2]<h1>ko_center engineering</h1>\n";
$html .= "<a href=?q=ko_center/about >\n";
$html .= "<img src=\"/ko_center/about/tn_ko_center_orgchart.png\" alt=\"ko_center_about\" border=0 height=\"30\" width=\"30\" /></a>\n";
if( $options[1] == "about" ) {
$html .= "<h1>Systems Management Branch</h1>\n";
$html .= "<h2>about</h2>\n";
$html .= "<hr>\n";
$html .= "<a href=/ko_center/about/ko_center_orgchart.png target=_blank><img src=/ko_center/about/tn_ko_center_orgchart.png border=0></a><br>\n";
$html .= "<hr>\n";
$html .= "<a href=/ko_center/about/ko_center_mission_9-blank.jpg target=_blank><img src=/ko_center/about/tn_ko_center_mission_9-blank.jpg border=0></a>\n";
$html .= "<br> \n";
$html .= "<a href=/ko_center/about/ko_center_mission_1-td.jpg target=_blank><img src=/ko_center/about/tn_ko_center_mission_1-td.jpg border=0></a>\n";
$html .= "       \n";
$html .= "<a href=/ko_center/about/ko_center_mission_2-mission.jpg target=_blank><img src=/ko_center/about/tn_ko_center_mission_2-mission.jpg border=0></a>\n";
$html .= "       \n";
$html .= "<a href=/ko_center/about/ko_center_mission_3-metl.jpg target=_blank><img src=/ko_center/about/tn_ko_center_mission_3-metl.jpg border=0></a>\n";
$html .= "       \n";
$html .= "<a href=/ko_center/about/ko_center_mission_4-core.jpg target=_blank><img src=/ko_center/about/tn_ko_center_mission_4-core.jpg border=0></a>\n";
$html .= "<br>\n";
$html .= "<a href=/ko_center/about/ko_center_mission_5-struct.jpg target=_blank><img src=/ko_center/about/tn_ko_center_mission_5-struct.jpg border=0></a>\n";
$html .= "       \n";
$html .= "<a href=/ko_center/about/ko_center_mission_6-org.jpg target=_blank><img src=/ko_center/about/tn_ko_center_mission_6-org.jpg border=0></a>\n";
$html .= "       \n";
$html .= "<a href=/ko_center/about/ko_center_mission_7-workforce.jpg target=_blank><img src=/ko_center/about/tn_ko_center_mission_7-workforce.jpg border=0></a>\n";
$html .= "       \n";
$html .= "<a href=/ko_center/about/ko_center_mission_8-plan.jpg target=_blank><img src=/ko_center/about/tn_ko_center_mission_8-plan.jpg border=0></a>\n";
print( "$html" );
return;
}
print( $html );
return;
}
if( $options[0] == "pchart" ) {
if( $options[1] == "main" ) {
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show( $options );
$html .= "<h1>Systems Management Branch</h1><h2>pchart main demo</h2>\n";
$html .= "<hr>\n";
// $html .= "<a href=https://147.238.94.126/ko_center/ko_pchart_examples.php target=_blank>ko_Pchart_examples</a><br>\n";
$html .= "<a href=/ko_center/ko_pchart_examples.php target=_blank>ko_Pchart_examples</a><br>\n";
/// $html .= "<br>\n";
/// $html .= "<a href=https://147.238.94.126/pChart/pchart213.pdf target=_blank>pchart213.pdf</a><br>\n";
/// $html .= "<br>\n";
/// $html .= "<a href=https://147.238.94.126/pChart target=_blank>pChart_examples</a><br>\n";
print( $html );
return;
}
if( $options[1] == "demo" ) {
// if( file_exists( "$document_root/pChart/" )) {
if( is_dir( "$document_root/pChart" )) {
// header( 'Location: https://147.238.94.126/pChart/' );
header( 'Location: /pChart/' );
return;
}
else {
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show( $options );
$html .= "<h1>Systems Management Branch</h1><h2>pchart demo unavailable</h2>\n";
$html .= "<hr>\n";
print( $html );
return;
}
}
if( $options[1] == "pie" ) {
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show( $options );
$html .= "<h1>pchar pie</h1><h2>fld=$fld val=[$val]</h2>\n";
$html .= pchart_pie($options);
$html .= "<hr>\n";
print( $html );
return;
}
if( $options[1] == "pdf" ) {
// if( file_exists( "$document_root/pChart/" )) {
if( file_exists( "$document_root/pChart/pchart231.pdf" )) {
// header( 'Location: https://147.238.94.126/pChart/pchart231.pdf' );
header( 'Location: /pChart/pchart231.pdf' );
return;
}
else {
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show( $options );
$html .= "<h1>Systems Management Branch</h1><h2>pchart231.pdf unavailable</h2>\n";
$html .= "<hr>\n";
print( $html );
return;
}
}
return;
}
if( $options[0] == "detail" ) {
// printf( "$progid $dttm MSG_440: $options[0] $options[1] $option2[2]<hr>xxxxxxxxxxxx<hr>\n" );
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show($options);
$html .= "<hr>\n";
$html .= "<table><tr><td>\n";
$html .= "<a href=$php_self?q=leds_update_form>update $option1</a>";
$html .= "     ";
// $html .= "<a href=$php_self?q=leds_rpts_form>rpts $option1</a>";
// $html .= "<a href=$php_self?q=leds_rpts_form>rpts $option1</a>";
// $html .= "     ";
$html .= "<a href=$php_self?q=nodes/rpts>rpts $option1</a>";
// $html .= leds_update_form( $options );
$html .= "</td></tr></table>\n";
$html .= "<hr>\n";
if( $options[1] == "ko_center" ) {
$html_ko_center = "";
// $html_ko_center .= "$progid $dttm MSG_460: ko_center $options[0] $options[1] $option2[2]<h1>system management branch</h1>\n";
$html .= "<a href=?q=ko_center >\n";
$html .= "<img src=\"/ko_center/imgs/btn/ko_center.png\" alt=\"ko_center\" border=0 height=\"35\" width=\"35\" /></a>\n";
$html .= "       \n" ;
$html .= "<a href=/itil/index.html >\n";
$html .= "<img src=\"$path_btn/itil.png\" alt=\"itil\" border=0 height=\"30\" width=\"30\" />";
$html .= "</a>\n";
$html .= "       \n" ;
$html .= "<a href=?q=kb >\n";
$html .= "<img src=\"/ko_center/imgs/btn/kbbooks.png\" alt=\"kb\" border=0 height=\"30\" width=\"30\" /></a>\n";
print( $html );
return;
}
if( $options[1] == "ko_centere" ) {
$html = "";
$html .= "$progid $dttm MSG_470: ko_center $options[0] $options[1] $option2[2]<h1>ko_center engineering</h1>\n";
$html .= "<a href=?q=certs >\n";
$html .= "<img src=\"/ko_center/imgs/btn/cert.png\" alt=\"kb\" border=0 height=\"30\" width=\"30\" /></a>\n";
$html .= "<a href=?q=db/grid/ko_center_certs >\n";
$html .= "<img src=\"/ko_center/imgs/btn/cert.png\" alt=\"kbko_center_certs\" border=0 height=\"30\" width=\"30\" /></a>\n";
$html .= "<a href=?q=db/grid/ko_center_certs/certs >\n";
$html .= "<img src=\"/ko_center/imgs/btn/cert.png\" alt=\"kbko_center_certs_certs\" border=0 height=\"30\" width=\"30\" /></a>\n";
print( $html );
return;
}
if( $options[1] == "ko_centerd" ) {
$dttm=date("Ymd_His");
// $html = "";
// $html .= html_btn_squares( $options, "" );
// $html .= leds_show( $options );
$html .= "<h3>ko_centerd deployment detail </h3>\n";
$html .= "<a href=?q=db/grid/ko_centerd>\n";
$html .= "<img src=\"/ko_center/imgs/btn/moving.png\" alt=\"ko_centerd\" border=0 height=\"40\" width=\"40\" /></a>\n";
$html .= "<a href=$php_self?q=db/grid/ko_centerd/moves >grid_search </a>\n";
$html .= "       ";
$html .= "<a href=$php_self?q=db/grid/ko_centerd/rpts >grid_rpts</a>\n";
$html .= "       ";
$html .= "<a href=$php_self?q=ko_centerd/rpts >rpts</a>\n";
$html .= "       ";
/// $html .= "<a href=$php_self?q=ko_centerd/view >view</a>\n";
$html .= "       ";
$html .= "<hr>\n";
// $html .= leds_certs($options);
if( $options[2] == "" ) {
// $html .= "<hr>BUGS_1301 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$html" );
return;
}
// if( $option2 == "new" ) {
// $html .= koaac_kb_add_form();
// print( "$html" );
// return;
// }
if( $option2 == "view" ) {
$ko_centerd_code=$option2;
$html .= leds_ko_centerd($options);
print( "$html" );
return;
}
if( $option2 == "rpts" ) {
// $html .= "<h2>BUGS_620 rpts</h2>\n";
$html .= leds_ko_centerd_rpts( $options );
print( "$html" );
return;
}
// if( $option2 == "mod" ) {
// $cert_id=$option2;
// $html .= leds_certs($options);
// $html .= "<hr>BUGS_1320 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
// print( "$html" );
// return;
// }
//
// if( $option2 == "add" ) {
// $html .= leds_certs($options);
// $html .= "<hr>BUGS_1330 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
// print( "$html" );
// return;
// }
if( $option2 == "search" ) {
$html .= leds_ko_centerd($options);
// $html .= "<hr>BUGS_1330 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$html" );
return;
}
print( $html );
return;
}
if( $options[1] == "ko_centert" ) {
$html_ko_center = "";
$html_ko_center .= "$progid $dttm MSG_480: ko_center $options[0] $options[1] $option2[2]<h1>ko_center training</h1>\n";
$html .= $html_ko_center;
print( $html );
return;
}
if( $options[1] == "hpx" ) {
if( $options[2] == "_us" ) {
if( file_exists( "$document_root/ko_center/us/kohpx_us.php" )) {
header( 'Location: https://147.238.94.126/ko_center/us/kohpx_us.php' );
return;
}
}
if( $options[2] == "_vg" ) {
if( file_exists( "$document_root/ko_center/vg/kohpx_vg.php" )) {
header( 'Location: https://147.238.94.126/ko_center/vg/kohpx_vg.php' );
return;
}
}
if( $options[2] == "_sw" ) {
if( file_exists( "$document_root/ko_center/sw/kohpx_sw.php" )) {
header( 'Location: https://147.238.94.126/ko_center/sw/kohpx_sw.php' );
return;
}
}
if( $options[2] == "_hs" ) {
if( file_exists( "$document_root/ko_center/hs/kohpx_hs.php" )) {
header( 'Location: https://147.238.94.126/ko_center/hs/kohpx_hs.php' );
return;
}
}
if( $options[2] == "_kb" ) {
if( file_exists( "$document_root/ko_center/kb/kohpx_kb.php" )) {
header( 'Location: https://147.238.94.126/ko_center/kb/kohpx_kb.php' );
return;
}
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show( $options );
$html .= "<h1>kohpx_kb</h1>\n";
$html .= "<h2>knowledgebase</h2>\n";
$html .= "<a href=$php_self/ko_center/hpx target=_blank>kohpx_rpts</a><br>\n";
$html .= "<hr>\n";
$html .= ko_ls( $options, "/home/ko/hpx" );
print( $html );
return;
}
if( $options[2] == "_bp" ) {
if( file_exists( "$document_root/ko_center/bp/kohpx_bp.php" )) {
header( 'Location: https://147.238.94.126/ko_center/bp/kohpx_bp.php' );
return;
}
}
}
if( $options[1] == "aix" ) {
if( $options[2] == "_us" ) {
if( file_exists( "$document_root/ko_center/us/koaix_us.php" )) {
// header( 'Location: https://147.238.94.126/ko_center/us/koaix_us.php' );
header( 'Location: /ko_center/us/koaix_us.php' );
return;
}
}
if( $options[2] == "_vg" ) {
if( file_exists( "$document_root/ko_center/vg/koaix_vg.php" )) {
header( 'Location: https://147.238.94.126/ko_center/vg/koaix_vg.php' );
return;
}
}
if( $options[2] == "_sw" ) {
if( file_exists( "$document_root/ko_center/sw/koaix_sw.php" )) {
// header( 'Location: https://147.238.94.126/ko_center/sw/koaix_sw.php' );
header( 'Location: /ko_center/sw/koaix_sw.php' );
return;
}
}
if( $options[2] == "_hs" ) {
if( file_exists( "$document_root/ko_center/hs/koaix_hs.php" )) {
header( 'Location: https://147.238.94.126/ko_center/hs/koaix_hs.php' );
return;
}
}
if( $options[2] == "_kb" ) {
if( file_exists( "$document_root/ko_center/kb/koaix_kb.php" )) {
// header( 'Location: https://147.238.94.126/ko_center/kb/koaix_kb.php' );
header( 'Location: /ko_center/kb/koaix_kb.php' );
return;
}
}
if( $options[2] == "_bp" ) {
if( file_exists( "$document_root/ko_center/bp/koaix_bp.php" )) {
header( 'Location: https://147.238.94.126/ko_center/bp/koaix_bp.php' );
return;
}
}
}
if( $options[1] == "rhe" ) {
if( $options[2] == "_us" ) {
if( file_exists( "$document_root/ko_center/us/korhe_us.php" )) {
header( 'Location: https://147.238.94.126/ko_center/us/korhe_us.php' );
return;
}
}
if( $options[2] == "_vg" ) {
if( file_exists( "$document_root/ko_center/vg/korhe_vg.php" )) {
header( 'Location: https://147.238.94.126/ko_center/vg/korhe_vg.php' );
return;
}
}
if( $options[2] == "_sw" ) {
if( file_exists( "$document_root/ko_center/sw/korhe_sw.php" )) {
header( 'Location: https://147.238.94.126/ko_center/sw/korhe_sw.php' );
return;
}
}
if( $options[2] == "_hs" ) {
if( file_exists( "$document_root/ko_center/hs/korhe_hs.php" )) {
header( 'Location: https://147.238.94.126/ko_center/hs/korhe_hs.php' );
return;
}
}
if( $options[2] == "_kb" ) {
if( file_exists( "$document_root/ko_center/kb/korhe_kb.php" )) {
header( 'Location: https://147.238.94.126/ko_center/kb/korhe_kb.php' );
return;
}
}
if( $options[2] == "_bp" ) {
if( file_exists( "$document_root/ko_center/bp/korhe_bp.php" )) {
header( 'Location: https://147.238.94.126/ko_center/bp/korhe_bp.php' );
return;
}
}
}
if( $options[1] == "win" ) {
if( $options[2] == "_us" ) {
if( file_exists( "$document_root/ko_center/us/kowin_us.php" )) {
header( 'Location: https://147.238.94.126/ko_center/us/kowin_us.php' );
return;
}
}
if( $options[2] == "_vg" ) {
if( file_exists( "$document_root/ko_center/vg/kowin_vg.php" )) {
header( 'Location: https://147.238.94.126/ko_center/vg/kowin_vg.php' );
return;
}
}
if( $options[2] == "_sw" ) {
if( file_exists( "$document_root/ko_center/sw/kowin_sw.php" )) {
header( 'Location: https://147.238.94.126/ko_center/sw/kowin_sw.php' );
return;
}
}
if( $options[2] == "_hs" ) {
if( file_exists( "$document_root/ko_center/hs/kowin_hs.php" )) {
header( 'Location: https://147.238.94.126/ko_center/hs/kowin_hs.php' );
return;
}
}
if( $options[2] == "_kb" ) {
if( file_exists( "$document_root/ko_center/kb/kowin_kb.php" )) {
header( 'Location: https://147.238.94.126/ko_center/kb/kowin_kb.php' );
return;
}
}
if( $options[2] == "_bp" ) {
if( file_exists( "$document_root/ko_center/bp/kowin_bp.php" )) {
header( 'Location: https://147.238.94.126/ko_center/bp/kowin_bp.php' );
return;
}
}
}
if( $options[1] == "uss" ) {
if( $options[2] == "_us" ) {
if( file_exists( "$document_root/ko_center/us/kouss_us.php" )) {
header( 'Location: https://147.238.94.126/ko_center/us/kouss_us.php' );
return;
}
}
if( $options[2] == "_vg" ) {
if( file_exists( "$document_root/ko_center/vg/kouss_vg.php" )) {
header( 'Location: https://147.238.94.126/ko_center/vg/kouss_vg.php' );
return;
}
}
if( $options[2] == "_sw" ) {
if( file_exists( "$document_root/ko_center/sw/kouss_sw.php" )) {
header( 'Location: https://147.238.94.126/ko_center/sw/kouss_sw.php' );
return;
}
}
if( $options[2] == "_hs" ) {
if( file_exists( "$document_root/ko_center/hs/kouss_hs.php" )) {
header( 'Location: https://147.238.94.126/ko_center/hs/kouss_hs.php' );
return;
}
}
if( $options[2] == "_kb" ) {
/// if( file_exists( "$document_root/ko_center/kb/kouss_kb.php" )) {
/// header( 'Location: https://147.238.94.126/ko_center/kb/kouss_kb.php' );
/// return;
/// }
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show( $options );
$html .= "<h1>kouss_kb</h1>\n";
$html .= "<h2>knowledgebase</h2>\n";
$html .= "<a href=$php_self/ko_center/uss target=_blank>kouss_rpts</a><br>\n";
$html .= "<hr>\n";
$html .= ko_ls( $options, "./uss" );
print( $html );
return;
}
if( $options[2] == "_bp" ) {
if( file_exists( "$document_root/ko_center/bp/kouss_bp.php" )) {
header( 'Location: https://147.238.94.126/ko_center/bp/kouss_bp.php' );
return;
}
}
}
if( $options[1] == "aac" ) {
if( $options[2] == "_us" ) {
if( file_exists( "$document_root/ko_center/us/koaac_us.php" )) {
header( 'Location: https://147.238.94.126/ko_center/us/koaac_us.php' );
return;
}
}
if( $options[2] == "_vg" ) {
if( file_exists( "$document_root/ko_center/vg/koaac_vg.php" )) {
header( 'Location: https://147.238.94.126/ko_center/vg/koaac_vg.php' );
return;
}
}
if( $options[2] == "_sw" ) {
if( file_exists( "$document_root/ko_center/sw/koaac_sw.php" )) {
header( 'Location: https://147.238.94.126/ko_center/sw/koaac_sw.php' );
return;
}
}
if( $options[2] == "_hs" ) {
if( file_exists( "$document_root/ko_center/hs/koaac_hs.php" )) {
header( 'Location: https://147.238.94.126/ko_center/hs/koaac_hs.php' );
return;
}
}
if( $options[2] == "_kb" ) {
/// if( file_exists( "$document_root/ko_center/kb/koaac_kb.php" )) {
/// header( 'Location: https://147.238.94.126/ko_center/kb/koaac_kb.php' );
/// return;
/// }
if( $options[3] == "search" ) {
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show( $options );
print( "$html" );
koaac_kb_update_form();
return;
}
if( $options[3] == "new" ) {
// $html = "";
// $html .= html_header($options);
// $html .= html_btn_squares($options);
// $html .= leds_show( $options );
// $html .= html_kb_Links($options);
$html .= koaac_kb_new_form($options);
print( $html );
return;
}
if( $options[3] == "add" ) {
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show( $options );
print( "$html" );
koaac_kb_add_form();
return;
}
if( $options[3] == "mod" ) {
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show( $options );
print( "$html" );
koaac_kb_mod_form( $kbid );
return;
}
if( $options[3] == "upd" ) {
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show( $options );
print( "$html" );
koaac_kb_upd_form( $kbid );
return;
}
if( $options[3] == "view" ) {
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show( $options );
print( "$html" );
koaac_kb_view_form( $kbid );
return;
}
$kbfile = $GLOBALS['kbfile'];
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show( $options );
$html .= "<h1>koaac_kb</h1>\n";
$html .= "<h2>knowledgebase</h2>\n";
$html .= "<a href=$php_self?q=detail/aac/_kb/new>search</a><br>\n";
$html .= "<a href=$php_self?q=detail/aac/_kb/new>new</a><br>\n";
$html .= "<a href=$php_self?q=detail/aac/_kb/update>update</a><br>\n";
$html .= "<a href=$php_self?q=detail/aac/_kb/new>mod</a><br>\n";
$html .= "<hr>\n";
$html .= "<a href=$php_self?q=db/grid/koaac_kb/kb target=_blank>grid</a><br>\n";
$html .= "<hr>\n";
$html .= "<a href=$php_self?q=pdo_cr_kb>pdo_cr_kb</a><br>\n";
$html .= "<a href=$php_self?q=pdo_cr_flds>pdo_cr_flds</a><br>\n";
$html .= "<hr>\n";
$html .= "kbfile=[$kbfile]<br>\n";
print( $html );
return;
}
if( $options[2] == "_bp" ) {
if( file_exists( "$document_root/ko_center/bp/koaac_bp.php" )) {
header( 'Location: https://147.238.94.126/ko_center/bp/koaac_bp.php' );
return;
}
}
if( $options[2] == "ko_center" ) {
$html .= "<hr>ko_center_822<hr>\n";
}
if( $options[2] == "ko_centere" ) {
$html .= "<hr>ko_centere_822<hr>\n";
}
if( $options[2] == "ko_centerd" ) {
$html .= "<hr>ko_centerd_822<hr>\n";
}
if( $options[2] == "ko_centert" ) {
$html .= "<hr>ko_centert_822<hr>\n";
}
}
// printf( "$progid $dttm MSG_1360: $options[0] $options[1] $option2[2]<hr>xxxxxxxxxxxx<hr>\n" );
$output = leds_detail( $options );
printf( $output );
return;
}
if( $options[0] == "view" ) { leds_view( $options ); return; }
if( $options[0] == "menu" ) { leds_menu( $options ); return; }
if( $options[0] == "tools" ) {
$html = "";
// printf( "<html><title>ko_center.php tools</title><body bgcolor=lightblue><hr>tools<hr></body></html>\n" );
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= html_btn_footer($options,"");
$html .= html_footer($options,"");
print( $html );
return;
}
if( $options[0] == "scrub" ) {
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show( $options );
// $html = scrub_show( $options );
// $output .= "<hr><a href=/ko_center/scrub.php target=_blank><img src=./imgs/scrubbrush01.jpg width=100 height=100 border=0></a><hr>\n";
// $output .= "<hr><a href=/ko_center/scrub.php target=_blank><img src=./imgs/scrubbrush02.jpg width=100 height=100 border=0></a><hr>\n";
// $output .= "<a href=$php_self?q=scrub_upload_form/$led_name>scrub_upload_form $led_name</a><br/>\n";
$html .= "ko_scrub will parse a file for ip, mac, hostname, ssn and replace with labels<br>\n";
$html .= "<hr>\n";
$html .= "<a href=/ko_center/ko_scrub_test.log target=_blank>ko_scrub_test.log</a><br>\n";
$html .= "<hr>\n";
$html .= "<a href=https://147.238.94.126/ko_center/ko_center.php?q=scrub_upload_form target=_blank>\n";
$html .= "<img src=\"/ko_center/imgs/scrubbrush.png\" alt=\"btn_black_scrub scrub_upload_form\" border=0 height=\"40\" width=\"40\" />";
$html .= "</a><hr>\n";
$html .= "<br>ko_scrub 0.2 multiple file download tests<br>\n";
$html .= "<a href=/biupload/index.html target=_blank><img src=/ko_center/imgs/scrubbrush01.png width=30 height=30 border=0> biupload </a>\n";
$html .= "       ";
$html .= "<a href=/h5upload/index.html target=_blank><img src=/ko_center/imgs/scrubbrush01.png width=30 height=30 border=0> h5upload</a>\n";
$html .= "       ";
$html .= "<a href=/plupload/examples/scrub.html target=_blank><img src=/ko_center/imgs/scrubbrush01.png width=30 height=30 border=0> plupload</a>\n";
$html .= html_footer($options,"");
print( $html );
return;
}
if( $options[0] == "scrub_upload_form" ) {
scrub_upload_form( $options );
return;
}
if( $options[0] == "scrub_upload" ) {
$html=scrub_upload( $options );
echo $html;
return;
}
if( $options[0] == "csv2db3" ) {
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show( $options );
$html .= "ko_csv2db3 will parse a file csv file and create db3 file<br>\n";
$html .= "<hr>\n";
$html .= "<a href=/ko_center/ko_csv2db3.csv target=_blank>ko_csv2db3.csv</a><br>\n";
$html .= "<a href=/ko_center/ko_csv2db3.psv target=_blank>ko_csv2db3.psv</a><br>\n";
$html .= "<hr>\n";
$html .= "<a href=https://147.238.94.126/ko_center/ko_center.php?q=csv2db3_upload_form target=_blank>\n";
$html .= "<img src=\"/ko_center/imgs/scrubbrush.png\" alt=\"btn_black_scrub csv2db3_upload_form\" border=0 height=\"40\" width=\"40\" />";
$html .= "</a><hr>\n";
$html .= "<br>ko_csv2db3 0.1 multiple file download tests<br>\n";
if( $options[1] != "" ) {
$csvfil=$options[1];
$delimiter="|";
if( preg_match( "/csv$/i", $csvfil )) { $delimiter = ","; }
$html_csv2db3=csv2db3($csvfil, $delimiter);
$html .= $html_csv2db3;
}
$html .= html_footer($options,"");
print( $html );
return;
}
if( $options[0] == "csvdb3_upload_form" ) {
csv2db3_upload_form( $options );
return;
}
if( $options[0] == "csv2db3_upload" ) {
/// printf( "BUGS_SCRUB_UPLOAD_238: output=[$output]\n" );
$html=csv2db3_upload( $options );
echo $html;
return;
}
if( $options[0] == "leds_update_form" ) { leds_update_form( $options ); return; }
if( $options[0] == "leds_update" ) {
/// printf( "BUGS_LEDS_UPDATE_235: option=[$options[0]]<br>\n" );
/// printf( "BUGS_LEDS_UPDATE_236: option1=[$options[1]]<br>\n" );
/// printf( "BUGS_LEDS_UPDATE_237: option2=[$options[2]]<br>\n" );
/// $output=ko_upload( $options );
/// printf( "BUGS_LEDS_UPDATE_238: output=[$output]\n" );
leds_update( $options );
return;
}
if( $options[0] == "mail" ) { ko_imap( $options ); return; }
if( $options[0] == "list" ) { leds_list( $options ); return; }
if( $options[0] == "install" ) { leds_install("new"); return; }
if( $options[0] == "reinstall" ) { leds_install("old"); return; }
if( $options[0] == "test" ) { leds_test( $options ); return; }
if( $options[0] == "local" ) { localcmds( $options ); return; }
if( $options[0] == "docview" ) {
$dbcode=$options[1];
$dbtable=$options[2];
$dbrowid=$options[3];
$page=$options[4];
docview( $dbcode, $dbtable, $dbrowid,$page );
return;
}
if( $options[0] == "set" ) {
// print( "<hr><a href=http://$http_host$php_self?q=set>set</a><hr>\n" );
$url_setvar=$options[1];
$url_setval=$options[2];
switch( true ) {
case ($url_setvar == "theme" ):
$setvals = explode( " ", "swanky redmond humanity frog darkness lightness" );
foreach( $setvals as $setval ) {
if( $setval == $url_setval ) {
$_SESSION['theme'] = $url_setval;
// print( "$url_setvar $url_setval _SESSION['theme']=".$_SESSION['theme']."<br>\n" );
}
}
break;
case ($url_setvar == "role" ):
$setvals = explode( " ", "admin local mgr op user anon" );
foreach( $setvals as $setval ) {
// print( "BUGS_254 setval=$setval url_setval=$url_setval<br>\n" );
if( $setval == $url_setval ) {
$_SESSION['role'] = $url_setval;
// print( "$url_setvar $url_setval _SESSION['role']=".$_SESSION['role']."<br>\n" );
// print( "BUGS_255_match setval=$setval url_setval=$url_setval<br>\n" );
}
}
break;
case ($url_setvar == "hs" ):
// $setvals = explode( " ", "none all grid us hw n11" );
$setvals = explode( " ", "all grid us hw n11" );
foreach( $setvals as $setval ) {
if( $setval == $url_setval ) {
$_SESSION['hs_type'] = $url_setval;
// print( "$url_setvar $url_setval _SESSION['hs_type']=".$_SESSION['hs_type']."<br>\n" );
}
}
break;
case ($url_setvar == "org" ):
$setvals = explode( " ", "a e h o p t" );
foreach( $setvals as $setval ) {
if( $setval == $url_setval ) {
$_SESSION['org_type'] = $url_setval;
// print( "$url_setvar $url_setval _SESSION['org_type']=".$_SESSION['org_type']."<br>\n" );
}
}
case ($url_setvar == "preview" ):
$setvals = explode( " ", "on off" );
foreach( $setvals as $setval ) {
if( $setval == $url_setval ) {
$_SESSION['preview'] = $url_setval;
// print( "$url_setvar $url_setval _SESSION['preview']=".$_SESSION['preview']."<br>\n" );
}
}
case ( $url_setvar == "grid_zoom" ):
if( $_SESSION['grid_zoom'] ) { unset( $_SESSION['grid_zoom'] ); }
else { $_SESSION['grid_zoom'] = true; }
break;
}
$location_url="$php_self?q=config";
if( $_REQUEST['callback'] != "" ) { $location_url=$_REQUEST['callback']; }
// print( "<a href=$location_url>$location_url</a><br>\n" );
header( 'Location:'.$location_url );
// html_page($options);
return;
}
if( $options[0] == "leds" ) {
if( $options[1] == "fp" ) {
printf( "\n<hr>fp<hr>\n" );
return;
}
if( $options[1] == "us" ) { /* users */
printf( "\n<hr>us<hr>\n" );
return;
}
if( $options[1] == "hs" ) { /* hosts */
printf( "\n<hr>hs<hr>\n" );
return;
}
if( $options[1] == "os" ) { /* os teams */
printf( "\n<hr>hs<hr>\n" );
return;
}
if( $options[1] == "sw" ) { /* swlist */
printf( "\n<hr>sw<hr>\n" );
return;
}
html_page($options);
return;
}
if( $options[0] == "db" ) {
$html_btn_squares = html_btn_squares($options);
if( $options[1] == "grid" ) {
$html_body .=pdo_grid($options );
$html_head .= html_header($options);
$html = $html_head . $html_btn_squares . $html_body . $html_foot;
print( $html );
return;
}
if( $options[1] == "load" ) { pdo_load($options ); return; }
if( $options[1] == "unload" ) { pdo_unload($options ); return; }
if( $options[1] == "gridxml" ) { pdo_gridxml($options ); return; }
if( $options[1] == "list" ) { pdo_list($options ); return; }
if( $options[1] == "update" ) { pdo_update($options ); return; }
// $callback="$php_self?q=zoom/$url_zmcode/$url_zmtype/$url_zmrowid";
$html_body = "<hr>\n";
$html_body .= "<a href=$php_self?q=db/grid>db grid</a><br>\n";
// $html_body .= "<a href=$php_self?q=db/unload>db unload</a><br>\n";
// $html_body .= "<a href=$php_self?q=db/load>db load</a><br>\n";
// $html_body .= "<a href=$php_self?q=db/list><i>db list</i></a><br>\n";
// $html_body .= "<a href=$php_self?q=db/update><i>db update</i></a><br>\n";
$html_body .= "<hr>\n";
$html_head = html_header($options);
$html = $html_head . $html_btn_squares . $html_body . $html_foot;
print( $html );
return;
}
if( $options[0] == "telnet" ) { telnet($options); return; }
if( $options[0] == "pdo_insert_pano" ) { pdo_insert_pano($options ); return; }
if( $options[0] == "pdo_insert_obj" ) { pdo_insert_obj($options ); return; }
if( $options[0] == "config" ) {
leds_config($options);
return;
}
if( $options[0] == "zoom" ) {
leds_zoom($options);
return;
}
if( $options[0] == "zoomxml" ) {
if( $_SESSION['zoomxml'] ) {
$zoomxml=$_SESSION['zoomxml']; print( $zoomxml ); }
// else {
// leds_zoomxml($options);
// }
return;
}
if( $options[0] == "zview" ) {
$output = leds_zview($options );
print( "$output" );
return;
}
if( $options[0] == "zviewxml" ) {
$zmcode=$options[1];
$zmtype=$options[2];
$zmrowid=$options[3];
leds_zview_xml($options);
// print( "BUGS_368 zviewxml: zmcode=[$zmcode] zmtype=[$zmtype] zmrowid=[$zmrowid]<br>\n" );
return;
if( $zmrowid != "" ) {
leds_zview_xml($options );
return;
}
if( $_SESSION['zoomxml'] ) {
$zoomxml = $_SESSION['zoomxml'];
print( $zoomxml );
return;
}
return;
}
if( $options[0] == "zview" ) { leds_zview($options ); return; }
// if( $options[0] == "zoom" ) { leds_zviewxml($options); return; }
if( $options[0] == "zview_xml" ) { leds_zview_xml($options); return; }
if( $options[0] == "zview_details" ) {
leds_zview_details($options); return;
}
if( $options[0] == "zoom" ) {
$output = leds_zoom($options);
print( "$output" );
return;
}
if( $options[0] == "ptobject" ) {
$output = html_btn_squares( $options, "" );
$output .= leds_ptobject($options);
print( "$output" );
return;
}
if( $options[0] == "ptviewer" ) {
$output = html_btn_squares( $options, "" );
$output .= leds_ptviewer($options);
print( "$output" );
return;
}
if( $options[0] == "dc" ) {
$dttm=date("Ymd_His");
// printf( "<hr>BUGS_1430 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n" );
$html = html_btn_squares( $options, "" );
$html .= leds_show( $options );
// $html .= html_dc_links( $options );
if( $options[1] == "" ) {
$html .= "<hr>BUGS_1201 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$html" );
return;
}
else {
/// if( $option1 == "new" ) {
/// $html .= "<hr>BUGS_1333 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
/// $html .= html_dc_links($options);
/// print( $html );
// $html = dc_new_form( $options );
// print( $html );
// return;
// }
// if( $option1 == "mod" ) {
// printf( "<h3>BUGS_1340_MOD</h3>\n" );
// $kbid=$option2;
//// $html .= "<hr>BUGS_1220 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
// $html .= koaac_kb_mod_form( $kbid );
// $html .= koaac_kb_new_form( $kbid );
// print( "$html" );
// return;
// }
if( $option1 == "rpts" ) {
printf( "BUGS_1460 RPTS<hr>\n" );
$html .= rpts( $options );
$html .= leds_dc_rpts( $options );
print( "$html" );
return;
}
if( $option1 == "rptsxml" ) {
$html .= rptsxml( $options );
print( "$html" );
return;
}
// if( $option1 == "view" ) {
// $html = html_header($options);
// $html .= "";
// $html .= html_btn_squares( $options, "" );
// $html .= "<h3>ko_center_reports</h3>\n";
// $html .= leds_dc($options);
// $html .= html_dc_links($options);
// $html .= "<hr>BUGS_1240 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
// print( "$html" );
// return;
// }
if( $option1 == "search" ) {
$output = html_btn_squares( $options, "" );
// $output .= leds_kb($options);
$output .= "<hr>BUGS_1250 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
$output .= "<hr>BUGS_1231 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( $output );
}
$output .= "<hr>BUGS_1235 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( $output );
}
// knowledgebase
if( $options[0] == "kb" ) {
$dttm=date("Ymd_His");
// printf( "<hr>BUGS_1200 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n" );
$html = html_btn_squares( $options, "" );
$html .= leds_show( $options );
$html .= html_kb_links( $options );
if( $options[1] == "" ) {
// $html .= "<hr>BUGS_1201 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$html" );
return;
}
else {
if( $option1 == "new" ) {
$html .= "<hr>BUGS_1333 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
// $html .= html_kb_links($options);
// print( $html );
$html = koaac_kb_new_form( $options );
print( $html );
return;
}
if( $option1 == "mod" ) {
printf( "<h3>BUGS_1340_MOD</h3>\n" );
$kbid=$option2;
// $html .= "<hr>BUGS_1220 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
// $html .= koaac_kb_mod_form( $kbid );
$html .= koaac_kb_new_form( $kbid );
print( "$html" );
return;
}
if( $option1 == "rpts" ) {
$html .= rpts( $options );
$html .= leds_kb_rpts( $options );
print( "$html" );
return;
}
if( $option1 == "rptsxml" ) {
$html .= rptsxml( $options );
print( "$html" );
return;
}
if( $option1 == "view" ) {
// $html = html_header($options);
// $html .= "";
// $html .= html_btn_squares( $options, "" );
$html .= "<h3>ko_center_knowledgebase_view</h3>\n";
$html .= leds_kb($options);
// $html .= html_kb_links($options);
// $html .= "<hr>BUGS_1240 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$html" );
return;
}
if( $option1 == "search" ) {
$output = html_btn_squares( $options, "" );
// $output .= leds_kb($options);
$output .= "<hr>BUGS_1250 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
$output .= "<hr>BUGS_1231 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( $output );
}
$output .= "<hr>BUGS_1565 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( $output );
}
if( $options[0] == "nodes" ) {
$dttm=date("Ymd_His");
// printf( "<hr>BUGS_1390 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n" );
// return;
$html = html_btn_squares( $options, "" );
$html .= leds_show( $options );
$html .= html_nodes_links( $options );
if( $options[1] == "" ) {
$html .= "<hr>BUGS_1201 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$html" );
return;
}
else {
if( $option1 == "new" ) {
$html .= "<hr>BUGS_1333 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
// $html .= html_nodes_links($options);
// print( $html );
// $html = koaac_kb_new_form( $options );
print( $html );
return;
}
if( $option1 == "mod" ) {
printf( "<h3>BUGS_1340_MOD</h3>\n" );
$kbid=$option2;
// $html .= "<hr>BUGS_1220 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
// $html .= koaac_kb_mod_form( $kbid );
$html .= koaac_kb_new_form( $kbid );
print( "$html" );
return;
}
if( $option1 == "rpts" ) {
$html .= leds_nodes_rpts( $options );
print( "$html" );
return;
}
if( $option1 == "view" ) {
// $html = html_header($options);
// $html .= "";
// $html .= html_btn_squares( $options, "" );
$html .= "<h3>ko_center_nodes_view</h3>\n";
// $html .= leds_nodes($options);
$html .= html_nodes_links($options);
$html .= "<hr>BUGS_1433 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$html" );
return;
}
}
if( $option1 == "search" ) {
$output = html_btn_squares( $options, "" );
// $output .= leds_kb($options);
$output .= "<hr>BUGS_1250 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
$output .= "<hr>BUGS_1231 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( $output );
}
if( $options[0] == "ko_center" ) {
$dttm=date("Ymd_His");
// printf( "<hr>BUGS_1400 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n" );
$html = html_btn_squares( $options, "" );
$html .= leds_show( $options );
// $html .= leds_smdb($options);
$html .= "<h3>ko_center ko_centerd detail </h3>\n";
$html .= "<a href=$php_self?q=db/grid/ko_centerd/certs >grid_search </a>\n";
$html .= "       ";
$html .= "<a href=$php_self?q=db/grid/ko_centerd/rpts >grid_rpts</a>\n";
$html .= "       ";
$html .= "<a href=$php_self?q=ko_centerd/rpts >rpts</a>\n";
$html .= "       ";
$html .= "<a href=$php_self?q=ko_centerd/view >view</a>\n";
$html .= "       ";
$html .= "<hr>\n";
// $html .= leds_ko_centerd($options);
if( $options[1] == "" ) {
// $output .= "<hr>BUGS_1301 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$html" );
return;
}
else {
/// if( $option1 == "new" ) {
/// $output .= koaac_kb_add_form();
/// print( "$output" );
/// return;
/// }
if( $option1 == "view" ) {
$ko_centerd_code=$option2;
$output .= leds_ko_centerd($options);
print( "$output" );
return;
}
if( $option1 == "rpts" ) {
// $output .= "<h2>BUGS_1415 rpts</h2>\n";
$output .= leds_ko_centerd_rpts( $options );
print( "$output" );
return;
}
// if( $option1 == "mod" ) {
// $cert_id=$option2;
// $output = html_btn_squares( $options, "" );
// $output .= leds_certs($options);
// $output .= "<hr>BUGS_1320 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
// print( "$output" );
// return;
// }
// if( $option1 == "add" ) {
// $output = html_btn_squares( $options, "" );
// $output .= leds_certs($options);
// $output .= "<hr>BUGS_1330 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
// print( "$output" );
// return;
// }
// if( $option1 == "search" ) {
// $output = html_btn_squares( $options, "" );
// $output .= leds_kb($options);
// $output .= "<hr>BUGS_1330 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
// print( "$output" );
// return;
// }
$output .= "<hr>BUGS_1956 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( $output );
return;
}
$output .= "<hr>BUGS_1330 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( $output );
return;
}
if( $options[0] == "certs" ) {
$dttm=date("Ymd_His");
// printf( "<hr>BUGS_1200 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n" );
$output = html_btn_squares( $options, "" );
$output .= leds_show( $options );
// $output .= leds_certs($options);
$output .= "<h3>ko_center certs detail </h3>\n";
$output .= "<a href=$php_self?q=db/grid/ko_center_certs/certs >grid_search </a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center_certs/rpts >grid_rpts</a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=certs/rpts >rpts</a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=certs/view >view</a>\n";
$output .= "       ";
$output .= "<hr>\n";
// $output .= leds_certs($options);
if( $options[1] == "" ) {
// $output .= "<hr>BUGS_1301 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
else {
if( $option1 == "new" ) {
$output .= koaac_kb_add_form();
print( "$output" );
return;
}
if( $option1 == "view" ) {
$cert_code=$option2;
$output .= leds_certs($options);
print( "$output" );
return;
}
if( $option1 == "rpts" ) {
// $output .= "<h2>BUGS_1315 rpts</h2>\n";
$output .= leds_certs_rpts( $options );
print( "$output" );
return;
}
if( $option1 == "mod" ) {
$cert_id=$option2;
$output = html_btn_squares( $options, "" );
$output .= leds_certs($options);
// $output .= "<hr>BUGS_1320 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
if( $option1 == "add" ) {
$output = html_btn_squares( $options, "" );
// $output .= leds_certs($options);
$output .= "<hr>BUGS_1330 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
if( $option1 == "search" ) {
$output = html_btn_squares( $options, "" );
$output .= leds_kb($options);
// $output .= "<hr>BUGS_1330 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
$output .= "<hr>BUGS_2036 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( $output );
return;
}
$output .= "<hr>BUGS_1330 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( $output );
return;
}
// certs
if( $options[0] == "certs1" ) {
if( $options[2] == "" ) {
$output = html_btn_squares( $options, "" );
$output .= leds_certs($options);
$output .= "<h2>CERTS_1140 o0=[$option1] o1=[$option1] o2=[$option2] o3=[$options3]</h2>\n";
print( "$output" );
return;
}
else {
if( $option1 == "view" ) {
$output = html_btn_squares( $options, "" );
$output .= leds_certs($options);
print( "$output" );
return;
}
if( $option1 == "mod" ) {
$output = html_btn_squares( $options, "" );
$output .= leds_certs($options);
print( "$output" );
return;
}
if( $option1 == "add" ) {
$output = html_btn_squares( $options, "" );
$output .= leds_certs($options);
print( "$output" );
return;
}
$output = html_btn_squares( $option2, "" );
$output .= "<h2>CERTS_1180 UNSUPPORTED COMMAND o0=[$option1] o1=[$option1] o2=[$option2] o3=[$options3]</h2>\n";
}
}
if( $options[0] == "cons" ) {
$dttm=date("Ymd_His");
// printf( "<hr>BUGS_1200 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n" );
$output = html_btn_squares( $options, "" );
$output .= leds_show( $options );
// $output .= leds_certs($options);
$output .= "<h3>ko_center cons detail </h3>\n";
$output .= "<a href=$php_self?q=db/grid/ko_center_cons/rsncons >grid_search </a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center_cons/rpts >grid_rpts</a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=cons/rpts >rpts</a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=cons/view >view</a>\n";
$output .= "       ";
$output .= "<hr>\n";
// $output .= leds_cons($options);
if( $options[1] == "" ) {
// $output .= "<hr>BUGS_1301 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
else {
//// if( $option1 == "new" ) {
//// $output .= koaac_kb_add_form();
//// print( "$output" );
//// return;
//// }
if( $option1 == "view" ) {
$cert_code=$option2;
$output .= leds_cons($options);
print( "$output" );
return;
}
if( $option1 == "rpts" ) {
// $output .= "<h2>BUGS_1315 rpts</h2>\n";
$output .= leds_cons_rpts( $options );
print( "$output" );
return;
}
if( $option1 == "mod" ) {
$cert_id=$option2;
$output = html_btn_squares( $options, "" );
$output .= leds_cons($options);
// $output .= "<hr>BUGS_1320 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
if( $option1 == "add" ) {
$output = html_btn_squares( $options, "" );
// $output .= leds_cons($options);
$output .= "<hr>BUGS_1330 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
if( $option1 == "search" ) {
$output = html_btn_squares( $options, "" );
$output .= leds_kb($options);
// $output .= "<hr>BUGS_1330 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
$output .= "<hr>BUGS_2148 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( $output );
return;
}
$output .= "<hr>BUGS_1330 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( $output );
return;
}
if( $options[0] == "dc" ) {
$dttm=date("Ymd_His");
// printf( "<hr>BUGS_1200 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n" );
$output = html_btn_squares( $options, "" );
$output .= leds_show( $options );
// $output .= leds_certs($options);
$output .= "<h3>ko_center test detail </h3>\n";
$output .= "<a href=$php_self?q=db/grid/ko_center_hosts/ko_center_hosts >ko_center_hosts </a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center_hosts/ko_center_servers >ko_center_servers </a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center_hosts/rsn_servers >rsn_servers </a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center_hosts/hrc_servers >hrc_servers </a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center_hosts/hrc_hosts >hrc_hosts </a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center_hosts/datacall >datacall </a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center_hosts/rpts >rpts</a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=hosts/rpts >rpts</a>\n";
$output .= "       ";
}
if( $options[0] == "hosts" ) {
$dttm=date("Ymd_His");
// printf( "<hr>BUGS_1200 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n" );
$output = html_btn_squares( $options, "" );
$output .= leds_show( $options );
// $output .= leds_certs($options);
$output .= "<h3>ko_center hosts detail </h3>\n";
$output .= "<a href=$php_self?q=db/grid/ko_center_hosts/ko_center_hosts >ko_center_hosts </a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center_hosts/ko_center_servers >ko_center_servers </a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center_hosts/rsn_servers >rsn_servers </a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center_hosts/hrc_servers >hrc_servers </a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center_hosts/hrc_hosts >hrc_hosts </a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center_hosts/datacall >datacall </a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=db/grid/ko_center_hosts/rpts >rpts</a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=hosts/rpts >rpts</a>\n";
$output .= "       ";
$output .= "<a href=$php_self?q=hosts/view >view</a>\n";
$output .= "       ";
$output .= "<hr>\n";
// $output .= leds_cons($options);
if( $options[1] == "" ) {
// $output .= "<hr>BUGS_1301 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
else {
//// if( $option1 == "new" ) {
//// $output .= koaac_kb_add_form();
//// print( "$output" );
//// return;
//// }
if( $option1 == "view" ) {
$cert_code=$option2;
$host_code=$option2;
$output .= leds_hosts($options);
print( "$output" );
return;
}
if( $option1 == "rpts" ) {
// $output .= "<h2>BUGS_1315 rpts</h2>\n";
$output .= leds_hosts_rpts( $options );
print( "$output" );
return;
}
if( $option1 == "mod" ) {
$cert_id=$option2;
$output = html_btn_squares( $options, "" );
$output .= leds_hosts($options);
// $output .= "<hr>BUGS_1320 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
if( $option1 == "add" ) {
$output = html_btn_squares( $options, "" );
// $output .= leds_hosts($options);
$output .= "<hr>BUGS_1330 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
if( $option1 == "search" ) {
$output = html_btn_squares( $options, "" );
$output .= leds_hosts($options);
// $output .= "<hr>BUGS_1330 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( "$output" );
return;
}
$output .= "<hr>BUGS_2262 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( $output );
return;
}
$output .= "<hr>BUGS_1820 $progid $dttm o0=$option0 o1=$option1 o2=$option2 o3=$option3<hr>\n";
print( $output );
return;
}
if( $options[0] == "iperms" ) { iperms($options); return; }
if( $options[0] == "run" ) {
$function_name=$options[1];
if( function_exists( $function_name )) {
// print( "startup MSG: EXISTS $function_name<br>\n" );
html_page($options);
$function_name( $options );
}
else {
html_page($options);
print( "startup ERR: UNAVAILABLE $options[1]<br>\n" );
// $functions = get_defined_functions();
// print_r($functions['user']);
}
return;
}
if( $_REQUESTS['todo'] ) { startup_todo(); }
if( $options[0] == "install_leds" ) {pdo_cr_leds(); pdo_insert_leds(); return;}
if( $options[0] == "install_users" ) {pdo_cr_users(); pdo_insert_users(); return;}
// leds_install();
// leds_query();
// $option0=$options[0];
// printf( "<hr>BUGS_501 option=$option0<hr>\n" );
html_page($options);
// printf( "<hr>BUGS_502 option=$option0<hr>\n" );
// fgmenu_htm($options);
// fgmenu_dyn($options);
}
function ko_ajax( $options ) {
$option1=$options[1];
$option2=$options[2];
$option3=$options[3];
// if( preg_match( "/index/i", $filename )) { continue; }
$output .= "ko_ajax MSG_2430: [$option1][$option2][$option3]<br>\n";
if( $option1 == "test1" ) {
$ctrl = new LoginController();
$result = new ServiceResult();
$result->success = $ctrl->login($_POST['username'], $_POST['password']);
$result->errors = $ctrl->errors;
$result->onSuccessEvent = 'refreshPage';
$result->onErrorEvent = 'userLoginFailed';
echo json_encode($result);
}
if( $option1 == "test2" ) {
}
return( $output );
}
function ko_ajax_controller($options) {
$ko_ajax_controler="";
$ko_ajax_controller .= "LoginController.prototype.login = function() {\n";
$ko_ajax_controller .= " var self = this;\n";
$ko_ajax_controller .= " var username = jQuery('#loginForm .email').val()\n";
$ko_ajax_controller .= " var password = jQuery('#loginForm .password').val()\n";
$ko_ajax_controller .= " var data = {\n";
$ko_ajax_controller .= " username:username,\n";
$ko_ajax_controller .= " password:password,\n";
$ko_ajax_controller .= " };\n";
$ko_ajax_controller .= " jQuery.ajax({\n";
$ko_ajax_controller .= " url:'login.php',\n";
$ko_ajax_controller .= " async:true,\n";
$ko_ajax_controller .= " service:'login',\n";
$ko_ajax_controller .= " type:'post',\n";
$ko_ajax_controller .= " dataType:'json',\n";
$ko_ajax_controller .= " data:data\n";
$ko_ajax_controller .= " });\n";
$ko_ajax_controller .= "}\n";
return( $ko_ajax_controller );
}
function ko_ajax_listener($options) {
$ko_ajax_listener = "";
$ko_ajax_listener .= "LoginController.prototype.login = function() {\n";
$ko_ajax_listener .= "function LoginController() {\n";
$ko_ajax_listener .= " var self = this;\n";
$ko_ajax_listener .= " jQuery(document).ready(function() {\n";
$ko_ajax_listener .= " self.onLoad();\n";
$ko_ajax_listener .= " })\n";
$ko_ajax_listener .= "}\n";
$ko_ajax_listener .= "\n";
$ko_ajax_listener .= "LoginController.prototype = new BaseController();\n";
$ko_ajax_listener .= "\n";
$ko_ajax_listener .= "LoginController.prototype.onLoad = function() {\n";
$ko_ajax_listener .= " var self = this;\n";
$ko_ajax_listener .= " this.addListener('userLoginFailed', function(event, result) {\n";
$ko_ajax_listener .= " self.onLoginFailed(result);\n";
$ko_ajax_listener .= " })\n";
$ko_ajax_listener .= "}\n";
$ko_ajax_listener .= "\n";
$ko_ajax_listener .= "LoginController.prototype.onLoginFailed = function(result) {\n";
$ko_ajax_listener .= " jQuery('#errorDisplay').html(result.errors[0]);\n";
$ko_ajax_listener .= "}\n";
return( $ko_ajax_listener );
}
function ko_ajax_app($options) {
$ko_ajax_app = "";
$ko_ajax_app .= "function AppController() {\n";
$ko_ajax_app .= " var self = this;\n";
$ko_ajax_app .= " jQuery(document).ready(function() {\n";
$ko_ajax_app .= " self.onLoad();\n";
$ko_ajax_app .= " })\n";
$ko_ajax_app .= "}\n";
$ko_ajax_app .= "\n";
$ko_ajax_app .= "AppController.prototype = new BaseController();\n";
$ko_ajax_app .= "\n";
$ko_ajax_app .= "AppController.prototype.onLoad = function () {\n";
$ko_ajax_app .= " this.addListener('refreshPage', function(event, user) {\n";
$ko_ajax_app .= " window.location.reload()\n";
$ko_ajax_app .= " })\n";
$ko_ajax_app .= "}\n";
return( $ko_ajax_app );
}
function ko_ajax_complete($options) {
$ko_ajax_compledte .= "jQuery(document).ajaxComplete(function(event, request, settings) {\n";
$ko_ajax_compledte .= " if (settings.dataType == 'json') {\n";
$ko_ajax_compledte .= " var dispatcher = new EventDispatcher();\n";
$ko_ajax_compledte .= " var result = jQuery.parseJSON(request.responseText);\n";
$ko_ajax_compledte .= " if (result) {\n";
$ko_ajax_compledte .= " if (result.success == true && result.onSuccessEvent) {\n";
$ko_ajax_compledte .= " dispatcher.dispatch(result.onSuccessEvent, result)\n";
$ko_ajax_compledte .= " } else if (result.onErrorEvent) {\n";
$ko_ajax_compledte .= " dispatcher.dispatch(result.onErrorEvent, result)\n";
$ko_ajax_compledte .= " }\n";
$ko_ajax_compledte .= " }\n";
$ko_ajax_compledte .= " }\n";
$ko_ajax_compledte .= "})\n";
return( $ko_ajax_compete );
}
function ko_ajax_result($options) {
$output .= "class ServiceResult {\n";
$output .= " public $success;\n";
$output .= " public $errors;\n";
$output .= " public $messages;\n";
$output .= " public $data;\n";
$output .= " public $onSuccessEvent;\n";
$output .= " public $onErrorEvent;\n";
$output .= "}\n";
return( $output );
}
function ko_dragdrop_redirect($options) {
$http_host=$_SERVER['HTTP_HOST'];
$php_self=$_SERVER['PHP_SELF'];
// $url="https://$http_host/$php_self?q=dragdrop/test2\n";
// $ko_dragdrop_redirect = "";
// $ko_dragdrop_redirect .= "url:$url";
$location_url .= "var url = \"https://$http_host/php_self?q=dragdrop/test2/\";\n";
$location_url = "$(location).attr('href',url);\n";
$output = "";
$output .= $location_url;
return( $output );
}
function ko_dragdrop( $options ) {
$option1=$options[1];
$option2=$options[2];
$option3=$options[3];
// if( preg_match( "/index/i", $filename )) { continue; }
$output .= "dragdrop MSG_2430: [$option1][$option2][$option3]<br>\n";
$cab="/ko_center/imgs/cab/cab_empty.png";
$item1="/ko_center/imgs/cab/visix_content_server.png";
$item2="/ko_center/imgs/cab/hp_dl585_g2.png";
$item3="/ko_center/imgs/cab/hp_rx7640.png";
$item4="/ko_center/imgs/cab/sun_x4140.png";
$item5="/ko_center/imgs/cab/sunfire_v440.png";
$output = "";
$width="50";
if( $option1 == "test1" ) {
$output .= "<hr><h2>test1</h2><hr>\n";
/// $output .= "div id=\"drop\"> \n";
//// $output .= "<div id=\"drop\"> <span id=\"sw\">Show</span>\n";
//// $output .= "<div id=\"drop\"><img src=imgs/cab/cab_empty.png width=50><span id=\"sw\">Show</span>\n";
$output .= "<div id=\"drop\"><img src=imgs/cab/cab_empty.png width=50></div>\n";
$output .= "<hr>\n";
$output .= "<div id=\"drop\"><span id=\"sw\">Show</span></div>\n";
//// $output .= "</div>\n";
$output .= "<div id=\"drag\">\n";
$output .= " imgs:<br/>\n";
//// $output .= "<img src=\"circle.gif\" alt=\"circle\" width=\"45\" height=\"45\" class=\"drg\" />\n";
//// $output .= "<img src=\"triangle.gif\" alt=\"triangle\" width=\"65\" height=\"55\" class=\"drg\" />\n";
$output .= " <img src=\"$item1\" alt=\"visix_content_server\" width=\"$width\" class=\"drg\" />\n";
$output .= " <img src=\"$item2\" alt=\"hp_dl585\" width=\"$width\" class=\"drg\" />\n";
$output .= " <img src=\"$item3\" alt=\"hp_rx7640\" width=\"$width\" class=\"drg\" />\n";
$output .= " <img src=\"$item4\" alt=\"sun_x4140\" width=\"$width\" class=\"drg\" />\n";
$output .= " <img src=\"$item5\" alt=\"sunfire_v440\" width=\"$width\" class=\"drg\" />\n";
$output .= "</div>\n";
$output .= " <div class=\"drg\" Click and drag</div>\n";
}
if( $option1 == "test2" ) {
printf( "MSG_2500: [$option1][$option2][$option3][$option4]<br>\n" );
}
if( $option1 == "test3" ) {
}
if( $option1 == "test4" ) {
}
return( $output );
}
function dragdrop_test1($options) {
$html = "";
$html .= "<style type=\"text/css\"><!--\n";
$html .= "#drop {\n";
$html .= " width:200px;\n";
$html .= " height:150px;\n";
$html .= " margin:3px auto;\n";
$html .= " background:#eddaa8;\n";
$html .= " font-size:16px;\n";
$html .= "}\n";
$html .= "#drop #sw { text-decoration:underline; cursor:pointer; }\n";
$html .= "#drag {\n";
$html .= " width:450px;\n";
$html .= " height:180px;\n";
$html .= " margin:12px auto;\n";
$html .= " border:1px solid silver;\n";
$html .= " font-size:16px;\n";
$html .= "}\n";
$html .= "#drag .drg { margin:10px 12px; }\n";
$html .= "#drag div.drg {\n";
$html .= " width:150px;\n";
$html .= " height:50px;\n";
$html .= " background:#07da08;\n";
$html .= " border:2px solid blue;\n";
$html .= "}\n";
$html .= "--></style>\n";
//// $html .= "<script type=\"text/javascript\" src=\"jquery_1.6.1.js\"></script>\n";
//// $html .= "<script type=\"text/javascript\" src=\"jquery-ui-1.8.14.js\"></script>\n";
//// jk $html .= "<script type=\"text/javascript\" src=\"jquery_1.8.3.js\"></script>\n";
//// jk $html .= "<script type=\"text/javascript\" src=\"jquery-ui-1.9.2.custom.js\"></script>\n";
//// $html .= "<script type=\"text/javascript\"><!--\n";
$html .= "<script type=\"text/javascript\">\n";
$html .= "$(document).ready(function() {\n";
$html .= " // sets the draggable\n";
$html .= " $('#drag .drg').draggable({\n";
$html .= " cursor: 'move', // sets the cursor apperance\n";
$html .= " revert: 'valid'\n";
$html .= " });\n";
$html .= "\n";
$html .= " // sets droppable\n";
$html .= " $('#drop').droppable({\n";
$html .= " drop: function(event, ui) {\n";
$html .= " // after the draggable is droped, hides it with a hide() effect\n";
$html .= " ui.draggable.hide(1000);\n";
$html .= " }\n";
$html .= " });\n";
$html .= "\n";
$html .= " // when the \"#sw\" element (inside the \"#drop\") is clicked\n";
$html .= " // show the items with class \"drg\", contained in \"#drag\"\n";
$html .= " $('#drop #sw').click(function(){\n";
$html .= " $('#drag .drg').slideDown(1000);\n";
$html .= " });\n";
$html .= "});\n";
$html .= "--></script>\n";
$html .= "</head>\n";
$html .= "<body>\n";
//// $html .= "<div id=\"drop\">Drop here <span id=\"sw\">Show</span></div>\n";
//// $html .= "<div id=\"drop\"><img src=imgs/cab/cab_empty width=50><span id=\"sw\">Show</span></div>\n<img src=imgs/cab/cab_empty width=25></div>\n";
$html .= "<div id=\"drop\"><img src=imgs/cab/cab_empty width=50>\n";
$html .= "<span id=\"hd\">hide</span></div>\n";
$html .= "<span id=\"loc\">loc</span></div>\n";
$html .= "<div id=\"drag\">\n";
$html .= " ko_center dragdrop test_2575: <br/>\n";
$html .= " <img src=\"imgs/cab/vbrick.png\" alt=\"vbrick\" width=\"45\" height=\"45\" class=\"drg\" />\n";
$html .= " <img src=\"imgs/cab/item1.png\" alt=\"item1\" width=\"45\" height=\"45\" class=\"drg\" />\n";
$html .= " <img src=\"imgs/cab/item2.png\" alt=\"item2\" width=\"45\" height=\"45\" class=\"drg\" />\n";
//// $html .= " <img src=\"imgs/cab/item3.png\" alt=\"item3\" width=\"45\" height=\"45\" class=\"drg\" />\n";
//// $html .= " <div class="drg">DIV with some content. Click and drag</div>\n";
$html .= "</div>\n";
return( $html );
}
function ko_im( $options ) {
$option1=$options[1];
$option2=$options[2];
$option3=$options[3];
// if( preg_match( "/index/i", $filename )) { continue; }
$output .= "MSG_2450 dragdrop MSG_1234: [$option1][$option2][$option3]<br>\n";
if( $option1 == "test1" ) {
}
if( $option1 == "test2" ) {
}
if( $option1 == "test3" ) {
}
if( $option1 == "test4" ) {
}
return( $output );
}
function sqlq( $dbfile, $sql, $fld ) {
/// printf( "MSG_2380: sqlq: dbfile=[$dbfile] sql=[$sql] fld=[$fld]<br>\n" );
$pdo = newpdo( $dbfile );
// $sql = "select * from $tblname where rpt_code='$rpt_code'";
$output = "";
$pdo = newpdo($dbfile);
foreach( $pdo->query($sql) as $row ) {
/// printf( "BUGS_2390: val=[$val] fld=[$fld] row=[$row]<br>\n" );
$val=$row[$fld];
$output .= "$val ";
}
$pdo=null;
return($output);
}
function ko_plans_items($options) {
$http_host=$_SERVER['HTTP_HOST'];
$php_self=$_SERVER['PHP_SELF'];
$dbfile="ko_center.db3";
$planid="plan1";
$cabtop_pngfil="/ko_center/imgs/cab/cabtop.png";
$cabbottom_pngfil="/ko_center/imgs/cab/cabbottom.png";
$cabtop_pngfil="/ko_center/imgs/cab/tn/tn_cabtop.png";
$cabbottom_pngfil="/ko_center/imgs/cab/tn/tn_cabbottom.png";
$cab_empty_pngfil="/ko_center/imgs/cab/cab_empty.png";
$output = "<h2>ko_plans_2750: dbfile=[$dbfile] planid=[$planid] cab=[$cab]</h2>\n";
$output .= "<hr>\n";
$items_flag="true";
$width="35";
$limit="5";
$step=0;
$steplim=5;
$item_limit=5;
$sql_maxamp = "select val maxamp from cfg where fld=='maxamp'";
$maxamp = sqlq( $dbfile, $sql_maxamp, "maxamp" );
//// printf( "MSG_2011: maxamp=[$maxamp] sql_maxamp=[$sql_maxamp] dbfile=[$dbfile]<br>\n" );
$sql_minamp = "select val minamp from cfg where fld=='minamp'";
$minamp = sqlq( $dbfile, $sql_minamp, "minamp" );
//// printf( "MSG_2012: maxamp=[$maxamp] sql_minamp=[$sql_minamp] dbfile=[$dbfile]<br>\n" );
$zm_output ="";
$zm_output .= "<a href=https://$http_host/ko_center/zm/zm.html alt=zoomify target=_blank>zm</a><br>";
// $setup_output = "MSG_2780: maxamp=[$maxamp] minamp=[$minamp] dropzone=[$dropzone] <hr>\n";
// $setup_ouput .= $dropzone;
$output_test1 = "";
$output_test1 .= "<img src=\"./imgs/cab/dd42.png\" class=\"img-float\">\n";
$output_test1 .= "<img src=\"./imgs/cab/dd45.png\" class=\"img-float\">\n";
$output_test1 .= "<img src=\"./imgs/cab/dd47.png\" class=\"img-float\">\n";
$item_limit=6;
$sql_items="select distinct(item) item, sn,cab,cab1,cab2,amps from ko_plans where planid == 'plan1' order by cast(amps as real) desc, cab limit $item_limit ";
$output = "";
$item_output = "";
$item_output .= "<hr><h1>item</h1><hr>\n" . $testout ;
//// $item_output .= "MSG_2330: width=$width dbfile=[$dbfile] sql_items=[$sql_items]<br>\n";
$pdo = newpdo( $dbfile );
$j=0; $item_tot_samps=0; $item1_pnglist="";
foreach( $pdo->query( $sql_items) as $row ) {
$item_output = "";
//// printf( "MSG_2828: $j sql_items=[$sql_items] dbfile=[$dbfile]<br>\n" );
$j++;
foreach( $row as $key=>$val ) {
if( is_numeric( $key )) { continue; }
if( $key == 'item' ) { $item=$val; }
if( $key == 'cab' ) { $cab=$val; }
if( $key == 'cab1' ) { $cab1=$val; }
if( $key == 'cab2' ) { $cab2=$val; }
if( $key == 'sn' ) { $sn=$val; }
if( $key == 'hrctag' ) { $hrctag=$val; }
if( $key == 'amps' ) { $amps=$val; }
}
//// printf( "MSG_2830: $j $item $cabs $sn $samps<br>" );
$item_pngfil="/ko_center/imgs/cab/tn/tn_$item.png";
$item_pngfil="/ko_center/imgs/cab/$item.png";
$im_cmd .= " $item_pngfil";
if( file_exists( $item_pngfil )) {
$item_url = "<a href=https://$http_host/$php_self?q=sn/$sn>";
$item_url .= "<img id=\"ko_dragdrop\" src=$item_pngfil border=0 width=$width alt=$sn>";
$item_url .= "</a>";
//// $item_divurl = "<div id=\"ko_dragdrop\" >\n";
//// $item_divurl .= "<div class=\"drg\" id=\"drag\" >$item_url</div>\n";
$item_divurl .= "<div class=\"ko_dragdrop\" id=\"$sn\" >$item_url</div>\n";
$item_output .= $item_divurl;
$item_divurl .= "</div>";
//// $item_divurl .= "</div>";
$item_output .= "\n<h4>MSG_2860</h4> sn=$sn hrctag=$hrctag item=$item amps=$amps [$cab][$cab1][$cab2] samps=$samps\n";
//// printf( "MSG_2841: FOUND item=[$item] item_pngfil=[$item_pngfil]<br>\n" );
}
else {
//// printf( "MSG_2842: NOTFOUND item=[$item] item_pngfil=[$item_pngfil]<br>\n" );
$item_null_url="<a https://$http_host/$php_self?q=item/$item>$item_empty_png</a>";
$item_divurl ="<div id=\"drag\" \n";
$item_divurl .= "<div class=\"ko_dragdrop\" id=\"$sn\" >$item_empty_url</div>";
$item_divurl .= "</div>\n";
$item_output .= $item_divurl;
}
}
//// printf( "MSG_2840: $j sql_items=[$sql_items] dbfile=[$dbfile]<br>\n" );
$dropzone = "";
// $dropzone .= "<div id=\"drop\"><img src=\"$cab_empty_pngfil\" alt=$sn width=$width><span id=\"sw\">show</span></div>\n";
$item_output .= "<hr>MSG_2870<hr>\n";
return( $item_output );
}
function ko_plans_steps($options) {
$http_host=$_SERVER['HTTP_HOST'];
$php_self=$_SERVER['PHP_SELF'];
$dbfile="ko_center.db3";
$planid="plan1";
$cabtop_pngfil="./imgs/cab/cabtop.png";
$cabbottom_pngfil="./imgs/cab/cabbottom.png";
$cabtop_pngfil="./imgs/cab/tn/tn_cabtop.png";
$cabbottom_pngfil="./imgs/cab/tn/tn_cabbottom.png";
$cab_empty_pngfil="./imgs/cab/cab_empty.png";
$output = "<h2>ko_plans_2750: dbfile=[$dbfile] planid=[$planid] cab=[$cab]</h2>\n";
$output .= "<hr>\n";
$items_flag="true";
$width="35";
$limit="5";
$step=0;
$steplim=5;
$item_limit=5;
$sql_maxamp = "select val maxamp from cfg where fld=='maxamp'";
$maxamp = sqlq( $dbfile, $sql_maxamp, "maxamp" );
//// printf( "MSG_2011: maxamp=[$maxamp] sql_maxamp=[$sql_maxamp] dbfile=[$dbfile]<br>\n" );
$sql_minamp = "select val minamp from cfg where fld=='minamp'";
$minamp = sqlq( $dbfile, $sql_minamp, "minamp" );
//// printf( "MSG_2012: maxamp=[$maxamp] sql_minamp=[$sql_minamp] dbfile=[$dbfile]<br>\n" );
$zm_output ="";
$zm_output .= "<a href=https://$http_host/ko_center/zm/zm.html alt=zoomify target=_blank>zm</a><br>";
// $setup_output = "MSG_2780: maxamp=[$maxamp] minamp=[$minamp] dropzone=[$dropzone] <hr>\n";
// $setup_ouput .= $dropzone;
$output_test1 .= "<img src=\"./imgs/cab/dd42.png\" class=\"img-float\">\n";
$output_test1 .= "<img src=\"./imgs/cab/dd45.png\" class=\"img-float\">\n";
$output_test1 .= "<img src=\"./imgs/cab/dd47.png\" class=\"img-float\">\n";
$sql_items="select distinct(item) item, sn,cab,cab1,cab2,amps from ko_plans where planid == 'plan1' order by cast(amps as real) desc, cab limit $item_limit ";
$output = "";
$item_output = "";
$item_output .= "<hr><h1>item</h1><hr>\n" . $testout ;
//// $item_output .= "MSG_2330: width=$width dbfile=[$dbfile] sql_items=[$sql_items]<br>\n";
//// printf( "item_output = $item_output $sql_items dbfile=[$dbfile]<br>\n" );
$pdo = newpdo( $dbfile );
$j=0; $item_tot_samps=0; $item1_pnglist="";
foreach( $pdo->query( $sql_items) as $row ) {
//// printf( "MSG_2930: $j sql_items=[$sql_items] dbfile=[$dbfile]<br>\n" );
$j++;
foreach( $row as $key=>$val ) {
if( is_numeric( $key )) { continue; }
if( $key == 'item' ) { $item=$val; }
if( $key == 'cab' ) { $cab=$val; }
if( $key == 'cab1' ) { $cab1=$val; }
if( $key == 'cab2' ) { $cab2=$val; }
if( $key == 'sn' ) { $sn=$val; }
if( $key == 'hrctag' ) { $hrctag=$val; }
if( $key == 'amps' ) { $amps=$val; }
}
//// printf( "MSG_2950: $j $item $cabs $sn $samps<br>" );
$item_pngfil="./imgs/cab/tn/tn_$item.png";
$item_pngfil="./imgs/cab/$item.png";
$im_cmd .= " $item_pngfil";
if( file_exists( $item_pngfil )) {
$item_url = "<a href=https://$http_host/$php_self?q=item/$item>";
$item_url .= "<img class=\"ko_dragdrop\" src=$item_pngfil border=0 width=$width alt=$sn>";
$item_url .= "</a>";
//// $item_divurl = "<div id=\"drag\" \n";
//// $item_divurl .= "<div class=\"drg\" id=\"drag\" >$item_url</div>\n";
//// $item_divurl .= "<div class=\"drg\" id=\"$sn\" >$item_url</div>\n";
//// $item_divurl .= "</div>";
$item_output .= $item_divurl;
$item_output .= "\n<br> sn=$sn hrctag=$hrctag item=$item amps=$amps samps=$samps\n";
//// printf( "MSG_2961: FOUND item=[$item] item_pngfil=[$item_pngfil]<br>\n" );
}
else {
//// printf( "MSG_2962: NOTFOUND item=[$item] item_pngfil=[$item_pngfil]<br>\n" );
$item_null_url="<a https://$http_host/$php_self?q=item/$item>$item_empty_png</a>";
//// $item_divurl ="<div id=\"drag\" \n";
//// $item_divurl .= "<div class=\"drg\" id=\"drag\" >$item_empty_url</div>";
//// $item_divurl .= "</div>\n";
$item_output .= $item_divurl;
}
}
//// printf( "MSG_2970: $j sql_items=[$sql_items] dbfile=[$dbfile]<br>\n" );
$sql_cab1="select distinct(cab1) cab1, group_concat( item, ' ' ) items, sum(amps) samps from ko_plans where planid == 'plan1' and cab == cab1 group by cab1 limit 6";
$output = "";
$cab1_output .= "<hr><h1>cab1</h1><hr>\n";
$pdo = newpdo( $dbfile );
$j=0; $cab1_tot_samps=0; $cab1_pnglist="";
/// printf( "MSG_2860: $j sql_cab1=[$sql_cab1] cab1=[$cab1] cab1_items=[$cab1_items] cab1_samps=[$cab1_samps] cab1_pngfil=[$cab1_pngfil]<br>\n" );
foreach( $pdo->query( $sql_cab1) as $row ) {
$j++;
foreach( $row as $key=>$val ) {
if( is_numeric( $key )) { continue; }
if( $key == 'cab1' ) { $cab1=$val; }
if( $key == 'items' ) { $cab1_items=$val; }
if( $key == 'samps' ) { $samps=$val; }
}
// printf( "$j cab1=[$cab1] cab1_items=[$cab1_items] cab1_samps=[$cab1_samps] cab1_pngfil=[$cab1_pngfil]<br>\n" );
$im_cmd = "convert $cabtop_pngfil ";
$items=explode( " ", $cab1_items );
foreach( $items as $item ) {
//// $item_pngfil="./imgs/cab/tn/tn_$item.png";
$item_pngfil="/ko_center/imgs/cab/$item.png";
$im_cmd .= " $item_pngfil";
if( file_exists( $item_pngfil )) {
// printf( "MSG_2991: FOUND cab1 item=[$item] item_pngfil=[$item_pngfil]<br>\n" );
}
else {
// printf( "MSG_2992: NOTFOUND cab1 item=[$item] item_pngfil=[$item_pngfil]<br>\n" );
}
}
$cab1_pngfil=sprintf( "./ko_plans/imgs/%s_cab1_%s_%03d_%03d.png", $planid, $cab1, $step, $samps );
$cab1_pngfiles .= " $cab1_pngfil";
$cab1_tot_samps += $samps;
$im_cmd .= " $cabbottom_pngfil -append $cab1_pngfil ";
$im_cmd_status="";
$status=exec($im_cmd,$im_cmd_status);
if( $items_flag == "true" ) {
$cab1_output .= "<img class=\"ko_dragdrop\" src=$cab1_pngfil> $cab1_pngfil $samps<br>\n";
// printf( "MSG_2481: status=[$status] im_cmd=[$im_cmd] cab2_tot_samps=[$cab2_tot_samps]<hr>\n" );
}
}
$pdo=null;
$cab1beg_pngfile=sprintf( "./ko_plans/imgs/%s_cab1beg_%03d_%04d.png", $planid, $setp, $cab1_tot_samps );
// floats to top
// $im_cmd = "convert $cab1_pngfiles +append -gravity north $cab1beg_pngfile";
$im_cmd = "convert $cab1_pngfiles +append -gravity north $cab1beg_pngfile";
printf( "MSG_3022: cab1_tot_samps=[$cab1_tot_samps] im_cmd=[$im_cmd] cab1beg_pngfil=[$cab1beg_pngfil]<hr>\n" );
$status=exec($im_cmd,$im_cmd_status);
$cab1_output .= "MSG_2441: <img src=$cab1beg_pngfile border=0 alt=$cab1beg_pngfile><hr>cab1beg_pngfile=[$cab1beg_pngfile] cab1_tot_samps=[$cab1_tot_samps]<br>\n";
// $sql_cab="select distinct(cab) cab, group_concat( item, ' ' ) items, sum(amps) samps from ko_center where planid == 'plan1' group by cab";
$sql_cab2="select distinct(cab2) cab2, group_concat( item, ' ' ) items, sum(amps) samps from ko_plans where planid == 'plan1' and cab == cab2 group by cab2";
$cab2_output = "<hr><h1>cab2</h1><hr>\n";
$pdo = newpdo( $dbfile );
$j=0; $cab2_tot_samps=0; $cab2_pnglist="";
foreach( $pdo->query( $sql_cab2) as $row ) {
$j++;
foreach( $row as $key=>$val ) {
if( is_numeric( $key )) { continue; }
if( $key == 'cab2' ) { $cab2=$val; }
if( $key == 'items' ) { $cab2_items=$val; }
if( $key == 'samps' ) { $samps=$val; }
}
printf( "MSG_3042: $j cab2=[$cab2] cab2_items=[$cab2_items] cab2_samps=[$cab2_samps] cab2_pngfil=[$cab2_pngfil]<br>\n" );
$im_cmd = "convert $cabtop_pngfil ";
$items=explode( " ", $cab2_items );
foreach( $items as $item ) {
/// $item_pngfil="/ko_center/imgs/cab/tn/tn_$item.png";
$item_pngfil="/ko_center/imgs/cab/$item.png";
$im_cmd .= " $item_pngfil";
//// if( file_exists( $item_pngfil )) {
//// printf( "MSG_2422: FOUND cab2 item=[$item] item_pngfil=[$item_pngfil]<br>\n" );
//// }
//// else {
//// printf( "MSG_2422: NOTFOUND cab2 item=[$item] item_pngfil=[$item_pngfil]<br>\n" );
//// }
}
$cab2_pngfil=sprintf( "./ko_plans/imgs/%s_cab2_%s_%03d_%03d.png", $planid, $cab2, $step, $samps );
$cab2_pngfiles .= " $cab2_pngfil";
$cab2_tot_samps += $samps;
/// printf( "bugs_1234 tot_samps=[$cab2_tot_samps] samps=[$samps]<br>\n" );
$im_cmd .= " $cabbottom_pngfil -append $cab2_pngfil ";
$im_cmd_status="";
$status=exec($im_cmd,$im_cmd_status);
if( $items_flag == 'true' ) {
$cab2_output .= "<img class=\"drg\" src=$cab2_pngfil> $cab2_pngfil $samps<br>\n";
/// printf( "MSG_2482: status=[$status] im_cmd=[$im_cmd] cab2_tot_samps=[$cab2_tot_samps]<hr>\n" );
}
}
$pdo=null;
$cab2beg_pngfile=sprintf( "./ko_plans/imgs/%s_cab2beg_%03d_%04d.png", $planid, $step, $cab2_tot_samps );
$im_cmd = "convert $cab2_pngfiles +append -gravity north $cab2beg_pngfile";
/// printf( "MSG_2432: cab2_tot_samps=[$cab2_tot_samps] im_cmd=[$im_cmd] cab2beg_pngfil=[$cab2beg_pngfil]<hr>\n" );
$status=exec($im_cmd,$im_cmd_status);
$cab2_output .= "<img class=\"drg\" src=$cab2beg_pngfile border=0 alt=$cab2beg_pngfile><hr>cab2beg_pngfile=[$cab2beg_pngfile] cab2_tot_samps=[$cab2_tot_samps]<br>\n";
$cab2_output .= "<hr><h2>cab2</h2><hr>\n";
$setup_output = "maxamp=[$maxamp] minamp=[$minamp]<hr>\n";
$reports_major=reports_menu("major");
$reports_minor=reports_menu("minor");
$output .= $setup_output . cab1_output . $cab2_output;
// $output = $setup_output . $reports_major . $zm_output . $cab1_output . $cab2_output . $reports_output_minor;
return( $output );
}
function ko_plans1($options) {
}
function ko_plans_save($options) {
$http_host=$_SERVER['HTTP_HOST'];
$php_self=$_SERVER['PHP_SELF'];
$dbfile="ko_center.db3";
$planid="plan1";
$cabtop_pngfil="./imgs/cab/cabtop.png";
$cabbottom_pngfil="./imgs/cab/cabbottom.png";
$cabtop_pngfil="./imgs/cab/tn/tn_cabtop.png";
$cabbottom_pngfil="./imgs/cab/tn/tn_cabbottom.png";
$cab_empty_pngfil="./imgs/cab/cab_empty.png";
$output = "<h2>ko_plans_2750: dbfile=[$dbfile] planid=[$planid] cab=[$cab]</h2>\n";
$output .= "<hr>\n";
$items_flag="true";
$width="35";
$limit="5";
$step=0;
$steplim=5;
$item_limit=5;
$sql_maxamp = "select val maxamp from cfg where fld=='maxamp'";
$maxamp = sqlq( $dbfile, $sql_maxamp, "maxamp" );
//// printf( "MSG_2011: maxamp=[$maxamp] sql_maxamp=[$sql_maxamp] dbfile=[$dbfile]<br>\n" );
$sql_minamp = "select val minamp from cfg where fld=='minamp'";
$minamp = sqlq( $dbfile, $sql_minamp, "minamp" );
//// printf( "MSG_2012: maxamp=[$maxamp] sql_minamp=[$sql_minamp] dbfile=[$dbfile]<br>\n" );
$zm_output ="";
$zm_output .= "<a href=https://$http_host/ko_center/zm/zm.html alt=zoomify target=_blank>zm</a><br>";
// $setup_output = "MSG_2780: maxamp=[$maxamp] minamp=[$minamp] dropzone=[$dropzone] <hr>\n";
// $setup_ouput .= $dropzone;
$output_widgets = "";
$output_widgets .= "<div id=\"resizable\" class=\"ui-widget-congent\">\n";
$output_widgets .= " <h3 class=\"ui-widget-header\">Resizable</h3>\n";
$output_widgets .= " </div>\n";
$output_test1 = "";
$output_test1 .= "<img src=\"./imgs/cab/dd42.png\" class=\"img-float\">\n";
$output_test1 .= "<img src=\"./imgs/cab/dd45.png\" class=\"img-float\">\n";
$output_test1 .= "<img src=\"./imgs/cab/dd47.png\" class=\"img-float\">\n";
$sql_items="select distinct(item) item, sn,cab,cab1,cab2,amps from ko_plans where planid == 'plan1' order by cast(amps as real) desc, cab limit $item_limit ";
$output = "";
$item_output = "";
$item_output .= "<hr><h1>item</h1><hr>\n" . $testout ;
//// $item_output .= "MSG_2330: width=$width dbfile=[$dbfile] sql_items=[$sql_items]<br>\n";
$pdo = newpdo( $dbfile );
$j=0; $item_tot_samps=0; $item1_pnglist="";
foreach( $pdo->query( $sql_items) as $row ) {
//// printf( "MSG_2828: $j sql_items=[$sql_items] dbfile=[$dbfile]<br>\n" );
$j++;
foreach( $row as $key=>$val ) {
if( is_numeric( $key )) { continue; }
if( $key == 'item' ) { $item=$val; }
if( $key == 'cabs' ) { $cabs=$val; }
if( $key == 'sn' ) { $sn=$val; }
if( $key == 'hrctag' ) { $hrctag=$val; }
if( $key == 'samps' ) { $samps=$val; }
if( $key == 'amps' ) { $amps=$val; }
}
//// printf( "MSG_2830: $j $item $cabs $sn $samps<br>" );
$item_pngfil="./imgs/cab/tn/tn_$item.png";
$item_pngfil="./imgs/cab/$item.png";
$im_cmd .= " $item_pngfil";
if( file_exists( $item_pngfil )) {
$item_url = "<a href=https://$http_host/$php_self?q=item/$item>";
$item_url .= "<img class=\"drg\" src=$item_pngfil border=0 width=$width alt=$sn>";
$item_url .= "</a>";
$item_divurl = "<div id=\"drag\" \n";
//// $item_divurl .= "<div class=\"drg\" id=\"drag\" >$item_url</div>\n";
$item_divurl .= "<div class=\"drg\" id=\"$sn\" >$item_url</div>\n";
$item_divurl .= "</div>";
$item_output .= $item_divurl;
$item_output .= "\n<br> sn=$sn hrctag=$hrctag item=$item amps=$amps samps=$samps\n";
//// printf( "MSG_2841: FOUND item=[$item] item_pngfil=[$item_pngfil]<br>\n" );
}
else {
//// printf( "MSG_2842: NOTFOUND item=[$item] item_pngfil=[$item_pngfil]<br>\n" );
$item_null_url="<a https://$http_host/$php_self?q=item/$item>$item_empty_png</a>";
$item_divurl ="<div id=\"drag\" \n";
$item_divurl .= "<div class=\"drg\" id=\"drag\" >$item_empty_url</div>";
$item_divurl .= "</div>\n";
$item_output .= $item_divurl;
}
}
//// printf( "MSG_2840: $j sql_items=[$sql_items] dbfile=[$dbfile]<br>\n" );
$dropzone = "";
// $dropzone .= "<div id=\"drop\"><img src=\"$cab_empty_pngfil\" alt=$sn width=$width><span id=\"sw\">show</span></div>\n";
$dropzone .= "<div id=\"drop\"><span id=\"sw\">show</span></div>\n";
$dropzone .= "<div id=\"drop\"><span id=\"sw\">show</span></div>\n";
$testout = "<div id=\"drop\">Drop here <span id=\"sw\">Show</span></div>\n";
$testout .= "<div id=\"drop\"> cab_empty <img src=\"./imgs/cab/cab_empty.png>\n\"";
$testout .= "<span id=\"sw\">Show</span></div>\n";
/// $testout .= "<div id=\"drag\"> Drag these imgs:<br/>\n";
// $testout .= "<img src=\"./imgs/cab/visix_content_server.png\" alt=\"visix_content_server\\">\n";
/// $testout .= "<img src=\"./imgs/cab/hp_dl585_g2.png\" alt=\"hp_dl585\" />\n";
/// $testout .= "<div class=\"drg\">DIV with some content. Click and drag</div>";
/// $testout .= "</div>\n";
$item_output .= $output_widgets;
$item_output .= $dropzone;
$item_output .= "<hr>MSG_2870<hr>\n";
return( $item_output );
$sql_cab1="select distinct(cab1) cab1, group_concat( item, ' ' ) items, sum(amps) samps from ko_plans where planid == 'plan1' and cab == cab1 group by cab1";
$output = "";
$cab1_output .= "<hr><h1>cab1</h1><hr>\n";
$pdo = newpdo( $dbfile );
$j=0; $cab1_tot_samps=0; $cab1_pnglist="";
/// printf( "MSG_2860: $j sql_cab1=[$sql_cab1] cab1=[$cab1] cab1_items=[$cab1_items] cab1_samps=[$cab1_samps] cab1_pngfil=[$cab1_pngfil]<br>\n" );
foreach( $pdo->query( $sql_cab1) as $row ) {
$j++;
foreach( $row as $key=>$val ) {
if( is_numeric( $key )) { continue; }
if( $key == 'cab1' ) { $cab1=$val; }
if( $key == 'items' ) { $cab1_items=$val; }
if( $key == 'samps' ) { $samps=$val; }
}
// printf( "$j cab1=[$cab1] cab1_items=[$cab1_items] cab1_samps=[$cab1_samps] cab1_pngfil=[$cab1_pngfil]<br>\n" );
$im_cmd = "convert $cabtop_pngfil ";
$items=explode( " ", $cab1_items );
foreach( $items as $item ) {
//// $item_pngfil="./imgs/cab/tn/tn_$item.png";
$item_pngfil="/ko_center/imgs/cab/$item.png";
$im_cmd .= " $item_pngfil";
if( file_exists( $item_pngfil )) {
/// printf( "MSG_2876: FOUND cab1 item=[$item] item_pngfil=[$item_pngfil]<br>\n" );
}
else {
//// printf( "MSG_2877: NOTFOUND cab1 item=[$item] item_pngfil=[$item_pngfil]<br>\n" );
}
}
$cab1_pngfil=sprintf( "./ko_plans/imgs/%s_cab1_%s_%03d_%03d.png", $planid, $cab1, $step, $samps );
$cab1_pngfiles .= " $cab1_pngfil";
$cab1_tot_samps += $samps;
$im_cmd .= " $cabbottom_pngfil -append $cab1_pngfil ";
$im_cmd_status="";
$status=exec($im_cmd,$im_cmd_status);
if( $items_flag == "true" ) {
$cab1_output .= "<img class=\"drg\" src=$cab1_pngfil> $cab1_pngfil $samps<br>\n";
// printf( "MSG_2481: status=[$status] im_cmd=[$im_cmd] cab2_tot_samps=[$cab2_tot_samps]<hr>\n" );
}
}
$pdo=null;
$cab1beg_pngfile=sprintf( "./ko_plans/imgs/%s_cab1beg_%03d_%04d.png", $planid, $setp, $cab1_tot_samps );
// floats to top
// $im_cmd = "convert $cab1_pngfiles +append -gravity north $cab1beg_pngfile";
$im_cmd = "convert $cab1_pngfiles +append -gravity north $cab1beg_pngfile";
//// printf( "MSG_2432: cab1_tot_samps=[$cab1_tot_samps] im_cmd=[$im_cmd] cab1beg_pngfil=[$cab1beg_pngfil]<hr>\n" );
$status=exec($im_cmd,$im_cmd_status);
$cab1_output .= "MSG_2441: <img src=$cab1beg_pngfile border=0 alt=$cab1beg_pngfile><hr>cab1beg_pngfile=[$cab1beg_pngfile] cab1_tot_samps=[$cab1_tot_samps]<br>\n";
// $sql_cab="select distinct(cab) cab, group_concat( item, ' ' ) items, sum(amps) samps from ko_center where planid == 'plan1' group by cab";
$sql_cab2="select distinct(cab2) cab2, group_concat( item, ' ' ) items, sum(amps) samps from ko_plans where planid == 'plan1' and cab == cab2 group by cab2";
$cab2_output = "<hr><h1>cab2</h1><hr>\n";
$pdo = newpdo( $dbfile );
$j=0; $cab2_tot_samps=0; $cab2_pnglist="";
foreach( $pdo->query( $sql_cab2) as $row ) {
$j++;
foreach( $row as $key=>$val ) {
if( is_numeric( $key )) { continue; }
if( $key == 'cab2' ) { $cab2=$val; }
if( $key == 'items' ) { $cab2_items=$val; }
if( $key == 'samps' ) { $samps=$val; }
}
/// printf( "MSG_2460: $j cab2=[$cab2] cab2_items=[$cab2_items] cab2_samps=[$cab2_samps] cab2_pngfil=[$cab2_pngfil]<br>\n" );
$im_cmd = "convert $cabtop_pngfil ";
$items=explode( " ", $cab2_items );
foreach( $items as $item ) {
/// $item_pngfil="./imgs/cab/tn/tn_$item.png";
$item_pngfil="/ko_center/imgs/cab/$item.png";
$im_cmd .= " $item_pngfil";
//// if( file_exists( $item_pngfil )) {
//// printf( "MSG_2422: FOUND cab2 item=[$item] item_pngfil=[$item_pngfil]<br>\n" );
//// }
//// else {
//// printf( "MSG_2422: NOTFOUND cab2 item=[$item] item_pngfil=[$item_pngfil]<br>\n" );
//// }
}
$cab2_pngfil=sprintf( "./ko_plans/imgs/%s_cab2_%s_%03d_%03d.png", $planid, $cab2, $step, $samps );
$cab2_pngfiles .= " $cab2_pngfil";
$cab2_tot_samps += $samps;
/// printf( "bugs_1234 tot_samps=[$cab2_tot_samps] samps=[$samps]<br>\n" );
$im_cmd .= " $cabbottom_pngfil -append $cab2_pngfil ";
$im_cmd_status="";
$status=exec($im_cmd,$im_cmd_status);
if( $items_flag == 'true' ) {
$cab2_output .= "<img class=\"drg\" src=$cab2_pngfil> $cab2_pngfil $samps<br>\n";
/// printf( "MSG_2482: status=[$status] im_cmd=[$im_cmd] cab2_tot_samps=[$cab2_tot_samps]<hr>\n" );
}
}
$pdo=null;
$cab2beg_pngfile=sprintf( "./ko_plans/imgs/%s_cab2beg_%03d_%04d.png", $planid, $step, $cab2_tot_samps );
$im_cmd = "convert $cab2_pngfiles +append -gravity north $cab2beg_pngfile";
/// printf( "MSG_2432: cab2_tot_samps=[$cab2_tot_samps] im_cmd=[$im_cmd] cab2beg_pngfil=[$cab2beg_pngfil]<hr>\n" );
$status=exec($im_cmd,$im_cmd_status);
$cab2_output .= "<img class=\"drg\" src=$cab2beg_pngfile border=0 alt=$cab2beg_pngfile><hr>cab2beg_pngfile=[$cab2beg_pngfile] cab2_tot_samps=[$cab2_tot_samps]<br>\n";
$cab2_output .= "<hr><h2>cab2</h2><hr>\n";
$setup_output = "maxamp=[$maxamp] minamp=[$minamp]<hr>\n";
$setup_output .= $dropzone;
$reports_major=reports_menu("major");
$reports_minor=reports_menu("minor");
$output .= $setup_output . cab1_output . $cab2_output;
// $output = $setup_output . $reports_major . $zm_output . $cab1_output . $cab2_output . $reports_output_minor;
return( $output );
}
function reports_menu($code) {
if( $code == 'main' ) {
$output = "<h1>reports</h1>\n";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/defrag_fromcabs>defrag_fromcabs</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/defrag_fromcabs_sum>defrag_fromcabs_sum</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/defrag_tocabs>defrag_tocabs</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/defrag_tocabs_sum>defrag_tocabs_sum</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/defrag_plans>defrag_plans</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/defrag_plans_sum>defrag_plans_sum</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/defrag_plans_sumcab>defrag_plans_sumcab</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/defrag_plans_items>defrag_plans_items</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/defrag_plans_items_amps>defrag_plans_items_amps</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/defrag_plans_items_cab>defrag_plans_items_cab</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/defrag_plans_items_sum>defrag_plans_items_sum</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/defrag_plans_items_sumamps>defrag_plans_items_sumamps</a><br>";
$output .= "<br>\n";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/sm>sm</a><br>";
return( $output );
}
if( $code == 'minor' ) {
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/sm>sm</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/sm1>sm1</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/sm2>sm2</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/sm3>sm3</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/sm4>sm4</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/sm5>sm5</a><br>";
$output .= "<br>\n";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/jk>jk</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/jk1>jk1</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/jk2>jk2</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/jk3>jk3</a><br>";
$output .= "<a href=https://$http_host/$php_self?q=reports/sql/jk4>jk4</a><br>";
$reports_output_minor .= "<a href=https://$http_host/$php_self?q=reports/sql/jk5>jk5</a><br>";
return($output );
}
return( "" );
}
function ko_dcall($options) {
$output = "<h2>ko_center</h2>\n";
$output .= "<hr>\n";
return( $output );
}
function ko_leds($options) {
$output = "<h2>ko_center</h2>\n";
$output .= "<hr>\n";
return( $output );
}
function ko_pchart_pie($options) {
$output = "<h2>ko_pchart_pie</h2>\n";
$output .= "<hr>\n";
include("../pcharts/class/pData.class.php");
include("../pcharts/class/pDraw.class.php");
include("../pcharts/class/pPie.class.php");
include("../pcharts/class/pImage.class.php");
$q=$_REQUEST['q'];
$options=explode( "/", $_REQUEST['q'] );
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
$option3=$options[3];
$option4=$options[4];
$size="10";
$used="5";
$rptcode=$option3;
$progid="ko_center";
$dttm=date('Ymd_His');
$series_code="df_size";
$series_desc="dv_size";
$labels_list=array();
$labels_list[0]="used";
$labels_list[1]="free";
$labels_list[3]="other";
$series_values=array();
$series_values[0]="25";
$series_values[1]="50";
$series_values[2]="25";
// printf( "<hr>\n" );
// $last_line=passthru( 'df|grep var', $retval );
// $last_line=system( 'df|grep var', $retval );
// $path="/tmp";
// if( $option1 == "" ) { $option1=$path; };
// $path=$option1;
// $syscmd="df|grep '/var' 2>&1";
// $syscmd="df|grep '/tmp'";
// $syscmd="df|grep '/home' 2>&1";
// $syscmd="df|grep '/var'";
// $syscmd="df | grep '/var'";
// $syscmd="df | grep '/tmp'";
// $syscmd="df | grep ' $option1'";
// $last_line=passthru( $syscmd, $retval );
// $last_line=system( "df|grep var", $retval );
// $last_line_system=system( $syscmd, $retval );
/// $last_line_passthru=passthru( $syscmd, $retval );
// $last_line_exec=exec( $syscmd, $retval );
//// exec( $syscmd, $syslines, $retval );
//// $sysline=$syslines[0];
// $args=explode( " ", $sysline );
// print_r( $args );
// $explode_text=explode($sysline);
// $args=preg_explode('/ +/', $sysline );
// $total=$args[1];
// $used=$args[2];
// $avail=$args[3];
// $perc=$args[4];
// $path=$args[5];
//
// $host=$option1;
// $path=$option2;
// $used=$option3;
// $free=$option4;
$series_values[0]=$used;
$series_values[1]=$free;
$chart_title="$dttm $host /$path used=$used free=$free";
$dbfile="ko_center.db3";
$pngfil="../imgs/pchart/ko_pchart_pie.png";
$sql="select distinct(cab1) from ko_center where planid == 'plan1' limit 5";
$pdo = newpdo( $dbfile );
$j=0;
foreach( $pdo->query( $sql) as $row ) {
$j++;
foreach( $row as $key=>$val ) {
$series_values[$j]=$j;
$labels_list[$j]=$val;
// print( "$j row=[$row] key=[$key] val=[$val] labels_list=[$labels_list[$j]] [$series_values[$j]]<br>\n" );
}
}
$pdo=null;
// $jlim=$j;
// printf( "MSG_2490: pchart_pie pngfil=[$pngfil] chart_title=[$chart_title]<hr>\n" );
// printf( "MSG_2490: pchart_pie jlim=[$jlim] labels_list[$j] series_values=[$series_values]<hr>\n" );
// for( $j=0; $j<$jlim; $j++ ) {
// printf( "MSG_2491: pchart_pie j=[$j] series_values=[$series_values[$j]]<hr>\n" );
// printf( "MSG_2492: pchart_pie j=[$j] labels_list=[$labels_list[$j]] [$series_values[$j]]<hr>\n" );
// }
// return;
// $j=0;
// $testlines=explode( '\n', $syslines );
// printf( "testcount=[$testcount]<br>\n" );
// foreach( $testlines as $sysline ) {
// $j++;
// printf( "$j sysline=[$sysline]<br>\n" );
// }
//
// print_r( $syslines );
/* Create and populate the pData object */
$MyData = new pData();
// $MyData->addPoints(array(50,2,3,4,7,10,25,48,41,10,100,200,500),"ScoreA");
// $MyData->addPoints(array(0,2,3,4,7,10),"ko_ScoreA");
// $MyData->setSerieDescription("ko_ScoreA","ko_Application A");
// $MyData->addPoints(array(0,2,3,4,7,10),"$series_code");
// $MyData->addPoints(array(0,2,3,4,7,10),"$series_code");
$MyData->addPoints($series_values,"$series_code");
$MyData->setSerieDescription("$series_code","$series_desc");
/* Define the absissa serie */
// $MyData->addPoints(array("A0","B1","C2","D3","E4","K5","J9"),"Labels");
// $labels_list=array("total", "used", "other" );
// printf( "BUGS_1234 labels_list=[$labels_list]<hr>\n" );
// print_r( $labels_list );
// return;
$MyData->addPoints($labels_list,"Labels");
/// $MyData->addPoints(array( "ab01", "ab02", "ab03", "ab04", "ab05"),"Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(300,260,$MyData);
/* Draw a solid background */
$Settings = array("R"=>170, "G"=>183, "B"=>87, "Dash"=>1, "DashR"=>190, "DashG"=>203, "DashB"=>107);
$myPicture->drawFilledRectangle(0,0,300,300,$Settings);
/* Overlay with a gradient */
$Settings = array("StartR"=>219, "StartG"=>231, "StartB"=>139, "EndR"=>1, "EndG"=>138, "EndB"=>68, "Alpha"=>50);
$myPicture->drawGradientArea(0,0,300,260,DIRECTION_VERTICAL,$Settings);
$myPicture->drawGradientArea(0,0,300,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>100));
/* Add a border to the picture */
$myPicture->drawRectangle(0,0,299,259,array("R"=>0,"G"=>0,"B"=>0));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName"=>"../pChart/fonts/Silkscreen.ttf","FontSize"=>6));
$myPicture->drawText(10,13,$chart_title,array("R"=>255,"G"=>255,"B"=>255));
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName"=>"../pChart/fonts/Forgotte.ttf","FontSize"=>10,"R"=>80,"G"=>80,"B"=>80));
/* Create the pPie object */
$PieChart = new pPie($myPicture,$MyData);
/* Draw an AA pie chart */
$PieChart->draw3DPie(160,140,array("Radius"=>70,"DrawLabels"=>TRUE,"LabelStacked"=>TRUE,"Border"=>TRUE));
/* Write the legend box */
$myPicture->setShadow(FALSE);
$PieChart->drawPieLegend(15,40,array("Alpha"=>20));
/* Render the picture (choose the best way) */
// $myPicture->autoOutput("$pngfil");
$myPicture->autoOutput($pngfil);
return( $output );
}
function csv2db3( $csvfil, $delimiter ) {
// if( preg_match( "/index/i", $filename )) { continue; }
$html = "";
$html .= "<hr>\n";
$html .= "csvfil=[$csvfil] [$delimiter]<br>\n";
$html .= "<hr>\n";
$db3hdr="";
$db3dta="";
$row = 1;
// $delimiter=",";
// if (($handle = fopen("commplat_test_20120927.csv", "r")) !== FALSE) {
if (($handle = fopen($csvfil, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
echo "<p> $num fields in line $row: <br /></p>\n";
for ($c=0; $c < $num; $c++) {
$fld = $data[$c];
$fld = strtolower($fld);
$tmp=$fld;
$fld = str_replace( ",",";", $tmp );
$tmp=$fld;
$fld = str_replace( "|",":", $tmp );
$tmp=$fld;
$fld = str_replace( "\"", "", $tmp );
// echo $data[$c] . "<br />\n";
echo $data[$c] . "$delimiter";
if( $row == 1 ) {
$tmp=$fld;
$fld = str_replace( " ", "_", $tmp );
$db3hdr .= $fld . "$delimiter";
}
else {
$db3dta .= $fld . "$delimiter";
}
}
if( $row == 1 ) {
$db3hdr .= "\n";
}
else {
$db3dta .= "\n";
}
if( $row == 1 ) {
echo "db3hdr=[".$db3hdr."]<br>\n";
}
else {
echo "db3dta=[".$db3dta."]<br>\n";
}
// echo " db3hdr =[" . $db3hdr . "]   db3dta=[" . $db3dta . "]<br />\n";
$row++;
}
fclose($handle);
}
return( $html);
}
function leds_reports_sql( $options ) {
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
$option3=$options[3];
$dbfile=$GLOBALS['dbfile'];
if( ! file_exists( $dbfile )) {
print( "leds_reports_sql ERR_2370: NOTFOUND sql=[$sql] dbfile=[$dbfile] csvfil=[$csvfil]<hr>\n" );
return;
}
// print( "leds_reports_sql MSG_2380: o0=[$option0] [$option1] o2=[$option2] FOUND sql=[$sql] dbfile=[$dbfile] csvfil=[$csvfil]<hr>\n" );
/// phpinfo();
/// exit;
if( isset( $_POST['post_options'] )) {
$post_option=$_POST['post_option'];
$rptnum=$_POST['rptnum'];
$rptcode=$_POST['rptcode'];
$rptdesc=$_POST['rptdesc'];
$rptsql=$_POST['rptsql'];
$rpt_dbfile=$_POST['rpt_dbfile'];
$sqlfile=$_POST['sqlfile'];
$sqltext=$_POST['sqltext'];
$status=$_POST['status'];
$dttm=date("Ymd_His");
$savefile = str_replace( ".sql", "_$dttm.sql", $sqlfile );
$sqladd="";
if( file_exists( $sqlfile )) {
copy( $sqlfile, $savefile );
}
else {
$sqladd = "insert or replace into rpts (";
$sqladd .= "rptnum, rptcode, rptdesc, rptsql, ";
$sqladd .= "dbfile, sqlfile, outfile, status ";
$sqladd .= ") ";
$sqladd .= " values ( ";
$sqladd .= "\"$rptnum\", \"$rptcode\", \"$rptdesc\", \"$rptsql\", ";
$sqladd .= "\"$dbfile\", \"$sqlfile\", \"$outfile\", \"$status\" ); ";
// print( "<hr>sqladd=[$sqladd]<br />\n" );
printf( "BUGS_1234: sqladd=[$sqladd]<br>\n" );
$pdo = newpdo($GLOBALS['dbfile']);
// $pdo->exec($sqlupd);
$pdo->exec($sqladd);
$pdo->null;
$option2=$rptcode;
}
$fh = fopen( $sqlfile, 'w');
if( $fh != "" ) {
$status = fwrite( $fh, $sqltext );
}
fclose($fh);
/// $sql_insert="update table rpts
/// printf( "BUGS_2409: status=[$status] sqlfile=[$sqlfile] sqltext=[$sqltext] [$sqladd]<br>\n" );
// exit;
}
$rptcode=$option2;
$tblname="rpts";
$pdo = newpdo($dbfile);
$sql = "select * from $tblname where rptcode == '$rptcode'";
$result = $pdo->query($sql);
$collim = $result->columnCount();
$countrows = 1;
$output = "";
foreach( $pdo->query($sql) as $row ) {
$rptnum=$row['rptnum'];
$rptcode=$row['rptcode'];
$rptdesc=$row['rptdesc'];
$rptsql=$row['rptsql'];
$rpt_dbfile=$row['dbfile'];
$sqlfile=$row['sqlfile'];
$outfile=$row['outfile'];
$status=$row['status'];
//// printf( "$progid $rptnum][$rptcode][$rptdesc][$rptsql][$dbfile][$sqlfile][$outfile][$status]<br>\n" );
}
// print( "MSG_2405: rptcode=[$rptcode] [$sqlfile]<br>\n" );
$sqltext="";
if( file_exists( $sqlfile )) {
//// print( "MSG_2406: rptcode=[$rptcode] FOUND sqlfile=[$sqlfile]<br>\n" );
$fp = fopen( $sqlfile, 'r' );
while( $bigline = fread($fp, 1024)) {
$lines = explode("\n", $bigline );
for( $j=0; $j < count($lines); $j++ ) {
$line=$lines[$j];
$sqltext .= $line . "\n";
$sqlhtml .= $line . "<br>\n";
// printf( "$progid $dttm MSG:_2420: $j line=[$line] [$remote_addr]<br>\n" );
// if( preg_match( "/$remote_addr/", $line, $matches)) {
// $allowflag="true";
// $GLOBALS['allowflag']=$line;
// break;
// }
}
// printf( "$progid $dttm MSG_2640: sqltext=[$sqltext] line=[$line]<br>\n" );
}
// printf( "BUGS_2650: sqltext=[$sqltext]<br>\n" );
$html_sqltext = "";
$html_sqltext .= "<hr>";
// $html_sqltext .= "<pre>\n";
// printf( "BUGS_2420: [$contents] [$html_sqltext]<hr>\n" );
//// for( $j=0; $j < count($lines); $j++ ) {
//// $sqltext .= $lines[$j] . "\n";
//// $html_sqltext .= $lines[$j] . "<br>\n";
// printf( "$j $html_sqltext<br>\n" );
//// }
// $html_sqltext .= "</pre>\n";
$html_anchor_top = "<a name='top'> --- top --- </a>\n";
$html_anchor_bottom = "<a name='bottom'> --- bottom --- </a>\n";
$html_go2top_link = "<a href=\"#top\"><img src=\"/ko_center/imgs/btn/go2top.png\" border=0 width=25 alt=\"go2top\"></a>\n";
$html_go2bottom_link = "<a href=\"#bottom\"><img src=\"/ko_center/imgs/btn/go2bottom.png\" border=0 width=25 alt=\"go2bottom\"></a>\n";
/// $html .= $html_go2top_link;
//// $html_updform = sql_updform($rptcode, $sqlfile, $sqltext );
/// printf( "BUGS_2459: sqltext=[$sqltext]<br>\n" );
/// printf( "BUGS_2460: [$rptnum][$rptcode][$rptdesc][$rptsql][$dbfile][$sqlfile][$outfile][$status]\n" );
$html_updform = sql_updform($rptnum, $rptcode, $rptdesc, $rptsql, $rpt_dbfile, $sqlfile, $outfile, $status, $sqltext );
$html .= $html_anchor_top;
$html .= $html_go2bottom_link;
$report_options[0]="reports";
$report_options[1]="rpt";
$report_options[2]="$rptcode";
$html_report = leds_reports_rpt( $report_options );
$html .= $html_report;
$html .= "<hr>\n";
$html .= $html_sqltext;
$html .= $html_updform;
$html .= $html_anchor_bottom;
// $html .= $html_totop_link;
//// print( $html );
}
return($html);
$dttm=date("Ymd_His");
// $csvfile = "$url_dbcode"."_$url_table"."_$dttm.csv";
}
function leds_reports_csv( $dbfile, $sql, $csvfil ) {
$dbfile=$GLOBALS['dbfile'];
if( ! file_exists( $dbfile )) {
print( "leds_reports_csv ERR_3340: NOTFOUND sql=[$sql] dbfile=[$dbfile] csvfil=[$csvfil]<hr>\n" );
return;
}
$pdo = newpdo($dbfile);
// $sql = "select * from $url_table";
$result = $pdo->query($sql);
$collim = $result->columnCount();
$countrows = 1;
$output = "";
while($row = $result->fetch(PDO::FETCH_ASSOC)) {
if($countrows == 1) {
$csvhdr=join(",",array_keys($row)) . "\n";
// $output .= join(",", array_keys($row)) . "\n";
$output .= join(",", $row) ."\n";
}
else {
$output .= join(",", $row) ."\n";
}
$countrows++;
}
$pdo=null;
// print( "BUGS tblname=$tblname cols=$cols<br>\n" );
$dttm=date("Ymd_His");
// $csvfile = "$url_dbcode"."_$url_table"."_$dttm.csv";
// print( "__FUNCTION__=".__FUNCTION__."<br>\n" );
// $content_type = "Content-type: application/csv Content-Disposition: \"inline; filename=$csvfile\"";
// print( "$content_type\n" );
// header( "$content_type" );
$dbfile=$dbfiles[$url_dbcode][dbfile];
if( ! file_exists( $dbfile )) {
print( "pdo_unload ERR: NOTFOUND url_dbcode=[$url_dbcode] dbfile=[$dbfile]<hr>\n" );
return;
}
$pdo = newpdo($dbfile);
$sql = "select * from $url_table";
$result = $pdo->query($sql);
$collim = $result->columnCount();
$countrows = 1;
$output = "";
while($row = $result->fetch(PDO::FETCH_ASSOC)) {
if($countrows == 1) {
$csvhdr=join(",",array_keys($row)) . "\n";
// $output .= join(",", array_keys($row)) . "\n";
$output .= join(",", $row) ."\n";
}
else {
$output .= join(",", $row) ."\n";
}
$countrows++;
}
$pdo=null;
// print( "$output" );
// print( "BUGS tblname=$tblname cols=$cols<br>\n" );
$dttm=date("Ymd_His");
$csvfile = "$url_dbcode"."_$url_table"."_$dttm.csv";
// print( "__FUNCTION__=".__FUNCTION__."<br>\n" );
// $content_type = "Content-type: application/csv Content-Disposition: \"inline; filename=$csvfile\"";
// print( "$content_type\n" );
// header( "$content_type" );
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
// header("Content-Length: " . strlen($out));
header("Content-type: text/x-csv");
// header("Content-type: text/csv");
// header("Content-type: application/vnd.ms-excel");
// header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=$csvfile");
print( "$output" );
return;
}
function leds_reports_rpt( $options ) {
// printf( "BUGS_9900 $options[1] $options[2]<hr>\n" );
$dbfile=$GLOBALS['dbfile'];
$progid=$GLOBALS['progid'];
$php_self=$_SERVER['PHP_SELF'];
$pdo = newpdo($dbfile);
// $dbfile="s:/xampp/htdocs/ko_center/ko_center.db3";
// $dbfile="$document_root/ko_center/ko_center.db3";
$tblname="rpts";
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
$option3=$options[3];
if( isset( $_GET['fmt'] )) { $fmt=$_GET['fmt']; } else { $fmt=""; }
$output = "<h2>$php_self leds_reports_rpt MSG_3540: fmt=[$fmt] $dbfile $option1 $option2 $option3</h2>\n";
// printf( "BUGS_dbfile=[$dbfile] $option1 $option2 $option0<br>\n" );
if( $option2 == "" ) {
$output .= "<hr>\n";
// $output .= "<h3>$progid $dttm MSG_3350: rpts dbfile=[$dbfile] tblname=[$tblname][$rpt]</h3>\n";
$output .= "<table border=1>\n";
$output .= "<tr>\n";
$output .= "<td>rptnum</td>\n";
$output .= "<td>status</td>\n";
$output .= "<td>rpturl</td>\n";
$output .= "<td>csvurl</td>\n";
$output .= "<td>rptdesc</td>\n";
$output .= "<td>sqlfile</td>\n";
$output .= "<td>rptsql</td>\n";
$output .= "<td>dbfile</td>\n";
$output .= "<td>outfile</td>\n";
$output .= "</tr>\n";
$sql = "select * from $tblname";
foreach( $pdo->query($sql) as $row ) {
$rptnum=$row['rptnum'];
$rptcode=$row['rptcode'];
$rpturl="<a href=$php_self?q=reports/rpt/$rptcode>$rptcode</a>\n";
// $csvimg="<img src=imgs/btn/export.png height=40 border=0 target=_blank>";
$csvimg="<img src=imgs/btn/export.png height=20 border=0 target=_blank>";
$csvurl = "<a href=$php_self?q=reports/rpt/$rptcode&fmt=header_csv>";
$csvurl .= "$csvimg</a>\n";
$rptdesc=$row['rptdesc'];
$rptsql=$row['rptsql'];
$dbfile=$row['dbfile'];
$sqlfile=$row['sqlfile'];
$outfile=$row['outfile'];
$status=$row['status'];
$output .= "<tr>\n";
$output .= "<td>$rptnum</td>\n";
$output .= "<td>$status</td>\n";
$output .= "<td>$rpturl</td>\n";
$output .= "<td>$csvurl</td>\n";
$output .= "<td>$rptdesc</td>\n";
if( file_exists( $sqlfile )) {
$sqlurl="<a href=$php_self?q=reports/sql/$rptcode>$rptcode sqlfile</a>\n";
$output .= "<td>$sqlurl</td>\n";
}
else {
$output .= "<td>$sqlfile notfound</td>\n";
// printf( "BUGS_9962 NOTFOUnD sqlfile=[$sqlfile] <br>\n" );
}
$output .= "<td>$rptsql</td>\n";
$output .= "<td>$dbfile</td>\n";
$output .= "<td>$outfile</td>\n";
$output .= "</tr>\n";
}
$output .= "</table>\n";
$output .= "<hr>\n";
$pdo = null;
return( $output );
}
if( $option2 != "" ) {
$rptcode=$option2;
$sql = "select * from $tblname where rptcode='$rptcode'";
$output .= "<html><head><title>leds_dc_rpts detail rptcode=$rptcode o1=$option1 o2=$option2 </title></head>\n";
$output .= "<body bgcolor=lightblue>\n";
$output .= "<h2>leds_reports detail $rptcode </h2>\n";
// $output .= "<hr>sql=[$sql]<hr>\n";
$output .= "<div id=\"rpts\">\n";
// $output .= "<hr>\n";
$output .= "<table>\n";
$output .= "<tr>\n";
$output .= "<td>rptnum</td>\n";
$output .= "<td>status</td>\n";
$output .= "<td>rptcode</td>\n";
$output .= "<td>rptdesc</td>\n";
$output .= "<td>sqlfile</td>\n";
$output .= "<td>rptsql</td>\n";
$output .= "<td>dbfile</td>\n";
$output .= "<td>outfile</td>\n";
$output .= "</tr>\n";
/// $output .= "<hr>BUGS_2540: sqlfile=[$sqlfile] rptcode=[$rptcode] sql=[$sql] $dbfile=[$dbfile] tblname=[$tblname] $option0 o1=$option1 o2=$option2<hr>\n";
foreach( $pdo->query($sql) as $row ) {
$rptnum=$row['rptnum'];
$status=$row['status'];
$rptcode=$row['rptcode'];
$rptdesc=$row['rptdesc'];
$sqlfile=$row['sqlfile'];
$rptsql=$row['rptsql'];
$dbfile=$row['dbfile'];
$outfile=$row['outfile'];
/// $output .= "<hr>BUGS_2550: sqlfile=[$sqlfile] rptcode=[$rptcode] sql=[$sql] $dbfile=[$dbfile] tblname=[$tblname] $option0 o1=$option1 o2=$option2<hr>\n";
$output .= "<tr>";
$output .= "<td>$rptnum</td>";
$output .= "<td>$status</td>";
$output .= "<td>$rptcode</td>";
$output .= "<td>$rptdesc</td>";
$output .= "<td>$sqlfile</td>";
$output .= "<td>$rptsql</td>";
$output .= "<td>$dbfile</td>";
$output .= "<td>$outfile</td>";
$output .= "</tr>\n";
}
$output .= "</table>\n";
$pdo=null;
// $dbfile=$GLOBALS['dbfile'];
/// $output .= "<hr>BUGS_2560: sqlfile=[$sqlfile] rptcode=[$rptcode] sql=[$sql] $dbfile=[$dbfile] tblname=[$tblname] $option0 o1=$option1 o2=$option2<hr>\n";
if( $sqlfile != '' ) {
if( file_exists( $sqlfile )) {
// printf( "$progid $dttm MSG_10010: FOUND sqlfile=[$sqlfile]<br>\n" );
// return;
// $path_sqlfile="$document_root/ko_center/$sqlfile";
// printf( "BUG_10028 : sqlfile=[$sqlfile] path_sqlfile=[$path_sqlfile]<br>\n" );
$rptsql="";
// printf( "BUG_10029 : GOOD sqlfile=[$sqlfile] path_sqlfile=[$path_sqlfile]<br>\n" );
$fh = fopen( $sqlfile, 'r' );
//// $contents = fread( $fh, filesize($filename));
if( $fh ) {
$icnt=0;
while (( $irec = fgets( $fh, 4096)) !== false) {
$icnt++;
$rptsql .= $irec;
if( $option2 == '' ) {
print( "$progid $dttm MSG_3560: $icnt $irec<br>\n" );
}
}
/// if(!feof($fh)){
/// print( "<hr>$progid ERR_140: reading $sqlfile<hr>\n" );
/// }
}
fclose($fh);
}
}
// $fp = fopen( $sqlfile, "r" )
// || die "$progid $dttm ERR_10010; fopen sqlfile=[$sqlfile]<br>\n";
/// while(( $filetext = fgets($fp)) !== false ) {
/// $rptsql .= $filetext;
/// printf( "$progid $dttm MSG_10030: filetext=[$filetext]<br>\n" );
/// $rownum++;
/// }
// fclose($fp);
//// }
/// else {
/// printf( "$progid $dttm MSG_10037: NOTFOUND sqlfile=[$sqlfile]<br>\n" );
/// }
/// }
/// printf( "$progid $dttm MSG_10042: <pre>rptsql=[$rptsql]</pre><hr>\n" );
/// return;
// display headers
$dbfile=$GLOBALS['dbfile'];
try {
$pdo = newpdo($dbfile);
$stmt = $pdo->query($rptsql);
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$output .= "<table border=1>\n";
$output .= "<tr>\n";
if(! empty( $result )) {
foreach( $result as $key=>$val) {
$output .= "<td>$key</td>\n";
}
}
$output .= "</tr>\n";
$pdo = null;
}
catch(PDOException $e) { $output .= $e->getMessage(); }
// display details
try {
$fmt="header";
if( isset( $_GET['fmt'] )) { $fmt = $_GET['fmt']; }
$pdo = newpdo($dbfile);
$j=0;
$firsttime=1;
$htmhdr = "";
$htmdtl = "";
$htmout = "";
$csvhdr = "";
$csvdtl = "";
$csvout = "";
$dttm=date("Ymd_His");
$rowcnt = 0;
$csvfil=sprintf( "%s_%s_%s.csv", $progid, $rptcode, $dttm );
// printf( "$progid $dttm MSG_2655: csvfil=[$csvfil] rptsql=[$rptsql] fmt=[$fmt] rowcnt=[$rowcnt]<br>\n" );
// $output .= "$progid $dttm MSG_2655: rptsql=[$rptsql] fmt=[$fmt] rowcnt=[$rowcnt]<br>\n";
$output .= "<tr>\n";
// orig foreach( $pdo->query($rptsql) as $row ) {
foreach( $pdo->query($rptsql) as $rowkey ) {
$rowcnt++;
// get field names
if( $firsttime == 1 ) {
$htmhdr = "<tr>";
$csvhdr = "";
}
$htmdtl .= "<tr>\n";
$colcnt = 0;
$csvrow = "";
foreach( $rowkey as $key=>$val ) {
// skip numeric columns
if( is_numeric( $key )) { continue; }
$colcnt++;
$val=$rowkey[$key];
$output .= "<td>$j key=$key val=$val</td>";
// $output .= "<td>$val</td>\n";
if( $firsttime == 1 ) {
$htmhdr .= "<td>$key</td>\n";
$csvhdr .= "$key,";
// printf( "BUGS_3670_1 $firsttime [$rowcnt][$colcnt]: csvdtl=[$csvdtl] val=[$val] key=[$key] rowkey=[$rowkey]<br>\n" );
}
else {
// check if fieldname contains _png for image output
$pngimg=key2png( $key, $val );
if( $pngimg == "" ) {
$htmdtl .= "<td>$val</td>";
}
else {
$htmdtl .= "<td>$pngimg</td>";
}
$csvrow .= "$val,";
$csvdtl .= "$val,";
// printf( "BUGS_3670_2 $firsttime [$rowcnt][$colcnt]: csvrow=[$csvrow] csvdtl=[$csvdtl]<br>\n" );
}
// printf( "BUGS_3671 [$rowcnt][$colcnt]: csvrow=[$csvrow] csvdtl=[$csvdtl] val=[$val] key=[$key] rowkey=[$rowkey]<br>\n" );
}
// printf( "BUGS_3685 [$rowcnt][$colcnt]: csvrow=[$csvrow] csvdtl=[$csvdtl] val=[$val] key=[$key] rowkey=[$rowkey]<br>\n" );
if( $firsttime == 1 ) {
$htmhdr .= "</tr>\n";
$csvhdr .= "\n";
$firsttime=0;
}
$htmdtl .= "</tr>\n";
$csvdtl .= "\n";
$output .= "\n";
}
// $htmout .= "</table>\n";
// $output .= "</table>\n";
// $csvout .= "\n";
$pdo=null;
}
catch(PDOException $e) { $output .= $e->getMessage(); }
// printf( "$prog $dttm MSG_2730: csvhdr=[$csvhdr] fmt=[$fmt]<br>\n" );
// printf( "$prog $dttm MSG_2730: csvdtl=[$csvdtl] fmt=[$fmt] csvfile=[$csvfil]<br>\n" );
// return;
$hdr_mask = "noheader";
// if( preg_match( "/$hdr_mask/", $fmt )) {
$matches="";
if( preg_match( "/noheader/", $fmt, $matches )) {
/// printf( "NOHEADERS_3580 [$fmt][csv][$csvfil]<hr>\n" );
$csvout = "";
$csvout .= $csvdtl;
$htmout .= "<table>\n";
$htmout .= "$htmdtl\n";
$htmout .= "</table>\n";
}
else {
/// printf( "HEADERS_3580 [$fmt][csv][$csvfil]<hr>\n" );
$csvout = "";
$csvout .= "$progid,$dttm,$csvfil\n";
$csvout .= $csvhdr;
$csvout .= $csvdtl;
$htmout .= "<table>\n";
$htmout .= $htmhdr;
$htmout .= $htmdtl;
$htmout .= "</table>\n";
}
if( preg_match( "/csv/", $fmt, $matches )) {
// printf( "$progid $dttm MSG_3690: dbfile=$dbfile sql=$sql csvfil=[$csvfil]<hr>\n" );
// leds_reports_csv( $dbfile, $sql, $csvfil );
// return;
$dttm=date("Ymd_His");
$progid=$GLOBALS['progid'];
$version=$GLOBALS['version'];
$csvfil = sprintf( "%s_%s_%s.csv", $progid, $rptcode, $dttm );
// printf( "BUGS_2770: csvfil=[$csvfil]<br>\n" );
// print( "__FUNCTION__=".__FUNCTION__."<br>\n" );
// printf( "NOHEADERS_3580 [$fmt][csv][$csvfil]<hr>\n" );
// return;
// $content_type = "Content-type: application/csv Content-Disposition: \"inline; filename=$csvfile\"";
// printf( "BUG_2310: csvfil=[$csvfil] <br>\n" );
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$csvfil\";" );
header("Content-Transfer-Encoding: binary");
print( $csvout );
exit;
// print( "a,b,c,jk,sk\n" );
// print( $csvout );
// print( $csvhdr );
// print( $csvdtl );
// return( "" );
}
else {
$csvimg="<img src=imgs/btn/export.png height=30 border=0 target=_blank>";
$csvurl = "<a href=$php_self?q=reports/rpt/$rptcode&fmt=header_csv>";
$csvurl .= "$csvimg</a>\n";
$htmout .= "<hr>$csvurl<hr>\n";
return( $htmout );
}
printf( "<hr>$prog $dttm MSG_3600: fmt=[$fmt]<hr>\n" );
return;
}
$output .= "$progid $dttm ERR UNSUPPORTED_7545: leds_kb_rpts o0=$option0 o1=$option1 o2=$option2<br>\n";
return;
}
function im_identify( $filemask ) {
//// $im_identifys_mask="imgs/cab/dd29*.png";
//// $cmdtext=`identify $im_identifys_mask`;
$cmdtext=`identify $filemask`;
$lines = explode( "\n", $cmdtext );
foreach( $lines as $line ) {
$flds_im = explode( " ", $line );
$im_filename=$flds_im[0];
$im_type=$flds_im[1];
$im_dim=$flds_im[2];
$im_loc=$flds_im[3];
$im_bit=$flds_im[4];
$im_class=$flds_im[5];
$im_colors=$flds_im[6];
$im_size=$flds_im[7];
$flds_im_dim = explode( "x", $im_dim );
$im_width=$flds_im_dim[0];
$im_height=$flds_im_dim[1];
$flds_im[8]=$im_width;
$flds_im[9]=$im_height;
// printf( "BUGS_160: im_width=[$im_width] im_height=[$im_height]<br>\n" );
// printf( "BUGS_160: im_filename=[$im_filename]<br>\n" );
// printf( "BUGS_160: im_type=[$im_type]<br>\n" );
// printf( "BUGS_160: im_dim=[$im_dim]<br>\n" );
// printf( "BUGS_160: im_loc=[$im_loc]<br>\n" );
// printf( "BUGS_160: im_bit=[$im_bit]<br>\n" );
// printf( "BUGS_160: im_class=[$im_class]<br>\n" );
// printf( "BUGS_160: im_colors=[$im_colors]<br>\n" );
// printf( "BUGS_160: im_size=[$im_size]<br>\n" );
// printf( "BUGS_160: width_height=[$width_height]<br>\n" );
return( $flds_im );
}
return( "" );
}
function key2png( $key, $val ) {
$matches = "";
$pngurl="";
$width="";
if(( preg_match( "/item_png/", $key, $matches ))
|| ( preg_match( "/cab_png/", $key, $matches ))
|| ( preg_match( "/cab1_png/", $key, $matches ))
|| ( preg_match( "/cab2_png/", $key, $matches ))) {
$pngfil = sprintf( "/ko_center/imgs/cab/tn/tn_%s.png", $val );
$pngfil_null = sprintf( "/ko_center/imgs/cab/tn/tn_%s_null.png", $key );
$pngfil_empty = sprintf( "/ko_center/imgs/cab/tn/tn_%s_empty.png", $key );
$width="";
if( preg_match( "/_full/", $key )) {
$width="";
$pngfil = sprintf( "/ko_center/imgs/cab/%s.png", $val );
$pngfil_null = sprintf( "/ko_center/imgs/cab/%s_null.png", $key );
$pngfil_empty = sprintf( "/ko_center/imgs/cab/%s_empty.png", $key );
}
if( preg_match( "/_larg/", $key )) {
$width="width=75";
$pngfil = sprintf( "/ko_center/imgs/cab/%s.png", $val );
$pngfil_null = sprintf( "/ko_center/imgs/cab/%s_null.png", $key );
$pngfil_empty = sprintf( "/ko_center/imgs/cab/%s_empty.png", $key );
}
if( preg_match( "/_big/", $key )) {
$pngfil = sprintf( "/ko_center/imgs/cab/%s.png", $val );
$pngfil_null = sprintf( "/ko_center/imgs/cab/%s_null.png", $key );
$pngfil_empty = sprintf( "/ko_center/imgs/cab/%s_empty.png", $key );
$width="width=50";
}
if( preg_match( "/_small/", $key )) {
$width="width=25";
}
if( preg_match( "/_tiny/", $key )) {
$width="width=10";
}
if( file_exists( $pngfil )) {
$im_flds=im_identify( $pngfil );
$png_color=$im_flds[6];
$png_width=$im_flds[8];
$png_height=$im_flds[9];
$alt="alt=\"$png_width $png_height $png_color\"";
$pngimg="<img src=$pngfil border=0 $alt $width >";
$pngurl="<a href=https://$http_host$php_self?q=png/$key/$val>";
$pngurl .= $pngimg;
$pngurl .= "</a>\n";
// printf( "BUGS_2921: pngurl=[$pngurl] key=[$key] val=[$val]<br>\n" );
}
else {
$pngurl_null = "<img src=$pngfil_null border=0 alt=$val $width >";
$pngurl = $pngurl_null;
// printf( "BUGS_2941: $pngfil_null pngurl_null=[$pngurl_null] key=[$key] val=[$val]<br>\n" );
$pngurl_empty = "<img src=$pngfil_empty border=0 alt=$val $width >";
$pngurl = $pngurl_empty;
// printf( "BUGS_2942: $pngfil_empty pngurl_empty=[$pngurl_empty] key=[$key] val=[$val]<br>\n" );
$pngurl = $pngurl_empty;
if( preg_match( "empty", $key )) { $pngurl = $pngurl_empty; }
if( preg_match( "null", $key )) { $pngurl = $pngurl_null; }
if( preg_match( "text" )) { $pngurl = "$val"; }
}
return( $pngurl );
}
return( "" );
}
function sql_updform($rptnum, $rptcode, $rptdesc, $rptsql, $rpt_dbfile, $sqlfile, $outfile, $status, $sqltext ) {
// $sqlurl="<a href=$php_self?q=reports/sqlupd/$rptcode>$rptcode sqlfile</a>\n";
// printf( "BUGS sqlurl=[$sqlurl]<br>\n" );
// $output .= "<td>$sqlurl</td>";
// $output .= sql_updform($sqlfile);
// printf( "BUGS_9961 FOUND sqlfile= $sqlfile<br>\n" );
/// $url_sqlupd = "<a href=$php_self?q=reports/rpt/upd/$rptcode>sqlupd</a>\n";
// $url_sqlundo = "<a href=$php_self?q=reports/rpt/undo/$rptcode>sqlundo</a><br>\n";
$html = "<hr>\n";
//// $html .= "MSG_2940: sqltext=[$sqltext] sqlfile=[$sqlfile]<br>\n";
$html .= "$url_sqlupd       $url_sqlundo<br>\n";
$html .= "<hr>\n";
$html_form = "<form method=\"post\" action=\"$php_self?q=reports/sql/$rptcode\" enctype=\"multipart/form-data\">\n";
$html_form .= "<input type=\"submit\" name=\"update\" value=\"update\"/>\n";
$html_form .= "<input type=\"reset\"/>\n";
$html_form .= "<input type=\"submit\" name=\"undo\" value=\"undo\"/>\n";
$html_form .= "<br>\n";
$html_form .= "<table>\n";
$html_form .= "<tr>\n";
$html_form .= "<td>rptnum:</td><td> <input type=\"text\" name=\"rptnum\" value=\"$rptnum\"></td>\n";
$html_form .= "<td>rptcode:</td><td> <input type=\"text\" name=\"rptcode\" value=\"$rptcode\"></td>\n";
$html_form .= "<td>rptdesc:</td><td> <input type=\"text\" name=\"rptdesc\" value=\"$rptdesc\"><td>\n";
$html_form .= "</tr>\n";
$html_form .= "<tr>\n";
$html_form .= "<td>rptsql:</td><td><input type=\"text\" name=\"rptsql\" value=\"$rptsql\"></td>\n";
$html_form .= "<td>dbfile:</td><td><input type=\"text\" name=\"rpt_dbfile\" value=\"$rpt_dbfile\"></td>\n";
$html_form .= "<td>   </td><td>   </td>\n";
$html_form .= "</tr>\n";
$html_form .= "<tr>\n";
$html_form .= "<td>sqlfile:</td><td><input type=\"text\" name=\"sqlfile\" value=\"$sqlfile\"></td>\n";
$html_form .= "<td>   </td><td>   </td>\n";
$html_form .= "<td>   </td><td>   </td>\n";
$html_form .= "</tr>\n";
$html_form .= "</table>\n";
$html_form .= "<textarea rows=\"20\" cols=\"80\" name=\"sqltext\">$sqltext</textarea><br/>\n";
## $html_form .= "<input type=\"hidden\" name=\"rptcode\" value=\"$rptcode\"/>\n";
## $html_form .= "        \n";
## $html_form .= "<input type=\"hidden\" name=\"rptnum\" value=\"$rptnum\"/>\n";
## $html_form .= "<input type=\"hidden\" name=\"sqlfile\" value=\"$sqlfile\"/>\n";
## $html_form .= "<input type=\"hidden\" name=\"sqltext\" value=\"$sqltext\"/>\n";
$html_form .= "<input type=\"hidden\" name=\"post_options\" value=\"upd\"/>\n";
$html_form .= "<input type=\"hidden\" name=\"query_string\" value=\"$query_string\"/>\n";
$html_form .= "<input type=\"hidden\" name=\"uploaded_loos\" value=\"'". $globals['uploaded']."'\"/>\n";
$html_form .= "<input type=\"submit\" name=\"update\" value=\"update\"/>\n";
$html_form .= "<input type=\"reset\"/>\n";
$html_form .= "<input type=\"submit\" name=\"undo\" value=\"undo\"/>\n";
if(( isset( $_SESSION['role'] )) && ( ! $_SESSION['role'] == "" )) {
$html .= $html_form;
}
$html_go2top_link .= "<a href=\"#top\"><img src=\"/ko_center/imgs/btn/go2top.png\" border=0 width=25 alt=\"go2top\"></a>\n";
$html_go2bottom_link .= "<a href=\"#bottom\"><img src=\"/ko_center/imgs/btn/go2bottom.png\" border=0 width=25 alt=\"go2bottom\"></a>\n";
$html .= $html_go2top_link;
return( $html );
}
function pchart_pie( $options ) {
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
$fld=$_GET['fld'];
$tblname="plans";
$sqldb="ko_center.db3";
$html= "pchart_pie_beg: fld=[$fld] [$option1][$option2][$option3]<br>\n";
$planid="plan1";
$sql = "select cab from $tblname where planid == '$planid'";
printf( "pchart_pie MSG_3210: sql=[$sql] [$sqldb]<br>\n" );
$pdo = newpdo($sqldb);
foreach( $pdo->query($sql) as $row ) {
printf( "BUGS__3228: $rpt_cabs row=[$row]<br>\n" );
$rpt_cabs=$row['cabs'];
$html .= "<tr>";
$html .= "<td>$rpt_cabs</td>";
$html .= "</tr>\n";
}
$html .= "</table>\n";
$html .= "</div>\n";
$pdo=null;
$html= "pchart_pie_end: fld=[$fld] [$option1][$option2][$option3]<br>\n";
return( $html);
/* Create and populate the pData object */
$MyData = new pData();
// $MyData->addPoints(array(50,2,3,4,7,10,25,48,41,10,100,200,500),"ScoreA");
// $MyData->addPoints(array(0,2,3,4,7,10),"ko_ScoreA");
// $MyData->setSerieDescription("ko_ScoreA","ko_Application A");
// $MyData->addPoints(array(0,2,3,4,7,10),"$series_code");
// $MyData->addPoints(array(0,2,3,4,7,10),"$series_code");
$MyData->addPoints($series_values,"$series_code");
$MyData->setSerieDescription("$series_code","$series_desc");
/* Define the absissa serie */
// $MyData->addPoints(array("A0","B1","C2","D3","E4","K5","J9"),"Labels");
// $labels_list=array("total", "used", "other" );
$MyData->addPoints($labels_list,"Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(300,260,$MyData);
/* Draw a solid background */
$Settings = array("R"=>170, "G"=>183, "B"=>87, "Dash"=>1, "DashR"=>190, "DashG"=>203, "DashB"=>107);
$myPicture->drawFilledRectangle(0,0,300,300,$Settings);
/* Overlay with a gradient */
$Settings = array("StartR"=>219, "StartG"=>231, "StartB"=>139, "EndR"=>1, "EndG"=>138, "EndB"=>68, "Alpha"=>50);
$myPicture->drawGradientArea(0,0,300,260,DIRECTION_VERTICAL,$Settings);
$myPicture->drawGradientArea(0,0,300,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>100));
/* Add a border to the picture */
$myPicture->drawRectangle(0,0,299,259,array("R"=>0,"G"=>0,"B"=>0));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName"=>"../pChart/fonts/Silkscreen.ttf","FontSize"=>6));
$myPicture->drawText(10,13,$chart_title,array("R"=>255,"G"=>255,"B"=>255));
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName"=>"../pChart/fonts/Forgotte.ttf","FontSize"=>10,"R"=>80,"G"=>80,"B"=>80));
/* Create the pPie object */
$PieChart = new pPie($myPicture,$MyData);
/* Draw an AA pie chart */
$PieChart->draw3DPie(160,140,array("Radius"=>70,"DrawLabels"=>TRUE,"LabelStacked"=>TRUE,"Border"=>TRUE));
/* Write the legend box */
$myPicture->setShadow(FALSE);
$PieChart->drawPieLegend(15,40,array("Alpha"=>20));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("../imgs/pchart/ko_draw3DPie_labels.png");
}
function hw($options) {
$item=$options[1];
$tblname="ko_hw";
$cabid= str_replace( "cab_", "", $option1);
$sql = "select * from $tblname where item like '%$item%'";
// print( "$php_self MSG_2000: option1=[$option1] tblname=[$tblname] sql=[$sql]<br>\n");
$collim=8;
$collim=24;
$colnum=1;
$html .= html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show($options);
$pdo = newpdo($GLOBALS['dbfile']);
$led_output = "<table>\n";
$led_output .= "<tr>\n";
$led_output .= "<td>cab</td>\n";
$led_output .= "<td>model</td>\n";
$led_output .= "<td>sn</td>\n";
$led_output .= "<td>hrc_tag</td>\n";
$led_output .= "<td>u_position</td>\n";
$led_output .= "<td>network</td>\n";
$led_output .= "<td>cpumem</td>\n";
$led_output .= "<td>amps</td>\n";
$led_output .= "<td>rpdu_outlets</td>\n";
$led_output .= "<td>rpdu_bank</td>\n";
$led_output .= "<td>switch</td>\n";
$led_output .= "<td>port</td>\n";
$led_output .= "<td>old_rowname</td>\n";
$led_output .= "</tr>\n";
foreach( $pdo->query($sql) as $row ) {
$item=$row['item'];
$item_png="/ko_center/imgs/cab/$item.png";
// printf( "BUGS_3220 item=[$item] item_png=$item_png<br>\n" );
// cab|zone|grp|vendor|item|cab1|zone1|grp1|btu|watts|amps|vac|height|width|depth|weight|spectext
$servers = $row['servers'];
$switch = $row['switch'];
$port = $row['port'];
$old_rowname = $row['old_rowname'];
$cab = $row['cab'];
$u_position = $row['u_position'];
$model = $row['model'];
$cpumem = $row['cpumem'];
$hrc_tag = $row['hrc_tag'];
$sn = $row['sn'];
$rpdu_outlet = $row['rpdu_outlet'];
$rpdu_bank = $row['rpdu_bank'];
$amps = $row['amps'];
// $led_output =
// 'cab=' . $cab . "   \n" .
// 'u_position=' . $u_position . "   \n" .
// 'network=' . $network . "   \n" .
// 'model=' . $model . "  \n" .
// 'cpumem=' . $cpumem . "   \n" .
// 'hrc_tag=' . $hrc_tag . "   \n" .
//// 'sn=' . $sn . "  \n" .
// 'rpdu_outlet=' . $rpdu_outlet . "<br>\n" .
// 'amps=' . $amps . "<br>\n" .
// 'rpdu_bank=' . $rpdu_bank ."<br>\n" .
// 'servers=' . $servers .
// 'switch=' . $switch .
// 'port=' . $port .
// 'old_rowname=' . $old_rowname .
// '<br>\n";
//// printf( "BUGS_3250 item=[$item] item_png=[$item_png]<br>\n" );
$item_url="<a href=https://$http_host/$php_self?q=hw/item='$item'><img src=$item_png border=0></a>\n";
$led_output .= "<tr>\n";
$led_output .= "<td>$item_url</td>\n";
$led_output .= "<td><a href=$php_self?q=hw&cab='$cab'>$cab</a></td>\n";
$led_output .= "<td><a href=$php_self?q=hw&item='$item'>$item</a></td>\n";
$led_output .= "<td><a href=$php_self?q=hw&sn='$sn'>$sn</a></td>\n";
$led_output .= "<td><a href=$php_self?q=hw&ip='$ip'>$ip</a></td>\n";
$led_output .= "<td><a href=$php_self?q=hw&machinename='$machinename'>$machinename</a></td>\n";
$led_output .= "<td><a href=$php_self?q=hw&hrctag='$hrctag'>$hrctag</a></td>\n";
$led_output .= "<td>$u_position</td>\n";
$led_output .= "<td>$network</td>\n";
$led_output .= "<td>$cpumem</td>\n";
$led_output .= "<td>$amps</td>\n";
$led_output .= "<td>$rpdu_outlets</td>\n";
$led_output .= "<td>$rpdu_bank</td>\n";
$led_output .= "<td>$switch</td>\n";
$led_output .= "<td>$port</td>\n";
$led_output .= "<td>$old_rowname</td>\n";
$led_output .= "</tr>\n";
$html .= $led_output;
}
$html .= "</table>\n";
print( $html );
}
function kbwrite( $kbfil, $kbrec ) {
// $fh = fopen( $kbfil, 'a+');
$fh = fopen( $kbfil, 'w');
/// print( "<hr>$progid $dttm BUGS_1180: fh=[$fh] status=[$status] logrec=[$logrec] logfil=[$logfil]<hr>\n" );
if( $fh != "" ) {
$status = fwrite( $fh, $kbrec );
$status = fwrite( $fh, "\n" );
fclose($fh);
}
}
function logwrite( $logfil, $logrec ) {
$fh = fopen( $logfil, 'a+');
// print( "<hr>$progid $dttm BUGS_4660: logfil=[$logfil] fh=[$fh] status=[$status] logrec=[$logrec] logfil=[$logfil]<hr>\n" );
if( $fh != "" ) {
$status = fwrite( $fh, $logrec );
fclose($fh);
}
}
function logdump( $logfil ) {
$fh = fopen( $logfil, 'r' );
// $contents = fread( $fh, filesize($filename));
if( $fh ) {
$icnt=0;
while (( $irec = fgets( $fh, 4096)) !== false) {
$icnt++;
print( "$icnt $irec<br>\n" );
}
if(!feof($fh)){
print( "<hr>$progid ERR_140: reading $logfil<hr>\n" );
}
}
fclose($fh);
/// print( "<hr>BUGS_145 contents=[$contents]<hr>\n" );
}
// list knowledgebase subddir
function kb_ls( $options, $path ) {
// kb_ls.php
//
// open this directory
// printf( "$progid $dttm kb_ls BUGS_1264: path=[$path]<br>\n" );
// $myDirectory = opendir(".");
/// $path="./uss";
/// $path="/home/ko/hpx";
$myDirectory = opendir("$path");
while($entryName = readdir($myDirectory)) { $dirArray[] = $entryName; }
closedir($myDirectory);
// count elements in array
$indexCount = count($dirArray);
$indexCount2=$indexCount-2;
/// Print ("please wait<br>");
// sort 'em
sort($dirArray);
// $option0=$options[0];
// $option1=$options[1];
// $option2=$options[2];
// $option3=$options[3];
// $option4=$options[4];
$html_ls = "";
$html_ls .= "<h2>path=$path o1=[$o1] o2=[$o2] o3=[$o3]</h2>\n";
$html_ls .= "<TABLE border=1 cellpadding=5 cellspacing=0 class=whitelinks>\n";
$html_ls .= "<tr><th>Filename</th><th>Filetype</th><th>Filesize</th></tr>\n";
// print("<TABLE border=1 cellpadding=5 cellspacing=0 class=whitelinks>\n");
// print("<TR><TH>Filename</TH><th>Filetype</th><th>Filesize</th></TR>\n");
// $GLOBALS['kb_rootpath'] = "$document_root/ko_center/kb";
$kb_rootpath = $GLOBALS['kb_rootpath'];
$document_root=$_SERVER['DOCUMENT_ROOT'];
// $kb_localpath = str_replace( $document_root, "", $kb_rootpath, $count );
$kb_localpath = str_replace( $document_root, "", $path, $count );
/// printf( "<h2>kb_localpath=[$kb_localpath] document_root=[$document_root] kb_rootpath=[$kb_rootpath] path=[$path]</h2>\n" );
// loop through the array of files and print them all
for($index=0; $index < $indexCount; $index++) {
if (substr("$dirArray[$index]", 0, 1) != "."){ // don't list hidden files
$filename=$dirArray[$index];
// if( preg_match( "index", "$dirArray[$index]" )) {
if( preg_match( "/index/i", $filename )) { continue; }
if( preg_match( "/php/i", $filename )) { continue; }
// $html_ls .= "<tr><td><a href=\"$kb_rootpath/$dirArray[$index]\">$dirArray[$index]</a></td>";
$html_ls .= "<tr><td><a href=\"$kb_localpath/$dirArray[$index]\">$dirArray[$index]</a></td>";
$html_ls .= "<td>";
$html_ls .= filetype($dirArray[$index]);
$html_ls .= "</td>";
$html_ls .= "<td>";
$html_ls .= filesize($dirArray[$index]);
$html_ls .= "</td>";
$html_ls .= "</TR>\n";
// print("<TR><TD><a href=\"$dirArray[$index]\">$dirArray[$index]</a></td>");
// print("<td>");
// print(filetype($dirArray[$index]));
// print("</td>");
// print("<td>");
// print(filesize($dirArray[$index]));
// print("</td>");
// print("</TR>\n");
}
}
$html_ls .= "</table>\n";
// printf( "$progid $dttm ko_ls BUGS_1234: path=[$path] html_ls=[$html_ls]<br>\n" );
// print( "$html" );
return( $html_ls );
}
function ko_ls( $options, $path ) {
// ko_ls.php
//
// open this directory
/// printf( "$progid $dttm ko_ls BUGS_1234: path=[$path]<br>\n" );
// $myDirectory = opendir(".");
/// $path="./uss";
/// $path="/home/ko/hpx";
$myDirectory = opendir("$path");
while($entryName = readdir($myDirectory)) { $dirArray[] = $entryName; }
closedir($myDirectory);
// count elements in array
$indexCount = count($dirArray);
$indexCount2=$indexCount-2;
Print ("please wait<br>");
// sort 'em
sort($dirArray);
$html_ls = "";
$html_ls .= "<h2>path=$path</h2>\n";
$html_ls .= "<TABLE border=1 cellpadding=5 cellspacing=0 class=whitelinks>\n";
$html_ls .= "<tr><th>Filename</th><th>Filetype</th><th>Filesize</th></tr>\n";
// print("<TABLE border=1 cellpadding=5 cellspacing=0 class=whitelinks>\n");
// print("<TR><TH>Filename</TH><th>Filetype</th><th>Filesize</th></TR>\n");
// loop through the array of files and print them all
for($index=0; $index < $indexCount; $index++) {
if (substr("$dirArray[$index]", 0, 1) != "."){ // don't list hidden files
$filename=$dirArray[$index];
// if( preg_match( "index", "$dirArray[$index]" )) {
if( preg_match( "/index/i", $filename )) { continue; }
if( preg_match( "/php/i", $filename )) { continue; }
$html_ls .= "<tr><td><a href=\"uss/$dirArray[$index]\">$dirArray[$index]</a></td>";
$html_ls .= "<td>";
$html_ls .= filetype($dirArray[$index]);
$html_ls .= "</td>";
$html_ls .= "<td>";
$html_ls .= filesize($dirArray[$index]);
$html_ls .= "</td>";
$html_ls .= "</TR>\n";
// print("<TR><TD><a href=\"$dirArray[$index]\">$dirArray[$index]</a></td>");
// print("<td>");
// print(filetype($dirArray[$index]));
// print("</td>");
// print("<td>");
// print(filesize($dirArray[$index]));
// print("</td>");
// print("</TR>\n");
}
}
$html_ls .= "</table>\n";
// printf( "$progid $dttm ko_ls BUGS_1234: path=[$path] html_ls=[$html_ls]<br>\n" );
// print( "$html" );
return( $html_ls );
}
function koaac_kb_new_form( $options ) {
$php_self=$_SERVER['PHP_SELF'];
$query_string=$_SERVER['QUERY_STRING'];
$user=$_POST['user'];
$pass=$_POST['pass'];
$step=$_POST['step'];
$tblname=$GLOBALS['tblname'];
$led_name=$options[1];
$kb_name=$options[1];
$kb_dttm=date("Y-m-d H:i:s");
$kb_remote_addr=$_SERVER['REMOTE_ADDR'];
$kb_referer=$_SERVER['REFERER'];
$kb_remote_port=$_SERVER['REMOTE_PORT'];
$kb_user=$GLOBALS['kb_user'];
$kb_host=$kb_referer;
$kb_ip=$kb_remote_addr;
$kb_org="kb_org";
$kb_os="kb_os";
$kb_grp="kb_grp";
$kb_sys="kb_sys";
$kb_cat="kb_cat";
// printf( "BUGS_1807<hr>\n" );
// leds_show();
// $html_btn_squares=&html_btn_squares();
$html = "";
$html .= html_header($options);
// $html .= $html_btn_squares;
$html .= html_btn_squares();
$html .= leds_show();
$html .= html_kb_links($options);
// $option5=$options[5];
// $user_kbid=$option5;
// print_r( $options );
// printf( " $progid $dttm BUGS_1176: kbid=[%s] [$kbid] user_kbid=[$user_kbid] option5=[%s][$option5] options5[%s] <br>\n",
// $kbid, $option5, $options[5] );
// $url_kbid=$options[4];
$url_kbid=$options[3];
// printf( "koaac_kb_new MSG_1627: BEG url_kbid=[%s] kbid=[%s] o1=[%s] o2=[%s] o3=[%s] o4=[%s] o5=[%s]<br>\n",
// $url_kbid, $options[0], $options[1], $options[2], $options[3], $options[4], $options[5] );
if( $url_kbid != "" ) {
printf( "koaac_kb_new MSG_1170: MOD url_kbid=[%s] o1=[%s] o2=[%s] o3=[%s] o4=[%s] o5=[%s]<br>\n",
$url_kbid, $options[0], $options[1], $options[2], $options[3], $options[4], $options[5] );
$kbfile=$GLOBALS['kbfile'];
if( file_exists( $kbfile )) {
$pdo = newpdo($GLOBALS['kbfile']);
$tblname="kb";
$sql = "select * from $tblname where kbid like '$url_kbid'";
$kbcnt=0;
printf( "$progid $dttm MSG: kbfile=[%s] tblname=[%s] sql=[$sql]<br>\n", $kbfile, $tblname );
foreach( $pdo->query($sql) as $row ) {
$kbcnt++;
$kbid=$row['kbid'];
$kb_user=$row['kb_user'];
$kb_host=$row['kb_host'];
$kb_ip=$row['kb_ip'];
$kb_os=$row['kb_os'];
$kb_org=$row['kb_org'];
$kb_grp=$row['kb_grp'];
$kb_sys=$row['kb_sys'];
$kb_cat=$row['kb_cat'];
$status=$row['status'];
$status_reason=$row['status_reason'];
$impact=$row['impact'];
$urgency=$row['urgency'];
$priority=$row['priority'];
$source=$row['source'];
$request_type=$row['request_type'];
$root_cause=$row['root_cause'];
$publish=$row['publish'];
$errtxt=$row['errtxt'];
$fixtxt=$row['fixtxt'];
$errtext=$row['errtext'];
$fixtext=$row['fixtext'];
$searchable=$row['searchable'];
$attachements=$row['attachements'];
$urgency=$row['filecount'];
$filecount=$row['filecount'];
$filelist=$row['filelist'];
$lock=$row['lock'];
$view_access=$row['view_access'];
$vendor_name=$row['vendor_name'];
$vendor_contact=$row['vendor_contact'];
$vendor_ticket_num=$row['vendor_ticket_num'];
$vendor_phone=$row['vendor_phone'];
$vendor_email=$row['vendor_email'];
$vendor_reported_dttm=$row['vendor_reported_dttm'];
$vendor_responded_dttm=$row['vendor_responded_dttm'];
$comment=$row['comment'];
printf( "$progid $dttm MSG_1240: FOUND url_kbid=[$url_kbid] kbid=[$kbid] kb_ip=[$kb_ip] kbcnt=[$kbcnt] errtxt=[$errtxt] fixtxt=[$fixtxt] status=[$status]<br>\n" );
}
$pdo=null;
if( $kbcnt == 0 ) {
$html .= "$progid $dttm ERR_1240: NOTFOUND url_kbid=[$url_kbid] kbcnt=[$kbcnt] kb_ip=[$kb_ip] status=[$status] status_reason=[$status_reason] url_kbid=[$url_kbid]<br>\n";
return($html);
}
else {
$html .= "$progid $dttm MSG_1245: FOUND url_kbid=[$url_kbid] kbcnt=[$kbcnt] kb_ip=[$kb_ip] status=[$status] status_reason=[$status_reason] url_kbid=[$url_kbid]<br>\n";
}
}
else {
$html .= "$progid $dttm ERR: NOTFOUND kbfile=[$kbfile]<br>\n";
return($html);
}
}
// print( "<hr>leds_admin<hr>\n" );
$dttm=date("Ymd_His");
// $html .= "<head><title>koaac_kb_new_form $dttm</title></head>\n";
/// $html .= "<body bgcolor=\"lightblue\">\n";
/// $html .= "<b>koaac_kb_new_form</b>\n";
// $html .= "<h2>$query_string [$user] step=[$step][$options[0][$options[1]]</h2>\n";
// $html .= "<form method=\"post\" action=\"$php_self?q=koaac_kb_update/$kbid\" enctype=\"multipart/form-data\">\n";
// $html .= "<form method=\"post\" action=\"$php_self?q=detail/aac/_kb/new\" enctype=\"multipart/form-data\">\n";
$html .= "<form method=\"post\" action=\"$php_self?q=detail/aac/_kb/add\" enctype=\"multipart/form-data\">\n";
$html .= "<br/>\n";
/// $html .= "led_name=[$led_name][$led_color][$led_speed][$led_type]<br>\n";
/// $html .= "[$led_date][$led_cmd][$led_desc][$led_misc]<br>\n";
/// $html .= "[$led_comment][$led_filename]<br /><br />\n";
$status_assigned_checked = "";
$status_scheduled_checked = "";
$status_tovendor_checked = "";
$status_noaction__checked = "";
$status_corrected_checked = "";
$status_closed_checked = "";
$status_cancelled_checked = "";
if( $status == "assigned" ) { $status_assigned_checked = "checked"; }
if( $status == "scheduled" ) { $status_scheduled_checked = "checked"; }
if( $status == "tovendor" ) { $status_tovendor_checked = "checked"; }
if( $status == "noaction" ) { $status_noaction_checked = "checked"; }
if( $status == "corrected" ) { $status_corrected_checked = "checked"; }
if( $status == "closed" ) { $status_closed_checked = "checked"; }
if( $status == "cancelled" ) { $status_cancelled_checked = "checked"; }
if( $status == "" ) { $status_noaction_checked = "checked"; }
$kb_host=$_SERVER['referer'];
$kbid=$dttm;
$kb_dttm=$kbid;
$html .= "<input type=\"text\" name=\"kbid\" value=\"$kbid\"> kbid <br/>\n";
$html .= "<input type=\"text\" name=\"kb_dttm\" value=\"$dttm\"> dttm <br/>\n";
$html .= "<input type=\"text\" name=\"kb_user\" value=\"$kb_user\"> kb_user <br/>\n";
$html .= "<input type=\"text\" name=\"kb_host\" value=\"$kb_host\"> kb_host <br/>\n";
$html .= "<input type=\"text\" name=\"kb_ip\" value=\"$kb_ip\"> kb_ip <br/>\n";
$html .= "<input type=\"text\" name=\"kb_org\" value=\"$kb_org\"> kb_org <br/>\n";
$html .= "<input type=\"text\" name=\"kb_grp\" value=\"$kb_grp\"> kb_grp <br/>\n";
$html .= "<input type=\"text\" name=\"kb_sys\" value=\"$kb_sys\"> kb_sys <br/>\n";
$html .= "<br>\n";
$html .= "<input type=\"text\" name=\"errtxt\" value=\"$errtxt\"> errtxt <br/>\n";
$html .= "<input type=\"text\" name=\"fixtxt\" value=\"$fixtxt\"> fixtxt <br/>\n";
$html .= "<input type=\"text\" name=\"comment\" value=\"$comment\"> comment <br/>\n";
$html .= "<input type=\"text\" name=\"notes\" value=\"$notes\"> notes <br/>\n";
$html .= "<br>\n";
$html .= "upload_: <input type=\"file\" name=\"uploaded\" /><br />\n";
$html .= "upload1: <input type=\"file\" name=\"uploaded1\" /><br />\n";
$html .= "upload2: <input type=\"file\" name=\"uploaded2\" /><br />\n";
$html .= "upload3: <input type=\"file\" name=\"uploaded3\" /><br />\n";
$html .= "upload4: <input type=\"file\" name=\"uploaded4\" /><br />\n";
$html .= "upload5: <input type=\"file\" name=\"uploaded5\" /><br />\n";
$html .= "upload6: <input type=\"file\" name=\"uploaded6\" /><br />\n";
$html .= "upload7: <input type=\"file\" name=\"uploaded7\" /><br />\n";
$html .= "upload8: <input type=\"file\" name=\"uploaded8\" /><br />\n";
$html .= "upload9: <input type=\"file\" name=\"uploaded9\" /><br />\n";
$html .= "<br>\n";
$html .= "<p>\n";
$html .= "<input type=\"submit\" name=\"update\" value=\"update\"/>\n";
$html .= "<input type=\"reset\"/>\n";
$html .= "</p>\n";
$html .= "<table>\n";
$html .= "<tr valign=\"top\">\n";
$html .= "<td width=\"100\">\n";
$html .= "<b>status: </b>\n";
$html .= "</td><td width=\"100\">\n";
$html .= "<input type=\"radio\" name=\"status\" value=\"assigned\" $status_assigned_checked />1-assigned";
$html .= "</td><td width=\"100\">\n";
$html .= "<input type=\"radio\" name=\"status\" value=\"scheduled\" $status_scheduled_checked />2-scheduled";
$html .= "</td><td width=\"100\">\n";
$html .= "<input type=\"radio\" name=\"status\" value=\"tovendor\" $status_tovendor_checked />3-tovendor";
$html .= "</td><td width=\"100\">\n";
$html .= "<input type=\"radio\" name=\"status\" value=\"noaction\" $status_noaction_checked />4-noaction";
$html .= "</td><td width=\"100\">\n";
$html .= "<input type=\"radio\" name=\"status\" value=\"corrected\" $status_corrected_checked />5-corrected";
$html .= "</td><td width=\"100\">\n";
$html .= "<input type=\"radio\" name=\"status\" value=\"closed\" $status_closed_checked />6-closed";
$html .= "</td><td width=\"100\">\n";
$html .= "<input type=\"radio\" name=\"status\" value=\"cancelled\" $status_cancelled_checked />7-cancelled";
$html .= "</td>\n";
$html .= "</tr>\n";
$html .= "</table>\n";
$status_reason_assigned_checked = "";
$status_reason_scheduled_checked = "";
$status_reason_infra_checked = "";
$status_reason_vendor_checked = "";
$status_reason_noaction_checked = "";
$status_reason_nofunding_checked = "";
$status_reason_corrected_checked = "";
$status_reason_pending_checked = "";
$status_reason_cancelled_checked = "";
$status_reason_duplicate_checked = "";
$status_reason_notapply_checked = "";
$status_reason_closed_checked = "";
$status_reason_other_checked = "";
if( $status_reason == "assigned" ) { $status_reason_assigned_checked = "checked"; }
if( $status_reason == "scheduled" ) { $status_reason_scheduled_checked = "checked"; }
if( $status_reason == "infra" ) { $status_reason_infra_checked = "checked"; }
if( $status_reason == "vendor" ) { $status_reason_vendor_checked = "checked"; }
if( $status_reason == "noaction" ) { $status_reason_noaction_checked = "checked"; }
if( $status_reason == "nofunding" ) { $status_reason_nofunding_checked = "checked"; }
if( $status_reason == "corrected" ) { $status_reason_corrected_checked = "checked"; }
if( $status_reason == "pending" ) { $status_reason_pending_checked = "checked"; }
if( $status_reason == "cancelled" ) { $status_reason_cancelled_checked = "checked"; }
if( $status_reason == "duplicate" ) { $status_reason_duplicate_checked = "checked"; }
if( $status_reason == "notapply" ) { $status_reason_notapply_checked = "checked"; }
if( $status_reason == "closed" ) { $status_reason_closed_checked = "checked"; }
if( $status_reason == "other" ) { $status_reason_other_checked = "checked"; }
if( $status_reason == "" ) { $status_reason_other_checked = "checked"; }
$html .= "<hr>\n";
$html .= "<table>\n";
$html .= "<tr valign=\"top\">\n";
$html .= "<td width=100>\n";
$html .= "<b>status_reason: </b>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"status_reason\" value=\"scheduled\" $status_reason_scheduled_checked />1-scheduled";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"status_reason\" value=\"infra\" $status_reason_infra_checked />2-infra";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"status_reason\" value=\"vendor\" $status_reason_vendor_checked />3-vendor";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"status_reason\" value=\"noaction\" $status_reason_noaction_checked />4-noaction";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"status_reason\" value=\"nofunding\" $status_reason_nofunding_checked />5-nofunding";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"status_reason\" value=\"corrected\" $status_reason_corrected_checked />6-corrected";
$html .= "</tr><tr>\n";
$html .= "<td width=100>\n";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"status_reason\" value=\"pending\" $status_reason_pending_checked />7-pending";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"status_reason\" value=\"cancelled\" $status_reason_cancelled_checked />8-cancelled";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"status_reason\" value=\"duplicate\" $status_reason_duplicate_checked />9-duplicate";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"status_reason\" value=\"notapply\" $status_reason_notapply_checked />10-notapply";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"status_reason\" value=\"closed\" $status_reason_closed_checked />11-closed";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"status_reason\" value=\"other\" $status_reason_other_checked />12-other";
$html .= "</td>\n";
$html .= "</tr>\n";
$html .= "</table>\n";
$html .= "<hr>\n";
$impact_extensive_checked="";
$impact_significant_checked="";
$impact_medium_checked="";
$impact_minor_checked="";
if( $impact == "extensive" ) { $impact_extensive_checked = "checked"; }
if( $impact == "significant" ) { $impact_significant_checked = "checked"; }
if( $impact == "moderate" ) { $impact_moderate_checked = "checked"; }
if( $impact == "minor" ) { $impact_minor_checked = "checked"; }
$html .= "<table>\n";
$html .= "<tr>\n";
$html .= "<td width=100>\n";
$html .= "<b>impact: </b>";
$html .= "</td></tr>\n";
$html .= "<tr><td width=100>   </td><td width=500>\n";
$html .= "<input type=\"radio\" name=\"impact\" value=\"extensive\" $impact_extensive_checked />1-extensive/widspread (service_down_multiple_users)";
$html .= "</td>\n";
$html .= "</tr>\n";
$html .= "<tr><td width=100>   </td><td width=500>\n";
$html .= "<input type=\"radio\" name=\"impact\" value=\"significant\" $impact_significant_checked />2-significant/Large (service_degraded_multiple_users)";
$html .= "</td>\n";
$html .= "</tr>\n";
$html .= "<tr><td width=100>   </td><td width=500>\n";
$html .= "<input type=\"radio\" name=\"impact\" value=\"medium\" $impact_medium_checked />3-medium/limited (service_down_one_use)";
$html .= "</td>\n";
$html .= "</tr>\n";
$html .= "<tr><td width=100>   </td><td width=500>\n";
$html .= "<input type=\"radio\" name=\"impact\" value=\"minor\" $impact_minor_checked />4-minor/localized (no_service_degradation_or_degraded_one_user)";
$html .= "</td>\n";
$html .= "</tr>\n";
$html .= "</table>\n";
$html .= "<hr>\n";
$urgency_critical_checked="";
$urgency_high_checked="";
$urgency_medium_checked="";
$urgency_low_checked="";
if( $urgency == "critical" ) { $urgency_critical_checked = "checked"; }
if( $urgency == "high" ) { $urgency_high_checked = "checked"; }
if( $urgency == "medium" ) { $urgency_medium_checked = "checked"; }
if( $urgency == "low" ) { $urgency_low_checked = "checked"; }
$html .= "<table>\n";
$html .= "<tr valign=\"top\" >\n";
$html .= "<td width=100>\n";
$html .= "<b>urgency: </b>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"urgency\" value=\"critical\" $urgency_critical_checked />1-critical";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"urgency\" value=\"high\" $urgency_high_checked />2-high";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"urgency\" value=\"medium\" $urgency_medium_checked />3-medium";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"urgency\" value=\"minor\" $urgency_low_checked />4-low";
$html .= "</td>\n";
$html .= "</tr>\n";
$html .= "</table>\n";
$priority_critical_checked="";
$priority_high_checked="";
$priority_medium_checked="";
$priority_low_checked="";
if( $priority == "critical" ) { $priority_critical_checked = "checked"; }
if( $priority == "high" ) { $priority_high_checked = "checked"; }
if( $priority == "medium" ) { $priority_moderate_checked = "checked"; }
if( $priority == "low" ) { $priority_low_checked = "checked"; }
$html .= "<hr>\n";
$html .= "<table>\n";
$html .= "<tr>\n";
$html .= "<td width=100>\n";
$html .= "<b>priority: </b>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"priority \" value=\"critical\" $priority_critical_checked />1 - critical<br/>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"priority \" value=\"high\" $priority_high_checked />2 - high<br/>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"priority \" value=\"medium\" $priority_medium_checked />3 - medium<br/>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"priority \" value=\"low\" $priority_low_checked />4 - low<br/>";
$html .= "</td>\n";
$html .= "</tr>\n";
$html .= "</table>\n";
$html .= "<hr>\n";
$source_email_checked="";
$source_fax_checked="";
$source_phone_checked="";
$source_vmail_checked="";
$source_walkin_checked="";
$source_system_checked="";
$source_web_checked="";
$source_other_checked="";
if( $source == "email" ) { $source_email_checked = "checked"; }
if( $source == "phone" ) { $source_phone_checked = "checked"; }
if( $source == "vmail" ) { $source_vmail_checked = "checked"; }
if( $source == "walkin" ) { $source_walkin_checked = "checked"; }
if( $source == "system" ) { $source_system_checked = "checked"; }
if( $source == "web" ) { $source_web_checked = "checked"; }
if( $source == "fax" ) { $source_fax_checked = "checked"; }
if( $source == "other" ) { $source_other_checked = "checked"; }
$html .= "<table>\n";
$html .= "<tr>\n";
$html .= "<td width=100>\n";
$html .= "<b>source: </b>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"source \" value=\"email\" $source_email_checked />1 - email<br/>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"source \" value=\"phone\" $source_phone_checked />2 - phone<br/>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"source \" value=\"vmail\" $source_vmail_checked />3 - vmail<br/>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"source \" value=\"walkin\" $source_walkin_checked />4 - walkin<br/>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"source \" value=\"system\" $source_system_checked />5 - system<br/>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"source \" value=\"web\" $source_web_checked />6 - web<br/>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"source \" value=\"other\" $source_other_checked />7 - other<br/>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"source \" value=\"fax\" $source_fax_checked />8 - fax<br/>";
$html .= "</td>\n";
$html .= "</table>\n";
$html .= "<hr>\n";
$request_type_config_item_checked="";
$request_type_incident_checked="";
$request_type_infrastruct_change_checked="";
$request_type_knownerr_checked="";
$request_type_investigation_checked="";
$request_type_release_checked="";
$request_type_solutiondb="";
if( $request_type == "config_item" ) { $request_type_config_item_checked = "checked"; }
if( $request_type == "incident" ) { $request_type_incident_checked = "checked"; }
if( $request_type == "infrastruct_change" ) { $request_infrastruct_change_checked = "checked"; }
if( $request_type == "knownerr" ) { $request_type_knownerr_checked = "checked"; }
if( $request_type == "investigation" ) { $request_type_investigation_cheked = "checked"; }
if( $request_type == "release" ) { $request_type_release_checked = "checked"; }
if( $request_type == "solutiondb" ) { $request_type_solutiondb_checked = "checked"; }
$html .= "<table>\n";
$html .= "<tr>\n";
$html .= "<td width=100>\n";
$html .= "<b>request_type: </b>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"request_type\" value=\"config\" $request_type_config_checked />1-config";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"request_type\" value=\"incident\" $request_type_incident_checked />2 - incident";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"request_type\" value=\"infrastruct\" $request_type_infrastruct_checked />3-infrastruct";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"request_type\" value=\"knownerr\" $request_type_knownerr_checked />4-knownerr";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"request_type\" value=\"investigation\" $request_type_investigation_checked />5-investigate";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"request_type\" value=\"release\" $request_type_release_checked />6-release";
$html .= "</td>\n";
$html .= "</tr>\n";
$html .= "</table>\n";
$html .= "<hr>\n";
$root_cause_hw_checked="";
$root_cause_sw_checked="";
$root_cause_patch_checked="";
$root_cause_operator_checked="";
$root_cause_other_checked="";
if( $root_cause == "hw" ) { $root_cause_hw_checked = "checked"; }
if( $root_cause == "sw" ) { $root_cause_sw_checked = "checked"; }
if( $root_cause == "patch" ) { $root_cause_patch_checked = "checked"; }
if( $root_cause == "operator" ) { $root_cause_operator_checked = "checked"; }
if( $root_cause == "other" ) { $root_cause_other_checked = "checked"; }
if( $root_cause == "" ) { $root_cause_other_checked = "checked"; }
$html .= "<table>\n";
$html .= "<tr>\n";
$html .= "<td width=100>\n";
$html .= "<b>root_cause: <br/>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"root_cause \" value=\"hw\" $root_cause_hw_checked />1 - hw<br/>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"root_cause \" value=\"sw\" $root_cause_sw_checked />2 - sw<br/>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"root_cause \" value=\"patch\" $root_cause_patch_checked />3 - patch<br/>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"root_cause \" value=\"operator\" $root_cause_operator_checked />4 - operator<br/>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"root_cause \" value=\"other\" $root_cause_other_checked />5 - other<br/>";
$html .= "</td>\n";
$html .= "</tr>\n";
$html .= "</table>\n";
$html .= "<hr>\n";
$kb_aac_checked="";
$kb_aix_checked="";
$kb_hpx_checked="";
$kb_ios_checked="";
$kb_sol_checked="";
$kb_uss_checked="";
$kb_win_checked="";
if( $kb_os == "aac" ) { $kb_aac_checked = "checked"; }
if( $kb_os == "aix" ) { $kb_aix_checked = "checked"; }
if( $kb_os == "hpx" ) { $kb_hpx_checked = "checked"; }
if( $kb_os == "ios" ) { $kb_ios_checked = "checked"; }
if( $kb_os == "sol" ) { $kb_sol_checked = "checked"; }
if( $kb_os == "uss" ) { $kb_uss_checked = "checked"; }
if( $kb_os == "win" ) { $kb_win_checked = "checked"; }
if( $kb_os == "" ) { $os_aac_checked = "checked"; }
$html .= "<table>\n";
$html .= "<tr>\n";
$html .= "<td width=100>\n";
$html .= "<b>os: <b/>";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"kb_os\" value=\"aac\" $kb_aac_checked />1-aac";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"kb_os\" value=\"aix\" $kb_aix_checked />2-aix";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"kb_os\" value=\"hpx\" $kb_hpx_checked />3-hpx";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"kb_os\" value=\"ios\" $kb_ios_checked />4-ios";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"kb_os\" value=\"sol\" $kb_sol_checked />5-sol";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"kb_os\" value=\"uss\" $kb_uss_checked />6-uss";
$html .= "</td><td width=100>\n";
$html .= "<input type=\"radio\" name=\"kb_os\" value=\"win\" $kb_win_checked />7-win";
$html .= "</td>\n";
$html .= "</tr>\n";
$html .= "</table>\n";
$html .= "<hr>\n";
$html .= "publish: ";
$html .= "<input type=\"radio\" name=\"published\" value=\"1\" \"checked\" />true";
$html .= "<input type=\"radio\" name=\"published\" value=\"0\" />false";
$html .= "<br />\n";
$html .= "<br />\n";
$html .= "errtext: <textarea rows=\"20\" cols=\"80\" name=\"errtext\">$errtext</textarea><br/>\n";
$html .= "<br />\n";
$html .= "fixtext: <textarea rows=\"40\" cols=\"100\" name=\"fixtext\">$fixtext</textarea><br/>\n";
$html .= "<br />\n";
$html .= "<p>\n";
$html .= "<input type=\"submit\" name=\"update\" value=\"update\"/>\n";
$html .= "<input type=\"reset\"/>\n";
$html .= "</p>\n";
$html .= "<input type=\"text\" name=\"kb_dttm\" value=\"$kb_dttm\"> kb_dttm <br/>\n";
$html .= "<input type=\"text\" name=\"kb_user\" value=\"$kb_user\"> kb_user <br/>\n";
$html .= "<input type=\"text\" name=\"kb_host\" value=\"$kb_host\"> kb_host <br/>\n";
$html .= "<input type=\"text\" name=\"kb_ip\" value=\"$kb_ip\"> kb_ip <br/>\n";
$html .= "<input type=\"text\" name=\"kb_os\" value=\"$kb_os\"> kb_os <br/>\n";
$html .= "<input type=\"text\" name=\"kb_org\" value=\"$kb_org\"> kb_org <br/>\n";
$html .= "<input type=\"text\" name=\"kb_sys\" value=\"$kb_sys\"> kb_sys <br/>\n";
$html .= "<input type=\"text\" name=\"kb_cat\" value=\"$kb_cat\"> kb_cat <br/>\n";
// $html .= "<input type=\"text\" name=\"impact\" value=\"$impact\"> impact <br/>\n";
// $html .= "<input type=\"text\" name=\"urgency\" value=\"$urgency\"> urgency <br/>\n";
// $html .= "<input type=\"text\" name=\"priority\" value=\"$priority\"> priority <br/>\n";
// $html .= "<input type=\"text\" name=\"source\" value=\"$source\"> source <br/>\n";
// $html .= "<input type=\"text\" name=\"request_type\" value=\"$request_type\"> request_type <br/>\n";
// $html .= "<input type=\"text\" name=\"root_cause\" value=\"$root_cause\"> root_cause <br/>\n";
// $html .= "<input type=\"text\" name=\"publish\" value=\"$publish\"> publish <br/>\n";
// $html .= "<input type=\"text\" name=\"searchable\" value=\"$searchable\"> searchable <br/>\n";
// $html .= "<input type=\"text\" name=\"attachments\" value=\"$attachments\"> attachments <br/>\n";
// $html .= "<input type=\"text\" name=\"filecount\" value=\"$filecount\"> filecount <br/>\n";
// $html .= "<input type=\"text\" name=\"filelist\" value=\"$filelist\"> filelist <br/>\n";
// $html .= "<input type=\"text\" name=\"locked\" value=\"$locked\"> locked <br/>\n";
// $html .= "<input type=\"text\" name=\"view_access\" value=\"$view_access\"> view_access <br/>\n";
$html .= "<input type=\"text\" name=\"vendor_name\" value=\"$vendor_name\"> vendor_name <br/>\n";
$html .= "<input type=\"text\" name=\"vendor_contact\" value=\"$vendor_contact\"> vendor_contact <br/>\n";
$html .= "<input type=\"text\" name=\"vendor_ticket_num\" value=\"$vendor_ticket_num\"> vendor_ticket_num <br/>\n";
$html .= "<input type=\"text\" name=\"vendor_phone\" value=\"$vendor_phone\"> vendor_phone <br/>\n";
$html .= "<input type=\"text\" name=\"vendor_email\" value=\"$vendor_email\"> vendor_email <br/>\n";
$html .= "<input type=\"text\" name=\"vendor_reported_dttm\" value=\"$vendor_reported_dttm\"> vendor_reported_dttm <br/>\n";
$html .= "<input type=\"text\" name=\"vendor_responded_dttm\" value=\"$vendor_responded_dttm\"> vendor_responded_dttm <br/>\n";
$html .= "<input type=\"hidden\" name=\"user\" value=\"$user\"/>\n";
$html .= "<input type=\"hidden\" name=\"pass\" value=\"$pass\"/>\n";
$html .= "<input type=\"hidden\" name=\"step\" value=\"update\"/>\n";
$html .= "<input type=\"hidden\" name=\"query_string\" value=\"$query_string\"/>\n";
$html .= "<input type=\"hidden\" name=\"uploaded_loos\" value=\"'". $globals['uploaded']."'\"/>\n";
$html .= "<hr/>\n";
$html .= "<p>\n";
$html .= "<input type=\"submit\" name=\"new\" value=\"add\"/>\n";
$html .= "<input type=\"reset\"/>\n";
$html .= "</p>\n";
$html .= "</form>\n";
$html .= "</body>\n";
$html .= "<html>\n";
return( $html );
// print( $html );
}
function koaac_kb_add_form( $options ) {
html_header();
$php_self=$_SERVER['PHP_SELF'];
$kb_name=$options[1];
// $kb_dttm=date("Y-m-d H:i:s");
$kb_dttm=date("Ymd_His");
$kb_remote_addr=$_SERVER['REMOTE_ADDR'];
$kb_referer=$_SERVER['REFERER'];
$kb_remote_port=$_SERVER['REMOTE_PORT'];
$kbpath = $GLOBALS['kbpath'];
$kbfile=$GLOBALS['kbfile'];
$query_string=$_SERVER['QUERY_STRING'];
$user=$_POST['user'];
$pass=$_POST['pass'];
$step=$_POST['step'];
$id = $_POST['id'];
$kbid = $_POST['kbid'];
$kb_dttm = $_POST['kb_dttm'];
$kb_user = $_POST['kb_user'];
$kb_host = $_POST['kb_host'];
$kb_ip = $_POST['kb_ip'];
$kb_os = $_POST['kb_os'];
$kb_org = $_POST['kb_org'];
$kb_grp = $_POST['kb_grp'];
$kb_sys = $_POST['kb_sys'];
$kb_cat = $_POST['kb_cat'];
$status = $_POST['status'];
$status_reason = $_POST['status_reason'];
$impact = $_POST['impact'];
$urgency = $_POST['urgency'];
$priority = $_POST['priority'];
$source = $_POST['source'];
$request_type = $_POST['request_type'];
$root_cause = $_POST['root_cause'];
$publish = $_POST['publish'];
$errtxt = $_POST['errtxt'];
$fixtxt = $_POST['fixtxt'];
$errtext = $_POST['errtext'];
$fixtext = $_POST['fixtext'];
$searchable = $_POST['searchable'];
$attachments = $_POST['attachments'];
$filecount = $_POST['filecount'];
$filelist = $_POST['filelist'];
$locked = $_POST['locked'];
$view_access = $_POST['view_access'];
$vendor_name = $_POST['vendor_name'];
$vendor_contact = $_POST['vendor_contact'];
$vendor_ticket_num = $_POST['vendor_ticket_num'];
$vendor_contact = $_POST['vendor_contact'];
$vendor_phone = $_POST['vendor_phone'];
$vendor_email = $_POST['vendor_email'];
$vendor_reported_dttm = $_POST['vendor_reported_dttm'];
$vendor_responded_dttm = $_POST['vendor_responded_dttm'];
$comment = $_POST['comment'];
$notes = $_POST['notes'];
// print( "leds_update MSG: user=[$user][$pass][$step] [$query_string]<br />\n" );
// print( "leds_update MSG: name=[$led_name][$led_color][$led_speed][$led_comment][$led_user]<br/>\n" );
// print( "leds_update MSG: filename=[$led_filename] published=[$led_published]<br/>\n" );
print( "$php_self koaac_kb_add MSG_1600: kbid=[$kbid] kb_user=[$kb_user] kb_dttm=[$kb_dttm]<br>\n" );
// create directory criteria
// if((isset($_FILES['uploaded']) && !empty($_FILES['uploaded']['name']))
// || (isset($_FILES['uploaded1']) && !empty($_FILES['uploaded1']['name']))
// || (isset($_FILES['uploaded2']) && !empty($_FILES['uploaded2']['name']))
// || (isset($_FILES['uploaded3']) && !empty($_FILES['uploaded3']['name']))
//// || (isset($_FILES['uploaded4']) && !empty($_FILES['uploaded4']['name']))
// || (isset($_FILES['uploaded5']) && !empty($_FILES['uploaded5']['name']))
//// || (isset($_FILES['uploaded6']) && !empty($_FILES['uploaded6']['name']))
//// || (isset($_FILES['uploaded7']) && !empty($_FILES['uploaded7']['name']))
// || (isset($_FILES['uploaded8']) && !empty($_FILES['uploaded8']['name']))
// || (isset($_FILES['uploaded9']) && !empty($_FILES['uploaded9']['name']))
// || (isset($_POST['errtxt']) && !empty($_POST['errtxt']))
// || (isset($_POST['fixtxt']) && !empty($_POST['fixtxt']))
// || (isset($_POST['errtext']) && !empty($_POST['errtext']))
// || (isset($_POST['fixtext']) && !empty($_POST['fixtext']))
// || (isset($_POST['comments']) && !empty($_POST['comments']))
// || (isset($_POST['notes']) && !empty($_POST['notes']))
// ) {
// printf( "<hr>create directory kbid=$kbid<hr>\n" );
// $full_kbpath=kb_mkdir( $kbpath, $kbid );
// }
$kbfullpath=kb_mkdir( $kbpath, $kbid );
printf( "BUGS_2525 kbpath=[$kbpath] kbid=[$kbid] full_kbpath=[$full_kbpath]<br>\n" );
if(isset($_POST['errtxt']) && !empty($_POST['errtxt'])) {
$pathfile_errtxt="$kbfullpath/errtxt_$kbid.txt";
kbwrite( $pathfile_errtxt, $_POST['errtxt'] );
}
if(isset($_POST['fixtxt']) && !empty($_POST['fixtxt'])) {
$pathfile_fixtxt="$kbfullpath/fixtxt_$kbid.txt";
kbwrite( $pathfile_fixtxt, $_POST['fixtxt'] );
}
if(isset($_POST['errtext']) && !empty($_POST['errtext'])) {
$pathfile_errtext="$kbfullpath/errtext_$kbid.txt";
kbwrite( $pathfile_errtext, $_POST['errtext'] );
}
if(isset($_POST['fixtext']) && !empty($_POST['fixtext'])) {
$pathfile_fixtext="$kbfullpath/fixtext_$kbid.txt";
kbwrite( $pathfile_fixtext, $_POST['fixtext'] );
}
if(isset($_POST['comment']) && !empty($_POST['comment'])) {
$pathfile_comment="$kbfullpath/comment_$kbid.txt";
kbwrite( $pathfile_comment, $_POST['comment']);
}
if(isset($_POST['notes']) && !empty($_POST['notes'])) {
$pathfile_notes="$kbfullpath/notes_$kbid.txt";
kbwrite( $pathfile_notes, $_POST['notes']);
}
// printf( "BUGS_2550 full_kbpath=[$full_kbpath] kbpath=[$kbpath] kbid=[$kbid]<br>\n" );
// printf( "BUGS_2550 pathfile_errtxt=[$pathfile_errtxt]<br>\n" );
// printf( "BUGS_2550 pathfile_fixtxt=[$pathfile_fixtxt]<br>\n" );
// printf( "BUGS_2550 pathfile_errtext=[$pathfile_errtext]<br>\n" );
// printf( "BUGS_2550 pathfile_fixtext=[$pathfile_fixtext]<br>\n" );
// printf( "BUGS_2550 pathfile_comment=[$pathfile_comment]<br>\n" );
// printf( "BUGS_2550 pathfile_notes=[$pathfile_notes]<br>\n" );
// printf( "BUGS_2550 pathfile_psv=[$pathfile_psv]<br>\n" );
// return;
$html_koaac_kb_upload = koaac_kb_upload( $kbid );
printf( "BUGS_2580 html_koaac_kb_upload=[$html_koaac_kb_upload]<br>\n" );
// cleanup paste text
// whilte(strpos($str, ' ') !== false) { $str = str_replace(' ', ' ', $string);
// $fmt_errtxt= htmlentities(preg_replace('/\s+/', ' ', $errtxt ));
$fmt_errtxt= preg_replace('/\s+/', ' ', $errtxt );
printf( "BUGS_2601 fmt_errtxt=[$fmt_errtxt][$errtxt]<br>\n" );
$fmt_errtxt = htmlentities($fmt_errtxt );
printf( "BUGS_2601 fmt_errtxt=[$fmt_errtxt][$errtxt]<br>\n" );
$fmt_errtxt= ereg_replace("/\n\r|\r\n|\r|\n", " ", $errtxt );
$fmt_errtxt= htmlentities(preg_replace('/\s+/', ' ', $fmt_errtxt ));
$fmt_fixtxt= ereg_replace("/\n\r|\r\n|\r|\n", " ", $fixtxt );
$fmt_fixtxt= htmlentities(preg_replace('/\s+/', ' ', $fmt_fixtxt ));
$fmt_errtext= ereg_replace("/\n\r|\r\n|\r|\n", " ", $errtext );
$fmt_errtext= htmlentities(preg_replace('/\s+/', ' ', $fmt_errtext ));
$fmt_fixtext= ereg_replace("/\n\r|\r\n|\r|\n", " ", $fixtext );
$fmt_fixtext= htmlentities(preg_replace('/\s+/', ' ', $fmt_fixtext ));
$fmt_notes= ereg_replace("/\n\r|\r\n|\r|\n", " ", $notes );
$fmt_notes= htmlentities(preg_replace('/\s+/', ' ', $fmt_notes ));
$fmt_comment= ereg_replace("/\n\r|\r\n|\r|\n", " ", $comment );
$fmt_comment= htmlentities(preg_replace('/\s+/', ' ', $fmt_comment ));
// printf( "BUGS_2602 fmt_fixtxt=[$fmt_fixtxt][$fixtxt]<br>\n" );
// printf( "BUGS_2603 fmt_fixtext=[$fmt_fixtext][fixtext]<br>\n" );
// printf( "BUGS_2604 fmt_errtext=[$fmt_errtext][errtext]<br>\n" );
// printf( "BUGS_2605 fmt_notes=[$fmt_notes][notes]<br>\n" );
// printf( "BUGS_2606 fmt_comment=[$fmt_comment][comment]<br>\n" );
// print( "$php_self koaac_kb_add MSG_1635: kbid=[$kbid] kb_user=[$kb_user] kb_dttm=[$kb_dttm]<br>\n" );
$html .= "$php_self koaac_kb_add MSG_2590: kbid=[$kbid] kb_user=[$kb_user] kb_dttm=[$kb_dttm]<br>\n";
$sqlupd = "update kb set ";
$sqlupd .= "dttm='$dttm', ";
$sqlupd .= "submit_by='$submit_by', ";
$sqlupd .= "where kbid=='$kbid' ";
// $html .= "<hr>sqlupd=[$sqlupd]<br />\n";
// printf( "BUGS_2615 sqlupd=[$sqlupd]<br>\n");
$sqladd = "insert or replace into kb (";
// $sqladd .= "id, kbid, kb_dttm, kb_user, kb_host, kb_os, kb_org, kb_grp, kb_sys, kb_cat, ";
$sqladd .= "kbid, kb_dttm, kb_user, kb_host, kb_os, kb_org, kb_grp, kb_sys, kb_cat, ";
$sqladd .= "status, status_reason, ";
$sqladd .= "impact, urgency, priority, source, request_type, root_cause, publish, ";
$sqladd .= "errtxt, fixtxt, errtext, fixtext, ";
$sqladd .= "vendor_name, vendor_contact, vendor_ticket_num, vendor_phone, vendor_email, ";
$sqladd .= "vendor_reported_dttm, vendor_responded_dttm, ";
$sqladd .= "comment, notes";
$sqladd .= ") ";
$sqladd .= " values ( ";
// $sqladd .= "\"$id\", \"$kbid\", \"$kb_dttm\", \"$kb_user\", \"$kb_host\", \"$kb_os\", \"$kb_org\", \"$kb_grp\", \"$kb_sys\", \"$kb_cat\", ";
$sqladd .= "\"$kbid\", \"$kb_dttm\", \"$kb_user\", \"$kb_host\", \"$kb_os\", \"$kb_org\", \"$kb_grp\", \"$kb_sys\", \"$kb_cat\", ";
$sqladd .= "\"$status\", \"$status_reason\", ";
$sqladd .= "\"$impact\", \"$urgency\", \"$priority\", \"$source\", \"$request_type\", \"$root_cause\", \"publish\", ";
$sqladd .= "\"$fmt_errtxt\", \"$fmt_fixtxt\", ";
$sqladd .= "\"$fmt_errtext\", \"$fmt_fixtext\", ";
$sqladd .= "\"$vendor_name\", \"$vendor_contact\", \"$vendor_ticket_num\", \"$vendor_phone\", \"$vendor_email\", ";
$sqladd .= "\"$vendor_reported_dttm\", \"$vendor_responded_dttm\", ";
$sqladd .= "\"$fmt_comment\", \"fmt_$notes\" ";
$sqladd .= " ); ";
$html .= "<hr>sqladd=[$sqladd]<br />\n";
printf( "BUGS_2622 sqladd=[$sqladd]<br>\n");
// print( "$php_self koaac_kb_add MSG_1670: kbfile=[$kbfile]\ kbid=[$kbid] kb_user=[$kb_user] kb_dttm=[$kb_dttm] sqladd=[$sqladd]<br>\n" );
try {
$pdo = newpdo($GLOBALS['kbfile']);
$result = $pdo->exec($sqladd);
$pdo = null;
}
catch(PDOException $e) { $output .= $e->getMessage(); }
// $string = htmlentities($string);
// $string = str_replace(array('<','>'), array('<', '>'), $string);
/// $pdo = newpdo($GLOBALS['dbfile']);
// $pdo = newpdo($GLOBALS['kbfile']);
// printf( "BUGS_2650: sqladd=[$sqladd]<hr>\n");
/// $pdo->exec($sqlupd);
// $pdo->exec($sqladd);
// $pdo = null;
printf( "<hr>BUGS_2670: sqladd=[$sqladd]<hr>\n");
$pathfile_sql="$full_kbpath/$kbid".".sql";
logwrite( $pathfile_sql, $sqladd );
// $pathfile_csv="$full_kbpath/$kbid".".csv";
// logwrite( $pathfile_csv, $sqladd );
// $pathfile_psv="$full_kbpath/$kbid".".psv";
// logwrite( $pathfile_psv, $sqladd );
$html_btn_squares = html_btn_squares($options);
$html_head .= html_header($options);
$html_kb_links = html_kb_links($options);
$html_body = leds_show();
$html_footer = html_footer( $options );
$html = $html_head . $html_btn_squares . $html_kb_links;
$html .= "$php_self koaac_kb_add MSG_2490: kbid=[$kbid] kb_user=[$kb_user] kb_dttm=[$kb_dttm] sqladd=[$sqladd]<br>\n";
$html .= $html_body . $html_upload . $html_scrub . $html_foot;
$html .= $html_body . $html_upload . $html_scrub . $html_foot;
print( $html );
}
function koaac_kb_upload( $kbid ) {
$php_self=$_SERVER['PHP_SELF'];
$dttm=date("Ymd_His");
$media_path = $GLOBALS['media_path'];
$kbpath=$GLOBALS['kbpath'];
// define( "FILEREPOSITORY", "$document_root/inbox" );
$html_upload = "";
$html_upload .= "php_self koaac_kb_upload MSG_1700a: kbid=[$kbid] syscmd_mkdir=[$syscmd_mkdir]<hr>\n";
// print_r($_FILES);
// print_r($_FILES[uploaded] );
// print( "<hr> uploaded1\n" );
// print_r($_FILES[uploaded1] );
// print( "<hr> uploaded2\n" );
// print_r($_FILES[uploaded2] );
// print( "<hr> uploaded3\n" );
// print_r($_FILES[uploaded3] );
// print( "<hr> uploaded4\n" );
// print_r($_FILES[uploaded4] );
// print( "<br>\n" );
// print( "$php_self koaac_kb_upload MSG_1700b: kbid=[$kbid] syscmd_mkdir=[$syscmd_mkdir]<hr>\n" );
$uploaded_name=$_FILES[uploaded][name];
$uploaded_tmpname=$_FILES[uploaded][tmp_name];
$uploaded_error=$_FILES[uploaded][error];
$uploaded_size=$_FILES[uploaded][size];
$uploaded_name1=$_FILES[uploaded1][name];
$uploaded_tmpname1=$_FILES[uploaded1][tmp_name];
$uploaded_error1=$_FILES[uploaded1][error];
$uploaded_size1=$_FILES[uploaded1][size];
$uploaded_name2=$_FILES[uploaded2][name];
$uploaded_tmpname2=$_FILES[uploaded2][tmp_name];
$uploaded_error2=$_FILES[uploaded2][error];
$uploaded_size2=$_FILES[uploaded2][size];
$uploaded_name3=$_FILES[uploaded3][name];
$uploaded_tmpname3=$_FILES[uploaded3][tmp_name];
$uploaded_error3=$_FILES[uploaded3][error];
$uploaded_size3=$_FILES[uploaded3][size];
$uploaded_name4=$_FILES[uploaded4][name];
$uploaded_tmpname4=$_FILES[uploaded4][tmp_name];
$uploaded_error4=$_FILES[uploaded4][error];
$uploaded_size4=$_FILES[uploaded4][size];
$uploaded_name5=$_FILES[uploaded5][name];
$uploaded_tmpname5=$_FILES[uploaded5][tmp_name];
$uploaded_error5=$_FILES[uploaded5][error];
$uploaded_size5=$_FILES[uploaded5][size];
$uploaded_name6=$_FILES[uploaded6][name];
$uploaded_tmpname6=$_FILES[uploaded6][tmp_name];
$uploaded_error6=$_FILES[uploaded6][error];
$uploaded_size6=$_FILES[uploaded6][size];
$uploaded_name7=$_FILES[uploaded7][name];
$uploaded_tmpname7=$_FILES[uploaded7][tmp_name];
$uploaded_error7=$_FILES[uploaded7][error];
$uploaded_size7=$_FILES[uploaded7][size];
$uploaded_name8=$_FILES[uploaded8][name];
$uploaded_tmpname8=$_FILES[uploaded8][tmp_name];
$uploaded_error8=$_FILES[uploaded8][error];
$uploaded_size8=$_FILES[uploaded8][size];
$uploaded_name9=$_FILES[uploaded9][name];
$uploaded_tmpname9=$_FILES[uploaded9][tmp_name];
$uploaded_error9=$_FILES[uploaded9][error];
$uploaded_size9=$_FILES[uploaded9][size];
// $html_upload .= "BUGS_1700_uploaded0: $uploaded_name tmpname=[$uploaded_tmpname] error=[$uploaded_error1] size=[$uploaded_size1]<hr>\n";
// $html_upload .= "BUGS_1700_uploaded1: name1=$uploaded_name1 tmpname1=[$uploaded_tmpname1] error1=[$uploaded_error1] size1=[$uploaded_size1]<hr>\n";
// $html_upload .= "BUGS_1700_uploaded2: name2=$uploaded_name2 tmpname2=[$uploaded_tmpname2] error2=[$uploaded_error2] size2=[$uploaded_size2]<hr>\n";
// $html_upload .= "BUGS_1700_uploaded3: name3=$uploaded_name3 tmpname3=[$uploaded_tmpname3] error3=[$uploaded_error3] size3=[$uploaded_size3]<hr>\n";
// $html_upload .= "BUGS_1700_uploaded4: name4=$uploaded_name4 tmpname4=[$uploaded_tmpname4] error4=[$uploaded_error4] size4=[$uploaded_size1]<hr>\n";
// $html_upload .= "BUGS_1700_uploaded5: name5=$uploaded_name5 tmpname5=[$uploaded_tmpname5] error5=[$uploaded_error5] size5=[$uploaded_size1]<hr>\n";
// $html_upload .= "BUGS_1700_uploaded6: name6=$uploaded_name6 tmpname6=[$uploaded_tmpname6] error6=[$uploaded_error6] size6=[$uploaded_size1]<hr>\n";
// $html_upload .= "BUGS_1700_uploaded7: name7=$uploaded_name7 tmpname7=[$uploaded_tmpname7] error7=[$uploaded_error7] size7=[$uploaded_size1]<hr>\n";
// $html_upload .= "BUGS_1700_uploaded8: name8=$uploaded_name8 tmpname8=[$uploaded_tmpname8] error8=[$uploaded_error8] size8=[$uploaded_size1]<hr>\n";
// $html_upload .= "BUGS_1700_uploaded9: name9=$uploaded_name9 tmpname9=[$uploaded_tmpname9] error9=[$uploaded_error9] size9=[$uploaded_size1]<hr>\n";
if( $kbid == "" ) {
$html_upload .= "$php_self koaac_kb_upload ERR_2675: kbid=[$kbid] <hr>\n";
return( $html_upload);
}
/// else {
// create new kb directory
$kbfullpath=kb_mkdir($kbpath, $kbid);
$html_upload .= "$php_self koaac_kb_upload MSG_2766: _FILES[uploaded][name]=".$_FILES['uploaded']['name']. " <br>\n";
$html_upload .= "$php_self koaac_kb_upload MSG_2767: _FILES[uploaded][tmp_name]=".$_FILES['uploaded']['tmp_name']. " <br>\n";
$html_upload .= "$php_self koaac_kb_upload MSG_2768: kbpath_ym_kb=[$kbpath_ym_kb] <br>\n";
$html_upload .= "$php_self koaac_kb_upload MSG_2768: kbfullpath=[$kbfullpath] <br>\n";
$j=0;
foreach ($_FILES as $file) {
$j++;
$file_name=$file['name'];
$file_tmpname=$file['tmp_name'];
$file_error=$file['error'];
$file_size=$file['size'];
if( $file_name == "" ) { continue; }
// printf( "$bugs koaac_kb_upload MSG_2778: j=[$j] file_name=[$file_name] file_tmpname=[$file_tmpname] error=[$file_error] size=[$file_size]<br>\n");
$html_upload .= "$php_self koaac_kb_upload MSG_2780: j=[$j] to_filename=[$to_filename] file_error=[$file_error] size=[$file_size]<br>\n";
// upload errors
switch ($file_error) {
case 1:
// print '<p> 1: bigger upload_max_filesixe in php.ini</p>';
$html_upload .= "p> 1: bigger upload_max_filesixe in php.ini</p>";
break;
case 2:
// print '<p> 2: bigger than max_file_size in form</p>';
$html_upload .= "<p> 2: bigger than max_file_size in form</p>";
break;
case 3:
// print '<p> 3: partial upload</p>';
$html_upload .= "<p> 3: partial upload</p>";
break;
case 4:
// print '<p> 4: not uploaded 4</p>';
$html_uplaod .= "<p> 4: not uploaded 4</p>";
break;
case 5:
// print '<p> 5: upload error 5</p>';
$html_upload .= "<p> 5: upload error 5</p>";
break;
case 6:
// print '<p> 6: missing temp folder</p>';
$html_upload .= "<p> 6: missing temp folder</p>";
break;
case 7:
// print '<p> 7: failed write to disk</p>';
$html_upload .= "<p> 7: failed write to disk</p>";
break;
case 8:
// print '<p> 8: upload_err_extension</p>';
$html_upload .= "<p> 8: upload_err_extension</p>";
break;
// default:
// print '<p> 0: unknown upload err</p>';
// break;
}
$allowedExtensions = array( "txt", "csv", "log", "htm", "html", "xml", "css", "doc", "xls", "rtf", "ppt", "pdf"," swf", "flv", "avi", "wmv", "mov", "jpg", "jpeg", "gif", "png", "pl", "php", "db3", "psv", "xlsx", "docx", "xfdl", "vcf" );
/// if ($file_tmpname > '') {
/// if (!in_array(end(explode(".", strtolower($file_name))), $allowedExtensions)) {
/// die($file_name.' is an invalid file type!<br/>'.
/// '<a href="javascript:history.go(-1);">'.
/// '<< Go Back</a>');
/// }
/// }
$from_filename=$file_name;
$from_tmp_filename=$file_tmpname;
// $to_filename = $kbpath_ym_kb . "/". basename( $file_name ) ;
$to_filename = $kbfullpath . "/". basename( $file_name ) ;
// printf( "$php_self MSG_2840: to_filename=[$to_filename]<br>\n");
$html_upload .= "$php_self MSG_2840: to_filename=[$to_filename]<br>\n";
// if( ereg(".brp", $to_filename )) {
// $orig_filename=$to_filename;
// $to_filename =str_replace( ".brp", "_brp.txt", $orig_filename );
// printf( "BUGS_2400: to_filename=[$to_filename] orig_filename=[$orig_filename]<br>\n" );
// }
$path_parts = pathinfo( $upload_filename );
// $path_parts['dirname'];
// $path_parts['basename'];
// $path_parts['extension'];
// $path_parts['filename'];
$from_filename_parts = pathinfo( $from_filename );
$from_filename_dirname = $from_filename_parts['dirname'];
$from_filename_basename = $from_filename_parts['basename'];
$name_ext = $from_filename_parts['basename'];
$from_filename_extension = $from_filename_parts['extension'];
$from_filename_filename = $from_filename_parts['filename'];
$basename = $from_filename_parts['filename'];
$html_upload .= "BUGS_2700: from_filename=[$from_filename]<br>\n";
// $html_upload .= "BUGS_2701: from_filename_dirname=[$from_filename_dirname]<br>\n";
// $html_upload .= "BUGS_2702: from_filename_basename=[$from_filename_basename]<br>\n";
// $html_upload .= "BUGS_2703: from_filename_extension=[$from_filename_extension]<br>\n";
// $html_upload .= "BUGS_2704: from_filename_filename=[$from_filename_filename]<br>\n";
// $html_upload .= "BUGS_2705: basename=[$basename]<br>\n";
$ok=1;
// print_r($_FILES);
$to_pathfile="$kbpath_ym_kb$to_filename";
$result = move_uploaded_file($from_tmp_filename, $to_filename );
if( $result == 1 ) {
$html_upload .= "hr>$php_self ko_upload MSG_2901: result=[$result] from_tmp_filename=[$from_tmp_filename]<br> to_filename=[$to_filename] to_pathfile=[$to_pathfile]<hr>\n";
}
else {
$html_upload .= "<hr>$php_self ko_upload ERR_2902: result=[$result] from_tmp_filename=[$from_tmp_filename]<br> to_filename=[$to_filename] to_pathfile=[$to_pathfile]<hr>\n";
}
// $html_upload .= "$php_self ko_upload MSG_2718: user=[$user] upload_filename=[$upload_filename]<br>\n";
// $html_upload .= "$php_self ko_upload MSG_2719: user=[$user] led_filename=[$led_filename]<br>\n";
/// $uploaded_size_limit = 350000;
/// if( $uploaded_size > $uploaded_size_limit ) {
/// $html_upload .= "$php_self ko_upload ERR: file to big uploaded_size=[$uploaded_size] size_limit=[$uploaded_size_limit]<br/>\n";
/// $ok=0;
/// }
/// if( $uploaded_type == "text/php") { $html_upload .= "$php_self ko_upload ERR: no php<br/>\n"; $ok=0; }
/// if( $uploaded_type == "text/exe") { $html_upload .= "$php_self ko_upload ERR: no exe<br/>\n"; $ok=0; }
/// if( $uploaded_type == "text/bin") { $html_upload .= "$php_self ko_upload ERR: no bin<br/>\n"; $ok=0; }
/// $nofile="nofile";
/// if( file_exists( $nofile )) {
if( file_exists( $to_filename )) {
/// $syscmd="cd $media_path; /usr/bin/perl $media_path/ko_scrub.pl scrub $to_filename > scrub.log";
/// system( $syscmd );
$html_upload .= "$php_self ko_upload MSG_2930 FOUND to_filename=[$to_filename]<br>\n";
$scrubfile=$to_filename;
$html_upload .= "$php_self ko_upload MSG_2631: FOUND to_filename=[$to_filename] name_ext=[$name_ext]<br/>\n";
// process gz files
if( preg_match( "/_skip_gz_uncompress/", $to_filename )) {
$gunzipfile = str_replace( ".gz", "", $to_filename );
$scrubfile = str_replace( ".gz", ".txt", $to_filename );
// print( "$php_self ko_upload MSG_1784: to_filename=[$to_filename] <br/>\n" );
// print( "$php_self ko_upload MSG_1785: gunzipfile=[$gunzipfile] <br/>\n" );
// print( "$php_self ko_upload MSG_1786: scrubfile=[$scrubfile] <br/>\n" );
$syscmd_gunzip = "gunzip $to_filename";
// print( "$php_self ko_upload MSG_2785: syscmd_gunzip=[$syscmd_gunzip] <br/>\n" );
system( $syscmd_gunzip );
if( file_exists( $gunzipfile )) {
// print( "$php_self ko_upload MSG_1800: rename($gunzipfile, $scrubfile) <br/>\n" );
rename( $gunzipfile, $scrubfile );
}
else {
print( "$php_self ko_upload ERR_1800: NOTFOUND gunzipfile=[$gunzipfile]<br/>\n" );
}
if( file_exists( $scrubfile )) {
// print( "$php_self ko_upload MSG_1800: FOUND scrubfile=[$scrubfile]<br/>\n" );
}
else {
print( "$php_self ko_upload ERR_1800: NOTFOUND scrubfile=[$scrubfile]<br/>\n" );
}
// exit;
}
/// if( file_exists( $scrubfile )) {
$kludge=1;
if( $kludge == 0 ) {
$scrubfile_parts = pathinfo( $to_filename );
$scrubfile_dirname = $scrubfile_parts['dirname'];
$scrubfile_basename = $scrubfile_parts['basename'];
$scrubfile_extension = $scrubfile_parts['extension'];
$basename=str_replace( $scrubfile_extension, "", $scrubfile_basename );
/// $basename=str_replace( ".", "", $basename );
$scrubout = "";
//// $scrubout .= "header('Content-Type: text/html; charset-iso-8859-1');";
//// $scrubout .= "\n\n";
//// $filedata=array();
//// $rownum=0;
//// $fp = fopen( $scrubfile, "r" );
//// while(( $filetext = fgets($fp)) !== false ) {
// $filedata[] = $filetext;
//// $scrubout .= $filetext;
/// printf( "BUGS: filetext=[$filetext]<br>\n" );
//// $rownum++;
//// }
//// fclose($fp);
// $data = $filedata;
//// $scrubout .= $filedata;
//// print( $scrubout );
//// exit;
// return;
// return( $scrubout );
/// print( "$php_self ko_upload MSG_2475: FOUND to_filename=[$to_filename] name_ext=[$name_ext]<br/>\n" );
$html_header=html_header($options);
$html_btn_squares=html_btn_squares($options);
$html_scrub_done = "<hr>\n";
$html_scrub_done .= "<body bgcolor=lightblue>\n";
$scrubfile_path = "$document_root/inbox";
$scrubfile_jobid = str_replace( $scrubfile_extension, "", $scrubfile_basename );
$results = getfiles( $scrubfile_path, $scrubfile_jobid );
$to_basename = str_replace( $scrubfile_dirname, "", $to_filename );
$to_basename = str_replace( "/", "", $to_basename );
$html_scrub_done .= "$to_basename<br><br>\n";
foreach( $results as $result ) {
if( preg_match( "/zip$/", $result )) {
$html_scrub_done .= "<a href=/inbox/$result target=_blank>$result</a><br>\n";
}
else {
$html_scrub_cond .= "... $result <br>\n";
}
}
$html_footer=html_footer();
$html_kb_links=$html_kb_links($options);
$html = $html_header . $html_btn_squares . $html_scrub_done . $html_kb_links . $html_footer;
return( $html );
}
else {
/// $html_upload .= "$php_self ko_upload MSG_2787: NOTFOUND to_filename=[$to_filename] to_pathfile=[$to_pathfile]<br/>\n";
}
}
else {
$html_upload .= "$php_self ko_upload ERR_2790: NOTFOUND file_name=[$file_name] file_tmpname=[$file_tmpname] to_filename=[$to_filename] to_pathfile=[$to_pathfile]<br/>\n";
// print( "$php_self ko_upload ERR_2790: NOTFOUND file_name=[$file_name] file_tmpname=[$file_tmpname] to_filename=[$to_filename] to_pathfile=[$to_pathfile]<br/>\n" );
}
}
// return( $led_filename );
return( $html_upload );
}
function kb_mkdir( $kbpath, $kbid ) {
// $document_root/ko_center/kb
$syscmd_mkdir="mkdir $kbpath";
// print( "$php_self koaac_kb_upload MSG_1711: kbid=[$kbid] kbpath=[$kbpath] syscmd_mkdir=[$syscmd_mkdir]<hr>\n" );
if( ! is_dir( $kbpath )) {
print( "$php_self koaac_kb_upload MSG_1711a: kbid=[$kbid] NOTFOUND kbpath=[$kbpath]<hr>\n" );
print( "$php_self koaac_kb_upload MSG_1712: kbid=[$kbid] syscmd_mkdir=[$syscmd_mkdir]<hr>\n" );
system( "$syscmd_mkdir" );
}
else {
// print( "$php_self koaac_kb_upload MSG_1713: kbid=[$kbid] exists syscmd_mkdir=[$syscmd_mkdir]<hr>\n" );
}
// $document_root/ko_center/kb/yyyymm
$kb_ym=substr( $kbid, 0, 6 );
$kbpath_ym .= "$kbpath/$kb_ym";
$syscmd_mkdir="mkdir $kbpath_ym";
// print( "$php_self koaac_kb_upload MSG_1711: kbid=[$kbid] kbpath_ym=[$kbpath_ym] syscmd_mkdir=[$syscmd_mkdir]<hr>\n" );
if( ! is_dir( $kbpath_ym )) {
print( "$php_self koaac_kb_upload MSG_1721a: kbid=[$kbid] NOTFOUND kbpath_ym=[$kbpath_ym]<hr>\n" );
print( "$php_self koaac_kb_upload MSG_1722: kbid=[$kbid] syscmd_mkdir=[$syscmd_mkdir]<hr>\n" );
system( "$syscmd_mkdir" );
}
else {
// print( "$php_self koaac_kb_upload MSG_1723: kbid=[$kbid] exists syscmd_mkdir=[$syscmd_mkdir]<hr>\n" );
}
// $document_root/ko_center/kb/yyyymm/yyyymmdd_hhmmss/
$kbpath_ym_kb="$kbpath_ym/$kbid";
$syscmd_mkdir="mkdir $kbpath_ym_kb";
// print( "$php_self koaac_kb_upload MSG_1731: kbid=[$kbid] kbpath_ym_kb=[$kbpath_ym_kb]<hr>\n" );
if(! is_dir( $kbpath_ym_kb )) {
// print( "$php_self koaac_kb_upload MSG_560: kbid=[$kbid] syscmd_mkdir=[$syscmd_mkdir]<hr>\n" );
system( "$syscmd_mkdir" );
}
else {
// print( "$php_self koaac_kb_upload WARN_2840: kbid=[$kbid] EXISTS syscmd_mkdir=[$syscmd_mkdir]<hr>\n" );
}
return( $kbpath_ym_kb );
}
function getfiles( $path, $mask ) {
// print( "getfiles: path=[$path] mask=[$mask] <br>\n" );
if( file_exists( $path )) {
$handler = opendir($path);
while( $file = readdir($handler)) {
if ( $file == "." ) { continue; }
if ( $file == ".." ) { continue; }
// print( "getfiles MSG_035: file=[$file] path=[$path] mask=[$mask] <br>\n" );
if ( preg_match( "/^$mask/", $file )) {
// print( "getfiles MSG_040: preg_match file=[$file] mask=[$mask] matches=[$matches]<br>\n" );
$results[] = $file;
}
else {
// print( "get_filelsit ERR_040: preg_match file=[$file] mask=[$mask] matches=[$matches]<br>\n" );
}
}
}
return( $results );
}
function scrub_view( $options ) {
$output ="";
$output .= "<html><title> es scrub view</title><body bgcolor=lightblue>\n";
$output .= "<hr>$php_self<br/>$dttm<br/>$version<br/>\n";
$output .= "_SERVER remote_addr=$remote_addr<br/>\n";
$output .= "_SERVER server_addr=$server_addr<br/>\n";
$output .= "_SERVER server_name=$server_name<br/>\n";
$output .= "_SERVER windir=$windir <br/>\n";
$output .= "<hr></body></html>\n";
return( $output );
}
function sql3_select_hallo($db3file,$db3tbl,$ip) {
// $db3file="kosaic.db3";
// $tblname="hallo";
$sql_select_hallo = "select * from $db3tbl where ip like '%".$ip."%'";
// printf( "BUGS_5961 sql3_select_hallo db3file=%s db3tbl=%s ip=%s sql_select_hallo=%s<br>", $db3file,$db3tbl,$ip, $sql_select_hallo );
$output = "";
$j=0;
$pdo = newpdo($db3file);
// $pdo = newpdo($GLOBALS['dbfile']);
foreach( $pdo->query($sql_select_hallo) as $row ) {
$j=$j+1;
$ip = $row['ip'];
// printf( "BUGS_5970 sql3_select_hallo j=%s ip=%s<br>",$j,$ip );
# $url = '<a href="'.$base.'.'.$ext.'" target=_blank>';
# $url .= ' <img src="'.$path.'/'.$base.'.'.$ext.'" height=25 border=0>';
# $url .= ' </a><br>';
# $output .= $url." ".$j." ".$base;
}
# sqlite_close($pdo);
return( $row );
}
function sql3_insert_hallo($db3file,$db3tbl) {
$progid="kosaic";
$dttm=date("Ymd_His");
// $db3file="kosaic.db3";
// $db3tbl="hallo";
// $sql_in = "select * from $tblname where base like '%".substr($led_name,8)."%'";
// printf( "BUGS_5980 sql3_insert_hallo db3file=%s db3tbl=%s<br>",$db3file,$db3tbl );
$referer=$_SERVER['HTTP_REFERER'];
# print( "referer=$pinfo_referer<br>" );
$remote_addr=$_SERVER['REMOTE_ADDR'];
$ip=$remote_addr;
$remote_port=$_SERVER['REMOTE_PORT'];
$server_addr=$_SERVER['SERVER_ADDR'];
$server_port=$_SERVER['SERVER_PORT'];
$server_name=$_SERVER['SERVER_NAME'];
$server_redirect=$_SERVER['REDIRECT_STATUS'];
$php_self=$_SERVER['PHP_SELF'];
$remote_addrcode=str_replace( ".", "-", $remote_addr );
# print( "BUGS_22 remote_addr=$remote_addr<br>\n" );
# print( "BUGS_22 remote_addrcode=$remote_addrcode<br>\n" );
$server_content_length=$_SERVER['CONTENT_LENGTH'];
$server_request_time=$_SERVER['REQUEST_TIME'];
$server_argv=$_SERVER['argv'];
$server_argc=$_SERVER['argc'];
$server_name=$_SERVER['SERVER_NAME'];
$server_host=$_SERVER['HOST'];
# print( "server_host=$server_host <br>" );
$http_user_agent=$_SERVER['HTTP_USER_AGENT'];
$user_agent=$http_user_agent;
$user_agent=str_replace( " ", "_", $user_agent );
$user_agent=str_replace( ",", "", $user_agent );
$user_agent=str_replace( "/", "", $user_agent );
$user_agent=str_replace( ";", "", $user_agent );
$user_agent=str_replace( "(", "", $user_agent );
$user_agent=str_replace( ")", "", $user_agent );
$user_agent=str_replace( ":", "", $user_agent );
$user_agent=str_replace( ".", "", $user_agent );
$user_agent=strtolower( $user_agent );
$server_redirect=$_SERVER['REDIRECT_STATUS'];
$php_self=$_SERVER['PHP_SELF'];
$remote_addrcode=str_replace(".","-",$remote_addr );
$server_content_length=$_SERVER['CONTENT_LENGTH'];
$server_document_root=$_SERVER['DOCUMENT_ROOT'];
$server_name=$_SERVER['SERVER_NAME'];
$server_host=$_SERVER['SERVER_HOST'];
$user_id="user_id";
$user_name="user_name";
$user_phone="user_phone";
$user_email="user_email";
$user_url="user_url";
if( isset( $_GET['user_id'] )) { $user_id=$_GET['user_id']; }
if( isset( $_POST['user_id'] )) { $user_id=$_POST['user_id']; }
if( isset( $_SERVER['user_id'] )) { $user_id=$_SERVER['user_id']; }
if( isset( $_SERVER['user_name'] )) { $user_name=$_SERVER['user_name']; }
if( isset( $_SERVER['user_phone'] )) { $user_phone=$_SERVER['user_phone']; }
if( isset( $_SERVER['user_email'] )) { $user_email=$_SERVER['user_email']; }
if( isset( $_SERVER['user_url'] )) { $user_url=$_SERVER['user_url']; }
// printf( "BUGS_6021 sql3_insert_hallo progid=%s<br>",$progid );
// printf( "BUGS_6021 sql3_insert_hallo dttm=%s<br>",$dttm );
// printf( "BUGS_6021 sql3_insert_hallo referer=%s<br>",$referer );
// printf( "BUGS_6022 sql3_insert_hallo remote_addr=%s<br>",$remote_addr );
// printf( "BUGS_6023 sql3_insert_hallo remote_port=%s<br>",$remote_port );
// printf( "BUGS_6024 sql3_insert_hallo server_addr=%s<br>",$server_addr );
// printf( "BUGS_6025 sql3_insert_hallo server_port=%s<br>",$server_port );
// printf( "BUGS_6026 sql3_insert_hallo server_redirect=%s<br>",$server_redirect );
// printf( "BUGS_6027 sql3_insert_hallo remote_addrcode=%s<br>",$remote_addrcode );
// printf( "BUGS_6028 sql3_insert_hallo server_content_length=%s<br>",$server_content_length );
// printf( "BUGS_6029 sql3_insert_hallo server_document_root=%s<br>",$server_document_root );
// printf( "BUGS_6030 sql3_insert_hallo server_name=%s<br>",$server_name );
// printf( "BUGS_6031 sql3_insert_hallo server_host=%s<br>",$server_host );
// printf( "BUGS_6032 sql3_insert_hallo user_id=%s<br>",$user_id );
// printf( "BUGS_6033 sql3_insert_hallo user_name=%s<br>",$user_name );
// printf( "BUGS_6034 sql3_insert_hallo user_phone=%s<br>",$user_phone );
// printf( "BUGS_6035 sql3_insert_hallo user_email=%s<br>",$user_email );
// printf( "BUGS_6036 sql3_insert_hallo user_url=%s<br>",$user_url );
$output = "";
$j=0;
$sql_insert = "";
$sql_insert .= "INSERT or REPLACE into $db3tbl ";
$sql_insert .= " ( ";
$sql_insert .= "'progid',";
$sql_insert .= "'dttm',";
$sql_insert .= "'status',";
$sql_insert .= "'allow',";
$sql_insert .= "'deny',";
$sql_insert .= "'ip',";
$sql_insert .= "'referer',";
$sql_insert .= "'user_agent',";
$sql_insert .= "'remote_addr',";
$sql_insert .= "'remote_port',";
$sql_insert .= "'server_addr',";
$sql_insert .= "'server_port',";
$sql_insert .= "'server_redirect',";
$sql_insert .= "'remote_addrcode',";
$sql_insert .= "'remote_addrcodek9',";
$sql_insert .= "'server_content_length',";
$sql_insert .= "'server_document_root',";
$sql_insert .= "'server_name',";
$sql_insert .= "'name',";
$sql_insert .= "'email',";
$sql_insert .= "'phn',";
$sql_insert .= "'mob',";
$sql_insert .= "'url',";
$sql_insert .= "'img',";
$sql_insert .= "'tn',";
$sql_insert .= "'desc'";
$sql_insert .= " ) values ( ";
$sql_insert .= "'$progid',";
$sql_insert .= "'$dttm',";
$sql_insert .= "'$status',";
$sql_insert .= "'$allow',";
$sql_insert .= "'$deny',";
$sql_insert .= "'$ip',";
$sql_insert .= "'$referer',";
$sql_insert .= "'$user_agent',";
$sql_insert .= "'$remote_addr',";
$sql_insert .= "'$remote_port',";
$sql_insert .= "'$server_addr',";
$sql_insert .= "'$server_port',";
$sql_insert .= "'$server_redirect',";
$sql_insert .= "'$remote_addrcode',";
$sql_insert .= "'$remote_addrcodek9',";
$sql_insert .= "'$server_content_length',";
$sql_insert .= "'$server_document_root',";
$sql_insert .= "'$server_name',";
$sql_insert .= "'$name',";
$sql_insert .= "'$email',";
$sql_insert .= "'$phn',";
$sql_insert .= "'$mob',";
$sql_insert .= "'$url',";
$sql_insert .= "'$img',";
$sql_insert .= "'$tn',";
$sql_insert .= "'$desc'";
$sql_insert .= " );";
// $dbfile = newpdo($GLOBALS['dbfile']);
$dbfile=$db3file;
// printf( "BUGS_6121 dbfile=%s<br>",$dbfile );
// printf( "BUGS_6121 db3file=%s<br>",$db3file );
// printf( "BUGS_6122 sql_insert=%s<br>",$sql_insert );
$db3 = newpdo($db3file);
$db3->exec($sql_insert);
// printf( "BUGS_6102 sql3_insert_hallo sql_insert=%s<br>",$sql_insert );
// sqlite_exec($pdo, $sql_insert );
// pdo_insert($db3file,$db3tbl,$sql_insert );
// sqlite_close($pdo);
// printf( "BUGS_6103 sql3_insert_hallo sql_insert=%s<br>",$sql_insert );
// $sql_insert .= " ( 'ip','progid', 'dttm', 'ip' ) values ( '$progid', '$dttm', '$ip' );"
// $pdo = newpdo($GLOBALS['dbfile']);
// printf( "BUGS_5650 sql_insert_hallo db3file=%s", $db3file );
// $pdo = newpdo($db3file);
// sqlite_exex($pdo, $sql_insert );
// foreach( $pdo->query($sql) as $row ) {
// $j=$j+1;
// $led_name = $row['led_name'];
// $path=$row['path'];
// $base=$row['base'];
// $ext=$row['ext'];
// $url = '<a href="'.$base.'.'.$ext.'" target=_blank>';
// $url .= ' <img src="'.$path.'/'.$base.'.'.$ext.'" height=25 border=0>';
// $url .= ' </a><br>';
// $output .= $url." ".$j." ".$base;
// }
return( $ip );
}
function leds_about( $options ) {
$dttm=date("Ymd_His");
$php_self=$_SERVER['PHP_SELF'];
$remote_addr=$_SERVER['REMOTE_ADDR'];
$server_addr=$_SERVER['SERVER_ADDR'];
$server_name=$_SERVER['SERVER_NAME'];
$windir=$_SERVER['WINDIR'];
$cygwin = $_ENV['CYGWIN'];
$os= $_ENV['OS'];
$username=$_ENV['USERNAME'];
$processor_architecture=$_ENV['PROCESSOR_ARCHITECTURE'];
$version = $GLOBALS['version'];
$hs_type=$_SESSION['hs_type'];
$org_type=$_SESSION['org_type'];
$preview=$_SESSION['preview'];
$output .= "<hr>$php_self<br/>$dttm<br/>$version<br/>\n";
$output .= "_SERVER remote_addr=$remote_addr<br/>\n";
$output .= "_SERVER server_addr=$server_addr<br/>\n";
$output .= "_SERVER server_name=$server_name<br/>\n";
$output .= "_SERVER windir=$windir <br/>\n";
$output .= "_ENV username=$username <br/>\n";
$output .= "_ENV cygwin=$cygwin <br/>\n";
$output .= "_ENV os=$os <br/>\n";
$output .= "_ENV processor_architecture=$processor_architecture <br/>\n";
$output .= "_SESSION hs_type=$hs_type <br/>\n";
$output .= "_SESSION org_type=$org_type <br/>\n";
$output .= "_SESSION preview=$preview <br/>\n";
$output .= "_GLOBALS version=$version <br/>\n";
$output .= "<hr>\n";
if($remote_addr == $server_addr ) {
$user_location="local";
$server_os = substr( $os, 0, 7 );
}
else {
$user_location="remote";
}
$_SESSION['user_location']=$user_location;
$_SESSION['server_os']=$server_os;
$output .= "user_location=$user_location<br>\n";
$output .= "server_os=$server_os<hr>\n";
// if(( $user_location == "local" ) & ($server_os == "Windows" )) {
// $cmd="wi temp.txt";
// $cmd="i_view32.exe";
// system( $cmd );
// }
return( $output );
// print( "<hr>BUGS_390 leds_about: $output<hr>\n" );
// html_page($options);
// print( "<hr>\n" );
}
function leds_phpinfo( $options ) {
$dttm=date("Ymd_His");
$php_self=$_SERVER['PHP_SELF'];
$version = $GLOBALS['version'];
print( "<hr>$php_self<br/>$dttm<br/>$version<hr>\n" );
print( "<hr>options=<br>\n" );
print_r( $options );
print( "<hr>_REQUEST=<br>\n" );
print_r( $_REQUEST );
print( "<hr>_GET=<br>\n" );
print_r( $_GET );
print( "<hr>\n" );
phpinfo();
print( "<hr>\n" );
html_page($options);
}
function anonymous_option1( $options ) { print( "<hr>\n" ); print_r( $options ); }
function anonymous_option2( $options ) { print( "<hr>\n" ); print_r( $options ); }
function anonymous_option3( $options ) { print( "<hr>\n" ); print_r( $options ); }
function guest_option1( $options ) { print( "<hr>\n" ); print_r( $options ); }
function guest_option2( $options ) { print( "<hr>\n" ); print_r( $options ); }
function guest_option3( $options ) { print( "<hr>\n" ); print_r( $options ); }
function user_option1( $options ) { print( "<hr>\n" ); print_r( $options ); }
function user_option2( $options ) { print( "<hr>\n" ); print_r( $options ); }
function user_option3( $options ) { print( "<hr>\n" ); print_r( $options ); }
function qc_option1( $options ) { print( "<hr>\n" ); print_r( $options ); }
function qc_option2( $options ) { print( "<hr>\n" ); print_r( $options ); }
function qc_option3( $options ) { print( "<hr>\n" ); print_r( $options ); }
function manager_option1( $options ) { print( "<hr>\n" ); print_r( $options ); }
function manager_option2( $options ) { print( "<hr>\n" ); print_r( $options ); }
function manager_option3( $options ) { print( "<hr>\n" ); print_r( $options ); }
function operator_option1( $options ) { print( "<hr>\n" ); print_r( $options ); }
function operator_option2( $options ) { print( "<hr>\n" ); print_r( $options ); }
function operator_option3( $options ) { print( "<hr>\n" ); print_r( $options ); }
function admin_option1( $options ) { print( "<hr>\n" ); print_r( $options ); }
function admin_option2( $options ) { print( "<hr>\n" ); print_r( $options ); }
function admin_option3( $options ) { print( "<hr>\n" ); print_r( $options ); }
function iperms( $options ) {
$php_self=$_SERVER['PHP_SELF'];
$cwd = getcwd();
$cwd_iperms = "c:/iperms/ko/bin";
if( $options[1] == "" ) {
html_page($options);
print( "<hr>iperms<hr>\n" );
print( "<a href=$php_self?q=iperms/periods_p>periods_p</a><br/>\n" );
print( "<a href=$php_self?q=iperms/periods_pp>periods_pp</a><br/>\n" );
// print( "<br/>\n" );
print( "<a href=$php_self?q=iperms/job2db>job2db</a><br/>\n" );
return;
}
if( $options[1] == "periods_p" ) {
$title="<hr>iperms periods_p<hr>\n";
$cmd="c:/perl/bin/perl.exe iperms.pl periods_p";
leds_process_psv( $title, $cmd, $cwd_iperms );
return;
}
if( $options[1] == "periods_pp" ) {
$title="<hr>iperms periods_pp<hr>\n";
$cmd="c:/perl/bin/perl.exe iperms.pl periods_pp";
leds_process_psv( $title, $cmd, $cwd_iperms );
return;
}
if(( $options[1] == "job2db" ) & ( $options[2] == "" )) {
html_page($options);
print( "<hr>iperms job2db<hr>\n" );
print( "<a href=$php_self?q=iperms/job2db/mkwl>mkwl</a><br/>\n" );
print( "<a href=$php_self?q=iperms/job2db/catwl>catwl</a><br/>\n" );
print( "<a href=$php_self?q=iperms/job2db/runwl>runwl</a><br/>\n" );
return;
}
if(( $options[1] == "job2db" ) & ( $options[2] != "" )) {
if( $options[2] == "mkwl" ) {
$title="<hr>iperms job2db mkwl<hr>\n";
$cmd="c:/perl/bin/perl.exe iperms.pl job2db mkwl";
leds_process( $title, $cmd, $cwd_iperms );
}
if( $options[2] == "catwl" ) {
$title="<hr>iperms job2db catwl<hr>\n";
$cmd="c:/perl/bin/perl.exe iperms.pl job2db catwl";
leds_process( $title, $cmd, $cwd_iperms );
}
if( $options[2] == "runwl" ) {
$title="<hr>iperms job2db runwl<hr>\n";
$cmd="c:/perl/bin/perl.exe iperms.pl job2db runwl";
leds_process( $title, $cmd, $cwd_iperms );
}
return;
}
}
function leds_process( $title, $cmd, $cwd_process ) {
$php_self=$_SERVER['PHP_SELF'];
$dttm=date("Ymd_His");
html_page($options);
if( $title != "" ) {print( "<hr>$title<hr>\n" ); }
print( "<hr>$php_self $dttm BEG: leds_process( $cmd, $cwd_process)<hr>\n" );
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("file","./ko_error.log","a")
);
$process = proc_open( $cmd, $descriptorspec, $pipes, $cwd_process );
if( is_resource($process)) {
print( "<hr>\n" );
$raw_output=stream_get_contents( $pipes[1] );
$output = explode( "\n", $raw_output );
$linenum=1;
print( "<table>\n" );
foreach( $output as $line ) {
trim( $line );
if( $line != "" ) {
print( "$linenum $line<br />\n" );
}
$linenum++;
}
print( "<hr>\n" );
fclose($pipes[1]);
$return_value=proc_close($process);
}
return;
}
function leds_process_psv( $title, $cmd, $cwd_process ) {
$php_self=$_SERVER['PHP_SELF'];
$dttm=date("Ymd_His");
html_page($options);
if( $title != "" ) {print( "<hr>$title<hr>\n" ); }
print( "<hr>$php_self $dttm BEG: leds_process_psv( $cmd, $cwd_process)<hr>\n" );
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("file","./ko_error.log","a")
);
$process = proc_open( $cmd, $descriptorspec, $pipes, $cwd_process );
if( is_resource($process)) {
print( "<hr>\n" );
$raw_output=stream_get_contents( $pipes[1] );
$output = explode( "\n", $raw_output );
$linenum=0;
print( "<table>\n" );
foreach( $output as $line ) {
if( strpos( $line, "select" )) {print( "$line<br/>\n" ); continue;}
if( strpos( $line, "from" )) {print( "$line<br/><br/>\n" ); continue;}
if( ! strpos( $line, "|" )) { continue; }
$flds = explode( "|", $line );
print( "<tr>\n" );
foreach( $flds as $fld ) {
trim( $fld );
print( "<td>$fld<td>\n" );
}
print( "</tr>\n" );
$linenum++;
}
print( "</table>\n" );
print( "<hr>\n" );
fclose($pipes[1]);
$return_value=proc_close($process);
}
return;
}
function leds_process_value( $title, $cmd, $cwd_process ) {
$php_self=$_SERVER['PHP_SELF'];
$dttm=date("Ymd_His");
// html_page($options);
// if( $title != "" ) {print( "<hr>$title<hr>\n" ); }
// print( "<hr>$php_self $dttm BEG: leds_process( $cmd, $cwd_process)<hr>\n" );
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("file","./ko_error.log","a")
);
$process = proc_open( $cmd, $descriptorspec, $pipes, $cwd_process );
if( is_resource($process)) {
print( "<hr>\n" );
$raw_output=stream_get_contents( $pipes[1] );
$output = explode( "\n", $raw_output );
// $linenum=1;
// print( "<table>\n" );
// foreach( $output as $line ) {
// trim( $line );
// if( $line != "" ) {
// print( "$linenum $line<br />\n" );
// }
// $linenum++;
// }
// print( "<hr>\n" );
fclose($pipes[1]);
$return_value=proc_close($process);
}
return( $output );
}
function newpdo( $dbfile ) {
$php_self=$_SERVER['PHP_SELF'];
$http_host=$_SERVER['HTTP_HOST'];
$request_uri=$_SERVER['REQUEST_URI'];
if( ! file_exists( $dbfile )) {
print( "$php_self newpdo ERR_3979: NOT_EXISTS dbfile=[$dbfile]<br>\n" );
if( $GLOBALS['install'] != true ) {
print( "$php_self newpdo ERR: NOT_INSTALL dbfile=[$dbfile]<br>\n" );
return;
}
else {
print( "$php_self newpdo MSG: CREATE dbfile=[$dbfile]<br>\n" );
}
}
try {
$pdo = null;
$pdo = new PDO("sqlite:$dbfile" );
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
// $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
if( $pdo == null ) {
print( "$php_self newpdo ERR: dbfile=[$dbfile]<br>\n" );
return $pdo;
}
return $pdo;
}
catch(PDOException $e ) {
$errmsg = $e->getMessage();
print( "$php_self newpdo ERR: pdo=[$pdo] dbfile=[$dbfile] errmsg=[$errmsg]<br>\n" );
$pdo = null;
return $pdo;
}
}
function html_page($options) {
$html = "";
$html .= html_header($options);
$html .= html_btn_squares($options);
// $html .= "<hr>$progid $dttm MSG_826 [$html]<hr>\n";
$html .= leds_show( $options );
// $html .= html_btn_themes($options,"");
// $html .= html_btn_roles($options,"");
// $html .= html_btn_orgs($options,"");
// $html .= html_btn_hotspots($options,"");
// $html .= html_footer($options,"");
print( $html );
}
function leds_config($options) {
$php_self=$_SERVER['PHP_SELF'];
$html = html_header($options);
$html .= html_btn_squares($options);
$html .= "<hr>leds_config<hr>\n";
// $html .= leds_show( $options );
$html .= html_btn_preview($options,"");
$html .= html_btn_themes($options,"");
$html .= html_btn_roles($options,"");
$html .= html_btn_orgs($options,"");
$html .= html_btn_hotspots($options,"");
$html .= html_footer($options);
print( $html );
// $location_url="$http_host$php_self?q=config";
// header( 'Location:'.$location_url );
}
function html_btn_hotspots($options, $callback) {
$php_self=$_SERVER['PHP_SELF'];
$query_string=$_SERVER['QUERY_STRING'];
$path_btn="/ko_center/imgs/btn";
$path_ani="/ko_center/imgs/ani";
$output = "<hr>\n";
// $hotspots_list="none all grid us hw n11";
$hotspots_list="all grid us hw n11";
$hs_type=$_SESSION['hs_type'];
// $hotspots=explode( " ", "none all grid us hw n11" );
$hotspots=explode( " ", "all grid us hw n11" );
$output .= "<hr><b>hotspots</b> $hs_type:      \n";
foreach( $hotspots as $hotspot ) {
$btn_hs="$path_btn/btn_$hotspot.gif"; $btn_width=15; $btn_height=15;
if( $hs_type == $hotspot ) { $btn_width=30; $btn_height=30; }
// $output .= "<a href=$php_self?q=hs_$hotspot>\n";\
if( $callback ) {
$hs_callback = str_replace( "\$hs", "$hotspot", $callback );
$output .= "<a href=$php_self?q=set/hs/$hotspot&callback=$hs_callback>\n";
}
else {
$output .= "<a href=$php_self?q=set/hs/$hotspot>\n";
}
$output .= "<img src=\"$btn_hs\" alt=\"$btn_hs\" border=0 height=\"$btn_width\" width=\"$btn_height\" />";
$output .= "</a> \n";
$output .= "    \n ";
}
$output .= "<br>\n";
if(( ! isset( $_SESSION['grid_zoom'] )) || ( $_SESSION['grid_zoom'] == "" )) {
// $_SESSION['grid_zoom'] = true;
// $output .= "<a href=$php_self?q=set/grid_zoom&callback=$query_string>\n";
$output .= "<a href=$php_self?q=set/grid_zoom/false&callback=$php_self?$query_string>\n";
$output .= "<img src=\"$path_btn/btn_black.gif\" alt=\"btn_white\" border=0 height=\"20\" width=\"20\" />";
$output .= "</a>\n";
}
// if(( isset( $_SESSION['role'] )) && ( ! $_SESSION['role'] == "" )) {
else {
// unset( $_SESSION['grid_zoom'] );
// $output .= "<a href=$php_self?q=$query_string>\n";
// $output .= "<a href=$php_self?q=set/grid_zoom&callback=$query_string>\n";
$output .= "<a href=$php_self?q=set/grid_zoom/true&callback=$php_self?$query_string>\n";
$output .= "<img src=\"$path_btn/btn_white.gif\" alt=\"btn_white\" border=0 height=\"20\" width=\"20\" />";
$output .= "</a>\n";
}
$output .= "\n";
return( $output );
}
function html_btn_orgs($options, $callback) {
$php_self=$_SERVER['PHP_SELF'];
$path_btn="/ko_center/imgs/btn";
$path_ani="/ko_center/imgs/ani";
$orgs_list="a e h o p t";
$org_type=$_SESSION['org_type'];
$orgs=explode( " ", $orgs_list );
$output .= "<hr><b>orgs</b> $org_type:      \n";
foreach( $orgs as $org ) {
$btn_org="btn_$org.gif"; $btn_width=15; $btn_height=15;
if( $org_type == $org ) { $btn_width=30; $btn_height=30; }
// $output .= "<a href=$php_self?q=org_$org>\n";
// $output .= "<a href=$php_self?q=set/org/$org>\n";
if( $callback != "" ) {
$output .= "<a href=$php_self?q=set/org/$org&callback=$callback>\n";
}
else {
$output .= "<a href=$php_self?q=set/org/$org&callback=$callback>\n";
}
$output .= "<img src=\"$path_btn/$btn_org\" alt=\"$btn_org\" border=0 height=\"$btn_width\" width=\"$btn_height\" />";
$output .= "</a> \n";
// $output .= "   ";
}
return( $output );
}
function html_btn_preview($options, $callback) {
$php_self=$_SERVER['PHP_SELF'];
$path_btn="/ko_center/imgs/btn";
$path_ani="/ko_center/imgs/ani";
$preview=$_SESSION['preview'];
$output .= "<hr><b>preview</b> $preview:      \n";
$previews_list="on off";
$preview_on="on";
$preview_off="off";
if( $preview == $preview_on ) {
$btn_preview="$path_ani/ani_grn00.gif"; $btn_width=15; $btn_height=15;
$output .= "<a href=$php_self?q=set/preview/$preview_off&callback=$callback>\n";
}
else {
$btn_preview="$path_ani/ani_red00.gif"; $btn_width=15; $btn_height=15;
$output .= "<a href=$php_self?q=set/preview/$preview_on&callback=$callback>\n";
}
$output .= "<img src=\"$btn_preview\" alt=\"$btn_preview\" border=0 height=\"$btn_width\" width=\"$btn_height\" />";
$output .= "</a> \n";
return( $output );
}
function html_btn_roles($options, $callback) {
$php_self=$_SERVER['PHP_SELF'];
$path_btn="/ko_center/imgs/btn";
$path_ani="/ko_center/imgs/ani";
$roles_list="admin local op mgr user anon";
$role_type=$_SESSION['role'];
/// if(( $role_type != "admin" ) && ( $role_type != "local" ) && ( $role_type != "op" )) { return; }
$roles=explode( " ", $roles_list );
// $output .= "<hr><b>roles</b> $role_type:\n";
$output .= "<hr><b>roles</b> $role_type:      \n";
foreach( $roles as $role ) {
$btn_role="btn_$role.gif"; $btn_width=15; $btn_height=15;
if( $role_type == $role ) { $btn_width=20; $btn_height=20; }
// $output .= "<a href=$php_self?q=set_role/$role>\n";
// $output .= "<a href=$php_self?q=set/role/$role>\n";
if( $callback ) {
$output .= "<a href=$php_self?q=set/role/$role&callback=$callback>\n";
}
else {
$output .= "<a href=$php_self?q=set/role/$role>\n";
}
$output .= "<img src=\"$path_btn/$btn_role\" alt=\"$btn_role\" border=0 height=\"$btn_width\" width=\"$btn_height\" />";
$output .= "</a> \n";
$output .= "     ";
}
return( $output );
}
function html_btn_themes($options, $callback) {
$http_host=$_SERVER['HTTP_HOST'];
$php_self=$_SERVER['PHP_SELF'];
$themes=$GLOBALS['themes'];
$default_theme=$themes[0];
$current_theme=$_SESSION['theme'];
$path_btn="/ko_center/imgs/btn";
$path_ani="/ko_center/imgs/ani";
// $html_theme_links ="";
// $html_theme_links .= "<a href=\"http://$http_host$php_self\"><b><img src=\"imgs/btn/btn_black.gif\"></a>  \n";
$html_theme_links = "<div id=\"themes\"\n";
$html_theme_links .= "<hr><b>themes:</b> $current_theme<br>\n";
foreach( $themes as $theme ) {
$theme_abrev=substr( $theme, 0, 2 );
if( $current_theme == $theme ) {
// $html_theme_links .= "<a href=\"http://$http_host$php_self?q=set_theme/$theme\" alt=$theme>";
if( $callback ) {
$html_theme_links .= "<a href=$php_self?q=set/theme/$theme&callback=$callback alt=$theme>\n";
}
else {
$html_theme_links .= "<a href=\"http://$http_host$php_self?q=set/theme/$theme\" alt=$theme>";
}
// $html_theme_links .= "<b>$theme_abrev</b></a>  \n";
$html_theme_links .= "<img src=\"imgs/btn/btn_theme_$theme".".gif\" border=0 height=100>";
$html_theme_links .= "<font size=3>$theme</font></a>  \n";
}
else {
// $html_theme_links .= "<a href=\"http://$http_host$php_self?q=set_theme/$theme\" alt=$theme>";
// $html_theme_links .= "<a href=\"http://$http_host$php_self?q=set/theme/$theme\" alt=$theme>";
if( $callback != "" ) {
$html_theme_links .= "<a href=$php_self?q=set/theme/$theme&callback=$callback alt=$theme>\n";
}
else {
$html_theme_links .= "<a href=$php_self?q=set/theme/$theme alt=$theme>\n";
}
// $html_theme_links .= "$theme_abrev</a>  \n";
$html_theme_links .= "<img src=\"imgs/btn/btn_theme_$theme".".gif\" border=0 height=50>";
$html_theme_links .= "<font size=2>$theme</font></a>  \n";
}
}
$html_theme_links .= "<hr>\n";
$html_theme_links .= "</div>\n";
return( $html_theme_links);
}
function scrub_show($options) {
$html = "";
$html .= leds_show( $options );
$dttm=date("Ymd_His");
$php_self=$_SERVER['PHP_SELF'];
$http_host=$_SERVER['HTTP_HOST'];
$request_uri=$_SERVER['REQUEST_URI'];
$preview=$_SESSION['preview'];
$path_btn="./imgs/btn";
$path_ani="./imgs/ani";
$path_fpb="./imgs/fpb";
// printf( "<hr>$php_self $dttm ERR_1058: UNAVAILABLE dbfile=[".$GLOBALS['dbfile']."]<hr>\n");
if( ! file_exists( $GLOBALS['dbfile'] )) {
// printf( "<hr>$php_self $dttm ERR: UNAVAILABLE dbfile=[".$GLOBALS['dbfile']."]<hr>\n");
$html .= "<hr>$php_self $dttm ERR: UNAVAILABLE dbfile=[".$GLOBALS['dbfile']."]<hr>\n";
return;
}
// else {
// printf( "<hr>$php_self $dttm MSG_1025: FOUND dbfile=[".$GLOBALS['dbfile']."]<hr>\n");
// }
// $testfile="$document_root/ko_center/es.db3";
// $testfile="$document_root/index.php";
/// $html .= html_btn_footer($options);
$html .= "<hr>\n";
$html .= html_footer();
/// echo $html;
/// printf( "BUGS_1043<hr>\n" );
return( $html );
}
function leds_show( $options ) {
// $output = html_header();
$dttm=date("Ymd_His");
$php_self=$_SERVER['PHP_SELF'];
$http_host=$_SERVER['HTTP_HOST'];
$request_uri=$_SERVER['REQUEST_URI'];
$preview=$_SESSION['preview'];
$path_btn="./imgs/btn";
$path_ani="./imgs/ani";
$path_fpb="./imgs/fpb";
$path_fpb="./imgs/cab";
// printf( "BUGS_4017 path_fpb=[$path_fpb]<br>\n" );
$option1=$options[1];
$option2=$options[2];
$option3=$options[3];
$option4=$options[4];
$option5=$options[5];
if( ! file_exists( $GLOBALS['dbfile'] )) {
// printf( "<hr>$php_self $dttm ERR: UNAVAILABLE dbfile=[".$GLOBALS['dbfile']."]<hr>\n");
$output .= "<hr>$php_self $dttm ERR: UNAVAILABLE dbfile=[".$GLOBALS['dbfile']."]<hr>\n";
return;
}
// $output .= "<hr>leds_show<hr>\n";
// printf( "<hr>leds_show_6330<hr>\n" );
$dttm=date( "Ymd_His" );
$today = mktime( 0,0,0, date("m"), date("d"), date("y"));
// $tomorrow = mktime( 0,0,0, date("m"), date("d")+1, date("y"));
// $yesterday = mktime( 0,0,0, date("m"), date("d")-1, date("y"));
$dbfile= $GLOBALS['dbfile'];
$pdo = newpdo($GLOBALS['dbfile']);
$tblname=$GLOBALS['tblname'];
$sql = "select * from $tblname";
$sql = "select * from $tblname where led_dttm == 'current'";
if(( isset( $_REQUEST['led_type'] )) && ( ! $_REQUEST['led_type'] == "" )) {
$led_type = $_REQUEST['led_type'];
$sql = "select * from $tblname where led_dttm == 'current' and led_type == '$led_type'";
}
// print( "$php_self MSG_4314: dbfile=[$dbfile] tblname=[$tblname] sql=[$sql] led_type=[$led_type]<br>\n");
// return;
// phpinfo();
$collim=8;
$collim=24;
$colnum=1;
foreach( $pdo->query($sql) as $row ) {
$led_output =
$row['led_name'] . ' - ' .
$row['led_dttm'] . ' - ' .
$row['led_color' ] . ' - ' .
$row['led_speed' ] . ' - ' .
$row['led_type' ] . ' - ' .
$row['led_date' ] . ' - ' .
$row['led_cmd' ] . ' - ' .
$row['led_desc' ] . ' - ' .
$row['led_misc' ] . ' - ' .
' <br />';
/// print( "MSG_5360: option1=[$option1] cab=[$cab] sql=[$sql] colnum=$colnum collim=$collim<br>led_output=[$led_output]<hr>\n" );
if( $row['led_type'] == "date" ) {
$mydt_yyyymd=$row['led_date'];
if( $mydt_yyyymd == "current" ) {
$mydt=$today;
$mydt_yyyy=date("Y");
$mydt_m=date("m");
$mydt_d=date("d");
}
else {
$mydt_yyyy=substr( $mydt_yyyymd, 0, 4 );
$mydt_m=substr( $mydt_yyyymd, 4, 2 );
$mydt_d=substr( $mydt_yyyymd, 6, 2 );
}
// print( "BUGS mydt_yyyymd=[$mydt_yyyymd] mydt_m=[$mydt_m][$mydt_d][$mydt_yyyy]<br>\n" );
$mydt=mktime( 0,0,0, $mydt_m, $mydt_d, $mydt_yyyy );
$diffdays=datediff( 'd', $today, $mydt );
$leds_properties=datediff_leds( $diffdays);
$diffdays=$leds_properties[0];
$color=$leds_properties[1];
$speed=$leds_properties[2];
$ledimg = "$path_ani/ani_" . $color . $speed . ".gif";
}
else {
if( $row['led_type'] == "cmd" ) {
$ledimg = "$path_ani/ani_" . $row['led_color'] . $row['led_speed'] . ".gif";
//// if( $row['led_cmd'] == "pwd" ) { $cmdout= system( "pwd" ); }
//// $cmdout=system( $row['led_cmd'] );
$cmd_code=$row['led_cmd'];
$led_cmd="";
$cmdout[0]="";
if( $cmd_code == "pwd" ) { $led_cmd = "pwd"; }
if( $cmd_code == "date" ) { $led_cmd = "date"; }
// if( $cmd_code == "dir" ) { $led_cmd = "ls -lat c:/xampp/htdocs/hrc/fp/fp*.php"; }
if( $cmd_code == "dir" ) { $led_cmd = "ls"; }
if( $cmd_code == "dir" ) { $led_cmd = "ps -W | grep SSH "; }
if( $cmd_code == "pwd" ) { $led_cmd = "ps -W | grep ssh "; }
if( $cmd_code == "ls" ) { $led_cmd = "ls"; }
// $led_cmd=$row['led_cmd'];
if( $led_cmd != "" ) {
$cmdout=leds_process_value( "", $led_cmd, $cmd_process );
};
if( $cmdout[0] == "" ) {
$color="red"; $speed="90";
}
else {
$color="grn"; $speed="90";
}
$ledimg = "$path_ani/ani_$color$speed.gif";
}
else {
$ledimg = "$path_ani/ani_" . $row['led_color'] . $row['led_speed'] . ".gif";
}
}
$fpnam = $row['led_name'];
$fpbnam = str_replace( "fp", "fpb", $fpnam );
$fpbimg = "$path_fpb/" . $fpbnam . ".png";
$fpbimg = "$path_fpb/tn/tn_" . $fpbnam . ".png";
// $fpbimg_default = "$path_fpb/fpb00.png";
$fpbimg_default = "$path_fpb/preview_default.png";
$fpbimg_default_cmd = "$path_fpb/preview_default_cmd.png";
$fpbimg_default_date = "$path_fpb/preview_default_date.png";
$fpb_title = $row['led_name'] . "(";
$fpb_title .= $row['led_title'] .") ";
// print( "<hr>BUGS_4130 cab=[$cab] sql=[$sql] path_fpb=[$path_fpb] preview=[$preview][". $_SESSION['preview'] . "]<hr>\n" );
if(( $row['led_type'] == "manual" ) | ( $row['led_type'] == "" )) {
$fpb_title .= " (" . $row['led_color'] . $row['led_speed'] . ")(";
$fpb_title .= " bldg(";
$fpb_title .= $row['led_bldg'] .") floor(";
$fpb_title .= $row['led_floor'].")";
$fpb_title .= " path_fpb=$path_fpb ";
$fpb_title .= " fpbimg=$fpbimg ";
}
if( $row['led_type'] == "date" ) {
$fpbimg_default = $fpbimg_default_date;
$fpb_title .= "($color$speed)";
$fpb_title .= " date(";
$fpb_title .= $row['led_date'] .") diffdays($diffdays)";
}
if( $row['led_type'] == "cmd" ) {
$fpbimg_default = $fpbimg_default_cmd;
$fpb_title .= "($color$speed)";
$fpb_title .= " cmd(";
$fpb_title .= $row['led_cmd'] .")($led_cmd) cmdout(". $cmdout[0]. ")";
/// $fpb_title .= $row['led_cmd'] .") cmdout(" ;
/// print( "BUGS_1125 [$cmd_code][$led_cmd]<br>\n" );
/// print( "BUGS_1125 cmdout0=[$cmdout[0]]<br>\n" );
/// print( "BUGS_1125 cmdout1=[$cmdout[1]]<br>\n" );
/// print( "BUGS_1125 cmdout2=[$cmdout[2]]<br>\n" );
/// foreach( $cmdout as $cmdline ) {
/// print( "BUGS_1129 cmdline=[$cmdline][$fbp_title]<br>\n" );
/// $fpb_title .= $cmdline ."<br>\n";
/// }
/// $fpb_title .= ")<hr>";
// $fpb_title .= $row['led_cmd'] .") cmdout(". $row['led_cmdout'] . ")";
}
if( $row['led_type'] == "null" ) {
$ledimg="led_null.png";
$ledimg = "$path_ani/ani_null.gif";
}
$output .= "<a href=$php_self?q=detail/".$row['led_name']." ";
// $preview = "off";
if( $preview == "on" ) {
if( $GLOBALS['screenshots_pcharts'] != "" ) {
$host="l1033"; $path="/var"; $used=rand(1,100); $free=rand(1,900);
$pchart_title="$dttm p=$path u=$used f=$free";
$pchart_url="/ko_center/ko_pcharts_pie.php?q=df/$host/$host/$used/$free";
$output .= " class=\"screenshot\" rel=\"$pchart_url\" title=\"$pchart_title\" ";
}
else {
if( file_exists( $fpbimg )) {
$output .= " class=\"screenshot\" rel=\"$fpbimg\" title=\"$fpb_title\" width=100 ";
// $output .= " class=\"preview\" rel=\"$fpbimg\" title=\"$fpb_title\" ";
}
else {
$output .= " class=\"screenshot\" rel=\"$fpbimg_default\" title=\"$fpb_title\" ";
}
}
}
$output .= ">\n";
if( preg_match( "/ko_center/", $fpbnam, $matches )) {
/// $output .= "<div id=\"drag\">\n";
/// $output .= "<div class=\"drg\" id=\"$ledcode\">\n";
$output .= "<img src=\"$ledimg\" alt=\"$ledimg\" border=0 height=\"20\" width=\"20\" />";
$output .= "</a>\n";
//// $output .= "</div>\n";
/// $output .= "</div>\n";
}
else {
$output .= "<img src=\"$ledimg\" alt=\"$ledimg\" border=0 height=\"15\" width=\"15\" />";
$output .= "</a>\n";
}
// $output .= "<!-- fpbimg=$fpbimg fpbnam=[$fpbnam]-->\n";
// $output .= "<a href=$fpbimg>$fpbimg<img src=$fpbimg></a>\n";
if(( preg_match( "/ko_centert/", $fpbnam, $matches ))
|| ( preg_match( "/nl/", $fpbnam, $matches ))
|| ( preg_match( "/pl/", $fpbnam, $matches ))
|| ( preg_match( "/ql/", $fpbnam, $matches ))
|| ( preg_match( "/tl/", $fpbnam, $matches ))
|| ( preg_match( "/vl/", $fpbnam, $matches ))
|| ( preg_match( "/xl/", $fpbnam, $matches ))
|| ( preg_match( "/vio/", $fpbnam, $matches ))
|| ( preg_match( "/data/", $fpbnam, $matches ))) {
$output .= "<br />\n";
$colnum=1;
}
else {
// if( $colnum == 12 ) { $output .= "     _     "; }
if(( preg_match( "/al/", $fpbnam, $matches ))
|| ( preg_match( "/cl/", $fpbnam, $matches ))
|| ( preg_match( "/el/", $fpbnam, $matches ))
|| ( preg_match( "/gl/", $fpbnam, $matches ))
|| ( preg_match( "/il/", $fpbnam, $matches ))
|| ( preg_match( "/kl/", $fpbnam, $matches ))
|| ( preg_match( "/ml/", $fpbnam, $matches ))
|| ( preg_match( "/ol/", $fpbnam, $matches ))
|| ( preg_match( "/ql/", $fpbnam, $matches ))
|| ( preg_match( "/sl/", $fpbnam, $matches ))
|| ( preg_match( "/ul/", $fpbnam, $matches ))) {
$output .= "  -   \n";
}
$colnum=$colnum+1;
if( $colnum > $collim ) {
$output .= "<br />\n";
$colnum=1;
}
}
}
$output .= "</div>\n";
$output .= "<br>\n";
$outout .= "<hr>\n";
$output .= "<div id=div_leds_context>\n";
$output .= html_leds_context();
$output .= "<hr>\n";
$output .= "<br>\n";
//// $output .= "BUGS_5540<br>\n";
$output .= "<a href=$php_self?q=kb target=_blank>\n";
$output .= "<img src=\"$path_btn/kbbooks.png\" alt=\"kb\" border=0 height=\"50\" width=\"50\" />";
$output .= "</a>\n";
$output .= "      \n";
$output .= "<a href=/ko_center/ko_center.php?q=reports><img src=./imgs/btn/reports.png border=0 height=50 width=50 alt=reports></a>\n";
$output .= "      \n";
$output .= "<a href=$php_self?q=hosts><img src=./imgs/btn/datacall.png border=0 height=50 width=50 alt=datacall></a>\n";
$output .= "<a href=$php_self?q=ko_plans><img src=./imgs/btn/whatsyourplan.png border=0 height=50 width=50 alt=plans></a>\n";
// $output .= "<a href=$php_self?q=ko_plans><img src=./imgs/btn/plan.png border=0 height=50 width=50 alt=plans></a>\n";
// $output .= "<a href=$php_self?q=ko_plans><img src=./imgs/btn/plan2.jpg border=0 height=50 width=50 alt=plans></a>\n";
// $output .= "<a href=$php_self?q=ko_plans><img src=./imgs/btn/plan_hands.jpg border=0 height=50 width=50 alt=plans></a>\n";
// $output .= "<a href=$php_self?q=ko_plans><img src=./imgs/btn/plans_toon.jpg border=0 height=50 width=50 alt=plans></a>\n";
// $output .= "<a href=$php_self?q=ko_plans><img src=./imgs/btn/scenario_planning.jpg border=0 height=50 width=50 alt=plans></a>\n";
$output .= "<hr>\n";
$pdo = null;
if(! isset($_SESSION['hs_type'] )) { $hs_type="default"; }
else {$hs_type=$_SESSION['hs_type'];}
if(! isset($_SESSION['org_type'] )) { $org_type="p"; }
else {$org_type=$_SESSION['org_type'];}
/// $osteams="hpx aix sol rhe win uss ioc aac"
// js_rollover( $options );
// css_rollovers_href( $options );
// js_fgmenu( $options );
// print( $output );
// $output .= html_btn_footer($options);
$tblname="shelves";
$tblname="ko_hw";
$cabid= str_replace( "cab_", "", $option1);
$sql = "select * from $tblname where cab == '$cabid'";
// $fpbnam = str_replace( "fp", "fpb", $led_name );
$collim=8;
$collim=24;
$colnum=1;
// if( $cabid == "" ) { return; }
$dbfile=$GLOBALS['dbfile'];
// printf( "BUGS_5560 sql=[$sql] cabid=[$cabid] dbfile=[$dbfile]<hr>\n" );
$pdo = newpdo($GLOBALS['dbfile']);
$j=0;
foreach( $pdo->query($sql) as $row ) {
$j++;
$item=$row['item'];
$model=$row['model'];
$item_png="./imgs/cab/".$item.".png";
$alt="";
// printf( "BUGS_5568 j=$j sql=[$sql] item_png=[$item_png] item=[$item]<br>\n" );
if( file_exists( $item_png )) {
$im_flds = im_identify( $item_png );
$im_color=$im_flds[6];
$im_width=$im_flds[8];
$im_height=$im_flds[9];
$im_size=$im_flds[10];
$alt="alt=\" $im_width $im_height $im_size $im_color\"";
// printf( "BUGS_5580: FOUND j=$j alt=[$alt] sql=[$sql] item_png=[$item_png] item=[$item]<br>\n" );
}
// printf( "BUGS_4331 item=[$item] item_png=$item_png<br>\n" );
// cab|zone|grp|vendor|item|cab1|zone1|grp1|btu|watts|amps|vac|height|width|depth|weight|spectext
$led_output = "";
if( $item_png != "" ) {
$led_output .= "<a href=https://$http_host/$php_self?q=item/$item>";
$led_output .= "<img src=". $item_png . " width=100 alt=$alt >";
$led_output .= "</a>\n";
}
$led_output .=
$row['cab'] . ' - ' .
$row['zone'] . ' - ' .
$row['grp' ] . ' - ' .
$row['vendor' ] . ' - ' .
$row['item' ] . ' - ' .
$row['cab1' ] . ' - ' .
$row['zone1' ] . ' - ' .
$row['grp1' ] . ' - ' .
$row['btu' ] . ' - ' .
$row['watts' ] . ' - ' .
$row['amps' ] . ' - ' .
$row['vac' ] . ' - ' .
$row['height' ] . ' - ' .
$row['width' ] . ' - ' .
$row['depth' ] . ' - ' .
$row['weight' ] . ' - ' .
$row['spectext' ];
// '<img src='. $item_png . ' height=50 alt=$alt>' .
// ' <br />';
// printf( "$led_output<hr>\n" );
// printf( "MSG_5611: led_output=$led_output<br>\n" );
}
$pdo=null;
$output .= $led_output;
//// printf( "MSG_5618: led_output=$led_output output=[$output]<br>\n" );
//// $output .= html_dc_links($options);
/// $output .= leds_zm($options);
$output .= html_footer();
return( $output );
}
function html_leds_context1() {
$height=10;
$htmout="";
if( $GLOBALS['leds_context'] == 'ai' ) { $height=20;} else {$height=10; }
$htmout .= "<form method=\"post\">\n";
$htmout .= "<input type=\"submit\" name=\"set_leds_context\" value=\"ai\" />\n";
$htmout .= " <button name=\"leds_context_ai\"> ";
$htmout .= " <img src=./ko_center.png height=$height border=0>";
$htmout .= " </button>\n";
$htmout .= " </form>\n";
if( $GLOBALS['leds_context'] == 'us' ) { $height=20; } else { $height=10; }
$htmout .= "<form method=\"post\">\n";
$htmout .= "<input type=\"submit\" name=\"set_leds_context\" value=\"us\" />\n";
$htmout .= " <button name=\"leds_context_us\"> ";
$htmout .= " <img src=./ko_center.png height=$height border=0>";
$htmout .= " </button>\n";
$htmout .= " </form>\n";
if( $GLOBALS['leds_context'] == 'cab' ) { $height=20; } else { $height=10; }
$htmout .= "<form method=\"post\">\n";
$htmout .= "<input type=\"submit\" name=\"set_leds_context\" value=\"cab\" />\n";
$htmout .= " <button name=\"leds_context_us\"> ";
$htmout .= " <img src=./ko_center.png height=$height border=0>";
$htmout .= " </button>\n";
$htmout .= " </form>\n";
if( $GLOBALS['leds_context'] == '' ) { $height=20; } else { $height=10; }
$htmout .= "<form method=\"post\">\n";
$htmout .= "<input type=\"submit\" name=\"set_leds_context\" value=\"\" />\n";
$htmout .= " <button name=\"leds_context\"> ";
$htmout .= " <img src=./ko_center.png height=$height border=0>";
$htmout .= " </button>\n";
$htmout .= " </form>\n";
return( $htmout);
}
function leds_zm($options) {
$output = "<hr>\n";
// $output .= "<a href=$php_self?q=zm/row01>\n";
// $output .= "<img src=imgs/cab/row01.png>\n";
// $output .= "<a href=zm/index.htm><img src=imgs/cab/tn_hrc_zm.png alt=hrc_zm></a>";
// $output .= "<a href=zm/hrc_c.htm><img src=imgs/cab/tn/tn_hrc_zm.png alt=hrc_zm></a>";
// $output .= "<a href=zm/hrc_cr01c00.htm><img width=%5 src=imgs/cab/tn/tn_hrc_cr01c00.png alt=hrc_cr01c00></a>";
// $output .= "     ";
$output .= "<a href=zm/hrc_dr13d09.htm><img width=%5 src=imgs/cab/tn/tn_hrc_dr13d09.png alt=hrc_dr13d09></a>";
$output .= "<br>\n";
$output .= "<a href=zm/hrc_cr03c12.htm><img width=%5 src=imgs/cab/tn/tn_hrc_cr03c12.png alt=hrc_cr03c12></a>";
$output .= "     ";
$output .= "<a href=zm/hrc_dr14d12.htm><img width=%5 src=imgs/cab/tn/tn_hrc_dr14d12.png alt=hrc_dr14d12></a>";
$output .= "<br>\n";
$output .= "<a href=zm/hrc_cr04c17.htm><img width=%5 src=imgs/cab/tn/tn_hrc_cr04c17.png alt=hrc_cr04c17></a>";
$output .= "     ";
$output .= "<a href=zm/hrc_dr15d17.htm><img width=%5 src=imgs/cab/tn/tn_hrc_dr15d17.png alt=hrc_dr15d17></a>";
$output .= "<br>\n";
$output .= "<a href=zm/hrc_cr05c20.htm><img width=%5 src=imgs/cab/tn/tn_hrc_cr05c20.png alt=hrc_cr05c20></a>";
$output .= "     ";
$output .= "<a href=zm/hrc_dr16d20.htm><img width=%5 src=imgs/cab/tn/tn_hrc_dr16d20.png alt=hrc_dr16d20></a>";
$output .= "<br>\n";
$output .= "<a href=zm/hrc_cr06c26.htm><img width=%5 src=imgs/cab/tn/tn_hrc_cr06c26.png alt=hrc_cr06c26></a>";
$output .= "     ";
$output .= "<a href=zm/hrc_dr17d26.htm><img width=%5 src=imgs/cab/tn/tn_hrc_dr17d26.png alt=hrc_dr17d26></a>";
$output .= "<br>\n";
$output .= "<a href=zm/hrc_cr07c29.htm><img width=%5 src=imgs/cab/tn/tn_hrc_cr07c29.png alt=hrc_cr07c29></a>";
$output .= "     ";
$output .= "<a href=zm/hrc_dr18d29.htm><img width=%5 src=imgs/cab/tn/tn_hrc_dr18d29.png alt=hrc_dr18d29></a>";
$output .= "<br>\n";
$output .= "<a href=zm/hrc_cr08c34.htm><img width=%5 src=imgs/cab/tn/tn_hrc_cr08c34.png alt=hrc_cr08c34></a>";
$output .= "     ";
$output .= "<a href=zm/hrc_dr19d34.htm><img width=%5 src=imgs/cab/tn/tn_hrc_dr19d34.png alt=hrc_dr19d34></a>";
$output .= "<br>\n";
$output .= "<a href=zm/hrc_cr09c37.htm><img width=%5 src=imgs/cab/tn/tn_hrc_cr09c37.png alt=hrc_cr09c37></a>";
$output .= "     ";
$output .= "<a href=zm/hrc_dr20d37.htm><img width=%5 src=imgs/cab/tn/tn_hrc_dr20d37.png alt=hrc_dr20d37></a>";
$output .= "<br>\n";
$output .= "<a href=zm/hrc_cr10c42.htm><img width=%5 src=imgs/cab/tn/tn_hrc_cr10c42.png alt=hrc_cr10c42></a>";
$output .= "     ";
$output .= "<a href=zm/hrc_dr21d42.htm><img width=%5 src=imgs/cab/tn/tn_hrc_dr21d42.png alt=hrc_dr21d42></a>";
$output .= "<br>\n";
$output .= "<a href=zm/hrc_cr11c45.htm><img width=%5 src=imgs/cab/tn/tn_hrc_cr11c45.png alt=hrc_cr11c4cr11c45></a>";
$output .= "     ";
$output .= "<a href=zm/hrc_dr22d45.htm><img width=%5 src=imgs/cab/tn/tn_hrc_dr22d45.png alt=hrc_dr22d45></a>";
$output .= "<br>\n";
$output .= "<a href=zm/hrc_cr12c51.htm><img width=%5 src=imgs/cab/tn/tn_hrc_cr12c51.png alt=hrc_cr12c51></a>";
$output .= "     ";
$output .= "<br>\n";
$output .= "<a href=zm/hrc_d.htm><img src=imgs/cab/tn/tn_hrc_d.png alt=hrc_d></a>";
$output .= "<br>\n";
$output .= "<a href=zm/hrc_d.htm><img src=imgs/cab/tn/tn_hrc_d.png alt=hrc_d></a>";
$output .= "<hr>\n";
return( $output );
}
function html_btn_squares($options) {
$dttm=date("Ymd_His");
$php_self=$_SERVER['PHP_SELF'];
$http_host=$_SERVER['HTTP_HOST'];
$request_uri=$_SERVER['REQUEST_URI'];
$path_btn="./imgs/btn";
$path_ani="./imgs/ani";
// $output .= "<body bgimage=imgs/chalk.gif>\n";
$output .= "<body bgcolor=lightblue>\n";
$output .= "<hr>\n";
$output .= "<div class=\"layer1\" id=\"leds_show\" >\n";
// $output .= " <p class=\"heading\">leds_show</p>\n";
// $output .= " <div class=\"content\">\n";
$output .= "<a href=$php_self>\n";
$output .= "<img src=\"$path_btn/btn_black.gif\" alt=\"btn_black\" border=0 height=\"20\" width=\"20\" />";
$output .= "</a>\n";
if(( ! isset( $_SESSION['role'] )) || ( $_SESSION['role'] == "" )) {
$output .= "<a href=$php_self?q=login>\n";
$output .= "<img src=\"$path_btn/btn_black.gif\" alt=\"btn_black\" border=0 height=\"20\" width=\"20\" />";
$output .= "</a>\n";
}
if(( isset( $_SESSION['role'] )) && ( ! $_SESSION['role'] == "" )) {
$output .= "<a href=$php_self?q=logout>\n";
$output .= "<img src=\"$path_btn/btn_white.gif\" alt=\"btn_white\" border=0 height=\"20\" width=\"20\" />";
$output .= "</a>\n";
// $squares = array( 'config', 'zoom', 'db', 'fgmenu', 'fgmenu_dyn', 'fgmenu_htm' );
// $squares = array( 'config', 'zoom', 'db', 'ptviewer', 'ptobject', 'fgmenu_htm' );
// $squares = array( 'config', 'zoom', 'db', 'ptviewer', 'ptobject', 'fgmenu_htm', 'db/grid/fp/pano', 'db/grid/fp/obj' );
// $squares = array( 'config', 'zoom', 'db/grid', 'db/grid/fp/pano', 'db/grid/fp/obj', 'fgmenu_htm' );
$squares = array( 'config', 'db/grid' );
foreach( $squares as $square ) {
$output .= "<a href=$php_self?q=$square>\n";
$output .= "<img src=\"$path_btn/btn_black.gif\" alt=\"btn_black\" border=0 height=\"20\" width=\"20\" />";
$output .= "</a>\n";
}
/// $output .= "       ";
/// $output .= "<a href=https://147.238.94.126/fp/fp.php target=_blank>\n";
/// $output .= "<img src=\"$path_btn/btn_black.gif\" alt=\"btn_black_fp\" border=0 height=\"20\" width=\"20\" />";
/// $output .= "</a>\n";
/// $output .= "<a href=https://147.238.94.126/ko_center/ko_center.php?q=scrub target=_blank>\n";
/// $output .= "<img src=\"$path_btn/btn_black.gif\" alt=\"btn_black_scrub\" border=0 height=\"20\" width=\"20\" />";
/// $output .= "</a>\n";
/// $output .= "<a href=https://hrc.mil target=_blank>\n";
/// $output .= "<img src=\"$path_btn/btn_hrc.png\" alt=\"btn_hrc\" border=0 height=\"20\" width=\"20\" />";
/// $output .= "</a>\n";
/// $output .= "<a href=https://us.army.mil target=_blank>\n";
/// $output .= "<img src=\"$path_btn/btn_perscom.gif\" alt=\"btn_perscom\" border=0 height=\"20\" width=\"20\" />";
/// $output .= "</a>\n";
/// $output .= "<a href=https://147.238.94.126/ko_center/media/zm/index.htm target=_blank>\n";
/// $output .= "<img src=\"$path_btn/btn_hrc.png\" alt=\"btn_perscom\" border=0 height=\"20\" width=\"20\" />";
/// $output .= "</a>\n";
}
$output .= "<a href=$php_self?q=tools>\n";
$output .= "<img src=\"$path_btn/btn_black.gif\" alt=\"tools\" border=0 height=\"20\" width=\"20\" />";
$output .= "</a>\n";
$output .= "<br>\n";
// $output .= " </div>\n";
return( $output );
// $output .= "<a href=$php_self?q=zoom>\n";
// $output .= "<img src=\"$path_btn/btn_black.gif\" alt=\"btn_black\" border=0 height=\"20\" width=\"20\" />";
// $output .= "</a>\n";
// $output .= "<a href=$php_self?q=fgmenu>\n";
// $output .= "<img src=\"$path_btn/btn_black.gif\" alt=\"btn_black\" border=0 height=\"20\" width=\"20\" />";
// $output .= "</a>\n";
// $output .= "<a href=$php_self?q=fgmenu_dyn>\n";
// $output .= "<img src=\"$path_btn/btn_black.gif\" alt=\"btn_black\" border=0 height=\"20\" width=\"20\" />";
// $output .= "</a>\n";
// $output .= "<a href=$php_self?q=fgmenu_htm>\n";
// $output .= "<img src=\"$path_btn/btn_black.gif\" alt=\"btn_black\" border=0 height=\"20\" width=\"20\" />";
// $output .= "</a>\n";
// $output .= "<a href=$php_self?q=view>\n";
// $output .= "<a href=$php_self?q=db/grid>\n";
// $output .= "<img src=\"$path_btn/btn_black.gif\" alt=\"btn_black\" border=0 height=\"20\" width=\"20\" />";
// $output .= "</a>\n";
// $output .= "<a href=$php_self?q=update>\n";
// $output .= "<img src=\"$path_btn/btn_black.gif\" alt=\"btn_black\" border=0 height=\"20\" width=\"20\" />";
// $output .= "</a>\n";
// $output .= "<a href=$php_self?q=list>\n";
// $output .= "<img src=\"$path_btn/btn_black.gif\" alt=\"btn_black\" border=0 height=\"20\" width=\"20\" />";
// $output .= "</a>\n";
}
function html_btn_footer( $options ) {
$path_btn="./imgs/btn";
$path_ani="./imgs/ani";
$http_host=$_SERVER['HTTP_HOST'];
$server_name=$_SERVER['SERVER_NAME'];
$server_addr=$_SERVER['SERVER_ADDR'];
$html_btn_footer = "";
$html_btn_footer .= "<hr>\n";
$html_btn_footer .= leds_show($options);
$html_btn_footer .= "<a href=https://us.army.mil target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/ako.png\" alt=\"us.army.mil\" border=0 height=\"30\" width=\"50\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "         ";
$html_btn_footer .= "<a href=https://atc.us.army.mil/iastar/ target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/iastar.png\" alt=\"atc.us.army.mil/iastar\" border=0 height=\"30\" width=\"60\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "         ";
$html_btn_footer .= "<a href=https://ia.signal.army.mil target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/iasignal.png\" alt=\"ia.signal.army.mil\" border=0 height=\"30\" width=\"30\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "         ";
$html_btn_footer .= "<a href=https://www.iad.gov target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/iad.png\" alt=\"iad.gov\" border=0 height=\"30\" width=\"30\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "         ";
$html_btn_footer .= "<a href=https://www.iad.gov/ioss/index.cfm target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/ioss.png\" alt=\"iad.gov/ioss\" border=0 height=\"30\" width=\"30\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "         ";
$html_btn_footer .= "<a href=https://www.hrc.army.mil target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/btn_hrc.png\" alt=\"hrc.army.mil\" border=0 height=\"30\" width=\"30\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "         ";
$html_btn_footer .= "<hr>\n";
$html_btn_footer .= "<table>\n";
$html_btn_footer .= "<tr>\n";
$html_btn_footer .= "<td>\n";
$html_btn_footer .= "ko_center<br>\n";
$html_btn_footer .= "<a href=$php_self?q=ko_center/about target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/ko_center.png\" alt=\"ko_center\" border=0 height=\"35\" width=\"35\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "</td>\n";
$html_btn_footer .= "<td width=15>   </td>\n";
$html_btn_footer .= "<td>\n";
$html_btn_footer .= "ko_centere<br>\n";
$html_btn_footer .= "<a href=$php_self?q=ko_centere target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/ko_centere.png\" alt=\"ko_centere\" border=0 height=\"30\" width=\"30\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "</td>\n";
$html_btn_footer .= "<td width=15>   </td>\n";
$html_btn_footer .= "<td>\n";
$html_btn_footer .= "ko_centerd<br>\n";
$html_btn_footer .= "<a href=$php_self?q=ko_centerd target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/ko_centerd.png\" alt=\"ko_centerd\" border=0 height=\"30\" width=\"30\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "</td>\n";
$html_btn_footer .= "<td width=15>   </td>\n";
$html_btn_footer .= "<td>\n";
$html_btn_footer .= "ko_centert<br>\n";
$html_btn_footer .= "<a href=$php_self?q=ko_centert target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/ko_centert.png\" alt=\"ko_centert\" border=0 height=\"30\" width=\"30\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "</td>\n";
$html_btn_footer .= "<td width=15>   </td>\n";
$html_btn_footer .= "<td width=15>   </td>\n";
$html_btn_footer .= "<td>\n";
$html_btn_footer .= "itil<br>\n";
$html_btn_footer .= "<a href=/itil/index.html target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/itil.png\" alt=\"itil\" border=0 height=\"30\" width=\"30\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "</td>\n";
$html_btn_footer .= "<td width=15>   </td>\n";
$html_btn_footer .= "</tr>\n";
$html_btn_footer .= "</table>\n";
$html_btn_footer .= "<hr>\n";
$html_btn_footer .= "<a href=http://arcsight.com target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/arcsight.png\" alt=\"arcsight\" border=0 height=\"30\" width=\"40\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "         ";
$html_btn_footer .= "<a href=https://147.238.94.170/console/app.showApp.cmd target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/tripwire.png\" alt=\"tripwire\" border=0 height=\"30\" width=\"40\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "         ";
$html_btn_footer .= "<a href=https://147.238.94.105/zabbix target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/zabbix.gif\" alt=\"zabbix\" border=0 height=\"30\" width=\"50\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "         ";
$html_btn_footer .= "<a href=https://sbm.usarec.army.mil target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/serena.png\" alt=\"serena\" border=0 height=\"30\" width=\"60\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "         ";
$html_btn_footer .= "<a href=https://hrcsharepoint.nase.ds.army.mil/hrcos/default.aspx target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/sharepoint.png\" alt=\"sharepoint\" border=0 height=\"30\" width=\"60\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "         ";
$html_btn_footer .= "<a href=http://147.238.93.73:6122 target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/bex.png\" alt=\"bex\" border=0 height=\"30\" width=\"50\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "         ";
$html_btn_footer .= "<hr>\n";
$html_btn_footer .= "<a href=https://147.238.94.126/dp7 target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/drupal.png\" alt=\"drupal\" border=0 height=\"30\" width=\"30\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "         ";
// $html_btn_footer .= "<a href=https://147.238.99.102/index.php target=_blank>\n";
$html_btn_footer .= "<a href=https://147.238.94.105/pat target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/thepat.png\" alt=\"thep@\" border=0 height=\"30\" width=\"40\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "         ";
$html_btn_footer .= "<a href=https://147.238.94.105/media/index.php target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/mediawiki.png\" alt=\"mediawiki\" border=0 height=\"40\" width=\"50\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "         ";
$html_btn_footer .= "<a href=$php_self/ko_center/media/zm/index.htm target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/zoomify.png\" alt=\"zoomify\" border=0 height=\"40\" width=\"50\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "         ";
$html_btn_footer .= "<a href=$php_self?q=scrub target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/scrubbrush.png\" alt=\"scrub\" border=0 height=\"30\" width=\"30\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "         ";
$html_btn_footer .= "<a href=$php_self/nap target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/netapp.png\" alt=\"scrub\" border=0 height=\"30\" width=\"30\" />";
$html_btn_footer .= "</a>\n";
//// $html_btn_footer .= "<hr>\n";
//// $html_btn_footer .= "<a href=/ko_center/ldap/index.html target=_blank>\n";
//// $html_btn_footer .= "<img src=\"$path_btn/ldap_us.png\" alt=\"ldap_us\" border=0 height=\"30\" width=\"30\" />\n";
// $html_btn_footer .= "<img src=\"$path_btn/ldap_bolt.png\" alt=\"ldap_bolt\" border=0 height=\"30\" width=\"30\" />";
//// $html_btn_footer .= "</a>\n";
/// $html_btn_footer .= "<img src=\"$path_btn/ldap.png\" alt=\"ldap\" border=0 height=\"30\" width=\"30\" />";
//// $html_btn_footer .= "<hr>\n";
// printf( "<hr>http_host=$http_host<hr>\n" );
// printf( "<hr>server_name=$server_name<hr>\n" );
// printf( "<hr>server_addr=$server_addr<hr>\n" );
// $html_btn_footer .= "<a href=$server_name/../../webcal/ target=_blank>\n";
// $html_btn_footer .= "<a href=http://www.k5n.us/webcalendar.php target=_blank>\n";
// $html_btn_footer .= "<img src=\"$path_btn/webcalendar.png\" alt=\"webcalendar $http_host\" border=0 height=\"30\" width=\"30\" />";
// $html_btn_footer .= "</a>\n";
$html_btn_footer .= "<hr>\n";
$html_btn_footer .= "<table>\n";
$html_btn_footer .= "<tr>\n";
$html_btn_footer .= "<td>\n";
$html_btn_footer .= "kb<br>\n";
$html_btn_footer .= "<a href=$php_self?q=kb target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/kbbooks.png\" alt=\"kb\" border=0 height=\"30\" width=\"30\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "</td>\n";
$html_btn_footer .= "<td width=15>   </td>\n";
$html_btn_footer .= "<td>\n";
$html_btn_footer .= "certs<br>\n";
$html_btn_footer .= "<a href=$php_self?q=certs target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/cert.png\" alt=\"certs\" border=0 height=\"30\" width=\"30\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "</td>\n";
// phpmaster.com/charting-with-pchart
// phpro.php
$html_btn_footer .= "<td width=15>   </td>\n";
$html_btn_footer .= "<td width=15>   </td>\n";
$html_btn_footer .= "<td>\n";
$html_btn_footer .= "pcharts<br>\n";
$html_btn_footer .= "<a href=$php_self?q=pchart/main target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/pchart_mirror.png\" alt=\"pchart\" border=0 height=\"30\" width=\"30\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "</td>\n";
$html_btn_footer .= "<td width=5>   </td>\n";
$html_btn_footer .= "<td>\n";
$html_btn_footer .= "dynamic<br>\n";
$html_btn_footer .= "<a href=/ko_center/ko_pcharts_df.php target=_blank>\n";
$html_btn_footer .= "<img src=\"$path_btn/pchart_mirror.png\" alt=\"pchart\" border=0 height=\"30\" width=\"30\" />";
$html_btn_footer .= "</a>\n";
$html_btn_footer .= "</td>\n";
$html_btn_footer .= "</tr>\n";
$html_btn_footer .= "</table>\n";
// $html_btn_footer .= "    path_btn=[$path_btn]<br>\n";
// $html_btn_footer .= "<br>webcalendar sqlite3 version currently pending<br>\n";
/// $html_btn_footer .= "<a href=$http_host/../../supercali target=_blank>\n";
/// $html_btn_footer .= "<img src=\"$path_btn/supercali.png\" alt=\"supercali\" border=0 height=\"30\" width=\"30\" />";
/// $html_btn_footer .= "</a>\n";
// $html_btn_footer .= "<br>path_btn=[$path_btn]<br>\n";
$html_btn_footer .= leds_zm($options);
$html_btn_footer .= "<br><br><a href=$php_self?q=konet ><img src=\"$path_btn/ko.png\" border=0 width=25 height=12></a><br>\n";
return( $html_btn_footer );
}
function html_dc_links( $option ) {
$html = "";
// $html .= "<h3>AAC knowledge base </h3>\n";
/// $html .= "<a href=$php_self?q=dc/rpts >rpts</a>\n";
$html .= "<a href=$php_self?q=dc/rpts ><img src=./imgs/btn/postits.png border=0 height=25></a>\n";
$html .= "       \n";
/// $html .= "<a href=$php_self?q=dc/view >view</a>\n";
$html .= "     \n";
// $html .= "<a href=$php_self?q=db/grid/ko_center/hw >grid: hw</a>\n";
$html .= "<a href=$php_self?q=db/grid/ko_center/hw ><img src=./imgs/btn/theme_swanky.jpg border=0 height=25></a>\n";
$html .= "     \n";
// $html .= "<a href=$php_self?q=db/grid/ko_center/rpts >grid: rpts</a>\n";
$html .= "<a href=$php_self?q=db/grid/ko_center/rpts ><img src=./imgs/btn/postit.png border=0 height=25 ></a>\n";
$html .= "       \n";
// $html .= "<a href=$php_self?q=db/grid/ko_center >grid: dc_hw</a>\n";
// $html .= "       \n";
/// $html .= "<a href=$php_self?q=dc/new >new</a>\n";
// $html .= "       \n";
// $html .= "<a href=$php_self?q=dc/mod >mod</a>\n";
$html .= "<br>\n";
return( $html );
}
function html_kb_links( $options ) {
$html = "";
$html .= "<h3>AAC knowledge base </h3>\n";
$html .= "<a href=$php_self?q=kb/view >view</a>\n";
$html .= "     \n";
$html .= "<a href=$php_self?q=db/grid/koaac_kb/kb >grid: search</a>\n";
$html .= "     \n";
$html .= "<a href=$php_self?q=db/grid/koaac_kb/rpts >grid: koaac_kb-rpts</a>\n";
$html .= "       \n";
// $html .= "<a href=$php_self?q=db/grid/koaac_kb >grid: koaac_kb-kb</a>\n";
// $html .= "       \n";
$html .= "<a href=$php_self?q=kb/rpts >kb_rpts</a>\n";
$html .= "       \n";
$html .= "<a href=$php_self?q=kb/new >new</a>\n";
// $html .= "       \n";
// $html .= "<a href=$php_self?q=kb/mod >mod</a>\n";
$html .= "<hr>\n";
return( $html );
}
function html_nodes_links( $options ) {
$html = "";
$html .= "<h3>AAC nodes </h3>\n";
$html .= "<a href=$php_self?q=nodes/view >view</a>\n";
$html .= "     \n";
$html .= "<a href=$php_self?q=db/grid/ko_center/nodes >grid: ko_center-nodes</a>\n";
$html .= "     \n";
$html .= "<a href=$php_self?q=db/grid/ko_center/rpts >grid: ko_center-rpts</a>\n";
$html .= "       \n";
// $html .= "<a href=$php_self?q=db/grid/ko_center >grid: ko_center_nodes-kb</a>\n";
// $html .= "       \n";
$html .= "<a href=$php_self?q=nodes/rpts >nodes_rpts</a>\n";
$html .= "       \n";
// $html .= "<a href=$php_self?q=nodes/new >new</a>\n";
// $html .= "       \n";
// $html .= "<a href=$php_self?q=kb/mod >mod</a>\n";
$html .= "<hr>\n";
return( $html );
}
function html_scrub( $options ) {
$php_self=$_SERVER['PHP_SELF'];
$http_host=$_SERVER['HTTP_HOST'];
$request_uri=$_SERVER['REQUEST_URI'];
// printf( "$progid $dttm MSG_1337: o0=[$options[0]] o1=[$options[1]] o2=[$options[2]]<hr>\n" );
// leds_show();
$pdo = newpdo($GLOBALS['dbfile']);
$tblname=$GLOBALS['tblname'];
$media_path=$GLOBALS['media_path'];
$path_ani="./imgs/ani";
$path_fpb="./imgs/fpb";
$output = "";
$output .= "<head>\n";
// $output .= " <script src=\"js/jqgrid.3.5.3/js/jquery-1.3.2.min.js\" type=\"text/javascript\"></script>\n";
// $output .= " <script src=\"js/jqgrid-4.4.0/js/jquery-1.7.2.min.js\" type=\"text/javascript\"></script>\n";
$output .= " <script src=\"js/jqgrid-4.4.0/js/jquery-1.8.3.min.js\" type=\"text/javascript\"></script>\n";
$output .= " <script src=\"js/jqgrid-4.4.0/js/jquery-ui-1.9.2.custom.js\" type=\"text/javascript\"></script>\n";
$output .= " <script src=\"js/tooltip/tooltip_main_screenshot.js\" type=\"text/javascript\"></script>\n";
$output .= " </head>\n";
$output .= html_btn_squares( $options, "" );
// $output .= "leds_detail MSG_1353: name=[$led_name] title=[$led_title] led_loc_code=[$led_loc_code] led_comment=[$led_comment]<br>\n";
// leds_show();
return;
}
function leds_detail( $options ) {
$php_self=$_SERVER['PHP_SELF'];
$http_host=$_SERVER['HTTP_HOST'];
$request_uri=$_SERVER['REQUEST_URI'];
// printf( "$progid $dttm MSG_6120: o0=[$options[0]] o1=[$options[1]] o2=[$options[2]]<hr>\n" );
// leds_show();
// return;
$pdo = newpdo($GLOBALS['dbfile']);
$tblname=$GLOBALS['tblname'];
$media_path=$GLOBALS['media_path'];
$path_ani="./imgs/ani";
$path_fpb="./imgs/fpb";
$path_fpb="./imgs/cab";
$output = "";
$output .= "<head>\n";
// $output .= " <script src=\"js/jqgrid.3.5.3/js/jquery-1.3.2.min.js\" type=\"text/javascript\"></script>\n";
$output .= " <script src=\"js/jqgrid-4.4.0/js/jquery-1.7.2.min.js\" type=\"text/javascript\"></script>\n";
$output .= " <script src=\"js/tooltip/tooltip_main_screenshot.js\" type=\"text/javascript\"></script>\n";
$output .= " </head>\n";
$output .= html_btn_squares( $options, "" );
// $output .= "leds_detail MSG_3545: name=[$led_name] title=[$led_title] led_loc_code=[$led_loc_code] led_comment=[$led_comment]<br>\n";
// leds_show();
$cab=$options[1];
$led_name=$options[1];
$os=$options[1];
$osimg= sprintf("./imgs/btn/$os.png");
// $output .= "<br><img src=$osimg width=10% height=6%><br>\n";
$cabimg= sprintf("./imgs/cab/$cab.png");
// $output .= "<br><img src=$cabimg width=10% height=6%><br>\n";
$output .= "<br><img src=$cabimg height=50%><br>\n";
// printf( "BUGS_4862 cabimg=[$cabimg] cab=[$cab] led_name=[$led_name] os=[$os]<hr>\n" );
$tblname="ko_hw";
$sql = "select * from $tblname";
$sql = "select * from $tblname where led_name == '$led_name' and led_published == '1' and led_dttm == 'current'";
$sql = "select * from $tblname where led_name == '$led_name'";
// $sql = "select * from $tblname where cab == '$cab' and model != ''";
$sql = "select * from $tblname where cab == '$cab' and item != ''";
// printf( "$progid $dttm MSG_4800: sql=[$sql] led_name=[$led_name] o0=[$options[0]] o1=[$options[1]] o2=[$options[2]]<hr>\n" );
/// exit;
$j=0;
$samps=0;
$output .= "<table>\n";
$tblhdr = "";
$tblhdr .= "<tr>\n";
$tblhdr .= "<td>jhdr</td>";
$tblhdr .= "<td>item_img jk</td>";
$tblhdr .= "<td>item</td>";
$tblhdr .= "<td>amps</td>";
$tblhdr .= "<td>ip</td>";
$tblhdr .= "<td>sn</td>";
$tblhdr .= "<td>hrctag</td>";
$tblhdr .= "<td>hostname</td>";
$tblhdr .= "<td>machinename</td>";
$tblhdr .= "</tr>\n";
$output .= $tblhdr;
foreach( $pdo->query($sql) as $row ) {
$j++;
// printf( "BUGS_6160: sql=[$sql]<br>\n" );
$led_name = $row['led_name'];
$led_dttm = $row['led_dttm'];
$led_cab = $row['cab'];
$btu = $row['btu'];
$os = $row['os'];
$item = $row['item'];
$model = $row['model'];
$sn = $row['sn'];
$btu = $row['btu'];
$amps = $row['amps'];
$switch = $row['switch'];
$hrctag = $row['hrctag'];
$hostname = $row['hostname'];
$machinename = $row['machinename'];
$ip = $row['ip'];
// $led_amps = $row['amps'];
$led_sn = $row['sn'];
$led_title = $row['led_title'];
$led_comment = $row['led_comment'];
$led_loc_code = $row['led_loc_code'];
$led_published = $row['led_published'];
$led_group = $row['led_group'];
$led_orgs = $row['led_orgs'];
$led_filename = $row['led_filename'];
$samps=$samps+$amps;
/// printf( "MSG_6200: item=[$item] sn=[$sn] amps=[$amps] $led_amps=[$led_amps]<br>\n" );
$item_img= sprintf("./imgs/cab/$item.png" );
// $output_detail="<hr>";
if( file_exists( $item_img )) {
$item_imgurl = "";
$item_imgurl .= "<a href=https://$http_host$php_self?q=hw/$item&hrctag=$hrctag>";
$item_imgurl .= "<img src=$item_img border=0 ></a>\n";
$tbldtl = "<tr>\n";
$tbldtl .= "<td>$j   </td>\n";
$tbldtl .= "<td>$item_imgurl   </td>\n";
$tbldtl .= "<td>$item   </td>\n";
$tbldtl .= "<td>$amps   </td>\n";
$tbldtl .= "<td>$ip   </td>\n";
$tbldtl .= "<td>$sn   </td>\n";
$tbldtl .= "<td>$hrctag   </td>\n";
$tbldtl .= "<td>$hostname   </td>\n";
$tbldtl .= "<td>$machinename   </td>\n";
$tbldtl .= "</tr>\n";
// $output_detail .= "$item_imgurl";
// $output_detail .= "amps=[$amps] \n";
// $output_detail .= "led_sn=[$led_sn] \n";
// $output_detail .= "item=[$item] \n";
// $output_detail .= "led_hrctag=[$led_hrctag] \n";
// $output_detail .= "led_ip=[$led_ip] \n";
// $output_detail .= "led_sn=[$led_sn] \n";
}
else {
/// $output_detail .= "$item_img     \n";
$tbldtl .= "<tr>\n";
$tbldtl .= "<td>$j   </td>";
$tbldtl .= "<td>$item_img   </td>";
$tbldtl .= "<td>$item   </td>";
$tbldtl .= "<td>$amps   </td>";
$tbldtl .= "<td>$ip   </td>";
$tbldtl .= "<td>$sn   </td>";
$tbldtl .= "<td>$hrctag   </td>";
$tbldtl .= "<td>$hostname   </td>";
$tbldtl .= "<td>$machinename   </td>";
$tbldtl .= "</tr>\n";
}
// printf( "BUGS_6205: output_detail=[$output_detail]<br>\n" );
// $output_detail .= sprintf( "cab=%s model=%s sn=%s btu=%s amps=%s", $cab, $model, $sn, $btu, $amps );
$output .= $tbldtl;
//// $output .= "</table>\n";
//// $output .= "<table>\n";
//// if( $led_title != "" ) {$output .= "<tr><td>title:</td><td><b>$led_title</b></td></tr>";}
//// if( $led_loc_code != "" ) {$output .= "<tr><td>loc_code:</td><td><b>$led_loc_code</b></td></tr>";}
//// if( $led_orgs != "" ) {$output .= "<tr><td>org:</td><td><b>$led_orgs</b></td></tr>";}
//// if( $led_group != "" ) {$output .= "<tr><td>group:</td><td><b>$led_group</b></td></tr>";}
//// if( $led_comment != "" ) {$output .= "<tr><td>comment:</td><td><b>$led_comment</b></td></tr>";}
//// $output .= "</table>\n";
if( $led_filename != "" ) {
// $led_pathfile="$media_path/$led_filename";
// $led_pathfile="$media_path/$led_filename";
$led_pathfile="$path_ani/$led_filename";
if( file_exists( $led_pathfile)) {
$output .= "<img src=\"$led_pathfile\"><br/>\n";
}
}
// print( $output );
}
$pdo = null;
$tbltot = "";
$tbltot .= "<tr>\n";
$tbltot .= "<td>   </td>\n";
$tbltot .= "<td><b>totals $dttm: $cab</b></td>\n";
$tbltot .= "<td> $j </td>\n";
$tbltot .= "<td><b>$samps</b></td>\n";
$tbltot .= "<td>   </td>\n";
$tbltot .= "</tr>\n";
$output .= "$tbltot";
$output .= "</table>\n";
$output .= "<hr>\n";
// printf( "MSG_6260: samps=[$samps]<br>\n" );
// leds_show();
// print( "<a href=\"./fp_zviewer.php?file=$led_name&path=imgs/\" target=_blank>$led_name</a><br>\n" );
// $fp_url="./fp_zviewer.php?file=$led_name&path=imgs/";
// header( 'Location:'.$fp_url );
print( "<br/>\n" );
if(! isset($_SESSION['hs_type'] )) { $hs_type="default"; }
else {$hs_type=$_SESSION['hs_type'];}
if(! isset($_SESSION['org_type'] )) { $org_type="p"; }
else {$org_type=$_SESSION['org_type'];}
$os=$options[1];
if( preg_match( "/ko_center/", $os, $matches )) {
$output .= "<h3>System Management Branch</h3>\n";
$output .= "<a href=$php_self?q=ko_center/about>about</a>       \n";
$output .= "<a href=/itil>itil</a><br>\n";
$output .= "<hr>\n";
}
if( preg_match( "/ko_centere/", $os, $matches )) {
$output .= "<h3>System Management Branch: Engineering</h3>\n";
}
if( preg_match( "/ko_centerd/", $os, $matches )) {
$output .= "<h3>System Management Branch: Deployment</h3>\n";
}
if( preg_match( "/ko_centert/", $os, $matches )) {
$output .= "<h3>System Management Branch: Training</h3>\n";
}
// printf( "$progid $dttm MSG_3600: os=[$os] o0=[$options[0]] o1=[$options[1]] o2=[$options[2]]<hr>\n" );
$tbllist="kb hs us sw vg hw dp bp";
$tbls=explode( " ",$tbllist );
$fpb_title="$os $tbl";
foreach( $tbls as $tbl ) {
$fpbimg= sprintf("./imgs/fpb/$tbl.png");
// $fpbimg= sprintf("./imgs/cab/$tbl.png");
// printf( "BUGS_3600 fpbimg=[$fpbimg] tbl=[$tbl]<br>\n" );
// printf( "$progid $dttm BUGS_1414: os=[$os] tbl=[$tbl] <hr>$php_self?q=detail/$os/$tbl<hr>\n" );
// $output .= "<a href=\"$php_self?q=grid/$os/$tbl\" ";
// $output .= "<a href=\"$php_self?q=db/grid/ko$os"."_$tbl\" ";
$output .= "<a href=\"$php_self?q=detail/$os/$op"."_$tbl\" ";
$output .= " class=\"screenshot\" rel=\"$fpbimg\" title=\"$fpb_title\" ";
$output .= "><img src=$fpbimg border=0 height=40></a>     \n";
}
// $path_tn="./media/zoom";
// sprintf( $xmlfile, "%s_%s_hotspots.xml", $option[1], $hs_type );
// $xmlfile=$led_name . "_" . $hs_type . "_hotspots.xml";
// $fpbfile="$path_fpb/fpb".substr( $led_name, 2 ) .".png";
// $zoom_file=$led_name;
// $zoom_code=$led_name;
// $zoomxml_code=$hs_type;
// $zoom_path="imgs/";
// $zoom_xml=$led_name . "_" . $hs_type . "_hotspots.xml";
// $zview_xml=$led_name . "_" . $hs_type . "_hotspots.xml";
// $zview_xml=$led_name . "_hotspots.xml";
// $zview_file=$led_name;
// $tn_zview_file="$path_tn/$led_name/Tilegroup0/0-0-0.jpg";
// $output = "<hr>no show_leds<hr>\n";
// $output .= "<hr>\n";
// $output .= "<hr>\n";
// print( "<img src=$tn_zview_file><br>\n" );
// print( "<img src=$fpbfile><br>\n" );
// if( file_exists( $tn_zview_file )) {
// $output .= "<a href=\"$php_self?q=zview/$zview_file/$zview_xml\" target=_blank><img src=$tn_zview_file border=0></a><br><br>\n";
//// $output .= "<a href=\"$php_self?q=zoom/$zoom_code/$zoomxml_code\" target=_blank><img src=$tn_zview_file border=0></a><br><br>\n";
// $path_fpb = "./imgs/fpb";
/// $path_fpb = "imgs/fpb";
// $fpbnam = str_replace( "fp", "fpb", $led_name );
// $fpbimg = "$path_fpb/" . $fpbnam . ".png";
// $fpb_title = $led_name . "(";
// $fpb_title .= $led_title . ")";
// $fpb_title .= " bldg(". $row['led_bldg'];
// $fpb_title .= " floor(". $row['led_floor'];
// $fpb_title .= ")";
//
// $output .= "<a href=\"$php_self?q=zoom/$zoom_code/$zoomxml_code\" ";
// $output .= " class=\"screenshot\" rel=\"$fpbimg\" title=\"$fpb_title\" ";
// $output .= ">\n";
//
// $output .= "<img src=$tn_zview_file border=0></a><br><br>\n";
// }
// else {
//// $output .= "<a href=\"$php_self?q=zview/$zview_file/$zview_xml\" target=_blank><img src=$fpbfile border=0></a><br><br>\n";
// $output .= "<a href=\"$php_self?q=zview/$zoom_code/$zoomxml_code\" target=_blank><img src=$fpbfile border=0></a><br><br>\n";
// }
//
// leds_zviewer( $zoom_file, $zoom_path, $zoom_xml );
// print( "<a href=\"$php_self?q=zview/$zview_file/$zview_xml\" target=_blank>zview $led_name</a><br><br>\n" );
// print( "<a href=\"./fp_zviewer.php?file=$led_name&path=imgs/&xml=$zoom_xml\" target=_blank>zviewer $led_name</a><br>\n" );
$led_name=$options[1];
// printf( "BUGS_5300 o1=$option1 o2=$option2 options=$options<hr>\n" );
if(( isset( $_SESSION['role'] )) && ( ! $_SESSION['role'] == "" )) {
$output .= "<hr>role: ". $_SESSION['role'] . "<hr>\n";
$output .= "<a href=$php_self?q=leds_update_form/$led_name>\n";
// $output .= "update $led_name</a>\n";
$output .= "<img src=./imgs/btn/postit.png height=20 border=0>";
$output .= "</a>\n";
$output .= "        ";
$output .= "<a href=$php_self?q=rpts/$led_name>";
/// $output .= "rpts $led_name</a><br/>\n";
$output .= "<img src=./imgs/btn/postits.png height=20 border=0>\n";
$output .= "</a><br/>\n";
}
else {
$output .= "<hr>role: ". $_SESSION['role'] . " guest<hr>\n";
$output .= "<a href=$php_self?q=leds_update_form/$led_name>";
$output .= "<img src=./imgs/btn/postit.png height=20></a>";
$output .= "        ";
$output .= "<a href=$php_self?q=rpts/$led_name>";
$output .= "<img src=./imgs/btn/postits.png height=20>";
$output .= "</a><br/>\n";
}
/// $output .= "<br>\n";
$output .= "<hr><a href=$php_self?q=scrub_upload_form/$led_name>scrub_upload_form $led_name</a><br/><hr>\n";
print( $output );
return( $output );
}
function html_zoom_detail($options) {
$php_self=$_SERVER['PHP_SELF'];
$path_fpb="./imgs/fpb";
$path_tn="./media/zoom";
$zmcode = $options[1];
// $zmtype = $options[2];
$zmtype = $_SESSION['hs_type'];
$zmrowid= $options[3];
/// $output .= "<hr>html_zoom_detail_1061: o1=$options[1]] o2=[$options[2]] o3=[$options[3]]<hr>\n";
// $xmlfile = sprintf( "%s_%s_hotspots.xml", $zmcode, $zmtype );
$xmlfile = sprintf( "%s_%s_%s_hotspots.xml", $zmcode, $zmtype, $zmrowid );
$fpbfile="$path_fpb/fpb".substr( $zmcode, 2 ) .".png";
// $zoom_file=$led_name;
// $zoom_code=$led_name;
// $zoomxml_code=$hs_type;
$zoom_file=$zmcode;
$zoom_code=$zmcode;
$zoomxml_code=$zmtype;
$zoom_path="imgs/";
$zoom_xml=$zmcode . "_" . $zmtype . "_hotspots.xml";
$zview_xml=$zmcode . "_" . $zmtype . "_hotspots.xml";
// $zview_xml=$zmcode . "_hotspots.xml";
$zview_xml = sprintf( "%s_%s_%s_hotspots.xml", $zmcode, $zmtype, $zmrowid );
$zview_file=$zmcode;
$tn_zview_file="$path_tn/$zmcode/Tilegroup0/0-0-0.jpg";
// $output = "<hr>html_zoom_details<hr>\n";
// $output .= "xmlfile=[$xmlfile]<br>\n";
// $output .= "<hr>\n";
// $output .= "leds_detail MSG: name=[$zmcode] title=[$led_title] led_loc_code=[$led_loc_code] led_comment=[$led_comment]<br>\n";
$output .= "<hr>\n";
// print( "<img src=$tn_zview_file><br>\n" );
// print( "<img src=$fpbfile><br>\n" );
if( file_exists( $tn_zview_file )) {
//// $output .= " <script src=\"js/jqgrid.3.5.3/js/jquery-1.3.2.min.js\" type=\"text/javascript\"></script>\n";
//// $output .= " <script src=\"js/jqgrid-4.4.0/js/jquery-1.7.2.min.js\" type=\"text/javascript\"></script>\n";
$output .= " <script src=\"js/tooltip/tooltip_main_screenshot_top.js\" type=\"text/javascript\"></script>\n";
$path_fpb = "./imgs/fpb";
$fpnam = $row['led_name'];
$fpbnam = str_replace( "fp", "fpb", $zmcode );
$fpbimg = "$path_fpb/" . $fpbnam . ".png";
$fpb_title = "$fpbnam";
/// $fpb_title = $row['led_name'] . "(";
/// $fpb_title .= $row['led_title'] .") bldg(";
/// $fpb_title .= $row['led_bldg'] .") floor(";
/// $fpb_title .= $row['led_floor'].")";
// orig $output .= "<a href=\"$php_self?q=zview/$zview_file/$zview_xml\" target=_blank ><img src=$tn_zview_file border=0></a><br><br>\n";
$output .= "<a href=\"$php_self?q=zview/$zview_file/$zview_xml\" ";
$output .= "class=\"screenshot_top\" rel=\"$fpbimg\" title=\"$fpb_title\" >\n";
$output .= "<img src=$tn_zview_file border=0>\n";
$output .= " </a>\n";
/// $output .= "<a href=\"$php_self?q=zoom/$zoom_code/$zoomxml_code\" target=_blank><img src=$tn_zview_file border=0></a><br><br>\n";
}
else {
$output .= "<a href=\"$php_self?q=zview/$zview_file/$zview_xml\" target=_blank ><img src=$fpbfile border=0></a><br><br>\n";
/// $output .= "<a href=\"$php_self?q=zoom/$zoom_code/$zoomxml_code\" target=_blank><img src=$fpbfile border=0></a><br><br>\n";
}
// leds_zviewer( $zoom_file, $zoom_path, $zoom_xml );
// print( "<a href=\"$php_self?q=zview/$zview_file/$zview_xml\" target=_blank>zview $led_name</a><br><br>\n" );
// print( "<a href=\"./fp_zviewer.php?file=$led_name&path=imgs/&xml=$zoom_xml\" target=_blank>zviewer $led_name</a><br>\n" );
// $output .= "<a href=$php_self?q=leds_update_form/$led_name>update $led_name</a><br/>\n";
// print( $output );
return( $output );
}
function docview($dbcode, $dbtable, $dbrowid, $page ) {
$php_self=$_SERVER['PHP_SELF'];
$user=$_SESSION['user'];
$role=$_SESSION['role'];
$dbfiles = $GLOBALS['dbfiles'];
$roles = $GLOBALS['roles'];
$dbs = $dbfiles[$role];
$dbfile=$dbs[$dbcode]['dbfile'];
$html = html_header($options);
$html .= html_btn_squares($options);
/// print_r( $dbs );
$output = "$php_self docview MSG: user=[$user] role=[$role]<br>\n";
if( $dbcode == "" ) { $output .= "<hr>$php_self ERR: dbcode=[$dbcode]<hr>\n"; }
if( $dbtable == "" ) { $output .= "<hr>$php_self ERR: dbtable=[$dbtable]<hr>\n"; }
if( $dbrowid == "" ) { $output .= "<hr>$php_self ERR: dbrowid=[$dbrowid]<hr>\n"; }
// $output .= "$php_self docview MSG_1510: [$dbcode][$dbtable][$dbrowid] [$dbfile]<hr>\n";
/// print_r( $GLOBALS['dbfiles'] );
if( ! file_exists( $dbfile )) {
$output .= "$php_self docview ERR_1514: NOTFOUND dbcode=[$dbcode] dbfile=[$dbfile]<hr>\n";
}
if( file_exists( $dbfile )) {
// $pdo = newpdo($GLOBALS['dbfile']);
// print( "BUGS_1519 dbfile=[$dbfile][$dbtable]<br>\n" );
$pdo = newpdo( $dbfile );
$output .= "<html><head><title>fp docview $dbcode $dbtable $dbrowid</title></head>\n";
// $output .= "<body bgcolor=lightgray>\n";
$output .= "<body bgcolor=lightblue>\n";
$output .= "<hr>fp docview $dbcode $dbtable $dbrowid<hr>\n";
$output .= "<hr>\n";
$output .= "<div class=docview>\n";
$output .= "<table>\n";
$sql = "select * from $dbtable where id=$dbrowid";
foreach( $pdo->query($sql) as $row ) {
$jobid=$row['jobid'];
$pagetotal=$row['pagetotal'];
$doc_pathfile=$row['tifffil'];
$doc_paths = explode( $jobid, $doc_pathfile );
$doc_rootpath = $doc_paths[0];
$doc_file = $doc_paths[1];
$doc_path = "$doc_rootpath"."$jobid";
$doc_todopath = "$doc_rootpath"."todo_$jobid";
$doc_donepath = "$doc_rootpath"."done_$jobid";
$doc_failpath = "$doc_rootpath"."fail_$jobid";
$docpath="";
switch( true ) {
/// case is_dir( "C:\iperms\ltrs\imgs" ): $docpath="C:\iperms\ltrs\imgs"; break;
case is_dir( $doc_path ): $docpath=$doc_path; break;
case is_dir( $doc_todopath ): $docpath=$doc_todopath; break;
case is_dir( $doc_donepath ): $docpath=$doc_donepath; break;
case is_dir( $doc_failpath ): $docpath=$doc_failpath; break;
}
if( $docpath == "" ) {
$output .= "$php_self docview MSG: NOTFOUND docpath=[$docpath]<br>\n";
return( $output );
}
$doc_pathfile="$docpath$doc_file";
if(( $page == "" ) | ( $page > $pagetotal )) {
// $output .= "page=$page pagetotal=$pagetotal<hr>\n";
$page="1";
while( $page <= $pagetotal ) {
$doc_pathfile_page= str_replace( ".tiff", ".0$page.tiff", $doc_pathfile );
if( file_exists( $doc_pathfile_page )) {
$output .= "<a href=$php_self?q=docview/$dbcode/$dbtable/$dbrowid/$page>";
$output .= "$dbrowid $doc_file page $page</a><br>\n";
// print( "BUGS_1576 FOUND page=[$page] $doc_pathfile_page<br>\n" );
}
else {
// print( "BUGS_1576 NOTFOUND page=[$page] $doc_pathfile_page<br>\n" );
$output .= "docview $doc_pathfile_page<br>\n";
}
$page++;
}
}
else {
$doc_pathfile_page= str_replace( ".tiff", ".0$page.tiff", $doc_pathfile );
if( file_exists( $doc_pathfile_page )) {
// $output .= "docview DISPLAY doc_pathfile_page=[$doc_pathfile_page]<br>\n";
$image="";
$fp = fopen( $doc_pathfile_page, 'r' );
while( $line = fread($fp, 1024)) { $image .= $line; }
fclose( $fp );
header('Content-Type: image/tiff');
print( $image);
return( $output );
}
}
// $output .= "doc_pathfile=[$doc_pathfile]<br>\n";
// $output .= "doc_pathfile_page=[$doc_pathfile_page]<br>\n";
// for( $pagenum=1; $pagenum <= $pagetotal; $pagenum++ ) {
// $output .= "doc_pathfile_page=[$doc_pathfile_page]<br>\n";
// }
// $output .= "$dbrowid jobid=[$jobid] doc_pathfile=[$doc_pathfile]<br>\n";
// $output .= "doc_path=[$doc_path] doc_file=[$doc_file]<br>\n";
// $output .= "pagetotal=[$pagetotal] doc_file=[$doc_file]<br>\n";
}
$output .= "</table>\n";
$output .= "</div>\n";
$output .= "<hr>\n";
// $output .= "</body></html>\n";
}
$html .= $output;
$html .= html_footer($options,"");
print( $html );
}
function leds_query() {
html_header();
$limit=1000;
$php_self=$_SERVER['PHP_SELF'];
$http_host=$_SERVER['HTTP_HOST'];
$request_uri=$_SERVER['REQUEST_URI'];
$tblname=$GLOBALS['tblname'];
$dbfile="$document_root/ko_center/$tblname";
$sql = "select * from $tblname";
$sql = "select * from leds $tblname led_dttm == 'current'";
$dbfile="C:/iperms/ko/bin/iperms.db";
$sql = "select * from periods limit $limit";
$sql = "select * from jobs limit $limit";
$sql = "select id, type, filnam, wc from jobs limit $limit";
// $dbfile="C:/iperms/aors/bin/aors.db";
// $sql = "select * from wl limit $limit";
// $dbfile="C:/iperms/ltrs/bin/ltrs.db";
// $sql = "select * from wl limit $limit";
print( "<hr>$php_self leds_query MSG: sql=[$sql] dbfile=[$dbfile] <hr>\n");
$pdo = newpdo($dbfile);
print( "<a href=$php_self>\n" );
print( "<img src=\"btn_white.gif\" alt=\"btn_white\" border=0 height=\"20\" width=\"20\" />" );
print( "</a>\n" );
print( "<hr>\n" );
print( "<div id=\"hrc\" >\n" );
// $sql = "SELECT * FROM periods LIMIT 10";
// $sql = "SELECT fy,p,pp,wk,enddt FROM periods LIMIT 3";
try {
// $stmt = $pdo->prepare($sql, array(PDO::ATTR_CURSOR, PDO::CURSOR_SCROLL));
// $stmt->execute();
$stmt = $pdo->query($sql);
// $result = $stmt->fetch(PDO::FETCH_BOTH);
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$output = "<table>\n";
$output .= "<tr><td>key</td><td>val</td></tr>\n";
foreach($result as $key=>$val ) {
$output .= "<tr><td>$key</td><td>$val</td></tr>\n";
}
$output .= "</table>\n";
print( "$output" );
// while ($row = $stmt->fetch(PDO::FETCH_BOTH, PDO::FETCH_ORI_NEXT)) {
// $collim=count($row);
//
// print( "collim=[$collim] count(row)=[".count($row)."<hr>\n" );
// $data = $row[0] . "\t" . $row[1] . "\t" . $row[2] . "<br>\n";
// print $data;
//
// print_r($row);
// for( $collim=0; $c<$collim; $col++ ) {
//
// print( "collim=$collim col=$col row[collim]=".$row[$col]."<br>\n" );
// }
//
// }
$stmt = null;
$pdo = null;
}
catch (PDOException $e) {
print $e->getMessage();
}
print( "<hr>$php_self leds_query END<hr>\n" );
return;
$sth = $pdo->prepare( $sql );
$sth->execute();
$result = $sth->fetch(PDO::FETCH_BOTH);
print_r($result);
return;
$pdo->query($sql);
foreach( $pdo->query($sql) as $row ) {
$output =
$row['led_name'] . ' - ' .
$row['led_dttm'] . ' - ' .
$row['led_color' ] . ' - ' .
$row['led_speed' ] . ' - ' .
' <br />';
print( "$output" );
}
print( "</div>\n" );
print( "<hr>\n" );
$pdo = null;
}
function html_header() {
/// $et=">";
// header("Content-type: text/vnd.wap.wml");
// $output = "<?xml version=\"1.0\"?$et\n";
// print( "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">\n" );
// print( "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\n" );
/// $output .= "<!DOCTYPE html PUBLIC \"-//OMA//DTD XHTML MOBILE 1.2//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd\">\n";
/// $output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\n";
// $output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\n";
// $output .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
// $output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
$output = "";
$output .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
// $output .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
$output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
$output .= "<head>\n";
$output .= js_scripts();
// $output .= css_rollovers_head( $options );
$output .= "</head>\n";
return( $output );
}
// pending
function jqgrid_login_form( $options ) {
$output = "";
$output .= "<table id=\"login_form\" class=\"scroll\" cellpadding=\"0\" cellspacing=\"0\">\n";
$output .= "</table>\n";
$output .= "<script type=\"text/javascript\">\n";
// $output .= "var gridimgpath = 'js/jqgrid-3.5.3/themes/redmond/imgs';\n";
$output .= "var gridimgpath = 'js/jqgrid-4.4.0/themes/redmond/imgs';\n";
$output .= "jQuery(\"#login_form\").jqGrid({\n";
$output .= " datatype: \"xml\",\n";
// $output .= " datatype: \"local\",\n";
$output .= " url:'http://$http_host$php_self?q=login_validate'\n";
$output .= " urledit:'http://$http_host$php_self?q=login_validate'\n";
$output .= " height: 250,\n";
$output .= " colNames:['user','pass'],\n";
$output .= " colModel:[ \n";
$output .= " {name:'user',index:'user', width:60 },\n";
$output .= " {name:'pass',index:'user', width:60 }\n";
$output .= " {name:'sid',index:'sid', width:60 },\n";
$output .= " ], \n";
$output .= "imgpath: gridimgpath,\n";
$output .= "multiselect: true,\n";
$output .= "caption: \"login\"\n";
$output .= "});\n";
$output .= "</script>\n";
return( $output );
}
function leds_login_form( $options ) {
$html = html_header($options);
$html .= html_btn_squares($options);
/// html_header();
$query_string = $_SERVER['QUERY_STRING'];
$user = $_POST['user'];
$role = $_POST['role'];
$sid = $_POST['sid'];
// $pass = $_POST['pass'];
$step = $_POST['step'];
// $jqgrid_login_html=jqgrid_login_form( $options );
// print( $jqgrid_login_html );
// print( "<hr>jqgrid_login_html<hr>\n" );
/// leds_show();
// print( "$progid $dttm ko_center_login MSG_3070: g_allowflag=[$g_allowflag] allowflag=[$allowflag]<br>\n" );
// print( "$progid $dttm ko_center_login MSG_3071: user=[$user] role=[$role] step=[$step] id=[$id] [$query_string]<br>\n" );
$php_self=$_SERVER['PHP_SELF'];
$allowflag = $GLOBALS['allowflag'];
$allowflag_fields=explode( " ", $allowflag );
$user=$allowflag_fields[2];
print( "BUGS_8453 login_validate user=$user<br>\n" );
/// print( "<head><title>ko_center_login</title>\n" );
// css_rollovers_head($options );
// js_fgmenu_head( $options );
/// print( "</head>\n" );
/// $output .= "<body bgcolor=\"lightgrey\">\n";
// $output .= "<h1>ko_center_login_form allowflag=[$allowflag] user=[$user] </h1>\n";
/// $output .= "<h2>ko_center_login_form allowflag=[$allowflag] user=[$user]</h2>\n";
$output .= "<h2>ko_center_login_form</h2>\n";
$output .= "<form method=\"post\" action=\"$php_self?q=login_validate\">\n";
$output .= "user: <input type=\"text\" name=\"user\" value=\"$user\" /><br/>\n";
$output .= "_pin: <input type=\"password\" name=\"pass\" /><br/>\n";
$output .= "<br>\n";
$output .= "<font size=1>\n";
$output .= "newpass1: <input type=\"password\" name=\"newpass1\" /><br/>\n";
$output .= "newpass2: <input type=\"password\" name=\"newpass2\" /><br/>\n";
$output .= "<input type=\"hidden\" name=\"role\" value=\"$role\"/>\n";
$output .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>\n";
$output .= "<input type=\"hidden\" name=\"step\" value=\"login\"/>\n";
$output .= "<input type=\"hidden\" name=\"query_string\" value=\"$query_string\"/>\n";
$output .= "</font>\n";
$output .= "<p>\n";
$output .= "<input type=\"submit\"/>\n";
$output .= "<input type=\"reset\"/>\n";
$output .= "</p>\n";
$output .= "</form>\n";
// $output .= jqgrid_login_form( $options );
// ssh to l1033
$sshurl_ip ="ssh://147.238.94.126";
$sshurl_name = "ssh://l1033";
// $html_ssh = "\n";
// $html_ssh .= "<hr>\n";
// $html_ssh .= "<a href=$sshurl_ip target=_blank>$sshurl_ip</a><br>\n";
// $html_ssh .= "<a href=$sshurl_name target=_blank>$sshurl_name</a><br>\n";
// $html_ssh .= "<hr>\n";
// $html_ssh .= "\n";
//
// $html .= $html_ssh;
$html .= $output;
$html .= html_footer($options,"");
print( $html );
}
function ldap_authenticate() {
// proxy1389.ldif
// dn: cn=proxyagent,ou=Profile,dc-hrc,dc=mil
// changeType: modify
// replace: userPassword
// userPassword: _________________
/// $ldapconfig['host'] = 'localhost';
/// $ldapconfig['port'] = NULL;
/// $ldapconfig['basedn'] = 'dc=localhost,dc=com';
/// $ldapconfig['authrealm'] = 'MSSE ldap Realm';
global $ldapconfig;
global $PHP_AUTH_USER;
global $PHP_AUTH_PW;
if ($PHP_AUTH_USER != "" && $PHP_AUTH_PW != "") {
$ds=@ldap_connect($ldapconfig['host'],$ldapconfig['port']);
$r = @ldap_search( $ds, $ldapconfig['basedn'], 'uid=' . $PHP_AUTH_USER);
if ($r) {
$result = @ldap_get_entries( $ds, $r);
if ($result[0]) {
if (@ldap_bind( $ds, $result[0]['dn'], $PHP_AUTH_PW) ) {
return $result[0];
}
}
}
}
header('WWW-Authenticate: Basic realm="'.$ldapconfig['authrealm'].'"');
header('HTTP/1.0 401 Unauthorized');
return NULL;
/// if (($result = ldap_authenticate()) == NULL) {
/// echo('Authorization Failed');
/// exit(0);
/// }
/// echo('Authorization success');
/// print_r($result);
}
function leds_login_validate( $options ) {
$pdo = newpdo($GLOBALS['dbfile']);
$user = $_POST['user'];
$pass = $_POST['pass'];
$role = $_POST['role'];
$sid = $_POST['sid'];
$step = $_POST['step'];
$newpass1 = "";
$newpass2 = "";
if( isset( $_POST['newpass1'] )) { $newpass1 = $_POST['newpass1']; }
if( isset( $_POST['newpass2'] )) { $newpass2 = $_POST['newpass2']; }
$user_code=strtolower($user);
$user_pass=strtolower($pass);
$user_newpass1 = strtolower($newpass1);
$user_newpass2 = strtolower($newpass2);
$validate="0";
// print( "$php_self leds_login_validate MSG_8571: sql=[$user][$pass] [$user_code][$user_pass]<br/>\n" );
// print( "$php_self leds_login_validate MSG_8572: u=[$user][$pass] r=[$role] step=[step] sid=[$sid]<br/>\n" );
// $pwfile="/etc/passwd";
// $document_root=$_SERVER['DOCUMENT_ROOT'];
// $pwfile="$document_root"."/../safer/passwd";
$pwfile="../../safer/passwd";
// print( "$php_self leds_login_validate MSG_8580 pwfile=[$pwfile]<br\n" );
$allowflag="false";
// if( file_exists( $pwfile )) {
// print( "BUGS_8501 ___FOUND pwfile=$pwfile allowflag=$allowflag<br>\n" );
// }
// else {
// print( "BUGS_8502 NOTFOUND pwfile=$pwfile allowflag=$allowflag<br>\n" );
// }
if( file_exists( $pwfile )) {
// printf( "$progid $dttm MSG:_8590: FOUND filename=[$filename][$remote_addr][$php_self]<br>\n" );
$fp = fopen( $pwfile, 'r' );
while( $line = fread($fp, 1024)) {
$image .= $line;
// if( $remote_addr == $line ) { printf( "ALLOW<br>\n" ); }
if( preg_match( "/$user/", $line, $matches)) {
// printf( "$progid $dttm msg_8600_in_pwfile: pwfile=[$pwfile] [$remote_addr][$matches[0]]<br>\n" );
$logrec="$progid|$dttm|msg_8600_in_pwfile|$remote_addr|$user|$email|allow|\n"; logwrite( $logfil, $logrec );
$allowflag="true";
break;
}
// printf( "$progid $dttm MSG_110: line=[$line]<br>\n" );
}
fclose( $fp );
}
// else {
// printf( "$progid $dttm MSG_8599: NOTFOUND pwfile=[$pwfile]<br>\n" );
// }
// printf( "BUGS_8600 user=[$user] allowflag=[$allowflag] ===========<br>\n" );
if( $user == "admin" ) {
$allowflag="true";
$logrec="$progid|$dttm|msg_4137_allow_admin|$remote_addr|$user|$email|admin|\n"; logwrite( $logfil, $logrec );
}
if( $user == "adam" ) {
$allowflag="true";
$user="admin";
$logrec="$progid|$dttm|msg_4137_allow_admin|$remote_addr|$user|$email|admin|\n"; logwrite( $logfil, $logrec );
}
if( $allowflag == "false" ) {
printf( "$php_SELF MSG_8620 leds_login_validate: user=[$user] LOGIN NOT ALLOWED<br>\n" );
$logrec="$progid|$dttm|err_4141_notin_pwfile|$remote_addr|$user|$email||\n"; logwrite( $logfil, $logrec );
}
else {
printf( "$php_SELF MSG_8622 leds_login_validate: user=[$user] LOGIN ___ ALLOWED<br>\n" );
}
$sql = "select * from users where user_code == '$user_code' and user_pass == '$user_pass' and user_status == 'a'";
print( "$php_self leds_login_validate MSG_8630: sql=[$sql]<br/>\n" );
foreach( $pdo->query($sql) as $row ) {
$output =
"user=[". $row['user_code'] . '] ' .
// $row['user_pass'] . ' - ' .
"role=[" . $row['user_role'] . ']' .
$row['user_status'] . ' - ' .
' <br />';
print( "leds_login_validate MSG_1690: $output\n" );
if( $user_code == $row['user_code']
&& $user_pass == $row['user_pass']
&& $row['user_status'] == 'a' ) {
$validate=1;
$user=$row['user_code'];
$role=$row['user_role'];
break;
print( "$php_self leds_login_validate MSG_8650: VALID USER $user<br/>\n" );
// $logrec="$progid|$dttm|bugs_4164|$remote_addr|$user|$email|valid|\n"; logwrite( $logfil, $logrec );
// print( "$php_self leds_login_validate MSG: VALID USER logrec=$logrec<br/>\n" );
}
}
# $validate = 1;
print( "BUGS_8650 validate=$validate<br>\n" );
if( $validate == 1 ) {
$_SESSION['id'] = session_id();
$_SESSION['user'] = $row['user_code'];
$_SESSION['name'] = $row['user_name'];
$_SESSION['pagelines'] = $row['user_pagelines'];
$_SESSION['role'] = $row['user_role'];
// print( "$php_self leds_login_validate MSG: validate=[$validate] </br>\n" );
// print( "$php_self leds_login_validate MSG: r_user=[".$row['user_code']."] </br>\n" );
// print( "$php_self leds_login_validate MSG: r_role=[".$row['user_role']."] <br/>\n" );
// print( "$php_self leds_login_validate MSG: s_id=[".$_SESSION['id']."] <br/>\n" );
// print( "$php_self leds_login_validate MSG: s_user=[".$_SESSION['user']."] </br>\n" );
// print( "$php_self leds_login_validate MSG: s_role=[".$_SESSION['role']."] <br/>\n" );
// print( "$php_self leds_login_validate MSG: u=[$user][$pass] r=[$role] step=[step] sid=[$sid]<br/>\n" );
// print_r( $_SESSION );
// $_SESSION['user'] = $_POST['user'];
// $_SESSION['data'] = $_POST['data'];
$id=$_SESSION['id'];
$user=$_SESSION['user'];
$name=$_SESSION['name'];
$role=$_SESSION['role'];
printf( "BUGS_4190: validate=$validate id=[$id] user=[$user] name=[$name] role=[$role]<br>\n" );
$logrec="$progid|$dttm|msg_4191_login_success|$remote_addr|$user|$email|$name|$role|$id||\n"; logwrite( $logfil, $logrec );
// change passwd implied
if(( $user_newpass1 != "" ) && ( $user_newpass2 != "" )) {
if( $user_newpass1 == $user_newpass2 ) {
$sql_chgpass = "update users ";
$sql_chgpass .= "set user_pass = '$user_newpass1' ";
$sql_chgpass .= "where user_code == '$user_code' and user_pass == '$user_pass' and user_status == 'a';";
$html_newpass = "$progid $dttm MSG_3400: user_newpass1=[$user_newpass1] user_newpass2=[$user_newpass2]<br>\n";
$html_newpass .= "sql_chgpass=[$sql_chgpass]<br>\n";
/// print( $html_newpass );
$pdo = newpdo($GLOBALS['dbfile']);
$pdo->exec($sql_chgpass);
$pdo = null;
$logrec="$progid|$dttm|bugs_4191_pwchange_success|$remote_addr|$user|$email|$name|$role|$id||\n"; logwrite( $logfil, $logrec );
/// print( $html_newpass );
}
else {
/// $html_newpass = "$progid $dttm MSG_3401: user_newpass1=[$user_newpass1] user_newpass2=[$user_newpass2]<br>\n";
/// print( $html_newpass );
$logrec="$progid|$dttm|bugs_4191_pwchange_fail|$remote_addr|$user|$email|$name|$role|$id||\n"; logwrite( $logfil, $logrec );
}
}
else {
/// $html_newpass = "$progid $dttm MSG_3402: user_newpass1=[$user_newpass1] user_newpass2=[$user_newpass2]<br>\n";
/// print( $html_newpass );
}
$html = html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show( $options );
// $html .= html_btn_themes($options,"");
// $html .= html_btn_roles($options,"");
// $html .= html_btn_orgs($options,"");
// $html .= html_btn_hotspots($options,"");
$html .= html_footer($options,"");
print( $html );
leds_menu( $options );
}
else {
leds_login_form( $options );
}
// return( $validate );
}
function leds_logout( $options ) {
// session_start();
// $_SESSION = array();
// if( isset($_COOKIE[session_name()])) {
// setcookie(session_name(), '', time()-42000, '/');
// }
// print( "$php_self leds_logout MSG: validate=[$validate] </br>\n" );
// print( "$php_self leds_logout MSG: r_user=[".$row['user_code']."] </br>\n" );
// print( "$php_self leds_logout MSG: r_role=[".$row['user_role']."] <br/>\n" );
// print( "$php_self leds_logout MSG: s_id=[".$_SESSION['id']."] <br/>\n" );
// print( "$php_self leds_logout MSG: s_user=[".$_SESSION['user']."] </br>\n" );
// print( "$php_self leds_logout MSG: s_role=[".$_SESSION['role']."] <br/>\n" );
// print( "$php_self leds_logout MSG: u=[$user][$pass] r=[$role] step=[step] sid=[$sid]<br/>\n" );
// print( "leds_logout MSG: [$user][$role][$step] [$query_string]<br>\n" );
$id=$_SESSION['id'];
$user=$_SESSION['user'];
$role=$_SESSION['role'];
$logrec="$progid|$dttm|bugs_4259_logout|$remote_addr|$user|$email|$name|$role|$id|logout|\n"; logwrite( $logfil, $logrec );
if( isset($_SESSION['id'])) { unset($_SESSION['id']); }
if( isset($_SESSION['user'])) { unset($_SESSION['user']); }
if( isset($_SESSION['role'])) { unset($_SESSION['role']); }
session_destroy();
$html = html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show( $options );
// $html .= html_btn_themes($options,"");
// $html .= html_btn_roles($options,"");
// $html .= html_btn_orgs($options,"");
// $html .= html_btn_hotspots($options,"");
$html .= html_footer($options,"");
print( $html );
}
function leds_update_form( $options ) {
$html = "";
$html .= html_header();
$php_self=$_SERVER['PHP_SELF'];
$query_string=$_SERVER['QUERY_STRING'];
$user=$_POST['user'];
$pass=$_POST['pass'];
$step=$_POST['step'];
$tblname=$GLOBALS['tblname'];
$led_name=$options[1];
// disable 20250507_0230
$html .= html_btn_squares($options);
// $html .= leds_show();
$dbfile=$GLOBALS['dbfile'];
$pdo = newpdo($dbfile);
$sql = "select * from $tblname where led_dttm='current' and led_name == '$led_name'";
foreach( $pdo->query($sql) as $row ) {
$led_name = $row['led_name'];
$led_color = $row['led_color'];
$led_speed = $row['led_speed'];
$led_type = $row['led_type'];
$led_date = $row['led_date'];
$led_cmd = $row['led_cmd'];
$led_cmdout = $row['led_cmdout'];
$led_desc = $row['led_desc'];
$led_misc = $row['led_misc'];
$led_err = $row['led_err'];
$led_fix = $row['led_fix'];
$led_os = $row['led_os'];
$led_comment = $row['led_comment'];
}
$pdo = null;
$dttm=date("Ymd_His");
$html .= "<hr>leds_admin<hr>\n";
$html .= "<head><title>leds_update_form $dttm</title></head>\n";
$html .= "<body bgcolor=\"lightblue\">\n";
$html .= "<b>leds_update_form</b>\n";
$html .= "<h2>$query_string [$user][$pass][$step][$options[0][$options[1]]</h2>\n";
$html .= "<h4>dbfile=[$dbfile] <br>sql=[$sql]</h4>\n";
$html .= "<form method=\"post\" action=\"$php_self?q=leds_update/$led_name\" enctype=\"multipart/form-data\">\n";
// $html .= "user: <input name=\"user\"/><br/>\n";
// $html .= "pass: <input type=\"pass\" name=\"pass\"/><br/>\n";
$html .= "<br/>\n";
// $html .= "led:\n";
// $html .= "<select name=\"led\">\n";
// $html .= "<option value=\"led1\" >led1</option>\n";
// $html .= "<option value=\"led2\">led2</option>\n";
// $html .= "<option value=\"led3\">led3</option>\n";
// $html .= "</select><br/>\n";
// $html .= "led_name=[$led_name][$led_color][$led_speed][$led_type]<br>\n";
// $html .= "[$led_date][$led_cmd][$led_desc][$led_misc]<br>\n";
// $html .= "[$led_comment][$led_filename]<br /><br />\n";
$type_manual_checked = "";
$type_date_checked = "";
$type_cmd_checked = "";
if(( $led_type == "manual" ) || ( $led_type == "" )) { $type_manual_checked = "checked"; }
if( $led_type == "date" ) { $type_date_checked = "checked"; }
if( $led_type == "cmd" ) { $type_cmd_checked = "checked"; }
$html .= "<table>\n";
$html .= "<tr>\n";
$html .= "<td>type: </td>";
$html .= "<td>\n";
$html .= "<input type=\"radio\" name=\"type\" value=\"manual\" $type_manual_checked />manual";
$html .= "<input type=\"radio\" name=\"type\" value=\"date\" $type_date_checked />date";
$html .= "<input type=\"radio\" name=\"type\" value=\"cmd\" $type_cmd_checked />cmd";
$html .= "</td>\n";
$html .= "</tr>\n";
// $html .= "<br>\n";
$red_checked = "";
$blu_checked = "";
$grn_checked = "";
if( $led_color == "red" ) { $red_checked = "checked"; }
if( $led_color == "blu" ) { $blu_checked = "checked"; }
if( $led_color == "grn" ) { $grn_checked = "checked"; }
$html .= "<tr>\n";
$html .= "<td>color: </td>";
$html .= "<td>\n";
$html .= "<input type=\"radio\" name=\"color\" value=\"red\" $red_checked />red";
$html .= "<input type=\"radio\" name=\"color\" value=\"blu\" $blu_checked />blue";
$html .= "<input type=\"radio\" name=\"color\" value=\"grn\" $grn_checked />green";
$html .= "</td>\n";
$html .= "</tr>\n";
$os_aac_checked="";
$os_aix_checked="";
$os_hpx_checked="";
$os_ios_checked="";
$os_sol_checked="";
$os_uss_checked="";
$os_win_checked="";
if( $led_os == "aac" ) { $os_aac_checked = "checked"; }
if( $led_os == "aix" ) { $os_aix_checked = "checked"; }
if( $led_os == "hpx" ) { $os_hpx_checked = "checked"; }
if( $led_os == "ios" ) { $os_ios_checked = "checked"; }
if( $led_os == "sol" ) { $os_sol_checked = "checked"; }
if( $led_os == "uss" ) { $os_uss_checked = "checked"; }
if( $led_os == "win" ) { $os_win_checked = "checked"; }
if( $led_os == "" ) { $os_aac_checked = "checked"; }
// $html .= "<br/>\n";
$html .= "<tr>\n";
$html .= "<td>os: </td>";
$html .= "<td>\n";
$html .= "<input type=\"radio\" name=\"led_os\" value=\"aac\" $os_aac_checked />aac";
$html .= "<input type=\"radio\" name=\"led_os\" value=\"aix\" $os_aix_checked />aix";
$html .= "<input type=\"radio\" name=\"led_os\" value=\"hpx\" $os_hpx_checked />hpx";
$html .= "<input type=\"radio\" name=\"led_os\" value=\"ios\" $os_ios_checked />ios";
$html .= "<input type=\"radio\" name=\"led_os\" value=\"sol\" $os_sol_checked />sol";
$html .= "<input type=\"radio\" name=\"led_os\" value=\"uss\" $os_uss_checked />uss";
$html .= "<input type=\"radio\" name=\"led_os\" value=\"win\" $os_win_checked />win";
$html .= "</td>\n";
$html .= "</tr>\n";
if( $led_speed == "00" ) { $select_speed_00 = "selected"; }
if( $led_speed == "10" ) { $select_speed_10 = "selected"; }
if( $led_speed == "20" ) { $select_speed_20 = "selected"; }
if( $led_speed == "30" ) { $select_speed_30 = "selected"; }
if( $led_speed == "40" ) { $select_speed_40 = "selected"; }
if( $led_speed == "50" ) { $select_speed_50 = "selected"; }
if( $led_speed == "60" ) { $select_speed_60 = "selected"; }
if( $led_speed == "70" ) { $select_speed_70 = "selected"; }
if( $led_speed == "80" ) { $select_speed_80 = "selected"; }
if( $led_speed == "90" ) { $select_speed_90 = "selected"; }
// $html .= "<br/>\n";
$html .= "<tr>\n";
$html .= "<td>speed: </td>\n";
$html .= "<td>\n";
$html .= "<select name=\"speed\">\n";
$html .= "<option $select_speed_00 value=\"00\" >0</option>\n";
$html .= "<option $select_speed_10 value=\"10\">1</option>\n";
$html .= "<option $select_speed_20 value=\"20\">2</option>\n";
$html .= "<option $select_speed_30 value=\"30\">3</option>\n";
$html .= "<option $select_speed_40 value=\"40\">4</option>\n";
$html .= "<option $select_speed_50 value=\"50\">5</option>\n";
$html .= "<option $select_speed_60 value=\"60\">6</option>\n";
$html .= "<option $select_speed_70 value=\"70\">7</option>\n";
$html .= "<option $select_speed_80 value=\"80\">8</option>\n";
$html .= "<option $select_speed_90 value=\"90\">9</option>\n";
$html .= "</select><br/>\n";
$html .= "</td>\n";
$html .= "</tr>\n";
// $html .= "<br />\n";
// $html .= "led_err: <input size=\"256\" type=\"text\" name=\"led_err\" value=\"$led_err\"/><br/>\n";
$html .= "<tr><td>led_err: </td><td><textarea rows=\"2\" cols=\"40\" name=\"led_err\">$led_err</textarea><br/></td></tr>\n";
$html .= "<tr><td>led_fix: </td><td><textarea rows=\"2\" cols=\"40\" name=\"led_fix\">$led_fix</textarea><br/></td></tr>\n";
$html .= "<tr><td>date: </td><td><input type=\"text\" name=\"date\" value=\"$led_date\"/><br/></td></tr>\n";
$html .= "<tr><td>cmd: </td><td><input type=\"text\" name=\"cmd\" value=\"$led_cmd\"/></td></tr>\n";
$html .= "<tr><td>cmdout: </td><td><input type=\"text\" name=\"cmdout\" value=\"$led_cmdout\"/></td></tr>\n";
$html .= "<tr><td>desc: </td><td><input type=\"text\" name=\"desc\" value=\"$led_desc\"/></td></tr>\n";
$html .= "<tr><td>misc: </td><td><input type=\"text\" name=\"misc\" value=\"$led_misc\"/></td></tr>\n";
// $html .= "<tr><td>status: </td><td>\n";
// $html .= "<input type=\"checkbox\" name=\"status\" value=\"0\"/>0\n";
// $html .= "<input type=\"checkbox\" name=\"status\" value=\"1\"/>1\n";
// $html .= "<input type=\"checkbox\" name=\"status\" value=\"2\"/>2\n";
// $html .= "<input type=\"checkbox\" name=\"status\" value=\"3\"/>3\n";
// $html .= "</td></tr>\n";
$html .= "<tr><td>publish: </td><td>";
$html .= "<input type=\"radio\" name=\"published\" value=\"1\" \"checked\" />true";
$html .= "<input type=\"radio\" name=\"published\" value=\"0\" />false";
$html .= "</td></tr>\n";
$html .= "<tr><td>comment: </td><td><input type=\"text\" name=\"comment\" value=\"$led_comment\"/></td></tr>\n";
$html .= "<tr><td>upload: </td><td><input type=\"file\" name=\"uploaded\" /></td></tr>\n";
$html .= "<tr><td>   </td><td><input type=\"hidden\" name=\"user\" value=\"$user\"/></td></tr>\n";
$html .= "<tr><td>   </td><td><input type=\"hidden\" name=\"pass\" value=\"$pass\"/></td></tr>\n";
$html .= "<tr><td>   </td><td><input type=\"hidden\" name=\"step\" value=\"update\"/></td></tr>\n";
$html .= "<tr><td>   </td><td><input type=\"hidden\" name=\"query_string\" value=\"$query_string\"/></td></tr>\n";
$html .= "<tr><td>   </td><td><input type=\"hidden\" name=\"uploaded_loos\" value=\"'". $globals['uploaded']."'\"/></td></tr></td></tr>\n";
$html .= "</table>\n";
$html .= "<hr/>\n";
$html .= "<p>\n";
$html .= "<input type=\"submit\" name=\"update\" value=\"update\"/>\n";
$html .= "<input type=\"reset\"/>\n";
$html .= "</p>\n";
$html .= "</form>\n";
$html .= "</body>\n";
$html .= "<html>\n";
print( $html );
}
function leds_update( $options ) {
html_header();
$php_self=$_SERVER['PHP_SELF'];
$led_name=$options[1];
$led_dttm=date("Y-m-d H:i:s");
$led_user_ip=$_SERVER['REMOTE_ADDR'];
$led_referer=$_SERVER['REFERER'];
$led_remote_port=$_SERVER['REMOTE_PORT'];
$query_string=$_SERVER['QUERY_STRING'];
$user=$_POST['user'];
$pass=$_POST['pass'];
$step=$_POST['step'];
$led_user=$_POST['user'];
$led_color=$_POST['color'];
$led_speed=$_POST['speed'];
$led_err=$_POST['led_err'];
$led_fix=$_POST['led_fix'];
$led_os=$_POST['led_os'];
$led_type=$_POST['type'];
$led_date=$_POST['date'];
$led_cmd=$_POST['cmd'];
$led_cmdout=$_POST['cmdout'];
$led_desc=$_POST['desc'];
$led_misc=$_POST['misc'];
$led_comment=$_POST['comment'];
$led_filename=$_POST['filename'];
$led_published=$_POST['published'];
// print( "leds_update MSG: user=[$user][$pass][$step] [$query_string]<br />\n" );
// print( "leds_update MSG: name=[$led_name][$led_color][$led_speed][$led_comment][$led_user]<br/>\n" );
// print( "leds_update MSG: filename=[$led_filename] published=[$led_published]<br/>\n" );
if(isset($_FILES['uploaded']) && !empty($_FILES['uploaded']['name'])) {
// print_r($_FILES);
// $led_filename = ko_upload( $led_user );
$html_scrub = ko_upload( $led_user );
/// print( "$php_self leds_update MSG_2333: led_user=[$led_user] led_filename=[$led_filename]<br>\n" );
// ko_upload2();
}
$sqlupd = "update leds set ";
$sqlupd .= "led_color='$led_color', led_speed='$led_speed', ";
$sqlupd .= "led_err='$led_err', ";
$sqlupd .= "led_fix='$led_fix', ";
$sqlupd .= "led_os='$led_os', ";
$sqlupd .= "led_type='$led_type', ";
$sqlupd .= "led_date='$led_date', ";
$sqlupd .= "led_cmd='$led_cmd', ";
$sqlupd .= "led_cmdout='$led_cmdout', ";
$sqlupd .= "led_desc='$led_desc', ";
$sqlupd .= "led_misc='$led_misc', ";
$sqlupd .= "led_comment='$led_comment', ";
$sqlupd .= "led_user='$led_user', led_user_ip='$led_user_ip', led_referer='$led_referer', ";
$sqlupd .= "led_filename='$led_filename', led_published='$led_published' ";
$sqlupd .= "where led_dttm='current' and led_name == '$led_name'";
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
print( "<hr>MSG_6280 o0=$option0 o1=$options1 $options2 sqlupd=[$sqlupd]<br />\n" );
$sqladd = "insert or replace into nodes (";
$sqladd .= "node_name, node_dttm, node_color, node_speed, ";
$sqladd .= "node_comment, node_user, node_user_ip, node_referer, ";
$sqladd .= "node_filename, node_published ";
$sqladd .= ") ";
$sqladd .= " values ( ";
$sqladd .= "\"$led_name\", \"$led_dttm\", \"$led_color\", \"$led_speed\", ";
$sqladd .= "\"$led_comment\", \"$led_user\", \"$led_user_ip\", \"$led_referer\", ";
$sqladd .= "\"$led_filename\", \"$led_published\" ) ";
// print( "<hr>sqladd=[$sqladd]<br />\n" );
$pdo = newpdo($GLOBALS['dbfile']);
$pdo->exec($sqlupd);
$pdo->exec($sqladd);
$pdo = null;
$html_btn_squares = html_btn_squares($options);
$html_head .= html_header($options);
$html_body = leds_show();
$html_footer = html_footer( $options );
$html = $html_head . $html_btn_squares . $html_body . $html_scrub . $html_foot;
print( $html );
}
function scrub_upload_form( $options ) {
// return;
$html_head = html_header($options);
$php_self=$_SERVER['PHP_SELF'];
$query_string=$_SERVER['QUERY_STRING'];
$user=$_POST['user'];
$pass=$_POST['pass'];
$step=$_POST['step'];
$tblname=$GLOBALS['tblname'];
$led_name=$options[1];
// leds_show();
$pdo = newpdo($GLOBALS['dbfile']);
$sql = "select * from $tblname where led_dttm='current' and led_name == '$led_name'";
echo "dbfile=".$GLOBALS['dbfile']." sql=$sql <br><hr>";
foreach( $pdo->query($sql) as $row ) {
$led_name = $row['led_name'];
$led_color = $row['led_color'];
$led_speed = $row['led_speed'];
$led_type = $row['led_type'];
$led_date = $row['led_date'];
$led_cmd = $row['led_cmd'];
$led_cmdout = $row['led_cmdout'];
$led_desc = $row['led_desc'];
$led_misc = $row['led_misc'];
$led_comment = $row['led_comment'];
}
$pdo = null;
$html_btn_squares = html_btn_squares($option);
// $html .= "<head><title>scrub_upload_form</title></head>\n";
// print( "<hr>leds_admin<hr>\n" );
// print( "<head><title>scrub_upload_form</title></head>\n" );
$html_scrub_form = "<b>scrub_upload_form</b>\n";
$html_scrub_form .= "<form method=\"post\" action=\"$php_self?q=scrub_upload\" enctype=\"multipart/form-data\">\n";
$html_scrub_form.= "<br/>\n";
$html_scrub_form .= "upload: <input type=\"file\" name=\"uploaded\" /><br />\n";
$html_scrub_form .= "<input type=\"hidden\" name=\"user\" value=\"$user\"/>\n";
$html_scrub_form .= "<input type=\"hidden\" name=\"pass\" value=\"$pass\"/>\n";
$html_scrub_form .= "<input type=\"hidden\" name=\"step\" value=\"update\"/>\n";
$html_scrub_form .= "<input type=\"hidden\" name=\"query_string\" value=\"$query_string\"/>\n";
$html_scrub_form .= "<input type=\"hidden\" name=\"uploaded_loos\" value=\"'". $globals['uploaded']."'\"/>\n";
$html_scrub_form .= "<hr/>\n";
$html_scrub_form .= "<p>\n";
$html_scrub_form .= "<input type=\"submit\" name=\"update\" value=\"scrub\"/>\n";
$html_scrub_form .= "<input type=\"reset\"/>\n";
$html_scrub_form .= "</p>\n";
$html_scrub_form .= "</form>\n";
$html_foot=html_footer();
$html = $html_head . $html_btn_squares . $html_scrub_form . $html_foot;
print( $html );
}
function scrub_upload( $user ) {
$php_self=$_SERVER['PHP_SELF'];
$dttm=date("Ymd_His");
$media_path = $GLOBALS['media_path'];
// define( "FILEREPOSITORY", "$document_root/inbox" );
/// print( "$php_self ko_upload MSG_4180: _FILES[uploaded][name]=".$_FILES['uploaded']['name']. " <br>\n" );
/// print( "$php_self ko_upload MSG_4181: _FILES[uploaded][tmp_name]=".$_FILES['uploaded']['tmp_name']. " <br>\n" );
/// print( "$php_self ko_upload MSG_4182: media_path=[$media_path] <br>\n" );
/// printf( "<hr>\n" );
/// printf( "_FILES: <br>\n" );
/// print_r( $_FILES );
/// printf( "<hr>\n" );
// upload errors
switch ($_FILES['uploaded'] ['error']) {
case 1:
print '<p> 1: bigger upload_max_filesixe in php.ini</p>';
break;
case 2:
print '<p> 2: bigger than max_file_size in form</p>';
break;
case 3:
print '<p> 3: partial upload</p>';
break;
case 4:
print '<p> 4: not uploaded 4</p>';
break;
case 5:
print '<p> 5: upload error 5</p>';
break;
case 6:
print '<p> 6: missing temp folder</p>';
break;
case 7:
print '<p> 7: failed write to disk</p>';
break;
case 8:
print '<p> 8: upload_err_extension</p>';
break;
/// default:
/// print '<p> 0: unknown upload err</p>';
/// break;
}
$allowedExtensions = array("txt","csv", "log", "htm","html","xml",
"css","doc","xls","rtf","ppt","pdf","swf","flv","avi",
"wmv","mov","jpg","jpeg","gif","png");
foreach ($_FILES as $file) {
if ($file['tmp_name'] > '') {
if (!in_array(end(explode(".", strtolower($file['name']))), $allowedExtensions)) {
die($file['name'].' is an invalid file type!<br/>'.
'<a href="javascript:history.go(-1);">'.
'<< Go Back</a>');
}
}
}
// phpinfo();
$from_filename=$_FILES['uploaded']['name'];
$from_tmp_filename=$_FILES['uploaded']['tmp_name'];
$to_filename = $media_path . basename( $_FILES['uploaded']['name']) ;
if( ereg(".brp", $to_filename )) {
$orig_filename=$to_filename;
$to_filename =str_replace( ".brp", "_brp.txt", $orig_filename );
// printf( "BUGS_4190: to_filename=[$to_filename] orig_filename=[$orig_filename]<br>\n" );
}
// $media_path = "media/";
$path_parts = pathinfo( $upload_filename );
// $path_parts['dirname'];
// $path_parts['basename'];
// $path_parts['extension'];
// $path_parts['filename'];
$from_filename_parts = pathinfo( $from_filename );
$from_filename_dirname = $from_filename_parts['dirname'];
$from_filename_basename = $from_filename_parts['basename'];
$name_ext = $from_filename_parts['basename'];
$from_filename_extension = $from_filename_parts['extension'];
$from_filename_filename = $from_filename_parts['filename'];
$basename = $from_filename_parts['filename'];
/// printf( "BUGS_4405: from_filename=[$from_filename]<br>\n");
/// printf( "BUGS_4405: from_filename_dirname=[$from_filename_dirname]<br>\n");
/// printf( "BUGS_4405: from_filename_basename=[$from_filename_basename]<br>\n");
/// printf( "BUGS_4405: from_filename_extension=[$from_filename_extension]<br>\n");
/// printf( "BUGS_4414: from_filename_filename=[$from_filename_filename]<br>\n");
/// printf( "BUGS_4415: basename=[$basename]<br>\n");
///
if( $user == "" ) { $user="scrub"; }
$led_filename = $path_parts['dirname'] . "/$user" . "_" . "$dttm." . $path_parts['extension'];
$ok=1;
// print_r($_FILES);
$result = move_uploaded_file($from_tmp_filename, $to_filename );
if( $result == 1 ) {
// printf( "$php_self ko_upload MSG_2391: from_tmp_filename=[ $from_tmp_filename] to_filename=[$to_filename]<br>\n" );
}
else {
printf( "$php_self ko_upload ERR_2392: from_tmp_filename=[ $from_tmp_filename] to_filename=[$to_filename]<br>\n" );
}
// print( "$php_self ko_upload MSG_2385: user=[$user] upload_filename=[$upload_filename]<br>\n" );
// print( "$php_self ko_upload MSG: user=[$user] led_filename=[$led_filename]<br>\n" );
if( $uploaded_size > 350000 ) { print( "$php_self ko_upload ERR: file to big<br/>\n" ); $ok=0; }
if( $uploaded_type == "text/php") { print( "$php_self ko_upload ERR: no php<br/>\n" ); $ok=0; }
if( $uploaded_type == "text/exe") { print( "$php_self ko_upload ERR: no exe<br/>\n" ); $ok=0; }
if( $uploaded_type == "text/bin") { print( "$php_self ko_upload ERR: no bin<br/>\n" ); $ok=0; }
// printf( "BUGS_2443: to_filename=[$to_filename] basename=[$basename]<br>\n");
if( file_exists( $to_filename )) {
$syscmd="cd $media_path; /usr/bin/perl $media_path/ko_scrub.pl scrub $to_filename > scrub.log";
system( $syscmd );
// $scrubfile="$media_path/$name_ext";
$scrubfile=$to_filename;
// print( "$php_self ko_upload MSG_2590: FOUND to_filename=[$to_filename] name_ext=[$name_ext]<br/>\n" );
// print( "$php_self ko_upload MSG_2591: scrubfile=[$scrubfile] <br/>\n" );
if( preg_match( "/gz/", $to_filename )) {
$gunzipfile = str_replace( ".gz", "", $to_filename );
$scrubfile = str_replace( ".gz", ".txt", $to_filename );
// print( "$php_self ko_upload MSG_2780: to_filename=[$to_filename] <br/>\n" );
// print( "$php_self ko_upload MSG_2780: gunzipfile=[$gunzipfile] <br/>\n" );
// print( "$php_self ko_upload MSG_2780: scrubfile=[$scrubfile] <br/>\n" );
$syscmd_gunzip = "gunzip $to_filename";
// print( "$php_self ko_upload MSG_2785: syscmd_gunzip=[$syscmd_gunzip] <br/>\n" );
system( $syscmd_gunzip );
if( file_exists( $gunzipfile )) {
// print( "$php_self ko_upload MSG_2790: rename($gunzipfile, $scrubfile) <br/>\n" );
rename( $gunzipfile, $scrubfile );
}
else {
print( "$php_self ko_upload ERR_2790: NOTFOUND gunzipfile=[$gunzipfile]<br/>\n" );
}
if( file_exists( $scrubfile )) {
// print( "$php_self ko_upload MSG_2800: FOUND scrubfile=[$scrubfile]<br/>\n" );
}
else {
print( "$php_self ko_upload ERR_2800: NOTFOUND scrubfile=[$scrubfile]<br/>\n" );
}
// exit;
}
if( file_exists( $scrubfile )) {
$scrubfile_parts = pathinfo( $to_filename );
$scrubfile_dirname = $scrubfile_parts['dirname'];
$scrubfile_basename = $scrubfile_parts['basename'];
$scrubfile_extension = $scrubfile_parts['extension'];
$basename=str_replace( $scrubfile_extension, "", $scrubfile_basename );
/// $basename=str_replace( ".", "", $basename );
$scrubout = "";
//// $scrubout .= "header('Content-Type: text/html; charset-iso-8859-1');";
//// $scrubout .= "\n\n";
//// $filedata=array();
//// $rownum=0;
//// $fp = fopen( $scrubfile, "r" );
//// while(( $filetext = fgets($fp)) !== false ) {
// $filedata[] = $filetext;
//// $scrubout .= $filetext;
/// printf( "BUGS: filetext=[$filetext]<br>\n" );
//// $rownum++;
//// }
//// fclose($fp);
// $data = $filedata;
//// $scrubout .= $filedata;
//// print( $scrubout );
//// exit;
// return;
// return( $scrubout );
/// print( "$php_self ko_upload MSG_2475: FOUND to_filename=[$to_filename] name_ext=[$name_ext]<br/>\n" );
$html_header=html_header($options);
$html_btn_squares=html_btn_squares($options);
/// $scrubout="<html><title>$php_self $dttm scrub $to_filename</title>\n";
$html_scrub_done = "<hr>\n";
$html_scrub_done .= "<body bgcolor=lightblue>\n";
/// $html_scrub_done .= "<br>basename=[$basename] to_filename=$to_filename<br>";
/// $html_scrub_done .= "scrubfile_dirname=[$scrubfile_dirname]<br>\n";
/// $html_scrub_done .= "scrubfile_basename=[$scrubfile_basename]<br>\n";
/// $html_scrub_done .= "scrubfile_extension=[$scrubfile_extension]<br>\n";
/// $html_scrub_done .= "to_filename=[$to_filename]<br>\n";
/// $html_scrub_done .= "scrubfile=[$scrubfile]<br>\n";
/// $html_scrub_done .= "<a href=/inbox/$basename"."_out1.txt target=_blank>$basename"."_out1.txt</a><br>\n";
/// $html_scrub_done .= "<a href=/inbox/$basename"."_out2.txt target=_blank>$basename"."_out2.txt</a><br>\n";
/// $html_scrub_done .= "<a href=/inbox/$basename"."_hs.txt target=_blank>$basename"."_hs.txt</a><br>\n";
/// $html_scrub_done .= "<a href=/inbox/$basename"."_ip.txt target=_blank>$basename"."_ip.txt</a><br>\n";
/// $html_scrub_done .= "<a href=/inbox/$basename"."db3 target=_blank>$basename.db3</a><br>\n";
/// $html_scrub_done .= "<a href=/inbox/$basename"."zip target=_blank>$basename.zip</a><br>\n";
$scrubfile_path = "$document_root/inbox";
$scrubfile_jobid = str_replace( $scrubfile_extension, "", $scrubfile_basename );
/// $scrubfile_zipfile = str_replace( $scrubfile_extension, "zip", $scrubfile_basename );
$results = getfiles( $scrubfile_path, $scrubfile_jobid );
/// $html_scrub_done .= "<hr>scrubfile_path=[$scrubfile_path] scrubfile_basename=[$scrubfile_basename] scrubfile_extension=[$scrubfile_extension] scrubfile_jobid=[$scrubfile_jobid]<hr>\n";
$to_basename = str_replace( $scrubfile_dirname, "", $to_filename );
$to_basename = str_replace( "/", "", $to_basename );
$html_scrub_done .= "$to_basename<br><br>\n";
foreach( $results as $result ) {
if( preg_match( "/zip$/", $result )) {
$html_scrub_done .= "<a href=/inbox/$result target=_blank>$result</a><br>\n";
}
else {
$html_scrub_cond .= "... $result <br>\n";
}
}
/// $html_scrub_done .= "<a href=/inbox/$result.zip target=_blank>$result.zip xyz</a><br>\n";
/// $html_scrub_done .= "<hr><hr>\n";
$html_footer=html_footer();
$html = $html_header . $html_btn_squares . $html_scrub_done . $html_footer;
return( $html );
}
else {
print( "$php_self ko_upload MSG_7990: NOTFOUND scrubfile=[$scrubfile]<br/>\n" );
}
}
else {
print( "$php_self ko_upload ERR_2425: NOTFOUND to_filename=[$to_filename]<br/>\n" );
//// if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $upload_filename)) {
// print( "$php_self ko_upload MSG_619: move_uploaded_file ".$_FILES['uploadedfile']['name']."<br/>\n" );
//// }
//// else {
// print( "$php_self ko_upload ERR_620: move_uploaded_file ".$_FILES['uploadedfile']['name']."<br/>\n" );
//// }
//// if( file_exists( $upload_filename )) {
// print( "$php_self ko_upload MSG_621: rename($upload_filename, $led_filename) <br/>\n" );
//// rename( $upload_filename, $led_filename );
//// }
//// else {
//// print( "$php_self ko_upload ERR_624: rename($upload_filename, $led_filename) <br/>\n" );
//// $led_filename="filefail";
//// }
}
return( $led_filename );
}
function ko_upload2() {
global $globals;
$php_self=$_SERVER['PHP_SELF'];
$uploaddir = 'inbox/';
$dir = opendir($uploaddir);
$files = array();
if(!empty($_POST['uploaded_loos'])) {
$globals['uploaded'] = $POST['uploaded_loos'];
}
if(isset($_FILES['uploaded']) && !empty($_FILES['uploaded']['name'])) {
if(!eregi('image/', $_FILES['uploaded']['type'])) {
print( "$php_self upload_back ERR: NOT IMAGE<br/>\n" );
}
else {
while($file = readdir($dir)) {
array_push($files,"$file");
print( "$php_self upload_back MSG: file=$file<br/>\n" );
}
closedir($dir);
$_FILES['uploaded']['name'] = ceil(count($files)+'1').''.
strrchr($_FILES['uploaded']['name'], '.');
$uploadfile=$uploaddir . basename($_FILES['uploaded']['name']);
$previousToDestroy =
empty($globals['uploaded']) && !empty($_FILES['uploaded']['name']) ?
'' : $uploaddir . $files[ceil(count($files)-'1')];
if(!move_uploaded_file($_FILES['uploaded']['tmp_name'], $uploadfile)) {
print( "<pre>\n" );
print( "$php_self upload_back ERR: <br/>\n" );
print_r($_FILES);
print( "</pre><br/>\n" );
}
else {
print( "$php_self upload_back MSG: upload successful<br/>\n" );
}
$globals['uploaded'] = $_FILES['uploaded']['name'];
if(!empty($previousToDestroy)) { unlink($previousToDestroy); }
}
}
}
function ko_uploads() {
$uploads_dir = '/inbox';
foreach ($_FILES["pictures"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["pictures"]["tmp_name"][$key];
$name = $_FILES["pictures"]["name"][$key];
move_uploaded_file($tmp_name, "$uploads_dir/$name");
}
}
}
function leds_menu( $options ) {
// print( "$php_self leds_menu MSG: validate=[$validate] </br>\n" );
// print( "$php_self leds_menu MSG: r_user=[".$row['user_code']."] </br>\n" );
// print( "$php_self leds_menu MSG: r_role=[".$row['user_role']."] <br/>\n" );
// print( "$php_self leds_menu MSG: s_id=[".$_SESSION['id']."] <br/>\n" );
// print( "$php_self leds_menu MSG: s_user=[".$_SESSION['user']."] </br>\n" );
// print( "$php_self leds_menu MSG: s_role=[".$_SESSION['role']."] <br/>\n" );
// print( "$php_self leds_menu MSG: u=[$user][$pass] r=[$role] step=[step] sid=[$sid]<br/>\n" );
// print_r( $_SESSION );
$dttm=date("Ymd_His");
$php_self = $_SERVER['PHP_SELF'];
leds_show();
print( "leds_menu: u: " . $_SESSION['user'] . " r: " . $_SESSION['role'] . " - " . $dttm . "<br\>\n" );
$dbfiles = $GLOBALS['dbs'];
if(( $_SESSION['role'] == "" ) || ( $_SESSION['role'] == "anonymous" )) {
print( "<hr>\n" );
print( "<a href=$php_self?q=run/anonymous_option1>anonymous_option1</a><br />\n" );
print( "<a href=$php_self?q=run/anonymous_option2>anonymous_option2</a><br />\n" );
print( "<a href=$php_self?q=run/anonymous_option3>anonymous_option3</a><br />\n" );
}
if( $_SESSION['role'] == "guest" ) {
print( "<hr>\n" );
print( "<a href=$php_self?q=run/guest_option1>guest_option1</a><br />\n" );
print( "<a href=$php_self?q=run/guest_option2>guest_option1</a><br />\n" );
print( "<a href=$php_self?q=run/guest_option3>guest_option1</a><br />\n" );
}
if( $_SESSION['role'] == "user" ) {
print( "<hr>\n" );
print( "<a href=$php_self?q=run/user_option1>user_option1</a><br />\n" );
print( "<a href=$php_self?q=run/user_option2>user_option2</a><br />\n" );
print( "<a href=$php_self?q=run/user_option3>user_option3</a><br />\n" );
}
if( $_SESSION['role'] == "qc" ) {
print( "<hr>\n" );
print( "<a href=$php_self?q=run/qc_option1>qc_option1</a><br />\n" );
print( "<a href=$php_self?q=run/qc_option2>qc_option2</a><br />\n" );
print( "<a href=$php_self?q=run/qc_option3>qc_option3</a><br />\n" );
}
if( $_SESSION['role'] == "tester" ) {
print( "<hr>\n" );
print( "<a href=$php_self?q=run/tester_option1>tester_option1</a><br />\n" );
print( "<a href=$php_self?q=run/tester_option2>tester_option2</a><br />\n" );
print( "<a href=$php_self?q=run/tester_option3>tester_option3</a><br />\n" );
}
/// if( $_SESSION['role'] == "iperms" ) {
/// print( "<hr>\n" );
/// print( "<a href=$php_self?q=run/iperms_option1>iperms_option1</a><br />\n" );
/// print( "<a href=$php_self?q=run/iperms_option2>iperms_option2</a><br />\n" );
/// print( "<a href=$php_self?q=run/iperms_option3>iperms_option3</a><br />\n" );
/// }
if( $_SESSION['role'] == "manager" ) {
print( "<hr>\n" );
print( "<a href=$php_self?q=run/manager_option1>manager_option1</a><br />\n" );
print( "<a href=$php_self?q=run/manager_option2>manager_option2</a><br />\n" );
print( "<a href=$php_self?q=run/manager_option3>manager_option3</a><br />\n" );
}
if( $_SESSION['role'] == "operator" ) {
print( "<hr>\n" );
print( "<a href=$php_self?q=run/operator_option1>operator_option1</a><br />\n" );
print( "<a href=$php_self?q=run/operator_option2>operator_option2</a><br />\n" );
print( "<a href=$php_self?q=run/operator_option3>operator_option3</a><br />\n" );
}
if( $_SESSION['role'] == "admin" ) {
print( "<hr>\n" );
print( "<a href=$php_self?q=run/admin_option1>admin_option1</a><br />\n" );
print( "<a href=$php_self?q=run/admin_option2>admin_option2</a><br />\n" );
print( "<a href=$php_self?q=run/admin_option3>admin_option3</a><br />\n" );
print( "<br\>\n" );
// print( "<a href=$php_self?q=aors>aors</a><br />\n" );
// print( "<a href=$php_self?q=ltrs>ltrs</a><br />\n" );
// print( "<a href=$php_self?q=iperms>iperms</a><br />\n" );
print( "<hr>admin:".$_SESSION['user'] . " ". $_SESSION['user'] . "<hr>\n" );
// select database
$url_dbcode=$options[1];
$url_table=$options[2];
// print( "BUGS_2252: dbfiles0=[$dbfiles[1]]<br>\n" );
if( $url_dbcode == "" ) {
if( $dbfiles[0] != "" ) {
foreach( $dbfiles as $dbcode => $dbinfo ) {
$dbfile=$dbfiles[$dbcode]['dbfile'];
$tblcnt=count( $dbfiles[$dbcode]['tables']);
$path_parts = pathinfo($dbfile);
$dbfile_filename=$path_parts['filename'];
print( "<a href=$php_self?q=menu/$dbfile_filename>$dbfile_filename $tblcnt</a><br />\n" );
}
}
}
// select database/tables
if(( $url_dbcode != "" ) && ( $url_table == "" )) {
foreach( $dbfiles[$url_dbcode]['tables'] as $table => $tableinfo ) {
print( "<a href=$php_self?q=menu/$url_dbcode/$tableinfo>$tableinfo </a><br />\n" );
}
}
if(( $url_dbcode != "" ) && ( $url_table != "" )) {
// print( "leds_menu BUGS_1021: url_dbcode=[$url_dbcode] url_table=[$url_table]<br/>\n" );
sql_view( $options );
}
else {
// print( "leds_menu BUGS_1022: url_dbcode=[$url_dbcode] url_table=[$url_table]<br/>\n" );
return;
}
}
if( $_SESSION['role'] == "" ) {
print( "<hr>public:".$_SESSION['user'] . " ". $_SESSION['user'] . "<hr>\n" );
}
print( "<hr>\n" );
print( "<a href=$php_self?q=unload>dbs unload<a><br>\n" );
print( "<a href=$php_self?q=load>dbs load<a><br>\n" );
print( "<hr>\n" );
print( "<a href=$php_self?q=ptviewer>panos<a><br>\n" );
print( "<a href=$php_self?q=ptobject>objects<a><br>\n" );
print( "<hr>\n" );
// print_r( $dbfiles );
// foreach( $dbfiles as $dbcode => $dbinfo) {
// $dbfile=$dbfiles[$dbcode]['dbfile'];
// $tblcnt=count($dbfiles[$dbcode]['tables']);
// print( "$dbcode dbfile=[$dbfile] tblcnt=[$tblcnt]<br>\n" );
// foreach( $dbfiles[$dbcode]['tables'] as $tblnum => $tblname ) {
// print( "$dbcode $tblnum tblname=[$tblname]<br>\n" );
// }
// }
//
// fgmenu_dyn( $options );
return;
leds_show();
print( "<hr>leds_menu o=$options[0] o1=$options[1]<hr>\n" );
$pdo = newpdo($GLOBALS['dbfile']);
if( $options[1] == "" ) {
$sql = "SELECT * from sqlite_master WHERE type='table'";
foreach( $pdo->query($sql) as $row ) {
print( "<a href=$php_self?q=menu/".$row['tbl_name'].">".$row['tbl_name'] );
print( "</a><br />\n" );
}
}
if( $options[1] != "" ) {
$sql = "SELECT * from $option1";
foreach( $pdo->query($sql) as $row ) {
print( "<a href=$php_self?q=menu/".$row['tbl_name'].">".$row['tbl_name'] );
print( "</a><br />\n" );
}
}
$pdo = null;
}
function sql_view( $options ) {
$dbfiles = $GLOBALS['dbs'];
leds_show();
$dbcode=$options[1];
$table=$options[2];
$dbfile = $dbfiles[$dbcode]['dbfile'];
print( "<hr>sql_view [$dbcode][$table]<hr>\n" );
if( file_exists( $dbfile )) {
$pdo = newpdo( $dbfile );
$sql = "SELECT * from $table";
print( "sql_view MSG: sql=[$sql]<br>\n" );
$pdo_query = $pdo->query($sql );
$pdo_result = $pdo_query->fetchAll(PDO::FETCH_OBJ);
$result_count=count($pdo_result);
print( "sql_view MSG: result_count=[$result_count]\n" );
print( "<hr><hr>\n" );
// return;
// foreach( $pdo->query($sql) as $row ) {
foreach( $pdo_result as $row ) {
foreach( $row as $col ) {
print( "$col - " );
}
print( "<br/>\n" );
}
}
else {
print( "sql_view $dttm ERR_7550: NOTFOUND dbfile=[$dbfile]<br>\n" );
}
$pdo = null;
}
function leds_view( $options ) {
leds_show();
print( "<hr>leds_view o=$options[0] o1=$options[1]<hr>\n" );
}
function leds_list( $options ) {
leds_show();
print( "<hr>leds_list o=$options[0] o1=$options[1]<hr>\n" );
}
function leds_test( $options ) {
$dttm=date("Ymd_His");
$php_self=$_SERVER['PHP_SELF'];
$dbfile=$GLOBALS['dbfile'];
print( "$php_self leds_test MSG: dbfile=[$dbfile] test_mode=[$test_mode]<br>\n" );
print_r($options);
print_r( $_SESSION );
return;
}
function leds_install( $install_mode ) {
$dttm=date("Ymd_His");
print( "<hr>leds_install BEG:<hr>\n" );
$GLOBALS['install'] = true;
$dbfile=$GLOBALS['dbfile'];
$dbfile_dttm = $dbfile;
$dbfile_dttm = str_replace( ".db3", "_$dttm.db3", $dbfile );
// print( "$php_self leds_install MSG: $install_mode dbfile=[$dbfile] dbfile_dttm=[$dbfile_dttm]<br/>\n" );
if(( "$install_mode" == "new" ) && file_exists( $dbfile )) {
print( "$php_self leds_install $install_mode ERR: already installed [$dbfile]\n" );
return;
}
if(( "$install_mode" == "old" ) && file_exists( $dbfile )) {
print( "$php_self leds_install $install_mode MSG: already installed [$dbfile]\n" );
if( file_exists( $dbfile )) {
print( "$php_self leds_install MSG: rename( $dbfile, $dbfile_dttm<br/>\n" );
rename( $dbfile, $dbfile_dttm );
// copy( $dbfile, $dbfile_dttm );
if( file_exists( $dbfile_dttm )) {
// unlink( $dbfile );
print( "$php_self leds_install MSG: unlink $dbfile<br/>\n" );
}
}
}
// $file = basename($path, ".php");
// $dir = dirname($path);
// $path_parts = pathinfo('$pathfile');
// $path_parts['dirname'];
// $path_parts['basename'];
// $path_parts['extension'];
// $path_parts['filename'];
// pdo_cr( $dbfile, $dbtable, $dbdata );
// pdo_insert( $dbfile, $dbtable, $dbdata );
pdo_cr_leds();
pdo_insert_leds();
pdo_cr_nodes();
pdo_insert_nodes();
pdo_cr_roles();
pdo_insert_roles();
pdo_cr_users();
pdo_insert_roles();
pdo_cr_dbs();
pdo_insert_dbs();
pdo_cr_fgmenu();
pdo_insert_fgmenu();
pdo_cr_fp();
pdo_insert_fp();
pdo_cr_grid();
pdo_insert_grid();
pdo_cr_us();
pdo_insert_us();
pdo_cr_hw();
pdo_insert_hw();
pdo_cr_n11();
pdo_insert_n11();
// pdo_insert( $dbfile, temp1, "" );
// pdo_insert( $dbfile, temp2, "" );
// pdo_insert( $dbfile, temp3, "" );
print( "<hr>leds_install END:<hr>\n" );
}
function pdo_create( $dbfile, $tblname, $sql ) {
$php_self=$_SERVER['PHP_SELF'];
$pdo = newpdo( $dbfile );
$sqldrop="DROP TABLE IF EXISTS $tblname";
printf( "<hr>$php_self pdo_cr DROP: dbfile=[$dbfile] tblfile=[$tblname] [$sqldrop]<br>\n" );
$pdo->exec($sqldrop);
printf( "$php_self pdo_create CREATE: dbfile=[$dbfile] tblfile=[$tblname] [$sql]<br>\n" );
$pdo->exec($sql);
$pdo = null;
}
function pdo_set_leds_context( $dbfile, $val ) {
# pdo_set( $dbfile,"cfg", "update cfg set fld='$val' where fld='$leds_context' );
$php_self=$_SERVER['PHP_SELF'];
$tblname="cfg";
$sqlset="update $tblname set val='$val' where fld='leds_context'";
$pdo = newpdo( $dbfile );
printf( "<hr>$php_self pdo_cr DROP: dbfile=[$dbfile] tblfile=[$tblname] [$sqlp]<br>\n" );
$pdo->exec($sqlset);
$pdo = null;
}
function exec_set_leds_context_dup($dbfile,$leds_context) {
$sclcmd="sqlite3 $dbfile \"update cfg set val='$leds_context' where fld='leds_context'\"";
print( "BUGS_9810 exec_set_leds_context sqlcmd=$sqlcmd<br>\n" );
exec( $sqlcmd,$out,$err );
print( "BUGS_9811 exec_set_leds_context out0=".$out[0]."<br>\n" );
}
function exec_get_leds_context_dup($dbfile ) {
$sqlcmd="sqlite3 $dbfile \"select val from cfg where fld='leds_context'\"";
print( "BUGS_9815 exec_get_leds_context sqlcmd=$sqlcmd<br>\n" );
exec( $sqlcmd,$out,$err );
$leds_context=$out[0];
print( "BUGS_9820 exec_get_leds_context $dbfile=$dbfile leds_context=$leds_context<br>\n" );
return( $leds_context );
}
// ------------------------------------------------------------------
// exec_set_leds_context — use PHP exec() to update the cfg table
// ------------------------------------------------------------------
function exec_set_leds_context( $dbfile, $leds_context ) {
$sqlcmd = "sqlite3 $dbfile \"update cfg set val='$leds_context' where fld='leds_context'\"";
exec( $sqlcmd, $out, $err );
return( $err );
}
// ------------------------------------------------------------------
// exec_get_leds_context — use PHP exec() to retrieve from cfg table
// ------------------------------------------------------------------
function exec_get_leds_context( $dbfile ) {
$sqlcmd = "sqlite3 $dbfile \"select val from cfg where fld='leds_context'\"";
exec( $sqlcmd, $out, $err );
if( isset( $out[0] ) && $out[0] !== "" ) {
return( $out[0] );
}
return( "" );
}
function pdo_get_leds_context( $dbfile ) {
$php_self=$_SERVER['PHP_SELF'];
$pdo = newpdo( $dbfile );
$tblname="cfg";
$sqlget="select val from $tblname where fld='leds_context'";
printf( "<hr>$php_self pdo_cr DROP: dbfile=[$dbfile] tblfile=[$tblname] [$sqldrop]<br>\n" );
$pdo->exec($sqlget);
printf( "$php_self pdo_create CREATE: dbfile=[$dbfile] tblfile=[$tblname] [$sql]<br>\n" );
$pdo->exec($sql);
$pdo = null;
}
function pdo_insert( $dbfile, $tblname, $data ) {
$csvfile = "$tblname.csv";
$psvfile = "$tblname.psv";
/// print( "BUGS1535_PDO_INSERT_beg: dbfile=[$dbfile] tblname=[$tblname]<br>\n" );
/// print_r($data);
if( file_exists( $csvfile )) {
$filedata= array();
print( "pdo_insert CSV: FOUND csvfile=[$csvfile]<br>\n" );
$rownum=0;
$fp = fopen( $csvfile, "r" );
while(( $filetext = fgets($fp)) !== false ) {
$filedata[] = $filetext;
print( "pdo_insert CSV: rownum=$rownum filedata=[".$filedata[$rownum]. "]<br>\n" );
$rownum++;
}
fclose($fp);
$data = $filedata;
}
else {
print( "pdo_insert CSV_ERR: NOTFOUND csvfile=[$csvfile]<br>\n" );
}
if( file_exists( $psvfile )) {
print( "pdo_insert PSV: FOUND psvfile=[$psvfile]<br>\n" );
$rownum=0;
$filedata=array();
$fp = fopen( $psvfile, "r" );
while(( $filetext = fgets($fp)) !== false ) {
$filedata[] = str_replace( "|", ",", $filetext);
print( "pdo_insert PSV: rownum=$rownum filedata=[".$filedata[$rownum]. "]<br>\n" );
$rownum++;
}
fclose($fp);
$data = $filedata;
}
// foreach( $data_leds as $data_led ) {
// print( "pdo_insert_leds MSG: data_led=[$data_led]<br>\n" );
// }
if( $data == "" ) {
print( "<hr>$php_self pdo_insert ERR: DATA_NOTFOUND tblname=[$tblname]<hr>\n" );
return;
}
set_time_limit(0); // 30 seconds
$pdo = newpdo( $dbfile );
$rownum=0;
foreach( $data as $row ) {
$cols = explode( ",", $row );
if( $rownum == 0 ) {
// print( "pdo_insert ROW_$rownum: dbfile=[$dbfile] tblname=[$tblname] row=[$row]<br>\n" );
$colnum=0;
$collim=count($cols);
$sql_cr = " CREATE TABLE IF NOT EXISTS $tblname ( ";
// $sql_cr .= "$tblname"."_id INTEGER PRIMARY KEY DESC, ";
// $sql_cr .= "$tblname"."_id INTEGER PRIMARY KEY, ";
$sql_flds = "INSERT OR REPLACE into $tblname ( ";
foreach( $cols as $col ) {
// if( $col != $tblname."_id" ) {
$sql_cr .= "$col VARCHAR, ";
$sql_flds .= "$col, ";
$colnum++;
// }
}
$sql_cr .= ")";
$sql_flds .= ")";
$sql_tmp = str_replace( "VARCHAR, )", "VARCHAR )", $sql_cr );
$sql_cr = $sql_tmp;
$sql_tmp = str_replace( ", )", " )", $sql_flds );
$sql_flds = $sql_tmp;
// print( "pdo_insert ROW_$rownum: sql_flds=[$sql_flds]<br>\n" );
print( "pdo_insert ROW_$rownum: sql_cr=[$sql_cr]<br>\n" );
$pdo->exec( $sql_cr );
$rownum++;
continue;
}
if( $rownum != 0 ) {
// print( "..... BUGS1608: pdo_insert ROW_$rownum: dbfile=[$dbfile] tblname=[$tblname] row=[$row]<br>\n" );
$sql_vals = "VALUES ( ";
foreach( $cols as $col ) {
$col_trim=trim($col);
$col = $col_trim;
$sql_vals .= "\"$col\", ";
}
$sql_vals .= ");";
$sql_tmp = str_replace( ", )", ")", $sql_vals );
$sql_vals=$sql_tmp;
if( $sql_vals == "VALUES ( \"\");" ) {
$sql = "END_OF_FIELDS";
}
else {
$sql = $sql_flds . " " . $sql_vals;
}
// print( "pdo_insert ROW_$rownum: sql_vals=[$sql_vals]<br>\n" );
// print( "pdo_insert ROW_$rownum: sql=[$sql]<br>\n" );
}
// print( "$php_self pdo_insert INS: $rownum dbfile=[$dbfile] tblname=[$tblname] sql=[$sql]<br>\n" );
// print( "$php_self pdo_insert BUGS_875: sql_vals=[$sql_vals]<br>\n" );
// print( "$php_self pdo_insert BUGS_876: sql=[$sql]<br>\n" );
if( $sql != "END_OF_FIELDS" ) {
print( "pdo_insert_1845: sql=[$sql]<br>\n" );
$pdo->exec( $sql );
}
$rownum++;
}
$pdo = null;
set_time_limit(30); // 30 seconds
/// return;
/// $row=1;
/// $handle = fopen($csvfile, "r");
/// while( $data = fgetcsv($handle, 1000, ",") !== FALSE ){
/// $num = count($data);
/// $row++;
/// for( $col=0l $col < $num; $col++ ) {
/// print( "$data[$col] <br />\n" );
/// }
/// }
}
function pdo_cr_leds() {
$dbfile = $GLOBALS['dbfile'];
$tblname="leds";
$sql="CREATE TABLE IF NOT EXISTS $tblname ( ";
$sql .= "led_id INTEGER PRIMARY KEY, ";
$sql .= "led_status VARCHAR, ";
$sql .= "led_code VARCHAR, ";
$sql .= "led_name VARCHAR, ";
$sql .= "led_dttm VARCHAR, ";
$sql .= "led_color VARCHAR, ";
$sql .= "led_speed VARCHAR, ";
$sql .= "led_err VARCHAR, ";
$sql .= "led_fix VARCHAR, ";
$sql .= "led_os VARCHAR, ";
$sql .= "led_type VARCHAR, "; // manual date cmd
$sql .= "led_date VARCHAR, ";
$sql .= "led_cmd VARCHAR, ";
$sql .= "led_cmdout VARCHAR, ";
$sql .= "led_desc VARCHAR, ";
$sql .= "led_misc VARCHAR, ";
$sql .= "led_city VARCHAR, ";
$sql .= "led_bldg VARCHAR, ";
$sql .= "led_loc_code VARCHAR, ";
$sql .= "led_floor VARCHAR, ";
$sql .= "led_group VARCHAR, ";
$sql .= "led_orgs VARCHAR, ";
$sql .= "led_title VARCHAR, ";
$sql .= "led_published VARCHAR, ";
$sql .= "led_width VARCHAR, ";
$sql .= "led_height VARCHAR, ";
$sql .= "led_comment VARCHAR, ";
$sql .= "led_filename VARCHAR, ";
$sql .= "led_user VARCHAR, ";
$sql .= "led_user_ip VARCHAR, ";
$sql .= "led_referer VARCHAR, ";
$sql .= "led_remote_port VARCHAR, ";
$sql .= "led_viewrole VARCHAR, ";
$sql .= "led_user_agent VARCHAR, ";
$sql .= "led_unique_id VARCHAR ";
$sql .= ");";
// print( "BUGS_2449: pdo_cr_leds dbfile=[$dbfile]<br>\n" );
// print( "BUGS_2450: pdo_cr_leds tlbname=[$tblname]<br>\n" );
// print( "BUGS_2451 : pdo_cr_leds sql=[$sql]<br>\n" );
pdo_create( $dbfile, $tblname, $sql );
}
function pdo_cr_menus() {
$dbfile = $GLOBALS['dbfile'];
$tblname="menus";
$sql="CREATE TABLE IF NOT EXISTS $tblname ( ";
$sql .= "menus_id INTEGER PRIMARY KEY DESC, ";
$sql .= "role VARCHAR, ";
$sql .= "url VARCHAR, ";
$sql .= "levels VARCHAR";
$sql .= ");";
pdo_create( $dbfile, $tblname, $sql );
}
function pdo_insert_menus( $options ) {
$role=$_SESSION['role'];
$dbfiles = $GLOBALS['dbfiles'];
$roles = $GLOBALS['roles'];
$dbs = $dbfiles[$role];
$GLOBALS['dbs'] = $dbs;
$dbcode="fp";
$dbfile_menu=$dbfiles['admin'][$dbcode]['dbfile'];
$dbtable = "menus";
print( "pdo_cr_menus MSG_1961: role=[$role] dbfile_menu=[$dbfile_menu] dbcode=[$dbcode] dbtable=[$dbtable]<br>\n" );
// $menus[""][] = "?q=fgmenu/menu1,menu1";
// $menus[""][] = "?q=fgmenu/menu2,menu2";
// $menus[""][] = "?q=fgmenu/menu3,menu3";
// $menus[""][] = "?q=fgmenu/menu4,menu4";
//
// $menus[1][] = "?q=fgmenu/1,menu1";
// $menus[1][] = "?q=fgmenu/2,menu2";
// $menus[1][] = "?q=fgmenu/3,menu3";
// $menus[1][] = "?q=fgmenu/4,menu4";
// $menus[1][] = "?q=fgmenu/5,menu5";
// $menus[1][] = "?q=fgmenu/6,menu6";
// $menus[1][] = "?q=fgmenu/7,menu7";
//
// $menus[2][] = "?q=fgmenu/2/1,menu1";
// $menus[2][] = "?q=fgmenu/2/1/1,!menu11";
// $menus[2][] = "?q=fgmenu/2/1/2,!menu12";
// $menus[2][] = "?q=fgmenu/2/1/3,!menu13";
// $menus[2][] = "?q=fgmenu/2/1/4,!menu14";
// $menus[2][] = "?q=fgmenu/2/1/5,!menu15";
// $menus[2][] = "?q=fgmenu/2/1/6,!menu16";
// $menus[2][] = "?q=fgmenu/2/1/1/1,!!menu111";
// $menus[2][] = "?q=fgmenu/2,menu3";
// $menus[3][] = "?q=fgmenu/3/1,menu1";
// $menus[3][] = "?q=fgmenu/3/2,menu2";
// $menus[3][] = "?q=fgmenu/3/2/1,!menu2-1";
// $menus[3][] = "?q=fgmenu/3/2/2,!menu2-2";
// $menus[3][] = "?q=fgmenu/3/2/3,!menu2-3";
// $menus[3][] = "?q=fgmenu/3/3,menu3";
// $menus[3][] = "?q=fgmenu/3/3/1,!menu3-1";
// $menus[3][] = "?q=fgmenu/3/3/2,!menu3-2";
// $menus[3][] = "?q=fgmenu/3/3/2/1,!!menu3-2-1";
// $menus[3][] = "?q=fgmenu/3/3/2/2,!!menu3-2-2";
// $menus[3][] = "?q=fgmenu/3/3/2/3,!!menu3-2-3";
// $menus[5][] = "?q=fgmenu/5/1,menu5-1";
// $menus[5][] = "?q=fgmenu/5/1/1,!menu5-11";
$menus[anon][] = "?q=login/,login";
$menus[anon][] = "?q=logout/,logout";
$menus[anon][] = "?q=logout/,logout";
$menus[anon][] = "?q=menu/,menu";
$menus[anon][] = "?q=view/,view";
$menus[anon][] = "?q=update/,update";
$menus[admin][] = "?q=fgmenu/admin/db,db";
$menus[admin][] = "?q=fgmenu/admin/unload,!unload";
$menus[admin][] = "?q=fgmenu/admin/load,!load";
$menus[admin][] = "?q=fgmenu/admin/query,!query";
$menus[admin][] = "?q=fgmenu/admin/media,media";
$menus[admin][] = "?q=fgmenu/zoom,!zoom";
$menus[admin][] = "?q=fgmenu/objects,!object";
$menus[admin][] = "?q=fgmenu/pano,!pano";
$menus[users][] = "?q=fgmenu/users/update,update";
$menus[users][] = "?q=fgmenu/users/zoom,zoom";
$menus[users][] = "?q=fgmenu/users/object,object";
$menus[users][] = "?q=fgmenu/users/pano,pano";
$menus[op][] = "?q=fgmenu/op/iperms,iperms";
$menus[op][] = "?q=fgmenu/op/iperms,!periods_p";
$menus[op][] = "?q=fgmenu/op/iperms,!periods_pp";
$menus[op][] = "?q=fgmenu/op/iperms,!job2db";
$menus[op][] = "?q=fgmenu/op/iperms,!!mkwl";
$menus[op][] = "?q=fgmenu/op/iperms,!!viwl";
$menus[op][] = "?q=fgmenu/op/iperms,!!catwl";
$menus[op][] = "?q=fgmenu/op/iperms,!!runwl";
$menus[op][] = "?q=fgmenu/op/aors,!aors";
$menus[op][] = "?q=fgmenu/op/aors/txt2tif,!!txt2tif";
$menus[op][] = "?q=fgmenu/op/aors/txt2tif/mkwl,!!!mkwl";
$menus[op][] = "?q=fgmenu/op/aors/txt2tif/catwl,!!!catwl";
$menus[op][] = "?q=fgmenu/op/aors/txt2tif/runwl,!!!runwl";
$menus[op][] = "?q=fgmenu/op/aors/tif2api,!!tif2api";
$menus[op][] = "?q=fgmenu/op/aors/tif2api/mkwl,!!!mkwl";
$menus[op][] = "?q=fgmenu/op/aors/tif2api/catwl,!!!catwl";
$menus[op][] = "?q=fgmenu/op/aors/tif2api/runwl,!!!runwl";
$menus[op][] = "?q=fgmenu/op/ltrs,!ltrs";
$menus[op][] = "?q=fgmenu/op/ltrs/txt2tif,!!txt2tif";
$menus[op][] = "?q=fgmenu/op/ltrs/txt2tif/mkwl,!!!mkwl";
$menus[op][] = "?q=q=fgmenu/op/ltrs/txt2tif/catwl,!!!catwl";
$menus[op][] = "?q=fgmenu/op/ltrs/txt2tif/runwl,!!!runwl";
$menus[op][] = "?q=fgmenu/op/ltrs/tif2api,!!tif2api";
$menus[op][] = "?q=fgmenu/op/ltrs/tif2api/mkwl,!!!mkwl";
$menus[op][] = "?q=fgmenu/op/ltrs/tif2api/catwl,!!!catwl";
$menus[op][] = "?q=fgmenu/op/ltrs/tif2api/runwl,!!!runwl";
$menus[op][] = "?q=fgmenu/op/db/,db";
$csvout = "menus_id,role,url,levels\n";
$id=1;
foreach( $menus as $role=>$menu_role ) {
print( "role=$role menu_role=$menu_role<br>\n" );
foreach( $menu_role as $menu_option=>$menu_data ) {
print( "menu_option=$menu_option menu_data=$menu_data<br>\n" );
$menu_fields = explode( ",", $menu_data );
$url=$menu_fields[0];
$levels=$menu_fields[1];
$csvout .= "$id,$role,$url,$levels\n";
$id++;
}
}
$dttm=date("Ymd_His");
$csvfil="fp_menus_$dttm.csv";
$csvfil="fp_menus.csv";
$csvfil="menus.csv";
$fp = fopen( $csvfil, "w" );
// $fp = fopen( $csvfil, "a" );
fwrite( $fp, $csvout );
// print( $csvout );
fclose($fp);
set_time_limit(120); // disable
print( $csvout );
// print( "BUGS_5287 pdo_cr_menus: pdo_insert( $dbfile_menu, $dbtable, csvout )<br>\n" );
// print( "pdo_cr_menus MSG_1961: role=[$role] dbfile_menu=[$dbfile_menu] dbcode=[$dbcode] dbtable=[$dbtable]<br>\n" );
// return;
pdo_insert( $dbfile_menu, $dbtable, $csvout );
set_time_limit(30); // enable to 30 seconds
}
function pdo_cr_nodes() {
$dbfile = $GLOBALS['dbfile'];
$tblname="nodes";
$sql="CREATE TABLE IF NOT EXISTS $tblname ( ";
$sql .= "node_id INTEGER PRIMARY KEY, ";
$sql .= "node_status VARCHAR, ";
$sql .= "node_code VARCHAR, ";
$sql .= "node_name VARCHAR, ";
$sql .= "node_dttm VARCHAR, ";
$sql .= "node_color VARCHAR, ";
$sql .= "node_speed VARCHAR, ";
$sql .= "node_city VARCHAR, ";
$sql .= "node_bldg VARCHAR, ";
$sql .= "node_loc_code VARCHAR, ";
$sql .= "node_floor VARCHAR, ";
$sql .= "node_group VARCHAR, ";
$sql .= "node_orgs VARCHAR, ";
$sql .= "node_title VARCHAR, ";
$sql .= "node_published VARCHAR, ";
$sql .= "node_width VARCHAR, ";
$sql .= "node_height VARCHAR, ";
$sql .= "node_comment VARCHAR, ";
$sql .= "node_filename VARCHAR, ";
$sql .= "node_user VARCHAR, ";
$sql .= "node_user_ip VARCHAR, ";
$sql .= "node_referer VARCHAR, ";
$sql .= "node_remote_port VARCHAR, ";
$sql .= "node_viewrole VARCHAR, ";
$sql .= "node_user_agent VARCHAR, ";
$sql .= "node_unique_id VARCHAR ";
$sql .= ");";
pdo_create( $dbfile, $tblname, $sql );
}
function pdo_cr_roles() {
$dbfile = $GLOBALS['dbfile'];
$tblname = "roles";
$sql="CREATE TABLE IF NOT EXISTS $tblname (";
$sql .= "role_id INTEGER PRIMARY KEY, ";
$sql .= "role_code VARCHAR, ";
$sql .= "role_status VARCHAR, ";
$sql .= "role_comment VARCHAR ";
$sql .= ");";
pdo_create( $dbfile, $tblname, $sql );
}
function pdo_cr_users() {
$dbfile = $GLOBALS['dbfile'];
$tblname = "users";
$sql="CREATE TABLE IF NOT EXISTS $tblname (";
$sql .= "user_id INTEGER PRIMARY KEY, ";
$sql .= "user_code VARCHAR, ";
$sql .= "user_status VARCHAR, ";
$sql .= "user_pass VARCHAR, ";
$sql .= "user_role VARCHAR, ";
$sql .= "user_group VARCHAR, ";
$sql .= "user_name VARCHAR, ";
$sql .= "user_phone VARCHAR, ";
$sql .= "user_email VARCHAR, ";
$sql .= "user_dttm VARCHAR, ";
$sql .= "user_comment VARCHAR, ";
$sql .= "user_pagelines VARCHAR ";
$sql .= "user_unique_id VARCHAR ";
$sql .= ");";
pdo_create( $dbfile, $tblname, $sql );
}
function pdo_cr_fp() {
$dbfile = $GLOBALS['dbfile'];
$tblname = "fp";
$sql="CREATE TABLE IF NOT EXISTS $tblname (";
$sql .= "fp_id INTEGER PRIMARY KEY, ";
$sql .= "code VARCHAR, ";
$sql .= "status VARCHAR, ";
$sql .= "label VARCHAR, ";
$sql .= "title VARCHAR, ";
$sql .= "width VARCHAR, ";
$sql .= "height VARCHAR, ";
$sql .= "dttm VARCHAR, ";
$sql .= "comment VARCHAR, ";
$sql .= "unique_id VARCHAR";
$sql .= ");";
// print( "BUGS1720 pdo_cr_fp END: [$dbfile][$tblname]<hr>$sql<hr>\n" );
pdo_create( $dbfile, $tblname, $sql );
}
function pdo_cr_grid() {
$dbfile = $GLOBALS['dbfile'];
$tblname = "grid";
$sql="CREATE TABLE IF NOT EXISTS $tblname (";
$sql .= "grid_id INTEGER PRIMARY KEY, ";
$sql .= "code VARCHAR, ";
$sql .= "status VARCHAR, ";
$sql .= "x VARCHAR, ";
$sql .= "y VARCHAR, ";
$sql .= "org VARCHAR, ";
$sql .= "name VARCHAR, ";
$sql .= "phone VARCHAR, ";
$sql .= "email VARCHAR, ";
$sql .= "dttm VARCHAR, ";
$sql .= "comment VARCHAR, ";
$sql .= "unique_id VARCHAR ";
$sql .= ");";
pdo_create( $dbfile, $tblname, $sql );
}
function pdo_cr_us() {
$dbfile = $GLOBALS['dbfile'];
$tblname = "us";
$sql="CREATE TABLE IF NOT EXISTS $tblname (";
$sql .= "us_id INTEGER PRIMARY KEY, ";
$sql .= "code VARCHAR, ";
$sql .= "status VARCHAR, ";
$sql .= "x VARCHAR, ";
$sql .= "y VARCHAR, ";
$sql .= "grp VARCHAR, ";
$sql .= "name VARCHAR, ";
$sql .= "phone VARCHAR, ";
$sql .= "email VARCHAR, ";
$sql .= "dttm VARCHAR, ";
$sql .= "comment VARCHAR, ";
$sql .= "unique_id VARCHAR ";
$sql .= ");";
pdo_create( $dbfile, $tblname, $sql );
}
function pdo_cr_hw() {
$dbfile = $GLOBALS['dbfile'];
$tblname = "hw";
$sql="CREATE TABLE IF NOT EXISTS $tblname (";
$sql .= "hw_id INTEGER PRIMARY KEY, ";
$sql .= "code VARCHAR, ";
$sql .= "status VARCHAR, ";
$sql .= "x VARCHAR, ";
$sql .= "y VARCHAR, ";
$sql .= "grp VARCHAR, ";
$sql .= "name VARCHAR, ";
$sql .= "phone VARCHAR, ";
$sql .= "email VARCHAR, ";
$sql .= "ip VARCHAR, ";
$sql .= "dttm VARCHAR, ";
$sql .= "comment VARCHAR, ";
$sql .= "unique_id VARCHAR ";
$sql .= ");";
pdo_create( $dbfile, $tblname, $sql );
}
function pdo_cr_n11() {
$dbfile = $GLOBALS['dbfile'];
$tblname = "n11";
$sql="CREATE TABLE IF NOT EXISTS $tblname (";
$sql .= "n11_id INTEGER PRIMARY KEY, ";
$sql .= "code VARCHAR, ";
$sql .= "status VARCHAR, ";
$sql .= "x VARCHAR, ";
$sql .= "y VARCHAR, ";
$sql .= "grp VARCHAR, ";
$sql .= "name VARCHAR, ";
$sql .= "phone VARCHAR, ";
$sql .= "email VARCHAR, ";
$sql .= "ip VARCHAR, ";
$sql .= "dttm VARCHAR, ";
$sql .= "comment VARCHAR, ";
$sql .= "unique_id VARCHAR ";
$sql .= ");";
pdo_create( $dbfile, $tblname, $sql );
}
function pdo_insert_leds() {
$dbfile=$GLOBALS['dbfile'];
$tblname="leds";
$php_self=$_SERVER['PHP_SELF'];
$led_referer=$_SERVER['HTTP_REFERER'];
$led_user_agent=$_SERVER['HTTP_USER_AGENT'];
$led_user_agent="Foxfire/3.0.13";
$led_remote_port=$_SERVER['REMOTE_PORT'];
// old $data[]="led_name,led_dttm,led_color,led_speed,
// oldled_type, led_date, led_cmd, led_cmdout, led_desc, led_misc,
// oldled_comment,led_user,led_user_ip,led_referer,led_user_agent,led_remote_port";
// old $data[]="fp01,current,red,10,type,date,cmd,cmdout,desc,misc,comment1,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp02,current,blu,10,type,date,cmd,cmdout,desc,misc,comment2,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp03,current,grn,10,type,date,cmd,cmdout,desc,misc,comment3,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp04,current,grn,50,type,date,cmd,cmdout,desc,misc,comment4,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp05,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp06,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp07,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp08,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp09,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp10,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp11,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp12,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp13,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp14,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp15,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp16,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp17,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp18,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp19,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp20,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp21,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp22,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp23,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp24,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp25,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp26,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp27,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp28,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp29,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp30,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp31,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp32,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp33,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp34,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp35,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
// old $data[]="fp36,current,grn,90,type,date,cmd,cmdout,desc,misc,comment5,admin,127.0.0.1,$led_referer,$led_user_agent,$led_remote_port";
$data[]="led_id,led_status,led_code,led_name,led_dttm,led_color,led_speed,led_type,led_date,led_cmd,led_cmdout,led_desc,led_misc,led_city,led_bldg,led_loc_code,led_floor,led_group,led_orgs,led_title,led_published,led_width,led_height,led_comment,led_filename,led_user,led_user_ip,led_referer,led_user_agent,led_remote_port";
$data[]="1,ga,fp01,fp01,current,blu,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,1s,1,,p,PERSINDS,1,10200,6600,comment_01,filename,user,127.0.0.1,referer,Firefox_3.0.13,";
$data[]="2,ga,fp02,fp02,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,1n,1,,p,PERSINDS,1,10200,6600,comment_02,20101230,,198.49.187.20,,Firefox_3.0.13,";
$data[]="3,ga,fp03,fp03,current,blu,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,1s,1,,t,TAGD,1,10200,6600,comment_03,20090101,,198.49.187.20,,Firefox_3.0.13,";
$data[]="4,ga,fp04,fp04,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,1n,1,,t,TAGD,,10200,6600,comment_04,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="5,ga,fp05,fp05,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,1s,1,,h,HRC Staff,,10200,6600,comment_05,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="6,ga,fp06,fp06,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,1n,1,,h,HRC Staff,,10200,6600,comment_06,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="7,ga,fp07,fp07,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,2e,1,,t,TAGD,,10200,6600,comment_07,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="8,ga,fp08,fp08,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,2w,1,,t,TAGD,,10200,6600,comment_08,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="9,ga,fp09,fp09,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,2e,1,,o,OMPD,,10200,6600,comment_09,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="10,ga,fp10,fp10,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,2w,1,,o,OMPD,,10200,6600,comment_10,20100311,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="11,ga,fp11,fp11,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,2e,1,,e,EPMD,,10200,6600,comment_11,20100310,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="12,ga,fp12,fp12,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,2w,1,,e,EPMD,,10200,6600,comment_12,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="13,ga,fp13,fp13,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,3e,1,,t,TAGD,,10200,6600,comment_13,20100201,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="14,ga,fp14,fp14,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,3w,1,,t,TAGD,,10200,6600,comment_14,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="15,ga,fp15,fp15,current,red,50,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,3e,1,,o e t,OPMD EPMD TAG,1,10200,6600,comment_test,20100301,,127.0.0.1,,Firefox_3.0.13,";
$data[]="16,ga,fp16,fp16,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,3w,1,,o e t,OPMD EPMD TAG,,10200,6600,comment_16,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="17,ga,fp17,fp17,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,3e,1,,e,EPMD,,10200,6600,comment_17,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="18,ga,fp18,fp18,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,3w,1,,e,EPMD,,10200,6600,comment_18,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="19,ga,fp19,fp19,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,nb,1,,h,HRC CG & Staff (north bridge),,10200,6600,comment_19,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="20,ga,fp20,fp20,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,4ne,1,,p,PERSINDS HRCoE JDC,,10200,6600,comment_20,20100312,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="21,ga,fp21,fp21,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,4nw,1,,p,PERSINDS HRCoE JDC,,10200,6600,comment_21,20100313,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="22,ga,fp22,fp22,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,4sw,1,,p,PERSINDS HRCoE JDC,,10200,6600,comment_22,20100314,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="23,ga,fp23,fp23,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,4se,1,,p,PERSINDS HRCoE JDC,,10200,6600,comment_23,20100330,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="24,ga,fp24,fp24,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,5s,1,,p,PERSINDS,,10200,6600,comment_24,20100401,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="25,ga,fp25,fp25,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,5n,1,,p,PERSINDS,,10200,6600,comment_25,20100415,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="26,ga,fp26,fp26,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,5s,1,,p a g6,PERSINDS AAC G6,,10200,6600,comment_26,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="27,ga,fp27,fp27,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,5n,1,,p a g6,PERSINDS AAC G6,,10200,6600,comment_27,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="28,ga,fp28,fp28,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,5s,1,,a,AAC,,10200,6600,comment_28,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="29,ga,fp29,fp29,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,5n,1,,a,AAC,,10200,6600,comment_29,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="30,ga,fp30,fp30,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,6e,1,,a t,AAC TAGD,,10200,6600,comment_30,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="31,ga,fp31,fp31,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,6w,1,,a t h,AAC TAGD HRC Staff,,10200,6600,comment_31,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="32,ga,fp32,fp32,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,6e,1,,a,AAC,1,10200,6600,comment_32,20100312,,198.49.187.20,,Firefox_3.0.13,";
$data[]="33,ga,fp33,fp33,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,6w,1,,a,AAC,,10200,6600,comment_33,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="34,ga,fp34,fp34,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,6e,1,,a,AAC,,10200,6600,comment_34,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="35,ga,fp35,fp35,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,6w,1,,a,AAC,,10200,6600,comment_35,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="36,ga,fp36,fp36,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,knox,plan-a,sb,1,,a,AAC CG (south bridge),,10200,6600,comment_36,20100301,admin,127.0.0.1,http://localhost/hrc/fp/fp.php?hs_us,Firefox_3.0.13,";
$data[]="37,ga,fp37,fp37,current,blu,90,manual,20100316,cmd,cmdout,desc,misc,stl,prevedel,prv-b2,-2,,h,Prevedel B2,,5000,5000,comment_37,20100301,,,,Firefox_3.0.13,";
$data[]="38,ga,fp38,fp38,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,stl,prevedel,prv-b1,-1,,h,Prevedel B1,,5000,5000,comment_38,20100301,,,,Firefox_3.0.13,";
$data[]="39,ga,fp39,fp39,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,stl,prevedel,prv-1,1,,h,Prevedel 1,,5000,5000,comment_39,20100301,,,,Firefox_3.0.13,";
$data[]="40,ga,fp40,fp40,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,stl,prevedel,prv-2,2,,h,Prevedel 2,,5000,5000,comment_40,20100301,,,,Firefox_3.0.13,";
$data[]="41,ga,fp41,fp41,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,stl,prevedel,prv-3,3,,h,Prevedel 3,,5000,5000,comment_41,20100301,,,,Firefox_3.0.13,";
$data[]="42,ga,fp42,fp42,current,blu,90,manual,20100316,cmd,cmdout,desc,misc,stl,prevedel,prv-4,4,,h,Prevedel 4,,5000,5000,comment_42,20100301,,,,Firefox_3.0.13,";
$data[]="43,ga,fp43,fp43,current,red,90,manual,20100316,cmd,cmdout,desc,misc,stl,prevedel,prv-5,5,,h,Prevedel 5,,5000,5000,comment_43,20100301,,,,Firefox_3.0.13,";
$data[]="44,ga,fp44,fp44,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,stl,bldg100,b100-1,1,,x,Bldg 100 1,,5000,5000,comment_44,20100301,,,,Firefox_3.0.13,";
$data[]="45,ga,fp45,fp45,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,stl,bldg100,b100-2,2,,x,Bldg 100 2,,5000,5000,comment_45,20100301,,,,Firefox_3.0.13,";
$data[]="46,ga,fp46,fp46,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,stl,bldg100,b100-3,3,,x,Bldg 100 3,,5000,5000,comment_46,20100301,,,,Firefox_3.0.13,";
$data[]="47,ga,fp47,fp47,current,red,90,manual,20100316,cmd,cmdout,desc,misc,stl,bldg100,b100-4,4,,x,Bldg 100 4,,5000,5000,comment_47,20100301,,,,Firefox_3.0.13,";
$data[]="48,ga,fp48,fp48,current,blu,90,manual,20100316,cmd,cmdout,desc,misc,stl,hrcstl,b100-prv,1,,h,b100-prv,,4800,6650,comment_48,20100301,,,,,";
$data[]="49,ga,fp49,fp49,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,stl,hrcstl-org2009,hrcstl-org2009,1,,h,hrcstl-org,,,,,20100301,,,,,";
$data[]="50,ga,fp50,fp50,current,grn,90,manual,20100316,cmd,cmdout,desc,misc,stl,advon-templet,advon-templet,1,,h,advon-templet,1,,,test,20120101,,198.49.187.20,,,";
$data[]="51,ga,fp51,fp51,current,blu,90,date,20010101,cmd,cmdout,desc,misc,,,,,,,,,,,comment_51_20010101,,,,,,";
$data[]="52,ga,fp52,fp52,current,blu,90,date,20100229,cmd,cmdout,desc,misc,,,,,,,,,,,comment_52_20100229,,,,,,";
$data[]="53,ga,fp53,fp53,current,blu,90,date,20100301,cmd,cmdout,desc,misc,,,,,,,,,,,comment_53_20100301,,,,,,";
$data[]="54,ga,fp54,fp54,current,blu,90,date,20100315,cmd,cmdout,desc,misc,,,,,,,,,,,comment_54_20100315,,,,,,";
$data[]="55,ga,fp55,fp55,current,blu,90,date,20100316,cmd,cmdout,desc,misc,,,,,,,,,,,comment_55_20100316,,,,,,";
$data[]="56,ga,fp56,fp56,current,blu,90,date,20100317,cmd,cmdout,desc,misc,,,,,,,,,,,comment_56_201000317,,,,,,";
$data[]="57,ga,fp57,fp57,current,blu,90,date,20100330,cmd,cmdout,desc,misc,,,,,,,,,,,comment_57_20100330,,,,,,";
$data[]="58,ga,fp58,fp58,current,blu,90,date,20100401,cmd,cmdout,desc,misc,,,,,,,,,,,comment_58_20100401,,,,,,";
$data[]="59,ga,fp59,fp59,current,blu,90,date,20110101,cmd,cmdout,desc,misc,,,,,,,,,,,comment_59_20110101,,,,,,";
$data[]="60,ga,fp60,fp60,current,blu,90,cmd,20100316,pwd,cmdout,desc,misc,,,,,,,,,,,comment_59_cmd_pwd,,,,,,";
$data[]="61,ga,fp61,fp61,current,blu,90,cmd,20100316,dir,cmdout,desc,misc,,,,,,,,,,,comment_59_cmd_dir,,,,,,";
pdo_insert( $dbfile, $tblname, $data);
}
function pdo_insert_nodes() {
$dbfile=$GLOBALS['dbfile'];
$tblname="nodes";
$node_dttm=date("Y-m-d H:i:s");
$led_referer=$_SERVER['HTTP_REFERER'];
$led_user_agent=$_SERVER['HTTP_USER_AGENT'];
$led_remote_port=$_SERVER['REMOTE_PORT'];
$data[]="node_name,node_dttm,node_color,node_speed,node_comment,node_user,node_user_ip,node_referer,node_user_agent,node_remote_port";
$data[]="fp01,$dttm,red,10,comment1,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp02,$dttm,blu,10,comment2,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp03,$dttm,grn,10,comment3,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp04,$dttm,grn,50,comment4,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp05,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp06,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp07,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp08,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp09,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp10,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp11,$dttm,red,10,comment1,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp12,$dttm,blu,10,comment2,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp13,$dttm,grn,10,comment3,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp14,$dttm,grn,50,comment4,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp15,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp16,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp17,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp18,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp19,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp20,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp21,$dttm,red,10,comment1,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp22,$dttm,blu,10,comment2,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp23,$dttm,grn,10,comment3,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp24,$dttm,grn,50,comment4,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp25,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp26,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp27,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp28,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp29,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp30,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp31,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp32,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp33,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp34,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp35,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
$data[]="fp36,$dttm,grn,90,comment5,admin,127.0.0.1,$node_referer,$node_user_agent,$node_remote_port";
pdo_insert( $dbfile, $tblname, $data);
return;
}
function pdo_insert_roles() {
$dbfile=$GLOBALS['dbfile'];
$tblname="roles";
$data[]="role_code, role_status, role_comment";
$data[]="admin,a,administrator";
$data[]="iperms,a,iperms";
$data[]="operator,a,operator";
$data[]="manager,a,manager";
$data[]="qc,a,quality_control";
$data[]="user,a,user";
$data[]="tester,a,tester";
$data[]="guest,a,guest";
$data[]=",a,anonymous";
pdo_insert( $dbfile, $tblname, $data);
return;
}
function pdo_insert_users() {
$dbfile=$GLOBALS['dbfile'];
$tblname="users";
$dt=date("Y-m-d H:i:s");
$data[] = "user_code,user_status,user_pass,user_role,user_group,user_name,user_dttm,user_pagelines";
$data[] = ",a,,,,anonymous,$dt,5";
$data[] = "admin,a,..adm1n,admin,grp,jan admin,$dt,30";
$data[] = "iperms,a,..ip3rmz,iperms,grp,jan admin,$dt,30";
$data[] = "tester,a,..t3st3r,tester,grp,jan admin,$dt,30";
$data[] = "op,a,..op,grp,grp,jan operator,$dt,25";
$data[] = "manager,a,..mgr,manager,grp,jan manager,$dt,20";
$data[] = "qc,a,..qc,qc,grp,jan quality_control,$dt,15";
$data[] = "user,a,..user,user,grp,jan user,$dt,10";
$data[] = "guest,a,..guest,guest,grp,jan guest,$dt,5";
$data[] = "a,a,aa,admin,grp,joe admin,$dt,30";
$data[] = "o,a,oo,admin,grp,joe admin,$dt,25";
$data[] = "m,a,mm,manager,grp,joe manager,$dt,20";
$data[] = "q,a,qq,qc,grp,joe quality_control,$dt,15";
$data[] = "u,a,uu,user,grp,joe user,$dt,10";
$data[] = "g,a,gg,guest,grp,jan guest,$dt,5";
pdo_insert( $dbfile, $tblname, $data );
return;
}
function pdo_insert_fp() {
$dbfile=$GLOBALS['dbfile'];
$tblname="fp";
$dt=date("Y-m-d H:i:s");
print( "BUGS1910 pdo_insert_fp BEG: [$dbfile][$tblname]<hr>$sql<hr>\n" );
$data[] = "code,status,label,title,width,height,dttm,comment,unique_id";
$data[] = "fp01,a,fp01,title01,5301,3300,20090912,comment,unique_id";
$data[] = "fp02,a,fp02,title02,5301,3300,20090912,comment,unique_id";
$data[] = "fp03,a,fp03,title03,5301,3300,20090912,comment,unique_id";
$data[] = "fp04,a,fp04,title04,5301,3300,20090912,comment,unique_id";
$data[] = "fp05,a,fp05,title05,5301,3300,20090912,comment,unique_id";
$data[] = "fp06,a,fp06,title06,5301,3300,20090912,comment,unique_id";
$data[] = "fp07,a,fp07,title07,5301,3300,20090912,comment,unique_id";
$data[] = "fp08,a,fp08,title08,5301,3300,20090912,comment,unique_id";
$data[] = "fp09,a,fp09,title09,5301,3300,20090912,comment,unique_id";
print_r( $data );
print( "BUGS1920 pdo_insert_fp END: [$dbfile][$tblname]<hr>$sql<hr>\n" );
pdo_insert( $dbfile, $tblname, $data );
}
function pdo_insert_grid() {
$dbfile=$GLOBALS['dbfile'];
$tblname="grid";
$dt=date("Y-m-d H:i:s");
$data[] ="code,status,x,y,org,name,phone,email,dttm,comment,unique_id";
$data[] ="fp01,status,x,y,org,name,phone,email,dttm,comment,unique_id";
$data[] ="fp02,status,x,y,org,name,phone,email,dttm,comment,unique_id";
$data[] ="fp03,status,x,y,org,name,phone,email,dttm,comment,unique_id";
$data[] ="fp36,status,x,y,org,name,phone,email,dttm,comment,unique_id";
pdo_insert( $dbfile, $tblname, $data );
}
function pdo_insert_us() {
$dbfile=$GLOBALS['dbfile'];
$tblname="us";
$dt=date("Y-m-d H:i:s");
$data[] ="code,status,x,y,grp,name,phone,email,dttm,comment,unique_id";
$data[] ="hb,us_status,us_x,us_y,us_grp,us_name,us_phone,us_email,us_dttm,us_comment,us_unique_id";
$data[] ="ct,us_status,us_x,us_y,us_grp,us_name,us_phone,us_email,us_dttm,us_comment,us_unique_id";
$data[] ="jn,us_status,us_x,us_y,us_grp,us_name,us_phone,us_email,us_dttm,us_comment,us_unique_id";
$data[] ="ng,us_status,us_x,us_y,us_grp,us_name,us_phone,us_email,us_dttm,us_comment,us_unique_id";
$data[] ="sw,us_status,us_x,us_y,us_grp,us_name,us_phone,us_email,us_dttm,us_comment,us_unique_id";
$data[] ="mo,us_status,us_x,us_y,us_grp,us_name,us_phone,us_email,us_dttm,us_comment,us_unique_id";
$data[] ="ds,us_status,us_x,us_y,us_grp,us_name,us_phone,us_email,us_dttm,us_comment,us_unique_id";
$data[] ="mlj,us_status,us_x,us_y,us_grp,us_name,us_phone,us_email,us_dttm,us_comment,us_unique_id";
$data[] ="tb,us_status,us_x,us_y,us_grp,us_name,us_phone,us_email,us_dttm,us_comment,us_unique_id";
$data[] ="jw,us_status,us_x,us_y,us_grp,us_name,us_phone,us_email,us_dttm,us_comment,us_unique_id";
pdo_insert( $dbfile, $tblname, $data );
}
function pdo_insert_hw() {
$dbfile=$GLOBALS['dbfile'];
$tblname="hw";
$dt=date("Y-m-d H:i:s");
$data[] = "code,status,x,y,grp,name,phone,email,ip,dttm,comment,unique_id";
$data[] = "ftp1a,status,x,y,grp,name,phone,email,ip,dttm,comment,unique_id";
$data[] = "ftp2a,status,x,y,grp,name,phone,email,ip,dttm,comment,unique_id";
$data[] = "ftp3a,status,x,y,grp,name,phone,email,ip,dttm,comment,unique_id";
$data[] = "api1,status,x,y,grp,name,phone,email,ip,dttm,comment,unique_id";
$data[] = "ascrv1,status,x,y,grp,name,phone,email,ip,dttm,comment,unique_id";
$data[] = "host1,status,x,y,grp,name,phone,email,ip,dttm,comment,unique_id";
print( "BUGS1953 pdo_insert_hw: $dbfile $tblname $data<br>\n" );
print_r( $data );
// pdo_insert( $dbfile, $tblname, $data );
}
function pdo_insert_n11() {
$dbfile=$GLOBALS['dbfile'];
$tblname="n11";
$dt=date("Y-m-d H:i:s");
$data[] = "code,status,x,y,grp,name,phone,email,ip,dttm,comment,unique_id";
$data[] = "ftp1a,status,x,y,grp,name,phone,email,ip,dttm,comment,unique_id";
$data[] = "ftp2a,status,x,y,grp,name,phone,email,ip,dttm,comment,unique_id";
$data[] = "ftp3a,status,x,y,grp,name,phone,email,ip,dttm,comment,unique_id";
$data[] = "api1,status,x,y,grp,name,phone,email,ip,dttm,comment,unique_id";
$data[] = "ascrv1,status,x,y,grp,name,phone,email,ip,dttm,comment,unique_id";
$data[] = "host1,status,x,y,grp,name,phone,email,ip,dttm,comment,unique_id";
pdo_insert( $dbfile, $tblname, $data );
}
function pdo_insert_obj() {
$dbfile=$GLOBALS['dbfile'];
$tblname="obj";
$dt=date("Y-m-d H:i:s");
$data[] = "filename,width,height,nhor,nvert,title,desc";
$data[] = "petri_1053_600_13_6.jpg,1053,600,13,1,petri dishes large 1053x600,desc01";
$data[] = "petri_526_300_13_6.jpg,526,300,13,1,petri dishes small 526x300,desc02";
$data[] = "strip_goplayers.jpg,4819,200,17,1,goplayer 4819x200,desc03";
$data[] = "strip_helmet.jpg,10880,480,17,1,helmet 10880x480,desc04";
$data[] = "strip_p100.jpg,1280,480,2,1,p100 two sides,desc05";
$data[] = "usf_1711_200_8_1.jpg,1711,200,8,1,us female body 1711x200,desc06";
$data[] = "usf_3464_405_8_1.jpg,3464,405,8,1,us female body 3464x405,desc07";
$data[] = "usf_855_100_8_1.jpg,855,100,8,1,us female body 855x100,desc08";
$data[] = "usf_head_3464_72_8_1.jpg,3452,72,8,1,femail head 3464x72,desc09";
$data[] = "usm_1711_200_8_1.jpg,1711,200,8,1,mail body 1711x200,desc10";
$data[] = "usm_3464_405_8_1.jpg,3464,405,8,1,us male body 3464x405,desc11";
$data[] = "usm_855_100_8_1.jpg,855,100,8,1,us male body 855x100,desc12";
$data[] = "usm_head_3464_64_8_1.jpg,3452,64,8,1,us male head 3464x64,desc13";
pdo_insert( $dbfile, $tblname, $data );
}
function pdo_insert_pano() {
$dbfile=$GLOBALS['dbfile'];
$tblname="pano";
$dt=date("Y-m-d H:i:s");
$data[] = "filename,width,height,nhor,nvert,title,desc";
$data[] = "pano_creek.jpg,2000,1000,0,0,pano creek,desc01";
$data[] = "pano_fort.jpg,2000,1000,0,0,pano fort,desc02";
$data[] = "pano_fort2.jpg,2000,1000,0,0,pano fort2,desc03";
$data[] = "pano_grotto.jpg,2000,1000,0,0,pano grotto.jpg,desc04";
$data[] = "pano_jtf_entrance.jpg,5607,512,0,0,pano entrance,desc05";
$data[] = "pano_night.jpg,2000,1000,0,0,pano night,desc06";
$data[] = "pano_office.jpg,2000,1000,0,0,pano office,desc07";
$data[] = "pano_templet.gif,600,300,0,0,pano templet,desc08";
$data[] = "pano_templet2.jpg,300,154,0,0,pano templet2,desc09";
pdo_insert( $dbfile, $tblname, $data );
}
function pdo_grid_array($options) {
$output = "";
$output .= "<table id=\"list4\" class=\"scroll\" cellpadding=\"0\" cellspacing=\"0\">\n";
$output .= "</table>\n";
$output .= "<script type=\"text/javascript\">\n";
// $output .= "var gridimgpath = 'js/jqgrid-3.5.3/themes/redmond/imgs';\n";
$output .= "var gridimgpath = 'js/jqgrid-4.4.0/themes/redmond/imgs';\n";
$output .= "jQuery(\"#list4\").jqGrid({\n";
$output .= " datatype: \"local\",\n";
$output .= " height: 250,\n";
$output .= " colNames:['No','Date', 'Client', 'Amount','Tax','Total','Notes'],\n";
$output .= " colModel:[ \n";
$output .= " {name:'id',index:'id', width:60, sorttype:\"int\"},\n";
$output .= " {name:'date',index:'date', width:90, sorttype:\"date\"},\n";
$output .= " {name:'name',index:'name', width:100},\n";
$output .= " {name:'amount',index:'amount', width:80, align:\"right\",sorttype:\"float\"},\n";
$output .= " {name:'tax',index:'tax', width:80, align:\"right\",sorttype:\"float\"},\n";
$output .= " {name:'total',index:'total', width:80,align:\"right\",sorttype:\"float\"},\n";
$output .= " {name:'note',index:'note', width:150, sortable:false}\n";
$output .= " ], \n";
$output .= "imgpath: gridimgpath,\n";
$output .= "multiselect: true,\n";
$output .= "caption: \"Manipulating Array Data\"\n";
$output .= "});\n";
$output .= "var mydata = [\n";
$output .= " {id:\"1\",date:\"2007-10-01\",name:\"test\",note:\"note\",amount:\"200.00\",tax:\"10.00\",total:\"210.00\"},\n";
$output .= " {id:\"2\",date:\"2007-10-02\",name:\"test2\",note:\"note2\",amount:\"300.00\",tax:\"20.00\",total:\"320.00\"},\n";
$output .= " {id:\"3\",date:\"2007-09-01\",name:\"test3\",note:\"note3\",amount:\"400.00\",tax:\"30.00\",total:\"430.00\"},\n";
$output .= " {id:\"4\",date:\"2007-10-04\",name:\"test\",note:\"note\",amount:\"200.00\",tax:\"10.00\",total:\"210.00\"},\n";
$output .= " {id:\"5\",date:\"2007-10-05\",name:\"test2\",note:\"note2\",amount:\"300.00\",tax:\"20.00\",total:\"320.00\"},\n";
$output .= " {id:\"6\",date:\"2007-09-06\",name:\"test3\",note:\"note3\",amount:\"400.00\",tax:\"30.00\",total:\"430.00\"},\n";
$output .= " {id:\"7\",date:\"2007-10-04\",name:\"test\",note:\"note\",amount:\"200.00\",tax:\"10.00\",total:\"210.00\"},\n";
$output .= " {id:\"8\",date:\"2007-10-03\",name:\"test2\",note:\"note2\",amount:\"300.00\",tax:\"20.00\",total:\"320.00\"},\n";
$output .= " {id:\"9\",date:\"2007-09-01\",name:\"test3\",note:\"note3\",amount:\"400.00\",tax:\"30.00\",total:\"430.00\"}\n";
$output .= " ]; \n";
$output .= "for( var i=0; i <= mydata.length; i++) \n";
$output .= " jQuery(\"#list4\").addRowData(i+1,mydata[i]); \n";
$output .= "</script>\n";
return( $output );
}
function pdo_grid( $options ) {
$http_host=$_SERVER['HTTP_HOST'];
$php_self=$_SERVER['PHP_SELF'];
$js_output=$GLOBALS['js_output'];
$dbfiles = $GLOBALS['dbs'];
$url_dbcode=$options[2];
$url_table=$options[3];
$url_value=$options[4];
$url_value1=$options[5];
$url_value2=$options[6];
$url_zmcode=$options[4];
$url_zmtype=$options[5];
$url_zmrowid=$options[6];
// print( "pdo_gird_2877: o1=[$options[1]] o2=[$options[2]] o3=[$options[3]] o4=[$options[4]] o5=[$options[5]] o6=[$options[6]] o7=[$options[7]]<br>\n" );
// print( "pdo_grid_2878: _SESSION[hs_type]=[".$_SESSION['hs_type']."] dbcode=[$url_dbcode] url_table=[$url_table] url_zmcode=[$url_zmcode] url_zmtype=[$url_zmtype]<br>\n" );
if(( $url_zmtype == "" ) & ( $_SESSION['hs_type'] )) { $url_zmtype = $_SESSION['hs_type']; }
// print( "pdo_grid_2880: _SESSION[hs_type]=[".$_SESSION['hs_type']."] dbcode=$url_dbcode url_table=$url_table url_zmcode=[$url_zmcode] url_zmtype=[$url_zmtype] url_zmrowid=[$url_zmrowid]<br>\n" );
$role=$_SESSION['role'];
$theme=$_SESSION['theme'];
$gridimgpath = $_SESSION['gridimgpath'];
// print( "BUGS_2595 gridimgpath=[$gridimgpath] theme=$theme role=$role<br>\n" );
$page=1;
$records=1;
if( $url_dbcode == "" ) {
print( "<hr><h2>pdo_grid url_dbcode[$url_dbcode] url_table=[$url_table]</h2><hr>\n" );
foreach( $dbfiles as $dbcode => $dbinfo ) {
$dbfile=$dbfiles[$dbcode]['dbfile'];
$tblcnt=count( $dbfiles[$dbcode]['tables']);
$path_parts = pathinfo($dbfile);
$dbfile_filename=$path_parts['filename'];
// print( "<a href=$php_self?q=db/grid/$dbfile_filename>$dbfile_filename $tblcnt</a><br />\n" );
$output .= "<a href=$php_self?q=db/grid/$dbfile_filename>$dbfile_filename $tblcnt</a><br />\n";
}
return($output);
}
// select database/tables
if(( $url_dbcode != "" ) && ( $url_table == "" )) {
// print( "<hr><h2>$dttm MSG_3536: pdo_unload url_dbcode[$url_dbcode] url_table=[$url_table]</h2><hr>\n" );
$output .= "<hr><h2>$dttm MSG_3536: pdo_unload url_dbcode[$url_dbcode] url_table=[$url_table]</h2><hr>\n";
foreach( $dbfiles[$url_dbcode]['tables'] as $table => $tableinfo ) {
// print( "<a href=$php_self?q=db/grid/$url_dbcode/$tableinfo>$tableinfo </a><br />\n" );
$output .= "<a href=$php_self?q=db/grid/$url_dbcode/$tableinfo>$tableinfo </a><br />\n";
}
return( $output );
}
$dbfile=$dbfiles[$url_dbcode]['dbfile'];
// print( "pdo_grid BUGS_10700: url_dbcode=[$url_dbcode] dbfile=[$dbfile]<hr>\n" );
// $testfile="/home/ko/vg/kohpx_vg.db3";
// $testfile="$document_root/index1.php";
// $testfile="/home/ko/vg/kohpx_vg.db3";
$testfile="$document_root/ko_center/kohpx_vg.db3";
/// if( file_exists( "/home/ko/vg/kohpx_vg.db3" )) {
/// printf( "$progid MSG_3550: FOUND testfile=[$testfile]<hr>\n" );
/// }
/// else {
/// printf( "$progid ERR_3550: NOTFOUND testfile=[$testfile]<hr>\n" );
/// }
if( ! file_exists( $dbfile )) {
// print( "pdo_grid ERR: NOTFOUND url_dbcode=[$url_dbcode] dbfile=[$dbfile]<hr>\n" );
$output .= "pdo_grid ERR_1070: NOTFOUND url_dbcode=[$url_dbcode] dbfile=[$dbfile]<hr>\n";
return( $output );
}
$where_clause="";
$jqgrid_list_id = "list_$url_dbcode"."_$url_table"."_$url_value"."_$url_value1"."_$url_value2";
$jqgrid_pager_id = "pager_$url_dbcode"."_$url_table"."_$url_value"."_$url_value1"."_$url_value2";
$jqgrid_url = "url:'https://$http_host$php_self";
$jqgrid_url .= "?q=db/gridxml/".$url_dbcode."/".$url_table."/".$url_value."/".$url_value1."/".$url_value2."',";
$jqgrid_editurl = "editurl:'https://$http_host$php_self";
$jqgrid_editurl .= "?q=db/gridxml/".$url_dbcode."/".$url_table."/".$url_value."/".$url_value1."/".$url_value2."',";
// print( "BUGS_2925 pdo_grid url_table=[$url_table]<br>\n" );
if( $url_table == "zoomxml" ) {
$jqgrid_list_id = "list_$url_dbcode"."_$url_table"."_$url_zmcode"."_$url_zmtype"."_$url_zmrowid";
$jqgrid_pager_id = "pager_$url_dbcode"."_$url_table"."_$url_zmcode"."_$url_zmtype"."_$url_zmrowid";
$jqgrid_url = "url:'https://$http_host$php_self";
$jqgrid_url .= "?q=db/gridxml/".$url_dbcode."/".$url_table."/".$url_zmcode."/".$url_zmtype."/".$url_zmrowid."',";
$jqgrid_editurl = "editurl:'https://$http_host$php_self";
$jqgrid_editurl .= "?q=db/gridxml/".$url_dbcode."/".$url_table."/".$url_zmcode."/".$url_zmtype."/".$url_zmrowid."',";
switch( true ) {
case( $url_zmcode == "" & $url_zmtype == "" & $url_zmrowid == "" ):
$where_clause = "";
break;
case( $url_zmcode == "" & $url_zmtype == "" & $url_zmrowid != "" ):
$where_clause = "where rowid = '$url_zmrowid'";
break;
case( $url_zmcode == "" & $url_zmtype != "" & $url_zmrowid == "" ):
$where_clause = "where type = '$url_zmtype'";
break;
case( $url_zmcode == "" & $url_zmtype != "" & $url_zmrowid != "" ):
$where_clause = "where type = '$url_zmtype' and rowid='$zmrowid'";
break;
case( $url_zmcode == "all" & $url_zmtype == "all" & $url_zmrowid == "" ):
$where_clause = "";
break;
case( $url_zmcode == "" & $url_zmtype == "all" & $url_zmrowid == "" ):
$where_clause = "";
break;
case( $url_zmcode == "" & $url_zmtype == "all" & $url_zmrowid != "" ):
$where_clause = "where zoomxml_id = '$url_zmrowid'";
break;
case( $url_zmcode != "" & $url_zmtype == "" & $url_zmrowid == "" ):
// $where_clause = "where code = '$url_zmcode'";
break;
case( $url_zmcode != "" & $url_zmtype == "" & $url_zmrowid != "" ):
$where_clause = "where code = '$url_zmcode' and rowid = '$rowid'";
break;
case( $url_zmcode != "" & $url_zmtype != "" & $url_zmrowid == "" ):
$where_clause = "where code = '$url_zmcode' and type = '$url_zmtype'";
break;
case( $url_zmcode != "" & $url_zmtype != "" & $url_zmrowid != "" ):
$where_clause = "where code = '$url_zmcode' & type = '$url_zmtype' and rowid = '$url_rowid'";
break;
}
/// print( "BUGS_2968 pdo_grid ZOOMXML: url_zmtype=[$url_zmtype] url_zmcode=[$url_zmcode] where=[$where_clause]\n" );
}
if( $url_table == "zoom" ) {
/// print( "BUGS_2972 pdo_grid ZOOM: url_zmtype=[$url_zmtype] url_zmcode=[$url_zmcode] where=[$where_clause]\n" );
}
$pdo = newpdo($dbfile);
// $sql = "select count(*) pagetotal from $url_table";
$sql = "select count(*) pagetotal from $url_table $where_clause";
$output .= "<!-- pdo_grid_2986: sql=[$sql]<br> -->\n";
$output .= "<!-- pdo_grid_2987: where_clause=[$where_clause]<br> -->\n";
$sqlout = $pdo->query($sql);
$record = $sqlout->fetchall();
if(sizeof($record) != 0) {
// print( "sizeof record != 0 $record<br>\n" );
$total_pages=$record[0][0];
}
else {
$total_pages=0;
}
// $sql = "select * from $url_table";
// $sql = "select rowid,* from $url_table";
$sql = "select rowid,* from $url_table $where_clause";
// print( "BUGS_2999 sql=[$sql] url_table=[$url_table] where_clause=[$where_clause] $zmcode $zmtype<br>\n" );
// print( "BUGS_3000 url_table[$url_table] url_zmcode=[$url_zmcode] url_zmtype=[$url_zmtype] url_zmrowid=[$url_zmrowid]<br>\n" );
$result = $pdo->query($sql);
$collim = $result->columnCount();
$xml_rowid = 1;
$output = "";
$colmodel="";
$colnames="";
$coldata="";
$sortname="";
while($row = $result->fetch(PDO::FETCH_ASSOC)) {
$xml .= "<row id='". $xml_rowid . ";>\n";
if($xml_rowid == 1) {
// $output .= join(",", array_keys($row)) . "\n";
$colnames = " colNames:[";
$colmodel .= " colModel:[\n";
foreach( $row as $col => $val ) {
if( $sortname == "" ) { $sortname=$col; }
// $colnames .= "<td>hdrs:". $col. " = ".$val."</td>\n";
// $colnames .= " colNames:['No','Date', 'Client', 'Amount','Tax','Total','Notes'],\n";
$colnames .= "'$col',";
// $colmodel .= " {name:'".$col."',index:'".$col."', width:40 },\n";
$colmodel .= " {name:'".$col."',index:'".$col."', width:40, editable:true },\n";
}
$colnames .= "]\n";
$colnames = str_replace( ",]", "],", $colnames );
$colmodel .= "]";
$colmodel = str_replace( "},\n]", "}\n ],\n", $colmodel );
}
else {
// $output .= join(",", $row) ."\n";
$coldata .="<tr>\n";
foreach( $row as $col => $val ) {
// $colmodel .= "<td>cols: ". $col. " = ".$val."</td>\n";
// $output .= " colModel:[\n";
// $output .= " {name:'No',index:'id', width:55},\n";
// $output .= " {name:'Notes',index:'note', width:150, sortable:false} \n";
// $output .= " ],\n";
$coldata .= "<td>$val</td>";
}
$coldata .= "\n</tr>\n";
}
// $rowid++;
$xml_rowid++;
}
$pdo=null;
// $js_output .= "<script type=\"text/javascript\">\n";
// $js_output .= " var gridimgpath = 'js/themes/swanky-purse/imgs'\n";
// $js_output .= "jQuery(document).ready(function(){\n";
// $js_output .= " jQuery().ready(function(){\n";
$js_output .= " jQuery(\"#$jqgrid_list_id\").jqGrid({\n";
/// $request="";
/// if( $_REQUEST['rowid'] ) { $request .= "&rowid=".$_REQUEST['rowid']; }
/// if( $_REQUEST['code'] ) { $request .= "&code=".$_REQUEST['code']; }
/// if( $_REQUEST['type'] ) { $request .= "&type=".$_REQUEST['type']; }
$js_output .= " $jqgrid_url\n";
$js_output .= " $jqgrid_editurl\n";
// $js_output .= " datatype: \"json\",\n";
$js_output .= " datatype: \"xml\",\n";
$js_output .= $colnames;
$js_output .= $colmodel;
// $js_output .= " imgpath: \"js/jqgrid-3.5.3/themes/redmond/imgs\",\n";
$js_output .= " imgpath: gridimgpath,\n";
$js_output .= " height:400,\n";
// $js_output .= " rowNum:50,\n";
$rownum_default=10;
$rownum=$rownum_default;
if( $url_table == "zoom" ) { $rownum=50; }
if( $url_table == "zoomxml" ) { $rownum=25; }
$caption = "$url_dbcode $url_table $zmcode $where_clause";
/// print( "BUGS_3081 CAPTION pdo_grid: caption=[$caption] rownum=[$rownum] url_table=[$url_table] where_clause=[$where_clause]<br>\n" );
$js_output .= " rowNum: $rownum,\n";
$js_output .= " autowidth: true,\n";
$js_output .= " rowList:[10,20,30,50, 100, 500, 1000],\n";
// $js_output .= " pager: jQuery('#pager1'),\n";
$js_output .= " pager: jQuery('#$jqgrid_pager_id'),\n";
$js_output .= " sortname: '".$sortname."',\n";
$js_output .= " viewrecords: true,\n";
$js_output .= " sortorder: \"asc\",\n";
// $js_output .= " sortorder: \"desc\",\n";
// $js_output .= " caption: \"jqgrid $url_dbcode $url_table $url_value\"\n";
// $js_output .= " caption: \"$url_dbcode $url_table $zmcode $where_clause\"\n";
$js_output .= " caption: \"$caption\"\n";
// $js_output .= " }).navGrid('#pager1',{edit:false,add:false,del:false});\n";
// $js_output .= " }).navGrid('#pager1',{edit:true,add:true,del:true});\n";
$js_output .= " }).navGrid('#$jqgrid_pager_id',{edit:true,add:true,del:true});\n";
$js_output .= "\n";
// $js_output .= " });\n";
// $js_output .= " });\n";
// $js_output .= "</script>\n";
$output = "";
/// $output .= $html_theme_links;
$output .= "<table id=\"$jqgrid_list_id\" class=\"scroll\" cellpadding=\"0\" cellspacing=\"0\"></table>\n";
$output .= "<div id=\"$jqgrid_pager_id\" class=\"scroll\" style=\"text-align:center;\"></div>\n";
$output .= "\n";
$url_table=$options[3];
$url_value=$options[4];
$export_img="<img src=imgs/btn/export.png width=40 border=0>";
$import_img="<img src=imgs/btn/import.png width=40 border=0>";
$unload_img="<img src=imgs/btn/unload.png width=40 border=0>";
$load_img="<img src=imgs/btn/load.png width=40 border=0>";
$http_host=$_SERVER['HTTP_HOST'];
$php_self=$_SERVER['PHP_SELF'];
$output .= "<hr>\n";
/// $output .= "<a href=http://$http_host$php_self?q=db/unload/$url_dbcode/$url_table>$export_img unload $url_dbcode $url_table</a>\n";
$output .= "<a href=http://$http_host$php_self?q=db/unload/$url_dbcode/$url_table>$unload_img unload (get) $url_dbcode $url_table</a>\n";
$output .= "     \n";
/// $output .= "<a href=http://$http_host$php_self?q=db/load/$url_dbcode/$url_table>load $url_dbcode $url_table</a>\n";
$output .= "<a href=http://$http_host$php_self?q=db/load/$url_dbcode/$url_table> (put) $url_dbcode $url_table $import_img</a>\n";
$output .= "<hr>\n";
/// $output .= "<hr>\n";
/// $output .= pdo_grid_array($options);
/// $output .= "<hr>\n";
// print( $output );
$GLOBALS['js_output'] = $js_output;
return( $output );
}
function html_footer() {
$output = "</body>\n";
$output .= "</html>\n";
return( $output );
}
function bugfile($options) {
$ofile="fp_bugs.txt";
$fp = fopen( $ofile, "w" );
$tmp = "";
$tmp .= "dbfile=$dbfile\n";
$tmp .= "url_table=$url_table\n";
$tmp .= "page=$page\n";
$tmp .= "total_pages=$total_pages\n";
$tmp .= "count=$count\n";
$tmp .= "limit-$limit\n";
$tmp .= "sidx=$sidx\n";
fwrite( $fp, $tmp );
$j=0;
fwrite( $fp, "post: =======================================\n" );
foreach( $_POST as $request ) {fwrite( $fp, "request-$j $request\n" ); $j++;}
$j=0;
fwrite( $fp, "request: =======================================\n" );
foreach( $_REQUEST as $request ) {fwrite( $fp, "request-$j $request\n" ); $j++;}
$j=0;
fwrite( $fp, "get: =======================================\n" );
foreach( $_GET as $get ) {fwrite( $fp, "get-$j $get\n" ); $j++;}
fwrite( $fp, "session: =======================================\n" );
foreach( $_SESSION as $session ) {fwrite( $fp, "session-$j $session\n" ); $j++;}
fwrite( $fp, $xml );
fclose( $fp );
system( "wi $ofile" );
}
function pdo_gridxml($options) {
$http_host=$_SERVER['HTTP_HOST'];
$php_self=$_SERVER['PHP_SELF'];
$query_string=$_SERVER['QUERY_STRING'];
$dbfiles = $GLOBALS['dbs'];
$url_dbcode=$options[2];
$url_table=$options[3];
$url_value=$options[4];
$url_value1=$options[5];
$url_value2=$options[6];
$url_zmcode=$options[4];
$url_zmtype=$options[5];
$url_zmrowid=$options[6];
$output="";
if( $url_dbcode == "" ) {
// print( "<hr><h2>pdo_gridxml url_dbcode[$url_dbcode] url_table=[$url_table]</h2><hr>\n" );
$output .= "<hr><h2>pdo_gridxml url_dbcode[$url_dbcode] url_table=[$url_table]</h2><hr>\n";
$output .= "<a href=$php_self?q=db/gridxml/fp>gridxml</a><br>\n";
$output .= "<br>\n";
// print( $output );
// print_r( $dbfiles );
foreach( $dbfiles as $dbcode => $dbinfo ) {
$dbfile=$dbfiles[$dbcode]['dbfile'];
$tblcnt=count( $dbfiles[$dbcode]['tables']);
$path_parts = pathinfo($dbfile);
$dbfile_filename=$path_parts['filename'];
// print( "<a href=$php_self?q=db/gridxml/$dbfile_filename>$dbfile_filename $tblcnt</a><br />\n" );
$output .= "<a href=$php_self?q=db/gridxml/$dbfile_filename>$dbfile_filename $tblcnt</a><br />\n";
}
// return;
}
// select database/tables
if(( $url_dbcode != "" ) && ( $url_table == "" )) {
// print( "<hr><h2>pdo_unload url_dbcode[$url_dbcode] url_table=[$url_table]</h2><hr>\n" );
$output .= "<hr><h2>pdo_unload url_dbcode[$url_dbcode] url_table=[$url_table]</h2><hr>\n";
foreach( $dbfiles[$url_dbcode]['tables'] as $table => $tableinfo ) {
// print( "<a href=$php_self?q=db/gridxml/$url_dbcode/$tableinfo>$tableinfo </a><br />\n" );
$output .= "<a href=$php_self?q=db/gridxml/$url_dbcode/$tableinfo>$tableinfo </a><br />\n";
}
// return;
}
$dbfile=$dbfiles[$url_dbcode]['dbfile'];
if( ! file_exists( $dbfile )) {
// print( "pdo_unload ERR: NOTFOUND url_dbcode=[$url_dbcode] dbfile=[$dbfile]<hr>\n" );
$output .= "pdo_unload ERR: NOTFOUND url_dbcode=[$url_dbcode] dbfile=[$dbfile]<hr>\n";
// return;
}
$q=$_REQUEST['q'];
$dttm=date("Ymd_His");
$tmp = "// $q,$dttm,BUGS_2962 BEG_pqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpq<br>\n";
/// $jqgrid_list_id = "list_$url_dbcode"."_$url_table"."_$url_zmcode"."_$url_zmtype"."_$url_zmrowid";
/// $jqgrid_pager_id = "pager_$url_dbcode"."_$url_table"."_$url_zmcode"."_$url_zmtype"."_$url_zmrowid";
/// $jqgrid_url = "url:'http://$http_host$php_self";
/// $jqgrid_url .= "?q=db/gridxml/".$url_dbcode."/".$url_table."/".$url_zmcode."/".$url_zmtype."/".$url_zmrowid."',";
/// $jqgrid_editurl = "editurl:'http://$http_host$php_self";
/// $jqgrid_editurl .= "?q=db/gridxml/".$url_dbcode."/".$url_table."/".$url_zmcode."/".$url_zmtype."/".$url_zmrowid."',";
if( $url_table == "zoomxml" ) {
switch( true ) {
case( $url_zmcode == "" & $url_zmtype == "" & $url_zmrowid == "" ):
$where_clause = "";
break;
case( $url_zmcode == "" & $url_zmtype == "" & $url_zmrowid != "" ):
$where_clause = "where rowid = '$url_zmrowid'";
break;
case( $url_zmcode == "" & $url_zmtype != "" & $url_zmrowid == "" ):
$where_clause = "where type = '$url_zmtype'";
break;
case( $url_zmcode == "" & $url_zmtype != "" & $url_zmrowid != "" ):
$where_clause = "where type = '$url_zmtype' and rowid='$zmrowid'";
break;
break;
case( $url_zmcode == "all" & $url_zmtype == "all" & $url_zmrowid == "" ):
$where_clause = "";
break;
case( $url_zmcode == "" & $url_zmtype == "all" & $url_zmrowid == "" ):
$where_clause = "";
break;
case( $url_zmcode == "" & $url_zmtype == "all" & $url_zmrowid != "" ):
$where_clause = "where zoomxml_id = '$url_zmrowid'";
break;
case( $url_zmcode != "" & $url_zmtype == "" & $url_zmrowid == "" ):
// $where_clause = "where code = '$url_zmcode'";
break;
case( $url_zmcode != "" & $url_zmtype == "" & $url_zmrowid != "" ):
$where_clause = "where code = '$url_zmcode' and rowid = '$rowid'";
break;
case( $url_zmcode != "" & $url_zmtype != "" & $url_zmrowid == "" ):
$where_clause = "where code = '$url_zmcode' and type = '$url_zmtype'";
break;
case( $url_zmcode != "" & $url_zmtype != "" & $url_zmrowid != "" ):
$where_clause = "where code = '$url_zmcode' & type = '$url_zmtype' and rowid = '$url_rowid'";
break;
}
$xml .= "<!-- BUGS_3120 gridxml: url_zmtype=[$url_zmtype] url_zmcode=[$url_zmcode]<br> [$where_clause] -->\n";
// return;
}
// build column array from _REQUEST and skip non-column keys
$j=0;
$colnames = "( ";
$colvalues = "( ";
foreach( $_REQUEST as $key => $val ) {
$skip=0;
if( $key == "q" ) { $skip=1; }
if( $key == "oper" ) { $skip=1; }
if( $key == "_search" ) { $skip=1; }
if( $key == "nd" ) { $skip=1; }
if( $key == "rows" ) { $skip=1; }
if( $key == "page" ) { $skip=1; }
if( $key == "sidx" ) { $skip=1; }
if( $key == "sord" ) { $skip=1; }
if( $key == "id" ) { $rowid=$val; $skip=1; }
if( $key == "PHPSESSID" ) { $skip=1;; }
if( $skip == 0 ) {
$colnames .= "'$key',";
$colvalues .= "'$val',";
$setvalues .= "$key = '$val',";
$colname = $key;
$colvalue = $val;
}
}
$colnames .= ")";
$colnames = str_replace( ",)", " )", $colnames );
$colvalues .= ")";
$colvalues = str_replace( ",)", " )", $colvalues );
$setvalues .= ")";
$setvalues = str_replace( ",)", "", $setvalues );
$tmp .= "// $q,$dttm,colnames=[$colnames]<br>\n";
$tmp .= "// $q,$dttm,colvalues=[$colvalues]<br>\n";
$tmp .= "// $q,$dttm,setvalues=[$setvalues]<br>\n";
$tmp .= "// $q,$dttm,colname=[$colname]<br>\n";
$tmp .= "// $q,$dttm,colvalue=[$colvalue]<br>\n";
$qops = array(
'eq'=>" = ",
'ne'=>" <> ",
'lt'=>" < ",
'le'=>" <= ",
'gt'=>" > ",
'ge'=>" >= ",
'bw'=>" LIKE ",
'bn'=>" NOT LIKE ",
'in'=>" IN ",
'ni'=>" NOT IN ",
'ew'=>" LIKE ",
'en'=>" NOT LIKE ",
'cn'=>" LIKE " ,
'nc'=>" NOT LIKE "
);
// $searchoper="eq"; $searchop=" = ";
// $searchoper=$options[4];
// print( "BUGS_200 searchoper=[$searchoper] searchop=[$searchop]<br>\n" ) ;
if( $_REQUEST['searchField'] ) { $searchfield = $_REQUEST['searchField']; }
if( $_REQUEST['searchString'] ) { $searchstring = $_REQUEST['searchString']; }
if( $_REQUEST['searchOper'] ) { $searchoper = $_REQUEST['searchOper']; }
// if( $searchoper == "eq" ) { $searchop = "="; }
// if( $searchoper == "lt" ) { $searchop = ">="; }
// if( $searchoper == "gt" ) { $searchop = "<="; }
foreach( $qops as $qop_col => $qop_val ) {
// print( "BUGS_201 qop_col=[$qop_col] qop_val=[$qop_val] qops=".$qops['$qop_col']."<br>\n" ) ;
if( $searchoper == $qop_col ) { $searchop = $qop_val; break; }
}
$sql_search= "select rowid,* from $url_table where $searchfield $searchop '".$searchstring."';";
// $sql_add= "insert or replace into $url_table $colnames values $colvalues where rowid = '".$_REQUEST['id']."';";
$sql_add= "insert or replace into $url_table $colnames values $colvalues;";
$sql_edit = "update $url_table set $setvalues where rowid = '".$_REQUEST['id']."';";
$sql_delete= "delete from $url_table where rowid = '".$_REQUEST['id']."';";
// $sql = "select * from $url_table ORDER BY $sidx $sord LIMIT $start, $limit";
// $sql = "select rowid,* from $url_table ORDER BY $sidx $sord LIMIT $start, $limit";
$sql = "select rowid,* from $url_table $where_clause ORDER BY $sidx $sord LIMIT $start, $limit";
if( $_REQUEST[_search] == 'true' ) {
// request_7 $_REQUEST[searchField]=[code] [( ][( ]
// request_8 $_REQUEST[searchString]=[abc] [( 'searchField',][( 'code',]
// request_9 $_REQUEST[searchOper]=[gt] [( 'searchField','searchString',][( 'code','abc',]
// $pdo = newpdo( $dbfile );
// $pdo->exec( $sql_search );
// $pdo = null;
$tmp .= "// $q,$dttm,BUGS_3046 _REQUEST[_search] sql_search=[$sql_search] dbfile=[$dbfile]<br>\n";
}
if( $_REQUEST[oper] == 'del' ) {
$tmp .= "// $q,$dttm,BUGS_3050 _REQUEST[_oper]==del sql_delete=[$sql_delete] dbfile=[$dbfile]<br>\n";
$pdo = newpdo( $dbfile );
$pdo->exec( $sql_delete );
$pdo = null;
}
if( $_REQUEST[oper] == 'add' ) {
$tmp .= "// $q,$dttm,BUGS_3056 _REQUEST[_oper]==add sql_add=[$sql_add] dbfile=[$dbfile]<br>\n";
$pdo = newpdo( $dbfile );
$pdo->exec( $sql_add );
$pdo = null;
}
if( $_REQUEST[oper] == 'edit' ) {
$tmp .= "// $q,$dttm,BUGS_3062 _REQUEST[_oper]==edit sql_edit=[$sql_edit] dbfile=[$dbfile]<br>\n";
$pdo = newpdo( $dbfile );
$pdo->exec( $sql_edit );
$pdo = null;
// for( $row=1; $row<10; $row++ ) {
// $sql = "insert or replace into test ( 'test_id', 'c1', 'c2', 'c3' ) ";
// $sql .= "values ( '$row', 'v1$row', 'v2$row', 'v3$row' );";
// $pdo->exec( $sql );
// }
// request_0 $_REQUEST[q]=[db/gridxml/fp/zoom/edit]
// request_1 $_REQUEST[zoom_id]=[5]
// request_2 $_REQUEST[code]=[fp05]
// ...
// request_25 $_REQUEST[maxscale]=[2]
// request_26 $_REQUEST[id]=[5]
// request_27 $_REQUEST[oper]=[edit]
// request_28 $_REQUEST[PHPSESSID]=[62autt8r17aiicstp30fa176c0]
// return;
}
if( $dbmode == "count" ) {
$count=0;
$pdo = newpdo($dbfile);
$sqlcnt = "select count(*) pagetotal from $table";
$sqlout = $pdo->query($sqlcnt);
$record = $sqlout->fetchall();
if(sizeof($record) != 0) {
// print( "sizeof record != 0 $record<br>\n" );
$count=$record[0][0];
}
return( $count );
}
$page=1;
$records=1;
$page = $_GET['page']; // requested page
$limit = $_GET['rows']; //rows in grid
$sidx = $_GET['sidx']; // index row ie user click sort
$sord = $_GET['sord']; // sort direction
if(!$page) $page =1;
if(!$sidx) $sidx =1;
if(!$sord) $sord ="asc";
if(!$limit) $limit=20;
$pdo = newpdo($dbfile);
// $sql = "select count(*) pagetotal from $url_table";
$sql = "select count(*) pagetotal from $url_table $where_clause";
$sqlout = $pdo->query($sql);
$record = $sqlout->fetchall();
if(sizeof($record) != 0) {
// print( "sizeof record != 0 $record<br>\n" );
$count=$record[0][0];
}
else {
$count=0;
}
if( $count > 0 ) {
$total_pages = ceil($count/$limit);
}
else {
$total_pages = 0;
}
if( $page > $total_pages) $page=$total_pages;
$start = $limit*$page - $limit; // do not put $limit*($page - 1)
$pdo = null;
$tmp .= "// $q,$dttm,COUNT sql=[$sql]<br>\n";
// $sql_select_page = "select rowid,* from $url_table ORDER BY $sidx $sord LIMIT $start, $limit";
$sql_select_page = "select rowid,* from $url_table $where_clause ORDER BY $sidx $sord LIMIT $start, $limit";
$xml .= "";
$xml .= "<!-- sql=$sql -->\n";
$xml .= "<!-- url_zmcode=$url_zmcode -->\n";
$xml .= "<!-- url_zmtype=$url_zmtype -->\n";
$xml .= "<!-- sql_select_page=$sql_select_page -->\n";
$xml .= "<!-- dbfile=$dbfile -->\n";
$xml .="<rows>\n";
$xml .= "<page>$page</page>\n";
$xml .= "<total>$total_pages</total>\n";
$xml .= "<records>$count</records>\n";
$xml .= "<limit>$limit</limit>\n";
$xml .= "<sidx>$sidx</sidx>\n";
$xml .= "<sord>$sord</sord>\n";
// $xml .= "<options1>".$options[1]."</options1>\n";
// $xml .= "<options2>".$options[2]."</options2>\n";
// $xml .= "<options3>".$options[3]."</options3>\n";
// $xml .= "<options4>".$options[4]."</options4>\n";
// $xml .= "<options5>".$options[5]."</options5>\n";
// be sure to put text data in CDATA
if( $_REQUEST[_search] == 'true' ) {
$sql = $sql_search;
}
else {
$sql = $sql_select_page;
}
$tmp .= "// $q,$dttm,BUGS_3164 SQL sql=[$sql] <br>\n";
$pdo = newpdo($dbfile);
$result = $pdo->query($sql);
$collim = $result->columnCount();
$xml_rowid = 1;
$output = "";
$rowcnt=0;
if( $url_table == "zoomxml" ) {
$zoomxml_rowid = 0;
$zoomxml = "<DATA>\n";
$zoomxml = "<DATA>\n";
$zoomxml .= " <HOTSPOTSETUP\n";
$zoomxml .= " AUTOLOOP=\"0\"\n";
$zoomxml .= " CHOICELIST=\"2\"\n";
$zoomxml .= " LISTSOURCE=\"CAPTION\"\n";
$zoomxml .= " INITIALVISIBILITY=\"1\"\n";
$zoomxml .= " MINSCALE=\"0.15\"\n";
$zoomxml .= " MAXSCALE=\"2\"\n";
$zoomxml .= " />\n";
}
$http_host=$_SERVER['HTTP_HOST'];
while($row = $result->fetch(PDO::FETCH_ASSOC)) {
$rowcnt++;
// if($countrows == 1) {
// $output .= join(",", array_keys($row)) . "\n";
// }
// else {
// $output .= join(",", $row) ."\n";
// }
//
if( $url_table == "zoomxml" & $rowcnt > 0 ) {
// $id=$row['rowid'];
$zoomxml_id=$row['zoomxml_id'];
$zmcode=$row['code'];
$zmtype=$row['type'];
$x=$row['x'];
$y=$row['y'];
$mediatype=$row['mediatype'];
$media=$row['media'];
$url=$row['url'];
$urltarget=$row['urltarget'];
$zoom=$row['zoom'];
$zoom="40";
$caption=$row['caption'];
$interval=$row['interval'];
$transition=$row['transition'];
$duration=$row['duration'];
$comment=$row['comment'];
$zoomxml .= " <HOTSPOT \n";
$zoomxml .= " ID=\"$zoomxml_id\"\n";
$zoomxml .= " MEDIATYPE=\"$mediatype\"\n";
$zoomxml .= " MEDIA=\"$media\"\n";
// $zoomxml .= " URL=\"$url\"\n";
$zoomxml .= " URL=\"$php_self?q=zview/$zmcode/$zmtype/$zoomxml_id\"\n";
$zoomxml .= " URLTARGET=\"$urltarget\"\n";
$zoomxml .= " X=\"$x\"\n";
$zoomxml .= " Y=\"$y\"\n";
$zoomxml .= " ZOOM=\"$zoom\"\n";
// $zoomxml .= " CAPTION=\"3: ".$zmcode."_".$zmtype."_hotspots.xml - $comment - $dttm\"\n";
$zoomxml .= " CAPTION=\"$zoomxml_id $caption\"\n";
$zoomxml .= " INTERVAL=\"$interval\"\n";
$zoomxml .= " TRANSITION=\"$transition\" \n";
$zoomxml .= " DURATION=\"$duration\" >\n";
$zoomxml .= " </HOTSPOT>\n";
$id++;
}
$colcnt=0;
foreach( $row as $col => $val ) {
if( $colcnt == 0 ) {
$db_rowid=$val;
$xml .= "<row id='". $db_rowid . "'>\n";
$tmp .= "// $q,$dttm,ROWID: xml_rowid=[$xml_rowid] db_rowid=[$db_rowid]<br>\n";
}
// $tmp .= "// $q,$dttm,xmlloop: rowcnt=[$rowcnt] colcnt=[$colcnt] col=[$col] val=[$val]<br>\n";
if( $colcnt < 0 ) {
$tmp .= "// $q,$dttm,foreach_ROWID: xml_rowid=[$xml_rowid] db_rowid=[$db_rowid] row['rowid']=[".$row['rowid']."]<br>\n";
// $cdata = "<a href=\"http://$http_host$php_self?q=zoom/$val\" target=_blank>$val</a>";
$cdata = "<a href=\"http://$http_host$php_self?q=zoom/$val\" target=_blank>$val<img src=\"imgs/btn/btn_hw.gif\" border=0></a>";
$xml .= "<cell><![CDATA[". $cdata ."]]></cell>\n";
}
else {
// $cdata = $val;
// $xml .= "<cell><![CDATA[". $cdata ."]]></cell>\n";
// $tmp .= "// $q,$dttm,xmlloop: colcnt=[$colcnt] col=[$col] val=[$val]<br>\n";
// field exception handling
switch( true ) {
case ($url_table == "zoom" and $col ==="code" ):
$fp=$row['code'];
if($_SESSION['hs_type'] ) { $hscode=$_SESSION['hs_type']; } else { $hscode=""; }
$url="$php_self?q=zoom/$fp/$hscode";
// $cdata = "<a href=\"$url\" target=_blank>$fp $db_rowid</a>";
$cdata = "<a href=\"$url\" >$fp $db_rowid</a>";
$xml .= "<cell><![CDATA[". $cdata ."]]></cell>\n";
break;
/// case ($url_table == "zoomxml" ):
case ($url_table == "zoomxml" & $col ==="url" ):
if( $col ==="url" ) {
$fp=$row['code'];
if(! $_SESSION['hs_code'] ) { $hscode=""; } else { $hscode=$_SESSION['hs_code']; }
$url="$php_self?q=zoom/$fp/$hscode/$db_rowid";
$cdata = "<a href=\"$url\" target=_blank>$fp $db_rowid</a>";
$xml .= "<cell><![CDATA[". $cdata ."]]></cell>\n";
break;
}
case ($url_table == "kb" and $col ==="kbid" ):
$kbid=$row['kbid'];
$kb_title=$row['kb_title'];
$height=$row['height'];
$width=$row['width'];
// $basename_flds = explode( "\.", $kbid );
// $basename = $basename_flds[0];
$kb_title=$kbid;
// $basename = $row['rowid'];
$url="$php_self?q=kb/view/$kbid/$width/$height";
// $cdata = "<a href=\"$url\" target=_blank>$kbid $db_rowid $kb_title</a>";
$cdata = "<a href=\"$url\" >$db_rowid $kb_title</a>";
$xml .= "<cell><![CDATA[". $cdata ."]]></cell>\n";
break;
case ($url_table == "certs" and $col ==="cert_code" ):
$cert_code=$row['cert_code'];
$height=$row['height'];
$width=$row['width'];
// $basename_flds = explode( "\.", $cert_id );
// $basename = $basename_flds[0];
// $basename = $row['rowid'];
$cert_title=$cert_code;
$url="$php_self?q=certs/view/$cert_code/$width/$height/";
// $cdata = "<a href=\"$url\" target=_blank>$db_rowid $cert_id</a>";
$cdata = "<a href=\"$url\" >$db_rowid $cert_code</a>";
$xml .= "<cell><![CDATA[". $cdata ."]]></cell>\n";
break;
case ($url_table == "pano" and $col ==="filename" ):
$filename=$row['filename'];
$height=$row['height'];
$width=$row['width'];
$basename_flds = explode( "\.", $filename );
$basename = $basename_flds[0];
// $basename = $row['rowid'];
$url="$php_self?q=ptviewer/$filename/$width/$height";
// $cdata = "<a href=\"$url\" target=_blank>$filename $db_rowid</a>";
$cdata = "<a href=\"$url\" >$basename $db_rowid</a>";
$xml .= "<cell><![CDATA[". $cdata ."]]></cell>\n";
break;
case ($url_table == "obj" and $col ==="filename" ):
$filename=$row['filename'];
$basename_flds = explode( "\.", $filename );
$basename = $basename_flds[0];
$width=$row['width'];
$height=$row['height'];
$nhor=$row['nhor'];
$nvert=$row['nvert'];
$url="$php_self?q=ptobject/$filename/$width/$height/$nhor/$nvert";
// $cdata = "<a href=\"$url\" target=_blank>$fp $db_rowid</a>";
$cdata = "<a href=\"$url\" >$basename </a>";
$xml .= "<cell><![CDATA[". $cdata ."]]></cell>\n";
break;
default;
// $cdata = "<a href=\"http://$http_host$php_self?q=zoom&id=$col $val\" target=_blank>$val</a>";
// $xml .= "<cell><![CDATA[". $cdata ."]]></cell>\n";
$xml .= "<cell>". htmlentities($val). "</cell>\n";
break;
}
}
$colcnt++;
}
$xml .= "</row>\n";
$xml_rowid++;
}
$pdo=null;
$xml .= "</rows>\n";
if( $url_table == "zoomxml" ) {
$zoomxml .= "</DATA>\n";
if( $xml_rowid > 1 ) { $_SESSION['zoomxml'] = $zoomxml; }
$fzxfil="fp_bugs_zoomxml.txt";
$fzx = fopen( $fzxfil, "w" );
// $fzx = fopen( $fzxfil, "a" );
fwrite( $fzx, $zoomxml );
fclose( $fzx );
}
$dttm=date("Ymd_His");
// $csvfile = "$url_dbcode"."_$url_table"."_$dttm.csv";
// print( "__FUNCTION__=".__FUNCTION__."<br>\n" );
// $content_type = "Content-type: application/csv Content-Disposition: \"inline; filename=$csvfile\"";
// print( "$content_type\n" );
// header( "$content_type" );
// header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
// header("Content-Length: " . strlen($out));
/// header("Content-type: text/x-csv");
// header("Content-type: text/csv");
// header("Content-type: application/vnd.ms-excel");
// header("Content-type: application/csv");
// header("Content-Disposition: attachment; filename=$csvfile");
if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {
header("Content-type: application/xhtml+xml;charset=utf-8");
}
else {
header("Content-type: text/xml;charset=utf-8");
}
/// $js_output .= "});\n";
$q=$_REQUEST['q'];
$dttm=date("Ymd_His");
$tmp .= "// $q,$dttm,_REQUEST[q] =============================================<br>\n";
$tmp .= "// $q,$dttm,ofile=$ofile";
$tmp .= "// $q,$dttm,dbfile=$dbfile\n";
$tmp .= "// $q,$dttm,url_table=$url_table\n";
$tmp .= "// $q,$dttm,page=$page\n";
$tmp .= "// $q,$dttm,total_pages=$total_pages\n";
$tmp .= "// $q,$dttm,count=$count\n";
$tmp .= "// $q,$dttm,limit=$limit\n";
$tmp .= "// $q,$dttm,sidx=$sidx\n";
$tmp .= "// $q, $dttm, post: =======================================\n";
// $j=0;
// foreach( $_POST as $col=>$val ) {
//
// $tmp .= "// $q,$dttm,post_$j col=$col val=$val\n"; $j++;
// }
$tmp .= "// $q,$dttm,request: =======================================\n";
$j=0;
$colnames = "( ";
$colvalues = "( ";
foreach( $_REQUEST as $key => $val ) {
$skip=0;
// $tmp .= "// $q,$dttm,request_$j \$_REQUEST[$key]=[$val] [$colnames][$colvalues]\n"; $j++;
$tmp .= "// $q,$dttm,request_$j \$_REQUEST[$key]=[$val]\n"; $j++;
if( $key == "q" ) { $skip=1; }
if( $key == "oper" ) { $skip=1; }
if( $key == "_search" ) { $skip=1; }
if( $key == "nd" ) { $skip=1; }
if( $key == "rows" ) { $skip=1; }
if( $key == "page" ) { $skip=1; }
if( $key == "sidx" ) { $skip=1;; }
if( $key == "sord" ) { $skip=1;; }
if( $key == "PHPSESSID" ) { $skip=1;; }
if( $skip == 0 ) {
$colnames .= "'$key',";
$colvalues .= "'$val',";
}
// $tmp .= "// $q,$dttm,request_$j \$_REQUEST[$key]=[$val] [$colnames][$colvalues]\n"; $j++;
}
$colnames .= ")";
$colnames = str_replace( ",)", " )", $colnames );
$colvalues .= ")";
$colvalues = str_replace( ",)", " )", $colvalues );
$tmp .= "// $q,$dttm,sql= $sql\n";
$tmp .= "// $q,$dttm,sql_select_page= $sql_select_page\n";
$tmp .= "// $q,$dttm,sql_edit= $sql_edit\n";
$tmp .= "// $q,$dttm,sql_add= $sql_add\n";
$tmp .= "// $q,$dttm,sql_delete= $sql_delete\n";
$tmp .= "// $q,$dttm,sql_search= $sql_search\n";
$tmp .= "\n";
$tmp .= "// $q,$dttm,colnames=[$colnames]\n";
$tmp .= "// $q,$dttm,colvalues=[$colvalues]\n";
$tmp .= "// $q,$dttm,setvalues=[$setvalues]\n";
$tmp .= "\n";
$tmp .= "// $q,$dttm,colname=[$colname]\n";
$tmp .= "// $q,$dttm,colvalue=[$colvalue]\n";
$tmp .= "\n";
$tmp .= "// $q,$dttm,searchfield=[$searchfield]\n";
$tmp .= "// $q,$dttm,searchoper=[$searchoper]\n";
$tmp .= "// $q,$dttm,searchop=[$searchop]\n";
$tmp .= "// $q,$dttm,searchstring=[$searchstring]\n";
$tmp .= "// $q,$dttm, get: =======================================\n";
$j=0;
foreach( $_GET as $key => $val ) {
$tmp .= "// $q,$dttm,get_$j \$_GET[$key]=[$val]\n"; $j++;
}
$tmp .= "// $q,$dttm, session: =======================================\n";
$j=0;
foreach( $_SESSION as $key => $val ) {
$tmp .= "// $q,$dttm,session_$j \$_SESSION[$key]=[$val]\n"; $j++;
}
$tmp .= "// $q,$dttm,END_bdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbd<br>\n";
// $xml .= "\n\n\n//bugs\n\n";
// $xml .= "\r\n// bugs";
// $xml .= "\r";
// $xml2 = str_replace( "\r", "=0D=0A=", $xml );
// $xml2 = str_replace( "\r", "\r\n", $xml );
// print( "$xml2" );
$xmlfile="fp_menus1.xml";
$xmlfile="fp_menus2.xml";
$xmlfile="";
if( file_exists( $xmlfile )) {
$fpxml = fopen( $xmlfile, "r" );
$xmltext = "";
while(( $filetext = fgets($fpxml)) !== false ) {
$xmltext .= $filetext;
}
fclose( $fpxml );
// print( $xmltext );
// return;
$xml=$xmltext;
}
print( "$xml" );
$ofile="fp_bugs.txt";
$fpo = fopen( $ofile, "w" );
// $fpo = fopen( $ofile, "a" );
fwrite( $fpo, $tmp );
fclose( $fpo );
$xfile="fp_bugs_xml.txt";
$fpx = fopen( $xfile, "w" );
// $fpx = fopen( $xfile, "a" );
fwrite( $fpx, $xml );
fclose( $fpx );
// system( "wi $ofile" );
// system( "wi $xfile" );
return;
}
function pdo_unload($options) {
$php_self=$_SERVER['PHP_SELF'];
$dbfiles = $GLOBALS['dbs'];
if($_SESSION['role'] ) { $role=$_SESSION['role']; }
$role=$_SESSION['role'];
$GLOBALS['dbfiles'];
$GLOBALS['dbs'] = $dbfiles[$role];
$url_dbcode=$options[2];
$url_table=$options[3];
if( $url_dbcode == "" ) {
print( "<hr><h2>pdo_unload url_dbcode[$url_dbcode] url_table=[$url_table]</h2><hr>\n" );
$output = "";
$output .= "<a href=$php_self?q=db/unload/fp>unload_fp</a><br>\n";
$output .= "<a href=$php_self?q=db/unload/us>unload_us</a><br>\n";
$output .= "<a href=$php_self?q=db/unload/hw>unload_hw</a><br>\n";
$output .= "<a href=$php_self?q=db/unload/grid>unload_grid</a><br>\n";
$output .= "<br>\n";
$output .= "<a href=$php_self?q=db/unload/leds>unload_leds</a><br>\n";
$output .= "<a href=$php_self?q=db/unload/users>unload_users</a><br>\n";
$output .= "<a href=$php_self?q=db/unload/roles>unload_roles</a><br>\n";
print( $output );
print_r( $dbfiles );
foreach( $dbfiles as $dbcode => $dbinfo ) {
$dbfile=$dbfiles[$dbcode]['dbfile'];
$tblcnt=count( $dbfiles[$dbcode]['tables']);
$path_parts = pathinfo($dbfile);
$dbfile_filename=$path_parts['filename'];
print( "<a href=$php_self?q=db/unload/$dbfile_filename>$dbfile_filename $tblcnt</a><br />\n" );
}
return;
}
// select database/tables
if(( $url_dbcode != "" ) && ( $url_table == "" )) {
print( "<hr><h2>pdo_unload url_dbcode[$url_dbcode] url_table=[$url_table]</h2><hr>\n" );
foreach( $dbfiles[$url_dbcode]['tables'] as $table => $tableinfo ) {
print( "<a href=$php_self?q=db/unload/$url_dbcode/$tableinfo>$tableinfo </a><br />\n" );
}
return;
}
$dbfile=$dbfiles[$url_dbcode][dbfile];
if( ! file_exists( $dbfile )) {
print( "pdo_unload ERR: NOTFOUND url_dbcode=[$url_dbcode] dbfile=[$dbfile]<hr>\n" );
return;
}
$pdo = newpdo($dbfile);
$sql = "select * from $url_table";
$result = $pdo->query($sql);
$collim = $result->columnCount();
$countrows = 1;
$output = "";
while($row = $result->fetch(PDO::FETCH_ASSOC)) {
if($countrows == 1) {
$csvhdr=join(",",array_keys($row)) . "\n";
// $output .= join(",", array_keys($row)) . "\n";
$output .= join(",", $row) ."\n";
}
else {
$output .= join(",", $row) ."\n";
}
$countrows++;
}
$pdo=null;
// print( "$output" );
// print( "BUGS tblname=$tblname cols=$cols<br>\n" );
$dttm=date("Ymd_His");
$csvfile = "$url_dbcode"."_$url_table"."_$dttm.csv";
// print( "__FUNCTION__=".__FUNCTION__."<br>\n" );
// $content_type = "Content-type: application/csv Content-Disposition: \"inline; filename=$csvfile\"";
// print( "$content_type\n" );
// header( "$content_type" );
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
// header("Content-Length: " . strlen($out));
header("Content-type: text/x-csv");
// header("Content-type: text/csv");
// header("Content-type: application/vnd.ms-excel");
// header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=$csvfile");
print( "$output" );
return;
}
function pdo_list($options) {
$output = "<hr>pdo_list o1=[$option[1]] o2=[$option[2]] o3=[$option[3]]<br>\n";
print( "$output" );
}
function pdo_update($options) {
$output = "<hr>pdo_list o1=[$option[1]] o2=[$option[2]] o3=[$option[3]]<br>\n";
print( "$output" );
}
function pdo_load($options) {
$php_self=$_SERVER['PHP_SELF'];
$dbfiles = $GLOBALS['dbs'];
$url_dbcode=$options[2];
$url_table=$options[3];
$dbcode=$url_dbcode;
$tblname=$url_table;
// print_r( $options );
// return;
if( $url_dbcode == "" ) {
print( "<hr><h2>pdo_load url_dbcode[$url_dbcode] url_table=[$url_table]</h2><hr>\n" );
$output = "";
$output .= "<a href=$php_self?q=db/load/fp>load_fp</a><br>\n";
$output .= "<a href=$php_self?q=db/load/us>load_us</a><br>\n";
$output .= "<a href=$php_self?q=db/load/hw>load_hw</a><br>\n";
$output .= "<a href=$php_self?q=db/load/grid>load_grid</a><br>\n";
$output .= "<br>\n";
$output .= "<a href=$php_self?q=db/load/leds>load_leds</a><br>\n";
$output .= "<a href=$php_self?q=db/load/users>load_users</a><br>\n";
$output .= "<a href=$php_self?q=db/load/roles>load_roles</a><br>\n";
// print( $output );
// print_r( $dbfiles );
foreach( $dbfiles as $dbcode => $dbinfo ) {
$dbfile=$dbfiles[$dbcode]['dbfile'];
$tblcnt=count( $dbfiles[$dbcode]['tables']);
$path_parts = pathinfo($dbfile);
$dbfile_filename=$path_parts['filename'];
print( "<a href=$php_self?q=db/load/$dbfile_filename>$dbfile_filename $tblcnt</a><br />\n" );
}
return;
}
// select database/tables
if(( $url_dbcode != "" ) && ( $url_table == "" )) {
print( "<hr><h2>pdo_load url_dbcode[$url_dbcode] url_table=[$url_table]</h2><hr>\n" );
foreach( $dbfiles[$url_dbcode]['tables'] as $table => $tableinfo ) {
print( "<a href=$php_self?q=db/load/$url_dbcode/$tableinfo>$tableinfo </a><br />\n" );
}
return;
}
$url_filename = $_FILES['loaddata']['name'];
$url_filetype = $_FILES['loaddata']['type'];
$url_filetemp = $_FILES['loaddata']['tmp_name'];
$url_fileerror = $_FILES['loaddata']['error'];
$url_filesize = $_FILES['loaddata']['size'];
if(( $url_dbcode != "" ) && ( $url_table != "" ) && ( $url_filetemp == "" )) {
$output = "";
$output .= "<html>";
$output .= "<head><title>pdo_load</title></head>\n";
$output .= "<body bgcolor=\"lightblue\">\n";
$output .= "<b>leds_load_form</b>\n";
$output .= "<br>";
$output .= "url_filename=[$url_filename]<br>\n";
$output .= "url_filetype=[$url_filetype]<br>\n";
$output .= "url_filetemp=[$url_filetemp]<br>\n";
$output .= "url_fileerror=[$url_fileerror]<br>\n";
$output .= "url_filesize=[$url_filesize]<br>\n";
$output .= "<form method=\"post\" action=\"$php_self?q=db/load/$url_dbcode/$url_table/$url_filename\" enctype=\"multipart/form-data\">\n";
$output .= "<br/>\n";
$output .= "loadmode: <br>\n";
$load_delete_checked = "";
$load_update_checked = "";
if( $led_loadmode == "load_delete" ) { $load_delete_checked = "checked"; }
if( $led_loadmode == "load_update" ) { $load_checked_checked = "checked"; }
$output .= "<input type=\"radio\" name=\"loadmode\" value=\"load_delete\" $load_delete_checked />load_delete";
$output .= "<input type=\"radio\" name=\"loadmode\" value=\"load_update\" $load_update_checked />load_update";
$output .= "<br/>";
$output .= "load: <input type=\"file\" name=\"loaddata\" /><br />\n";
$output .= "<input type=\"hidden\" name=\"query_string\" value=\"$query_string\"/>\n";
$output .= "<input type=\"hidden\" name=\"loaddata_loos\" value=\"'". $globals['loaddata']."'\"/>\n";
$output .= "<input type=\"hidden\" name=\"dbcode\" value=\"$url_dbcode\"/>\n";
$output .= "<input type=\"hidden\" name=\"loadfile\" value=\"'". $globals['uploaded']."'\"/>\n";
$output .= "<input type=\"hidden\" name=\"table\" value=\"$url_table\"/>\n";
$output .= "<hr/>\n";
$output .= "<p>\n";
$output .= "<input type=\"submit\" name=\"load\" value=\"load\"/>\n";
$output .= "<input type=\"reset\"/>\n";
$output .= "</p>\n";
$output .= "</form>\n";
$output .= "</body>\n";
$output .= "<html>\n";
print( "$output" );
return;
}
if(( $url_dbcode != "" ) && ( $url_table != "" ) && ( $url_filetemp != "" )) {
$output = "";
$output .= "<head><title>fp_load</title></head>\n";
$output .= "<body bgcolor=\"lightblue\">\n";
$output .= "<b>fp_load</b>\n";
$output .= "<br>";
$output .= "url_filename=[$url_filename]<br>\n";
$output .= "url_filetype=[$url_filetype]<br>\n";
$output .= "url_filetemp=[$url_filetemp]<br>\n";
$output .= "url_fileerror=[$url_fileerror]<br>\n";
$output .= "url_filesize=[$url_filesize]<br>\n";
if( file_exists( $url_filetemp )) {
$output .= "pdo_load MSG: FOUND url_filetemp=[$url_filetemp]<br>\n";
$filedata= array();
$rownum=0;
$fp = fopen( $url_filetemp, "r" );
while(( $filetext = fgets($fp)) !== false ) {
$filedata[] = $filetext;
/// $output .= "pdo_load CSV: rownum=$rownum filedata=[".$filedata[$rownum]. "]<br>\n";
$rownum++;
}
fclose($fp);
$dbfile=$dbfiles[$url_dbcode]['dbfile'];
if( ! file_exists( $dbfile )) {
print( "pdo_unload ERR: NOTFOUND dbfile=[$dbfile] <hr>\n" );
return;
}
else {
print( "pdo_unload MSG: FOUND dbfile=[$dbfile] <hr>\n" );
}
$data = $filedata;
$dttm=date("Ymd_His");
$newfile="$url_dbcode"."_".$url_table.".csv";
$savefile="$url_dbcode"."_".$url_table."_$dttm.csv";
$dbcode=$url_dbcode;
$tblname=$url_table;
$output .= "BUGS2311: pdo_insert( $url_dbcode, $url_table, \$data )<br>\n";
$output .= "BUGS2312: pdo_insert( $dbfile, $tblname, \$data )<br>\n";
$output .= "BUGS2313: copy( $newfile, $savefile )<br>\n";
$output .= "BUGS2314: copy( $url_filetemp, $newfile )<br>\n";
if( file_exists( $newfile )) { copy( $newfile, $savefile ); }
if( file_exists( $url_filetemp )) { copy( $url_filetemp, $newfile ); }
/// print( "BUGS2315_PDO_INSERT_BEG: dbfile=[$dbfile] tblname=[$tblname]<br>\n" );
// print_r( $data );
pdo_insert( $dbfile, $tblname, $data );
/// print( "BUGS2315_PDO_INSERT_END: dbfile=[$dbfile] [tblname=[$tblname]<br>\n" );
/// print_r( $data );
}
else {
$output .= "pdo_load ERR: NOTFOUND url_filetemp=[$url_filetemp]<br>\n";
}
print( $output );
return;
}
$dbfile=$dbfiles[$url_dbcode][dbfile];
print( "pdo_load MSG: NOTFOUND url_dbcode=[$url_dbcode] dbfile=[$dbfile]<hr>\n" );
if( ! file_exists( $dbfile )) {
print( "pdo_load ERR: NOTFOUND url_dbcode=[$url_dbcode] dbfile=[$dbfile]<hr>\n" );
return;
}
}
function leds_zviewer( $zoom_file, $zoom_path, $zoom_xml ) {
// $xmlfile="$file"."_".$hscode."_hotspots.xml";
print( "leds_zviewer MSG: zoom_file=$zoom_file zoom_path=$zoom_path zoom_xml=$zoom_xml<br>\n" );
$output ="<html>\n";
$output .= "<head>\n";
$output .= "<title>leds_zviewer $zoom_path $zoom_file $zoom_xml</title>";
$output .= "<body bgcolor=\"lightblue\">\n";
// print( "<hr>\n" );
$file=$zoom_file; $path=$zoom_path; $xml=$zoom_xml;
print( "leds_zviewer MSG1985: file=$file path=$path xml=$xml<hr>\n" );
$output .= "<div align=\"center\">\n";
$object = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"\n";
$object .= "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0\"\n";
$object .= "width=\"900\" height=\"500\"\n";
$object .= "id=\"ZoomifyHotspotViewer\"\n";
// $object .= "id=\"ZoomifyTourViewer\"\n";
// $object .= "id=\"zoomifyviewer\"\n";
$object .= ">\n";
$object .= "<param name=\"flashvars\"\n";
$object .= "value=\"zoomifyImagePath=$path$file&zoomifyHotspotsXMLPath=$xml\">\n";
$object .= "<param name=\"menu\" value=\"false\">\n";
$object .= "<param name=\"src\"\n";
$object .= "value=\"ZoomifyHotspotViewer.swf\">\n";
// $object .= "value=\"ZoomifyTourViewer.swf\">\n";
// $object .= "value=\"zoomifyviewer.swf\">\n";
$object .= "<embed\n";
$object .= "flashvars=\"zoomifyImagePath=$path$file&zoomifyHotspotsXMLPath=$xml\"\n";
$object .= "src=\"ZoomifyHotspotViewer.swf\"\n";
// $object .= "src=\"ZoomifyTourViewer.swf\"\n";
// $object .= "src=\"zoomifyviewer.swf\"\n";
$object .= "menu=\"false\"\n";
$object .= "pluginspage=\"http://www.adobe.com/go/getflashplayer\"\n";
$object .= "type=\"application/x-shockwave-flash\"\n";
$object .= "width=\"900\" height=\"500\"\n";
$object .= "name=\"ZoomifyHotspotViewer\">\n";
// $object .= "name=\"ZoomifyTourViewer\">\n";
// $object .= "name=\"zoomifyviewer\">\n";
$object .= "</embed>\n";
$object .= "</object>\n";
$output .= $object;
$output .= "</div>\n";
$output .= "</body>\n";
$output .= "</html>\n";
print( "$output\n" );
}
function html_zviewer( $zoom_file, $zoom_path, $zoom_xml ) {
// $xmlfile="$file"."_".$hscode."_hotspots.xml";
// $output = "<hr>html_zviewer MSG_3948: zoom_file=$zoom_file zoom_path=$zoom_path zoom_xml=$zoom_xml<br>\n";
// $output .= "html_zviewer [$zoom_path] [$zoom_file] [$zoom_xml]</title>";
// $output .= "<body bgcolor=\"#ffffff\">\n";
$file=$zoom_file; $path=$zoom_path; $xml=$zoom_xml;
$output .= "<hr>html_zviewer MSG1985: file=$file path=$path xml=$xml<hr>\n";
$output .= "<div id=\"zviewer\" align=\"center\">\n";
$object = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"\n";
$object .= "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0\"\n";
$object .= "width=\"900\" height=\"500\"\n";
$object .= "id=\"ZoomifyHotspotViewer\"\n";
// $object .= "id=\"ZoomifyTourViewer\"\n";
// $object .= "id=\"zoomifyviewer\"\n";
$object .= ">\n";
$object .= "<param name=\"flashvars\"\n";
$object .= "value=\"zoomifyImagePath=$path$file&zoomifyHotspotsXMLPath=$xml\">\n";
$object .= "<param name=\"menu\" value=\"false\">\n";
$object .= "<param name=\"src\"\n";
$object .= "value=\"ZoomifyHotspotViewer.swf\">\n";
// $object .= "value=\"ZoomifyTourViewer.swf\">\n";
// $object .= "value=\"zoomifyviewer.swf\">\n";
$object .= "<embed\n";
$object .= "flashvars=\"zoomifyImagePath=$path$file&zoomifyHotspotsXMLPath=$xml\"\n";
$object .= "src=\"ZoomifyHotspotViewer.swf\"\n";
// $object .= "src=\"ZoomifyTourViewer.swf\"\n";
// $object .= "src=\"zoomifyviewer.swf\"\n";
$object .= "menu=\"false\"\n";
$object .= "pluginspage=\"http://www.adobe.com/go/getflashplayer\"\n";
$object .= "type=\"application/x-shockwave-flash\"\n";
$object .= "width=\"900\" height=\"500\"\n";
$object .= "name=\"ZoomifyHotspotViewer\">\n";
// $object .= "name=\"ZoomifyTourViewer\">\n";
// $object .= "name=\"zoomifyviewer\">\n";
$object .= "</embed>\n";
$object .= "</object>\n";
$output .= $object;
$output .= "</div>\n";
return( "$output\n" );
}
// jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
function leds_certs( $options ) {
$php_self=$_SERVER['PHP_SELF'];
$output = "";
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
$pdo = newpdo($GLOBALS['ko_center_certsfile']);
$tblname="certs";
$output .= "<h2>leds_certs_7607 o0=[$option0] o1=[$option1] o2=[$option2]</h2>\n";
// $output .= "<a href=$php_self?q=certs target=_blank>certs</a>";
// $output .= "<a href=$php_self?q=db/grid/ko_center_certs/certs target=_blank> ko_center_certs: certs</a>";
$output .= "<a href=$php_self?q=db/grid/ko_center_certs/certs> ko_center_certs: certs</a>";
$output .= "<hr>\n";
if(( $option2 == "" ) && ( $option3 == "" )) {
$output = "";
$output .= "<html><head><title>ko_center_certs_7610 index tblname=[$tblname]</title></head>\n";
$output .= "<body bgcolor=lightblue>\n";
$output .= "<hr>ko_center_certs tblname=[$tblname] index<hr>\n";
$output .= "<hr>\n";
$output .= "<div class=certs>\n";
$output .= "<table>\n";
$output .= "<tr>\n";
$output .= "<td>cert_id</td>\n";
$output .= "<td>os</td>\n";
$output .= "<td>fn</td>\n";
$output .= "<td>cn</td>\n";
$output .= "<td>notbefore</td>\n";
$output .= "<td>notafter</td>\n";
$output .= "<td>hosts</td>\n";
// $sql = "select * from $tblname limit 25";
$sql = "select * from $tblname";
foreach( $pdo->query($sql) as $row ) {
$output .= "<tr><td>";
// $output .= "<a href=$php_self?q=certs/view/$cert_id target=_blank>certs</a><br>\n";
// $output .= "<a href=$php_self?q=certs/".$row['cert_code'] . " target=_blank>". $row['cert_code']. "</a>";
$output .= "<a href=$php_self?q=certs/view/".$row['cert_code'] . " target=_blank>". $row['cert_code']. "</a>";
$output .= "<td>".$row['host']."</td>\n";
$output .= "<td>".$row['os']."</td>";
$output .= "<td>".$row['fn']."</td>";
$output .= "<td>".$row['cn']."</td>";
$output .= "<td>".$row['notbefore']."</td>";
$output .= "<td>".$row['notafter']."</td>";
$output .= "<td>".$row['hosts']."</td>";
$output .= "</tr>\n";
}
$output .= "</table>\n";
$output .= "<hr>\n";
$output .= "</div>\n";
$output .= "</body></html>\n";
return( $output );
}
$cert_code=$option2;
// $sql = "select * from $tblname where cert_id = '$cert_id'";
$sql = "select * from $tblname where cert_code='$cert_code'";
// $output .= "<html><head><title>MSG_7970 ko_center_certs detail cert_code=$cert_code o1=$option1 o2=$option2 </title></head>\n";
// $output .= "<body bgcolor=lightblue>\n";
$output .= "<h3>ko_center_certs detail $cert_code<h3>\n";
$output .= "<h4>sql=[$sql]</h4><br>\n";
$output .= "<div id=\"certs\">\n";
$output .= "<hr>\n";
$output .= "<table border=1 >\n";
$output .= "<tr><td>cert_code</td><td>host</td><td>os</td><td>fn</td><td>cn</td><td>notbefore</td><td>notafter</td><td>hosts</td></tr>\n";
// $output .= "<h4>sql=[$sql]</h4>\n";
// return( $output );
foreach( $pdo->query($sql) as $row ) {
$output .= "<tr>";
$output .= "<td>".$row['cert_code']."</td>";
$output .= "<td>".$row['host']."</td>";
$output .= "<td>".$row['os']."</td>";
$output .= "<td>".$row['fn']."</td>";
$output .= "<td>".$row['cn']."</td>";
$output .= "<td>".$row['notbefore']."</td>";
$output .= "<td>".$row['notafter']."</td>";
$output .= "<td>".$row['hosts']."</td>";
$output .= "</tr>\n";
}
$output .= "</table>\n";
$output .= "</div>\n";
$output .= "<hr>\n";
$output .= "</body></html>\n";
return( $output );
}
function leds_cons( $options ) {
$php_self=$_SERVER['PHP_SELF'];
$output = "";
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
$pdo = newpdo($GLOBALS['ko_center_cons']);
$tblname="certs";
$output .= "<h2>leds_cons_7607 o0=[$option0] o1=[$option1] o2=[$option2]</h2>\n";
// $output .= "<a href=$php_self?q=cons target=_blank>certs</a>";
// $output .= "<a href=$php_self?q=db/grid/ko_center_cons/rsncons target=_blank> ko_center_cons: cons</a>";
$output .= "<a href=$php_self?q=db/grid/ko_center_cons/rsncons> ko_center_certs: cons</a>";
$output .= "<hr>\n";
if(( $option2 == "" ) && ( $option3 == "" )) {
$output = "";
$output .= "<html><head><title>ko_center_cons_8610 index tblname=[$tblname]</title></head>\n";
$output .= "<body bgcolor=lightblue>\n";
$output .= "<hr>ko_center_cons tblname=[$tblname] index<hr>\n";
$output .= "<hr>\n";
$output .= "<div class=cons>\n";
$output .= "<table>\n";
$output .= "<tr>\n";
$output .= "<td>vendor</td>\n";
$output .= "<td>sw_name</td>\n";
$output .= "<td>sw_ver</td>\n";
$output .= "<td>con_yn</td>\n";
$output .= "<td>prod_id</td>\n";
$output .= "<td>endprod</td>\n";
$output .= "<td>platform</td>\n";
$output .= "<td>type_cots_gots</td>\n";
$output .= "<td>poc</td>\n";
$output .= "<td>domain</td>\n";
$output .= "<td>envir</td>\n";
$output .= "<td>connam</td>\n";
$output .= "<td>localhrc_yn</td>\n";
$output .= "<td>comments</td>\n";
$output .= "<td>status</td>\n";
// $sql = "select * from $tblname limit 25";
$sql = "select * from $tblname";
foreach( $pdo->query($sql) as $row ) {
$output .= "<tr><td>";
// $output .= "<a href=$php_self?q=cons/view/$row_id target=_blank>cons</a><br>\n";
// $output .= "<a href=$php_self?q=cons/".$row['row_id'] . " target=_blank>". $row['cert_code']. "</a>";
$output .= "<a href=$php_self?q=cons/view/".$row['row_id'] . " target=_blank>". $row['row_id']. "</a>";
$output .= "<td>".$row['vendor']."</td>\n";
$output .= "<td>".$row['sw_name']."</td>\n";
$output .= "<td>".$row['sw_ver']."</td>\n";
$output .= "<td>".$row['con_yn']."</td>\n";
$output .= "<td>".$row['prod_id']."</td>\n";
$output .= "<td>".$row['endprod']."</td>\n";
$output .= "<td>".$row['platform']."</td>\n";
$output .= "<td>".$row['typ_cots_gots']."</td>\n";
$output .= "<td>".$row['poc']."</td>\n";
$output .= "<td>".$row['domain']."</td>\n";
$output .= "<td>".$row['envir']."</td>\n";
$output .= "<td>".$row['connam']."</td>\n";
$output .= "<td>".$row['localhrc_yn']."</td>\n";
$output .= "<td>".$row['comments']."</td>\n";
$output .= "<td>".$row['status']."</td>";
$output .= "</tr>\n";
}
$output .= "</table>\n";
$output .= "<hr>\n";
$output .= "</div>\n";
$output .= "</body></html>\n";
return( $output );
}
$row_id=$option2;
// $sql = "select * from $tblname where row_id = '$row_id'";
$sql = "select * from $tblname where row_id='$row_id'";
// $output .= "<html><head><title>MSG_7970 ko_center_certs detail cert_code=$cert_code o1=$option1 o2=$option2 </title></head>\n";
// $output .= "<body bgcolor=lightblue>\n";
$output .= "<h3>ko_center_cons detail $row_id<h3>\n";
$output .= "<h4>sql=[$sql]</h4><br>\n";
$output .= "<div id=\"cons\">\n";
$output .= "<hr>\n";
$output .= "<table border=1 >\n";
$output .= "<tr><td>vendor</td>
<td>sw_name</td><td>sw_ver</td><td>con_yn</td><td>prod_id</td><td>endprod</td><td>platform</td><td>type_cots_gots</td><td>poc</td><td>domain</td><td>envir</td><td>connam</td><td>localhrc_yn</td><td>comments</td><td>status</td></tr>\n";
// $output .= "<h4>sql=[$sql]</h4>\n";
// return( $output );
foreach( $pdo->query($sql) as $row ) {
$output .= "<tr>";
$output .= "<td>".$row['vendor']."</td>";
$output .= "<td>".$row['sw_name']."</td>";
$output .= "<td>".$row['sw_ver']."</td>";
$output .= "<td>".$row['con_yn']."</td>";
$output .= "<td>".$row['prod_id']."</td>";
$output .= "<td>".$row['endprod']."</td>";
$output .= "<td>".$row['platform']."</td>";
$output .= "<td>".$row['type_cots_gots']."</td>";
$output .= "<td>".$row['poc']."</td>";
$output .= "<td>".$row['domain']."</td>";
$output .= "<td>".$row['envir']."</td>";
$output .= "<td>".$row['connam']."</td>";
$output .= "<td>".$row['localhrc_yn']."</td>";
$output .= "<td>".$row['comments']."</td>";
$output .= "<td>".$row['status']."</td>";
$output .= "</tr>\n";
}
$output .= "</table>\n";
$output .= "</div>\n";
$output .= "<hr>\n";
$output .= "</body></html>\n";
return( $output );
}
function leds_hosts( $options ) {
$php_self=$_SERVER['PHP_SELF'];
$output = "";
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
$pdo = newpdo($GLOBALS['ko_center_cons']);
$tblname="hosts";
$output .= "<h2>leds_cons_7607 o0=[$option0] o1=[$option1] o2=[$option2]</h2>\n";
// $output .= "<a href=$php_self?q=hosts target=_blank>certs</a>";
// $output .= "<a href=$php_self?q=db/grid/ko_center_hosts/rsn_servers> ko_center_hosts rsn_servers: </a>";
$output .= "<a href=$php_self?q=db/grid/ko_center_hosts/hrc_servers> ko_center_hosts hrc_servers: </a>";
$output .= "<a href=$php_self?q=db/grid/ko_center_hosts/hrc_hosts> ko_center_hosts hrc_hosts: </a>";
$output .= "<hr>\n";
if(( $option2 == "" ) && ( $option3 == "" )) {
$output = "";
$output .= "<html><head><title>ko_center_cons_8610 index tblname=[$tblname]</title></head>\n";
$output .= "<body bgcolor=lightblue>\n";
$output .= "<hr>ko_center_cons tblname=[$tblname] index<hr>\n";
$output .= "<hr>\n";
$output .= "<div class=cons>\n";
$output .= "<table>\n";
$output .= "<tr>\n";
$output .= "<td>vendor</td>\n";
$output .= "<td>sw_name</td>\n";
$output .= "<td>sw_ver</td>\n";
$output .= "<td>con_yn</td>\n";
$output .= "<td>prod_id</td>\n";
$output .= "<td>endprod</td>\n";
$output .= "<td>platform</td>\n";
$output .= "<td>type_cots_gots</td>\n";
$output .= "<td>poc</td>\n";
$output .= "<td>domain</td>\n";
$output .= "<td>envir</td>\n";
$output .= "<td>connam</td>\n";
$output .= "<td>localhrc_yn</td>\n";
$output .= "<td>comments</td>\n";
$output .= "<td>status</td>\n";
// $sql = "select * from $tblname limit 25";
$sql = "select * from $tblname";
foreach( $pdo->query($sql) as $row ) {
$output .= "<tr><td>";
// $output .= "<a href=$php_self?q=cons/view/$row_id target=_blank>cons</a><br>\n";
// $output .= "<a href=$php_self?q=cons/".$row['row_id'] . " target=_blank>". $row['cert_code']. "</a>";
$output .= "<a href=$php_self?q=cons/view/".$row['row_id'] . " target=_blank>". $row['row_id']. "</a>";
$output .= "<td>".$row['vendor']."</td>\n";
$output .= "<td>".$row['sw_name']."</td>\n";
$output .= "<td>".$row['sw_ver']."</td>\n";
$output .= "<td>".$row['con_yn']."</td>\n";
$output .= "<td>".$row['prod_id']."</td>\n";
$output .= "<td>".$row['endprod']."</td>\n";
$output .= "<td>".$row['platform']."</td>\n";
$output .= "<td>".$row['typ_cots_gots']."</td>\n";
$output .= "<td>".$row['poc']."</td>\n";
$output .= "<td>".$row['domain']."</td>\n";
$output .= "<td>".$row['envir']."</td>\n";
$output .= "<td>".$row['connam']."</td>\n";
$output .= "<td>".$row['localhrc_yn']."</td>\n";
$output .= "<td>".$row['comments']."</td>\n";
$output .= "<td>".$row['status']."</td>";
$output .= "</tr>\n";
}
$output .= "</table>\n";
$output .= "<hr>\n";
$output .= "</div>\n";
$output .= "</body></html>\n";
return( $output );
}
$row_id=$option2;
// $sql = "select * from $tblname where row_id = '$row_id'";
$sql = "select * from $tblname where row_id='$row_id'";
// $output .= "<html><head><title>MSG_7970 ko_center_hosts detail cert_code=$cert_code o1=$option1 o2=$option2 </title></head>\n";
// $output .= "<body bgcolor=lightblue>\n";
$output .= "<h3>ko_center_hosts detail $row_id<h3>\n";
$output .= "<h4>sql=[$sql]</h4><br>\n";
$output .= "<div id=\"hosts\">\n";
$output .= "<hr>\n";
$output .= "<table border=1 >\n";
$output .= "<tr><td>vendor</td>
<td>sw_name</td><td>sw_ver</td><td>con_yn</td><td>prod_id</td><td>endprod</td><td>platform</td><td>type_cots_gots</td><td>poc</td><td>domain</td><td>envir</td><td>connam</td><td>localhrc_yn</td><td>comments</td><td>status</td></tr>\n";
// $output .= "<h4>sql=[$sql]</h4>\n";
// return( $output );
foreach( $pdo->query($sql) as $row ) {
$output .= "<tr>";
$output .= "<td>".$row['vendor']."</td>";
$output .= "<td>".$row['sw_name']."</td>";
$output .= "<td>".$row['sw_ver']."</td>";
$output .= "<td>".$row['con_yn']."</td>";
$output .= "<td>".$row['prod_id']."</td>";
$output .= "<td>".$row['endprod']."</td>";
$output .= "<td>".$row['platform']."</td>";
$output .= "<td>".$row['type_cots_gots']."</td>";
$output .= "<td>".$row['poc']."</td>";
$output .= "<td>".$row['domain']."</td>";
$output .= "<td>".$row['envir']."</td>";
$output .= "<td>".$row['connam']."</td>";
$output .= "<td>".$row['localhrc_yn']."</td>";
$output .= "<td>".$row['comments']."</td>";
$output .= "<td>".$row['status']."</td>";
$output .= "</tr>\n";
}
$output .= "</table>\n";
$output .= "</div>\n";
$output .= "<hr>\n";
$output .= "</body></html>\n";
return( $output );
}
function leds_kb( $options ) {
$php_self=$_SERVER['PHP_SELF'];
$output = "";
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
$option3=$options[3];
$pdo = newpdo($GLOBALS['kbfile']);
$tblname="kb";
if( $option2 == "" ) {
$output .= "<hr>kb tblname=[$tblname] index<hr>\n";
// $output .= "<hr>\n";
$output .= "<div class=kb>\n";
$output .= "<table border=2>\n";
$output .= "<tr>\n";
$output .= "<td>kbid</td>\n";
$output .= "<td>kb_user</td>\n";
$output .= "<td>status</td>\n";
$output .= "<td>fixtxt</td>\n";
$output .= "<td>errtxt</td>\n";
$output .= "<td>searchable</td>\n";
$output .= "<td>notes</td>\n";
$output .= "<td>comments</td>\n";
$output .= "<td>filelist</td>\n";
$output .= "<td>filecount</td>\n";
$output .= "</tr>\n";
// $sql = "select * from $tblname limit 25";
$sql = "select * from $tblname order by kbid desc limit 100";
foreach( $pdo->query($sql) as $row ) {
$kbid=$row['kb_user'];
$status=$row['status'];
$searchable=$row['searchable'];
$notes=$row['notes'];
$comment=$row['comment'];
$errtext=$row['errtext'];
$errtxt=$row['errtxt'];
$fixtxt=$row['fixtxt'];
$fixtext=$row['fixtext'];
$yyyymm=substr( $kbid, 0, 6 );
$kb_rootpath="$document_root/kb/ko_center";
$kb_path="$document_root/ko_center/kb/$yyyymm/$kbid";
if( is_dir( $kb_path )) {
// printf( "BUGS_7776: FOUND isdir kb_path=[$kb_path]<br>\n" );
// $filelist=system( "ls -lat $kb_path" );
// $filecount=system( "ls -lat $kb_path | wc -l" );
$filelist="true";
$filecount="1";
}
else {
$filelist="nodir";
$filecount=0;
}
$output .= "<tr><td>";
// $output .= "<a href=$php_self?q=kb/view/$kbid target=_blank>kb</a><br>\n";
$output .= "<a href=$php_self?q=kb/view/".$row['kbid'] . " target=_blank>". $row['kbid']. "</a>";
$output .= "<td>".$kb_user."</td>\n";
$output .= "<td>".$status."</td>";
$output .= "<td>".$searchable."</td>";
$output .= "<td>".$notes."</td>";
$output .= "<td>".$comments."</td>";
$output .= "<td>".$errtxt."</td>";
$output .= "<td>".$fixtxt."</td>";
$output .= "<td>".$errtext."</td>";
$output .= "<td>".$fixtext."</td>";
$output .= "<td>".$filelist."</td>";
$output .= "<td>".$filecount."</td>";
$output .= "</tr>\n";
}
$output .= "</table>\n";
$output .= "<hr>\n";
$output .= "</div>\n";
$output .= "</body></html>\n";
return( $output );
}
if( $option1 == "view" ) {
$kbid=$option2;
$sql = "select * from $tblname where kbid='$kbid' order by kbid desc";
// $output .= "<html><head><title>koaac_kb view kbid=$kbid o1=$option1 o2=$option2 </title></head>\n";
// $output .= "<body bgcolor=lightblue>\n";
$output .= "<h2>koaac_kb view kbid=$kbid </h2>\n";
$output .= "<h3>sql=[$sql]</h3>\n";
$output .= "<div id=\"kb_view\">\n";
$output .= "<hr>\n";
$output .= "<table border=1>\n";
$output .= "<tr><td>kbid</td><td>kb_user</td><td>status</td>\n";
$output .= "<td>fixtxt</td><td>errtxt</td><td>notes</td><td>comments</td>\n";
$output .= "<td>searchable</td><td>filelist</td><td>filecount</td></tr>\n";
// printf( "BUGS_7496: view o1=$option1 o2=$option2 kb_path=[$kb_path]<br>\n" );
$yyyymm=substr( $kbid, 0, 6 );
$kb_rootpath="$document_root/kb/ko_center";
$kb_path="$document_root/ko_center/kb/$yyyymm/$kbid";
$output_ls="";
if( is_dir( $kb_path )) {
/// printf( "BUGS_7500: FOUND isdir kb_path=[$kb_path]<br>\n" );
/// $filelist=system( "ls -lat $kb_path" );
/// $filecount=system( "ls -lat $kb_path | wc -l" );
$output_ls = kb_ls( $options, $kb_path );
}
else {
$filelist="nofiles";
$filecount=0;
}
// return( $output );
foreach( $pdo->query($sql) as $row ) {
$kbid=$row['kbid'];
$kb_user=$row['kb_user'];
$kb_status=$row['kb_status'];
$kb_searchable=$row['searchable'];
// $kb_filecount=$row['kb_filecount'];
// $kb_filelist=$row['filelist'];
$errtxt=$row['errtxt'];
$fixtxt=$row['fixtxt'];
$errtext=$row['errtext'];
$fixtext=$row['fixtext'];
$comment=$row['comment'];
$notes=$row['notes'];
$filelist=$row['filelist'];
$filecount=$row['filecount'];
$searchable=$row['searchable'];
$output .= "<tr>";
$output .= "<td>".$kbid."</td>";
$output .= "<td>".$kb_user."</td>";
$output .= "<td>".$kb_status."</td>";
$output .= "<td>".$fixtxt."</td>";
$output .= "<td>".$errtxt."</td>";
$output .= "<td>".$notes."</td>";
$output .= "<td>".$comment."</td>";
$output .= "<td>".$searchable."</td>";
$output .= "<td>".$filelist."</td>";
$output .= "<td>".$filecount."</td>";
$output .= "</tr>\n";
}
$output .= "</table>\n";
$output .= "<hr>\n";
$output .= $output_ls;
$output .= "</body></html>\n";
return( $output );
}
if( $option1 == "mod" ) {
$kbid=$option2;
$sql = "select * from $tblname where kbid='$kbid'";
$output .= "<html><head><title>koaac_kb detail kbid=$kbid o1=$option1 o2=$option2 </title></head>\n";
$output .= "<body bgcolor=lightblue>\n";
$output .= "<h2>koaac_kb detail $kbid </h2>\n";
$output .= "<hr>sql=[$sql]<hr>\n";
$output .= "<div id=\"kb\">\n";
$output .= "<hr>\n";
$output .= "<table>\n";
$output .= "<tr><td>kbid</td><td>kb_user</td><td>status</td><td>searchable</td><td>filelist</td><td>filecount</td></tr>\n";
// $output .= "<hr>sql=[$sql]<hr>\n";
// return( $output );
foreach( $pdo->query($sql) as $row ) {
$output .= "<tr>";
$output .= "<td>".$row['kbid']."</td>";
$output .= "<td>".$row['kb_user']."</td>";
$output .= "<td>".$row['status']."</td>";
$output .= "<td>".$row['searchable']."</td>"; $output .= "<td>".$row['filelist']."</td>";
$output .= "<td>".$row['filecount']."</td>";
$output .= "</tr>\n";
}
$output .= "</table>\n";
$output .= "<hr>\n";
$output .= "</body></html>\n";
return( $output );
}
printf( "ERR UNSUPPORTED_7545: leds_kb o0=$option0 o1=$option1 o2=$option2<br>\n" );
return;
}
function leds_kb_rpts( $options ) {
$kbfile=$GLOBALS['kbfile'];
$php_self=$SERVER['PHP_SELF'];
$pdo = newpdo($kbfile);
$tblname="rpts";
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
$option3=$options[3];
if( isset( $_GET['fmt'] )) { $fmt=$_GET['fmt']; } else { $fmt=""; }
$output = "<h2>$php_self leds_kb_rpts MSG_8800: fmt=[$fmt] $option1 $option2 $option3</h2>\n";
if( $option2 == "" ) {
$output .= "<hr>\n";
// $output .= "<h3>leds_kb_rpts kbfile=[$kbfile] tblname=[$tblname]</h3>\n";
$output .= "<table border=1>\n";
$output .= "<tr><td>rpt_code</td><td>rpt_sql</td></tr>\n";
$sql = "select * from $tblname";
foreach( $pdo->query($sql) as $row ) {
$rpt_code=$row['rpt_code'];
$rpt_sql=$row['rpt_sql'];
$rpt_url="<a href=$php_self?q=kb/rpts/$rpt_code >$rpt_code</a>\n";
$output .= "<tr><td>$rpt_url</td><td>$rpt_sql</td></tr>\n";
}
$output .= "</table>\n";
$output .= "<hr>\n";
$pdo = null;
return( $output );
}
if( $option2 != "" ) {
$rpt_code=$option2;
$sql = "select * from $tblname where rpt_code='$rpt_code'";
$output .= "<html><head><title>leds_kb_rpts detail rpt_code=$rpt_code o1=$option1 o2=$option2 </title></head>\n";
$output .= "<body bgcolor=lightblue>\n";
$output .= "<h2>leds_kb_rpts detail $rpt_code </h2>\n";
// $output .= "<hr>sql=[$sql]<hr>\n";
$output .= "<div id=\"kb_rpts\">\n";
// $output .= "<hr>\n";
$output .= "<table>\n";
$output .= "<tr><td>rpt_code</td><td>rpt_title</td><td>rpt_sql</td></tr>\n";
foreach( $pdo->query($sql) as $row ) {
$rpt_code=$row['rpt_code'];
$rpt_sql=$row['rpt_sql'];
$rpt_title=$row['rpt_title'];
$output .= "<tr>";
$output .= "<td>$rpt_code</td>";
$output .= "<td>$rpt_title</td>";
$output .= "<td>$rpt_sql</td>";
$output .= "</tr>\n";
}
$output .= "</table>\n";
$pdo=null;
// $output .= "<h2>BUGS_8248 kbfile=[$kbfile] rpt_sql=[$rpt_sql]</h2>\n";
// display headers
try {
$pdo = newpdo($kbfile);
$stmt = $pdo->query($rpt_sql);
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$output .= "<table border=1>\n";
$output .= "<tr>\n";
foreach( $result as $key=>$val) {
$output .= "<td>$key</td>\n";
}
$output .= "</tr>\n";
$pdo = null;
}
catch(PDOException $e) { $output .= $e->getMessage(); }
// display details
try {
$pdo = newpdo($kbfile);
$j=0;
// $output .= "BUGS_1234 rpt_sql=[$rpt_sql]<br>\n";
$output .= "<tr>\n";
foreach( $pdo->query($rpt_sql) as $row ) {
// get field names
foreach( $result as $key=>$val ) {
// $output .= "<td>$j key=$key val=$val</td>";
$rowkey=$row[$key];
$output .= "<td>$rowkey</td>\n";
}
$output .= "</tr>\n";
}
$output .= "</tr>\n";
$output .= "</table>\n";
$pdo=null;
}
catch(PDOException $e) { $output .= $e->getMessage(); }
return( $output );
}
$output .= "$progid $dttm ERR UNSUPPORTED_7545: leds_kb_rpts o0=$option0 o1=$option1 o2=$option2<br>\n";
return;
}
function leds_dc_rpts( $options ) {
// printf( "BUGS_9900 $options[1] $options[2]<hr>\n" );
$kbfile=$GLOBALS['dbfile'];
$php_self=$SERVER['PHP_SELF'];
$pdo = newpdo($kbfile);
$tblname="rpts";
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
$option3=$options[3];
if( isset( $_GET['fmt'] )) { $fmt=$_GET['fmt']; } else { $fmt=""; }
$output = "<h2>$php_self leds_kb_rpts MSG_8800: fmt=[$fmt] $option1 $option2 $option3</h2>\n";
if( $option2 == "" ) {
$output .= "<hr>\n";
// $output .= "<h3>leds_kb_rpts kbfile=[$kbfile] tblname=[$tblname]</h3>\n";
$output .= "<table border=1>\n";
$output .= "<tr><td>rpt_code</td><td>rpt_sql</td></tr>\n";
$sql = "select * from $tblname";
foreach( $pdo->query($sql) as $row ) {
$rpt_code=$row['rpt_code'];
$rpt_sql=$row['rpt_sql'];
$rpt_url="<a href=$php_self?q=dc/rpts/$rpt_code >$rpt_code</a>\n";
$output .= "<tr><td>$rpt_url</td><td>$rpt_sql</td></tr>\n";
}
$output .= "</table>\n";
$output .= "<hr>\n";
$pdo = null;
return( $output );
}
if( $option2 != "" ) {
$rpt_code=$option2;
$sql = "select * from $tblname where rpt_code='$rpt_code'";
$output .= "<html><head><title>leds_kb_rpts detail rpt_code=$rpt_code o1=$option1 o2=$option2 </title></head>\n";
$output .= "<body bgcolor=lightblue>\n";
$output .= "<h2>leds_kb_rpts detail $rpt_code </h2>\n";
// $output .= "<hr>sql=[$sql]<hr>\n";
$output .= "<div id=\"kb_rpts\">\n";
// $output .= "<hr>\n";
$output .= "<table>\n";
$output .= "<tr><td>rpt_code</td><td>rpt_title</td><td>rpt_sql</td></tr>\n";
foreach( $pdo->query($sql) as $row ) {
$rpt_code=$row['rpt_code'];
$rpt_sql=$row['rpt_sql'];
$rpt_title=$row['rpt_title'];
$output .= "<tr>";
$output .= "<td>$rpt_code</td>";
$output .= "<td>$rpt_title</td>";
$output .= "<td>$rpt_sql</td>";
$output .= "</tr>\n";
}
$output .= "</table>\n";
$pdo=null;
// $output .= "<h2>BUGS_8248 kbfile=[$kbfile] rpt_sql=[$rpt_sql]</h2>\n";
// display headers
try {
$pdo = newpdo($kbfile);
$stmt = $pdo->query($rpt_sql);
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$output .= "<table border=1>\n";
$output .= "<tr>\n";
foreach( $result as $key=>$val) {
$output .= "<td>$key</td>\n";
}
$output .= "</tr>\n";
$pdo = null;
}
catch(PDOException $e) { $output .= $e->getMessage(); }
// display details
try {
$pdo = newpdo($kbfile);
$j=0;
// $output .= "BUGS_1234 rpt_sql=[$rpt_sql]<br>\n";
$output .= "<tr>\n";
foreach( $pdo->query($rpt_sql) as $row ) {
// get field names
foreach( $result as $key=>$val ) {
// $output .= "<td>$j key=$key val=$val</td>";
$rowkey=$row[$key];
$output .= "<td>$rowkey</td>\n";
}
$output .= "</tr>\n";
}
$output .= "</tr>\n";
$output .= "</table>\n";
$pdo=null;
}
catch(PDOException $e) { $output .= $e->getMessage(); }
return( $output );
}
$output .= "$progid $dttm ERR UNSUPPORTED_7545: leds_kb_rpts o0=$option0 o1=$option1 o2=$option2<br>\n";
return;
}
function leds_certs_rpts( $options ) {
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
$option3=$options[3];
$ko_center_certsfile=$GLOBALS['ko_center_certsfile'] = "$document_root/ko_center/db3/ko_center_certs.db3";
$tblname="rpts";
$php_self=$SERVER['PHP_SELF'];
// $output = "<h2>BUGS_8197 ko_center_certsfile=[$ko_center_certsfile] leds_certs_rpts $option1 $option2 $option3</h2>\n";
// return( $output );
if( $option2 == "" ) {
$output .= "<hr>\n";
$output .= "<h3>leds_certs_rpts ko_center_certsfile=[$ko_center_certsfile] tblname=[$tblname]</h3>\n";
$output .= "<table border=1>\n";
$output .= "<tr><td>rpt_code</td><td>rpt_sql</td></tr>\n";
$pdo = newpdo($ko_center_certsfile);
$sql = "select * from $tblname";
foreach( $pdo->query($sql) as $row ) {
$rpt_code=$row['rpt_code'];
$rpt_sql=$row['rpt_sql'];
$rpt_url="<a href=$php_self?q=certs/rpts/$rpt_code >$rpt_code</a>\n";
$output .= "<tr><td>$rpt_url</td><td>$rpt_sql</td></tr>\n";
}
$output .= "</table>\n";
$output .= "<hr>\n";
$pdo = null;
return( $output );
}
if( $option2 != "" ) {
$rpt_code=$option2;
$output .= "<html><head><title>leds_certs_rpts detail rpt_code=$rpt_code o1=$option1 o2=$option2 </title></head>\n";
$output .= "<body bgcolor=lightblue>\n";
$output .= "<h2>leds_certs_rpts detail $rpt_code </h2>\n";
$output .= "<hr>sql=[$sql]<hr>\n";
$output .= "<div id=\"certs_rpts\">\n";
$output .= "<hr>\n";
$output .= "<table>\n";
$output .= "<tr><td>rpt_code</td><td>rpt_title</td><td>rpt_sql</td></tr>\n";
$sql = "select * from $tblname where rpt_code='$rpt_code'";
$pdo = newpdo($ko_center_certsfile);
foreach( $pdo->query($sql) as $row ) {
$rpt_code=$row['rpt_code'];
$rpt_title=$row['rpt_title'];
$rpt_sql=$row['rpt_sql'];
$output .= "<tr>";
$output .= "<td>$rpt_code</td>";
$output .= "<td>$rpt_title</td>";
$output .= "<td>$rpt_sql</td>";
$output .= "</tr>\n";
}
$output .= "</table>\n";
$pdo=null;
try {
$pdo = newpdo($ko_center_certsfile);
$stmt = $pdo->query($rpt_sql);
// $output .= "<h2>BUGS_8250 kbfile=[$kbfile] rpt_sql=[$rpt_sql]</h2>\n";
$result = $stmt->fetch(PDO::FETCH_ASSOC);
// $output .= "result_count=[$result_count]<br>\n";
$output .= "<hr>\n";
$output .= "<table border=1>\n";
$output .= "<tr>\n";
foreach( $result as $key=>$val) {
$output .= "<td>$key</td>\n";
}
$output .= "</tr>\n";
$pdo = null;
}
catch(PDOException $e) { $output .= $e->getMessage(); }
try {
$pdo = newpdo($ko_center_certsfile);
$j=0;
// $output .= "BUGS_1234 rpt_sql=[$rpt_sql]<br>\n";
$output .= "<tr>\n";
foreach( $pdo->query($rpt_sql) as $row ) {
foreach( $result as $key=>$val ) {
// $output .= "<td>$j key=$key val=$val</td>";
$rowkey=$row[$key];
$output .= "<td>$rowkey</td>\n";
// print_r($row );
}
$output .= "</tr>\n";
}
$output .= "</tr>\n";
$output .= "</table>\n";
$pdo=null;
}
catch(PDOException $e) { $output .= $e->getMessage(); }
return( $output );
}
$output .= "$progid $dttm ERR UNSUPPORTED_8360: leds_certs_rpts o0=$option0 o1=$option1 o2=$option2<br>\n";
return;
}
function leds_cons_rpts( $options ) {
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
$option3=$options[3];
$ko_center_cons=$GLOBALS['ko_center_cons'] = "$document_root/ko_center/db3/ko_center_cons.db3";
$tblname="rpts";
$php_self=$SERVER['PHP_SELF'];
// $output = "<h2>BUGS_8197 ko_center_cons=[$ko_center_cons] leds_cons_rpts $option1 $option2 $option3</h2>\n";
// return( $output );
if( $option2 == "" ) {
$output .= "<hr>\n";
$output .= "<h3>leds_cons_rpts ko_center_cons=[$ko_center_cons] tblname=[$tblname]</h3>\n";
$output .= "<table border=1>\n";
$output .= "<tr><td>rpt_code</td><td>rpt_sql</td></tr>\n";
$pdo = newpdo($ko_center_cons);
$sql = "select * from $tblname";
foreach( $pdo->query($sql) as $row ) {
$rpt_code=$row['rpt_code'];
$rpt_sql=$row['rpt_sql'];
$rpt_url="<a href=$php_self?q=cons/rpts/$rpt_code >$rpt_code</a>\n";
$output .= "<tr><td>$rpt_url</td><td>$rpt_sql</td></tr>\n";
}
$output .= "</table>\n";
$output .= "<hr>\n";
$pdo = null;
return( $output );
}
if( $option2 != "" ) {
$rpt_code=$option2;
$output .= "<html><head><title>leds_cons_rpts detail rpt_code=$rpt_code o1=$option1 o2=$option2 </title></head>\n";
$output .= "<body bgcolor=lightblue>\n";
$output .= "<h2>leds_cons_rpts detail $rpt_code </h2>\n";
$output .= "<hr>sql=[$sql]<hr>\n";
$output .= "<div id=\"cons_rpts\">\n";
$output .= "<hr>\n";
$output .= "<table>\n";
$output .= "<tr><td>rpt_code</td><td>rpt_title</td><td>rpt_sql</td></tr>\n";
$sql = "select * from $tblname where rpt_code='$rpt_code'";
$pdo = newpdo($ko_center_cons);
foreach( $pdo->query($sql) as $row ) {
$rpt_code=$row['rpt_code'];
$rpt_title=$row['rpt_title'];
$rpt_sql=$row['rpt_sql'];
$output .= "<tr>";
$output .= "<td>$rpt_code</td>";
$output .= "<td>$rpt_title</td>";
$output .= "<td>$rpt_sql</td>";
$output .= "</tr>\n";
}
$output .= "</table>\n";
$pdo=null;
try {
$pdo = newpdo($ko_center_cons);
$stmt = $pdo->query($rpt_sql);
// $output .= "<h2>BUGS_8250 kbfile=[$kbfile] rpt_sql=[$rpt_sql]</h2>\n";
$result = $stmt->fetch(PDO::FETCH_ASSOC);
// $output .= "result_count=[$result_count]<br>\n";
$output .= "<hr>\n";
$output .= "<table border=1>\n";
$output .= "<tr>\n";
foreach( $result as $key=>$val) {
$output .= "<td>$key</td>\n";
}
$output .= "</tr>\n";
$pdo = null;
}
catch(PDOException $e) { $output .= $e->getMessage(); }
try {
$pdo = newpdo($ko_center_cons);
$j=0;
// $output .= "BUGS_1234 rpt_sql=[$rpt_sql]<br>\n";
$output .= "<tr>\n";
foreach( $pdo->query($rpt_sql) as $row ) {
foreach( $result as $key=>$val ) {
// $output .= "<td>$j key=$key val=$val</td>";
$rowkey=$row[$key];
$output .= "<td>$rowkey</td>\n";
// print_r($row );
}
$output .= "</tr>\n";
}
$output .= "</tr>\n";
$output .= "</table>\n";
$pdo=null;
}
catch(PDOException $e) { $output .= $e->getMessage(); }
return( $output );
}
$output .= "$progid $dttm ERR UNSUPPORTED_9145: leds_cons_rpts o0=$option0 o1=$option1 o2=$option2<br>\n";
return;
}
function leds_hosts_rpts( $options ) {
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
$option3=$options[3];
$ko_center_hosts=$GLOBALS['ko_center_hosts'] = "$document_root/ko_center/db3/ko_center_hosts.db3";
$tblname="rpts";
$php_self=$SERVER['PHP_SELF'];
// $output = "<h2>BUGS_8197 ko_center_hosts=[$ko_center_hosts] leds_hosts_rpts $option1 $option2 $option3</h2>\n";
// return( $output );
if( $option2 == "" ) {
$output .= "<hr>\n";
$output .= "<h3>leds_hosts_rpts ko_center_hosts=[$ko_center_hosts] tblname=[$tblname]</h3>\n";
$output .= "<table border=1>\n";
$output .= "<tr><td>rpt_code</td><td>rpt_sql</td></tr>\n";
$pdo = newpdo($ko_center_hosts);
$sql = "select * from $tblname";
foreach( $pdo->query($sql) as $row ) {
/// printf( "$row<br>\n" );
$rptcode=$row['rptcode'];
$rptdesc=$row['rptdesc'];
$rptsql=$row['rptsql'];
$dbfile=$row['dbfile'];
$status=$row['status'];
$rpt_url="<a href=$php_self?q=hosts/rpts/$rptcode >$rptcode</a>\n";
$output .= "<tr><td>$rpt_url</td><td>$rptsql</td></tr>\n";
}
$output .= "</table>\n";
$output .= "<hr>\n";
$pdo = null;
return( $output );
}
// $output = "<h2>BUGS_9590 ko_center_hosts=[$ko_center_hosts] leds_hosts_rpts $option1 $option2 $option3</h2>\n";
// return( $output );
if( $option2 != "" ) {
$rptcode=$option2;
$output .= "<html><head><title>leds_hosts_rpts detail rptcode=$rptcode o1=$option1 o2=$option2 </title></head>\n";
$output .= "<body bgcolor=lightblue>\n";
$output .= "<h2>leds_hosts_rpts detail $rptcode </h2>\n";
/// $output .= "<hr>sql=[$sql]<hr>\n";
$output .= "<div id=\"hosts_rpts\">\n";
$output .= "<hr>\n";
$output .= "<table>\n";
$output .= "<tr><td>rptcode</td><td>rptdesc</td><td>rptsql</td></tr>\n";
$sql = "select * from $tblname where rptcode='$rptcode'";
// printf( "BUGS_9598 rptcode=$rptcode sql=[$sql]<hr>\n" );
// return( $output );
$pdo = newpdo($ko_center_hosts);
foreach( $pdo->query($sql) as $row ) {
$rptcode=$row['rptcode'];
$rptdesc=$row['rptdesc'];
$rptsql=$row['rptsql'];
$dbfile=$row['dbfile'];
$status=$row['status'];
$output .= "<tr>";
$output .= "<td>$rptcode</td>";
$output .= "<td>$rptdesc</td>";
$output .= "<td>$rptsql</td>";
$output .= "</tr>\n";
}
$output .= "</table>\n";
$pdo=null;
try {
$pdo = newpdo($ko_center_hosts);
$stmt = $pdo->query($rptsql);
$result = $stmt->fetch(PDO::FETCH_ASSOC);
// $output .= "result_count=[$result_count]<br>\n";
$output .= "<hr>\n";
$output .= "<table border=1>\n";
$output .= "<tr>\n";
foreach( $result as $key=>$val) {
$output .= "<td>$key</td>\n";
}
$output .= "</tr>\n";
$pdo = null;
}
catch(PDOException $e) { $output .= $e->getMessage(); }
try {
$pdo = newpdo($ko_center_hosts);
$j=0;
// $output .= "BUGS_1234 rptsql=[$rptsql]<br>\n";
$output .= "<tr>\n";
foreach( $pdo->query($rptsql) as $row ) {
foreach( $result as $key=>$val ) {
// $output .= "<td>$j key=$key val=$val</td>";
$rowkey=$row[$key];
$output .= "<td>$rowkey</td>\n";
// print_r($row );
}
$output .= "</tr>\n";
}
$output .= "</tr>\n";
$output .= "</table>\n";
$pdo=null;
}
catch(PDOException $e) { $output .= $e->getMessage(); }
return( $output );
}
$output .= "$progid $dttm ERR UNSUPPORTED_9145: leds_hosts_rpts o0=$option0 o1=$option1 o2=$option2<br>\n";
return;
}
function leds_ko_centerd_rpts( $options ) {
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
$option3=$options[3];
$ko_centerd_sqldb=$GLOBALS['ko_centerd_sqldb'] = "$document_root/ko_center/db3/ko_centerd.db3";
$tblname="rpts";
$php_self=$SERVER['PHP_SELF'];
// $html = "<h2>BUGS_8650 ko_centerd=[$ko_centerd] leds_ko_centerd_rpts $option1 $option2 $option3</h2>\n";
// return( $html );
$html = html_header($options);
$html .= html_btn_squares($options);
$html .= leds_show($options);
if( $option2 == "" ) {
$html .= "<hr>\n";
$html .= "<h3>leds_ko_centerd_rpts ko_centerd=[$ko_centerd_sqldb] tblname=[$tblname]</h3>\n";
$html .= "<table border=1>\n";
$html .= "<tr><td>rpt_code</td><td>rpt_sql</td></tr>\n";
$pdo = newpdo($ko_centerd_sqldb);
$sql = "select * from $tblname";
foreach( $pdo->query($sql) as $row ) {
$rpt_code=$row['rpt_code'];
$rpt_sql=$row['rpt_sql'];
$rpt_url="<a href=$php_self?q=ko_centerd/rpts/$rpt_code >$rpt_code</a>\n";
$html .= "<tr><td>$rpt_url</td><td>$rpt_sql</td></tr>\n";
}
$html .= "</table>\n";
$html .= "<hr>\n";
$pdo = null;
return( $html );
}
if( $option2 != "" ) {
$rpt_code=$option2;
// $html .= "<html><head><title>leds_ko_centerd_rpts detail rpt_code=$rpt_code o1=$option1 o2=$option2 </title></head>\n";
// $html .= "<body bgcolor=lightblue>\n";
$html .= "<h2>leds_ko_centerd_rpts detail $rpt_code </h2>\n";
$html .= "<hr>sql=[$sql]<hr>\n";
$html .= "<div id=\"ko_centerd_rpts\">\n";
$html .= "<hr>\n";
$html .= "<table>\n";
$html .= "<tr><td>rpt_code</td><td>rpt_title</td><td>rpt_sql</td></tr>\n";
$sql = "select * from $tblname where rpt_code='$rpt_code'";
$pdo = newpdo($ko_centerd_sqldb);
foreach( $pdo->query($sql) as $row ) {
$rpt_code=$row['rpt_code'];
$rpt_title=$row['rpt_title'];
$rpt_sql=$row['rpt_sql'];
$html .= "<tr>";
$html .= "<td>$rpt_code</td>";
$html .= "<td>$rpt_title</td>";
$html .= "<td>$rpt_sql</td>";
$html .= "</tr>\n";
}
$html .= "</table>\n";
$html .= "</div>\n";
$pdo=null;
try {
$pdo = newpdo($ko_centerd_sqldb);
$stmt = $pdo->query($rpt_sql);
// $html .= "<h2>BUGS_8250 ko_centerd_sqldb=[$ko_centerd_sqldb] rpt_sql=[$rpt_sql]</h2>\n";
$result = $stmt->fetch(PDO::FETCH_ASSOC);
// $html .= "result_count=[$result_count]<br>\n";
$html .= "<hr>\n";
$html .= "<table border=1>\n";
$html .= "<tr>\n";
foreach( $result as $key=>$val) {
$html .= "<td>$key</td>\n";
}
$html .= "</tr>\n";
$pdo = null;
}
catch(PDOException $e) { $html .= $e->getMessage(); }
try {
$pdo = newpdo($ko_centerd_sqldb);
$j=0;
// $html .= "BUGS_1234 rpt_sql=[$rpt_sql]<br>\n";
$html .= "<tr>\n";
foreach( $pdo->query($rpt_sql) as $row ) {
foreach( $result as $key=>$val ) {
// $html .= "<td>$j key=$key val=$val</td>";
$rowkey=$row[$key];
$html .= "<td>$rowkey</td>\n";
// print_r($row );
}
$html .= "</tr>\n";
}
$html .= "</tr>\n";
$html .= "</table>\n";
$pdo=null;
}
catch(PDOException $e) { $html .= $e->getMessage(); }
return( $html );
}
$html .= "$progid $dttm ERR UNSUPPORTED_8360: leds_ko_centerd_rpts o0=$option0 o1=$option1 o2=$option2<br>\n";
return;
}
function leds_nodes_rpts( $options ) {
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
$option3=$options[3];
// $ko_centerd_sqldb=$GLOBALS['ko_centerd_sqldb'] = "$document_root/ko_center/db3/ko_centerd.db3";
// $ko_center_sqldb=$GLOBALS['ko_center_sqldb'] = "$document_root/ko_center/ko_center.db3";
$tblname="rpts";
$php_self=$SERVER['PHP_SELF'];
$html = "<h2>BUGS_8935 leds_nodes_rpts $option1 $option2 $option3</h2>\n";
// $html = html_header($options);
// $html .= html_btn_squares($options);
// $html .= leds_show($options);
if( $option2 == "" ) {
$html .= "<hr>\n";
$html .= "<h3>leds_nodes_rpts ko_centerd=[$ko_centerd_sqldb] tblname=[$tblname]</h3>\n";
$html .= "<table border=1>\n";
$html .= "<tr><td>rpt_code</td><td>rpt_sql</td><td>rpt_filename</td></tr>\n";
$pdo = newpdo($GLOBALS['dbfile']);
$sql = "select * from $tblname";
foreach( $pdo->query($sql) as $row ) {
$rpt_code=$row['rpt_code'];
$rpt_sql=$row['rpt_sql'];
$rpt_filename=$row['rpt_filename'];
$rpt_url="<a href=$php_self?q=nodes/rpts/$rpt_code >$rpt_code</a>\n";
$html .= "<tr><td>$rpt_url</td><td>$rpt_sql</td><td>$rpt_filename</td></tr>\n";
}
$html .= "</table>\n";
$html .= "<hr>\n";
$pdo = null;
return( $html );
}
if( $option2 != "" ) {
$rpt_code=$option2;
// $html .= "<html><head><title>leds_ko_centerd_rpts detail rpt_code=$rpt_code o1=$option1 o2=$option2 </title></head>\n";
// $html .= "<body bgcolor=lightblue>\n";
$html .= "<h2>leds_nodes_rpts detail $rpt_code </h2>\n";
$html .= "<hr>sql=[$sql]<hr>\n";
$html .= "<div id=\"ko_centerd_rpts\">\n";
$html .= "<hr>\n";
$html .= "<table>\n";
$html .= "<tr><td>rpt_code</td><td>rpt_title</td><td>rpt_sql</td><td>rpt_filename</td></tr>\n";
$sql = "select * from $tblname where rpt_code='$rpt_code'";
// $pdo = newpdo($ko_centerd_sqldb);
$pdo = newpdo($GLOBALS['dbfile']);
foreach( $pdo->query($sql) as $row ) {
$rpt_code=$row['rpt_code'];
$rpt_title=$row['rpt_title'];
$rpt_sql=$row['rpt_sql'];
$rpt_filename=$row['rpt_filename'];
$html .= "<tr>";
$html .= "<td>$rpt_code</td>";
$html .= "<td>$rpt_title</td>";
$html .= "<td>$rpt_sql</td>";
$html .= "<td>$rpt_filename</td>";
$html .= "</tr>\n";
}
$html .= "</table>\n";
$html .= "</div>\n";
$pdo=null;
try {
$pdo = newpdo($GLOBALS['dbfile']);
$stmt = $pdo->query($rpt_sql);
// $html .= "<h2>BUGS_8250 ko_centerd_sqldb=[$ko_centerd_sqldb] rpt_sql=[$rpt_sql]</h2>\n";
$result = $stmt->fetch(PDO::FETCH_ASSOC);
// $html .= "result_count=[$result_count]<br>\n";
$html .= "<hr>\n";
$html .= "<table border=1>\n";
$html .= "<tr>\n";
foreach( $result as $key=>$val) {
$html .= "<td>$key</td>\n";
}
$html .= "</tr>\n";
$pdo = null;
}
catch(PDOException $e) { $html .= $e->getMessage(); }
try {
$pdo = newpdo($GLOBALS['dbfile']);
$j=0;
// $html .= "BUGS_1234 rpt_sql=[$rpt_sql]<br>\n";
$html .= "<tr>\n";
foreach( $pdo->query($rpt_sql) as $row ) {
foreach( $result as $key=>$val ) {
// $html .= "<td>$j key=$key val=$val</td>";
$rowkey=$row[$key];
$html .= "<td>$rowkey</td>\n";
// print_r($row );
}
$html .= "</tr>\n";
}
$html .= "</tr>\n";
$html .= "</table>\n";
$pdo=null;
}
catch(PDOException $e) { $html .= $e->getMessage(); }
return( $html );
}
$html .= "$progid $dttm ERR UNSUPPORTED_8360: leds_ko_centerd_rpts o0=$option0 o1=$option1 o2=$option2<br>\n";
return;
}
function leds_ptviewer( $options ) {
$php_self=$_SERVER['PHP_SELF'];
$ptpath="./java/ptviewer";
$panopath="./media/pano";
$panofile="obj.jpg"; $width="640"; $height="480"; $nhor="25"; $nver="1";
$output = "";
if( $options[2] == "" ) {
$pdo = newpdo($GLOBALS['dbfile']);
$tblname="pano";
$output = "";
$output .= "<html><head><title>fp ptviewer index</title></head>\n";
$output .= "<body bgcolor=lightblue>\n";
$output .= "<hr>fp ptviewer index<hr>\n";
$output .= "<hr>\n";
$output .= "<div class=pano>\n";
$output .= "<table>\n";
$sql = "select * from $tblname";
foreach( $pdo->query($sql) as $row ) {
$output .= "<tr><td>";
// $output .= "<a href=$php_self?q=ptviewer/pano_templet.gif/600/300 target=_blank>pano_templet</a><br>\n";
$output .= "<a href=$php_self?q=ptviewer/".$row['filename'];
$output .= "/".$row['width']."/".$row['height']." target=_blank>";
$output .= $row['filename']."</a></td><td>".$row['title']."</td></tr>\n";
}
$output .= "</table>\n";
$output .= "<hr>\n";
$output .= "</div>\n";
$output .= "</body></html>\n";
print( "$output" );
return;
// return( $output );
}
$panofile=$options[1];
$width=$options[2];
$height=$options[3];
$nhor=$options[4];
$nver=$options[5];
if( $nver == "" ) { $nver="1"; }
$panopathfile = "$panopath/$panofile";
$output .= "<html><head><title>fp ptviewer detail $panofile $width $height</title></head>\n";
$output .= "<body bgcolor=lightblue>\n";
$output .= "<hr>fp ptviewer detail $panofile $width $height<hr>\n";
$output .= "<div id=\"ptviewer\">\n";
$output .= "<hr>\n";
$output .= "<applet code=\"ptviewer.class\" archive=\"$ptpath/ptviewer.jar\" ";
$output .= "width=$width height=$height>\n";
$output .= "<param name=file value=\"$panopathfile\">\n";
// $output .= "<param name=cursor value=\"CROSSHAIR\">\n";
$output .= "<param name=cursor value=\"MOVE\">\n";
$output .= "<param name=FOV value=\"-105\">\n";
$output .= "<param name=pan value=\"360\">\n";
// $output .= "<param name=imgLoadFeedback value=\"true\">\n";
// $output .= "<param name=showToolbar value=\"true\">\n";
// $output .= "<param name=inits value=\"ptviewer:startApplet(0)\">\n";
$output .= "</applet>\n";
$output .= "</div>\n";
$output .= "</body></html>\n";
return( $output );
}
function html_links($options) {
$http_host=$_SERVER['HTTP_HOST'];
$php_self=$_SERVER['PHP_SELF'];
$output = "<a href=\"http://$http_host$php_self\"><b><img src=\"imgs/btn/btn_black.gif\"></a>  \n";
$output .= "<hr>\n";
return( $output );
}
function leds_zoom( $options ) {
$php_self=$_SERVER['PHP_SELF'];
$zoompath="./media/zoom/";
$output = "";
$url_zmcode=$options[1];
$url_zmtype=$options[2];
$url_zmrowid=$options[3];
// print( "leds_zoom MSG_4236: url_zmcode=[$url_zmcode] url_zmtype=[$url_zmtype] url_rowid=[$url_rowid]<br>\n" );
// print( "leds_zoom MSG_4237: _SESSION[hs_type]=[".$_SESSION['hs_type']."] url_zmtype=[$url_zmtype]<br>\n" );
// print( "leds_zoom MSG_4238: o0=[$options[0]] o1=[$options[1]] o2=[$options[2]] o3=[$options[3]]<br>\n" );
if( $url_zmtype != "" ) { $_SESSION['hs_type'] = $url_zmtype; }
// print( "leds_zoom MSG_4242: _SESSION[hs_type]=[".$_SESSION['hs_type']."] url_zmcode=[$url_zmcode] url_zmtype=[$url_zmtype]<br>\n" );
$html_links = html_links($options);
$html_btn_squares = html_btn_squares($options);
// $callback="$php_self?q=zoom/$url_zmcode/$url_zmtype/$url_zmrowid";
$callback="$php_self?q=zoom/$url_zmcode/\$hs/$url_zmrowid";
// print( "leds_zoom MSG_2660: url_zmcode=[$url_zmcode] url_zmtype=[$url_zmtype] url_rowid=[$url_rowid]<br>$callback\n" );
// print( "leds_zoom MSG_4252: callback=[$callback]<br>\n" );
$html_btn_hotspots = html_btn_hotspots($options, $callback);
$path_btn="./imgs/btn";
$query_string=$_SERVER['QUERY_STRING'];
$html_grid .= "<br>\n";
// if(( ! isset( $_SESSION['grid_zoom'] )) || ( $_SESSION['grid_zoom'] == "" )) {
// $html_grid .= "<a href=$php_self?$query_string>\n";
// $_SESSION['grid_zoom'] = true;
// $html_grid .= "<img src=\"$path_btn/btn_white.gif\" alt=\"btn_white\" border=0 height=\"20\" width=\"20\" />";
// $html_grid .= "</a>\n";
// }
// else {
// unset( $_SESSION['grid_zoom'] );
// $html_grid .= "<a href=$php_self?$query_string>\n";
// $html_grid .= "<img src=\"$path_btn/btn_black.gif\" alt=\"btn_white\" border=0 height=\"20\" width=\"20\" />";
// $html_grid .= "</a>\n";
// }
if(( ! isset( $_SESSION['grid_zoom'] )) || ( $_SESSION['grid_zoom'] == "" )) {
$zoom_options = array( "db", "grid", "fp", "zoom", "" );
$html_grid .= "<hr>\n";
$html_grid .= pdo_grid( $zoom_options );
$html_grid .= "<hr>\n";
$html_foot = html_footer($options);
}
// return;
if( $url_zmcode == "" ) {
// print( "BUGS_3938 zmcode=[$zmcode] zmtype=[$zmtype] o1=[$options[1]] o2=[$options[2]]<br>\n" );
if( $_SESSION['hs_type'] ) { $zmtype=$_SESSION['hs_type']; } else { $zmtype="none"; $_SESSION['hs_type'] = "none"; }
$zoomxml_options = array( "db", "grid", "fp", "zoomxml", "$url_zmcode", "$url_zmtype" );
switch( true ) {
case( $url_zmtype == "all" ):
$zoomxml_options = array( "db", "grid", "fp", "zoomxml", "all", "$url_zmtype" );
// $html_grid2 .= "BUGS_4270 leds_zoom ALL: url_zmcode=[$url_zmcode] url_zmtype=[$url_zmtype]<br>\n";
$html_grid2 .= pdo_grid( $zoomxml_options );
$html_grid2 .= "\n";
break;
case( $url_zmtype == "grid" ):
// $html_grid2 .= "BUGS_4275 leds_zoom GRID: url_zmcode=[$url_zmcode] url_zmtype=[$url_zmtype]<br>\n";
$html_grid2 .= pdo_grid( $zoomxml_options );
break;
case( $url_zmtype == "us" ):
// $html_grid2 .= "BUGS_4280 leds_zoom US: url_zmcode=[$url_zmcode] url_zmtype=[$url_zmtype]<br>\n";
$html_grid2 .= pdo_grid( $zoomxml_options );
break;
case( $url_zmtype == "hw" ):
// $html_grid2 .= "BUGS_4285 leds_zoom HW: url_zmcode=[$url_zmcode] url_zmtype=[$url_zmtype]<br>\n";
$html_grid2 .= pdo_grid( $zoomxml_options );
break;
case( $url_zmtype == "n11" ):
// $html_grid2 .= "BUGS_4290 leds_zoom 911: url_zmcode=[$url_zmcode] url_zmtype=[$url_zmtype]<br>\n";
$html_grid2 .= pdo_grid( $zoomxml_options );
break;
default:
// $html_grid2 .= "BUGS_4295 leds_zoom NONE: url_zmcode=[$url_zmcode] url_zmtype=[$url_zmtype]<br>\n";
}
$html_head = html_header($options);
$html = $html_head . $html_btn_squares . $html_btn_hotspots . $html_grid . $html_grid2 . $html_foot;
print( $html );
return;
}
$zoomxml_options = array( "db", "grid", "fp", "zoomxml", "$url_zmcode", "$url_zmtype", "$url_zmrowid" );
// $html_grid2 .= "BUGS_4307 leds_zoom ALL: url_zmcode=[$url_zmcode] url_zmtype=[$url_zmtype]<br>\n";
$html_grid2 .= pdo_grid( $zoomxml_options );
$html_grid2 .= "\n";
/// if( $url_zmcode != "" ) {
///
/// $zoom_options = array( "db", "grid", "fp", "zoom", "" );
/// $output .= pdo_grid( $zoom_options );
///
// print( "leds_zoom MSG_2695: o1=[$options[1]] o2=[$options[2]] o3=[$options[3]]<br>\n" );
// leds_zview( $options );
// return;
/// $zoomcode=$options[1];
/// $pdo = newpdo($GLOBALS['dbfile']);
/// $tblname="zoom";
// $output = "";
/// $output .= "<html><head><title>fp zoom index</title></head>\n";
/// $output .= "<body bgcolor=lightgray>\n";
/// $output .= "<hr>fp zoom index<hr>\n";
/// $output .= "<hr>\n";
/// $output .= "<a href=$php_self?q=zoom>list</a><br>\n";
/// $output .= "<div class=zoom>\n";
/// $output .= "<table>\n";
/// $sql = "select * from $tblname where code = '$zoomcode'";
// print( "BUGS2607: sql=[$sql]<br>\n" );
/// foreach( $pdo->query($sql) as $row ) {
// $output .= "<a href=$php_self?q=zoom/fp01/grid target=_blank>fp01</a><br>\n";
/// $output .= "<tr><td>";
// $output .= "<b>".$row['code']."</b>";
// $output .= "<a href=$php_self?q=zoom/".$row['code'];
// $output .= "/".$row['width']."/".$row['height'];
// $output .= "/".$row['height']."/".$row['nvert']." target=_blank>";
// $output .= " target=_blank";
// $output .= ">";
// $output .= $row['code']."</a></td><td>".$row['city']."</td>";
/// $output .= "<b>".$row['code']."</b><td>".$row['city']."</td>";
/// $output .= "<td>".$row['city']."</td>";
/// $output .= "<td>".$row['bldg']."</td>";
/// $output .= "<td>".$row['loc']."</td>";
/// $output .= "<td>".$row['floor']."</td>";
/// $output .= "<td>".$row['title']."</td>";
/// $output .= "<td>".$row['comment']."</td>";
///
/// $output .= "</tr>\n";
/// }
///
/// $output .= "</table>\n";
/// $output .= "</div>\n";
//////
/// $html_grids = "";
/// $zoomxml_codes= array( 'all', 'grid', 'us', 'hw', 'n11' );
/// foreach( $zoomxml_codes as $zoomxml_code ) {
/// $output .= "<a href=$php_self?q=zoom/".$row['code']."/$zoomxml_code";
// $output .= "/".$row['width']."/".$row['height'];
// $output .= "/".$row['height']."/".$row['nvert']." target=_blank>";
// $output .= " target=_blank";
/// $output .= "> $zoomxml_code </a>";
/// $output .= "       ";
/// }
/// $output .= "<hr>\n";
// print( "$output" );
// return;
// return( $output );
/// }
///
/// if(( $options[1] != "" ) & ( $options[2] != "" )) {
/// $output .= "leds_zoom MSG_2756: o1=$options[1] o2=$options[2]<br>\n";
/// $output .= leds_zoomswf($options);
/// }
/// $zoom_options = array( "db", "grid", "fp", "zoom", "us" );
/// $output .= pdo_grid( $zoom_options );
/// $html_grids = "";
// $zmtype_list = array( "1", "grid", "us", "hw", "n11" );
/// $zmtype_list = array( "us", "hw" );
/// foreach( $zmtype_list as $zmtype ) {
/// $zoomxml_options = array( "db", "grid", "fp", "zoomxml", "$zmcode", "$zmtype" );
/// $html_grids .= pdo_grid( $zoomxml_options );
/// $html_grids .= "\n";
/// }
/// $zoomxml_options = array( "db", "grid", "fp", "zoomxml", "$url_zmcode", "$url_zmtype", "$url_zmrowid" );
/// $html_grid2 .= pdo_grid( $zoomxml_options );
// screenshot rollover
$path_fpb = "./imgs/fpb";
$fpnam = $row['led_name'];
$fpbnam = str_replace( "fp", "fpb", $fpnam );
$fpbimg = "$path_fpb/" . $fpbnam . ".png";
$fpb_title = $row['led_name'] . "(";
$fpb_title .= $row['led_title'] .") bldg(";
$fpb_title .= $row['led_bldg'] .") floor(";
$fpb_title .= $row['led_floor'].")";
$zoom_file = "$url_zmcode";
$zoom_path = $zoompath;
// $zoom_xml = sprintf( "%s_%s_%s_hotspots.xml", $url_zmcode, $url_zmtype, $url_zmrowid );
$zoom_xml = sprintf( "$php_self?q=zoomxml/%s/%s/%s", $url_zmcode, $url_zmtype, $url_zmrowid );
/// $zoom_xml = sprintf( "$php_self?q=zoomxml/%s/%s/%s class=\"screenshot\" rel=\"%s\" title=\"%s\"",
/// $url_zmcode, $url_zmtype, $url_zmrowid, $fpbimg, $fpb_title );
$html_zviewer = html_zviewer( $zoom_file, $zoom_path, $zoom_xml );
$html_zoom_detail = html_zoom_detail($options);
$html_head = html_header($options);
$html_links = html_links($options);
$html_foot = html_footer($options);
// $html = $html_head . $html_links . $html_grid . $html_grids . $html_foot;
$html_head = html_header($options);
$html = $html_head . $html_btn_squares . $html_btn_hotspots;
$html .= $html_zoom_detail;
// $html .= $html_zoom_detail . $html_zviewer;
// $html .= "<div id=\"toggle\" class=\"layer1\">\n";
// $html .= " <p class=\"heading\">toggle</p>\n";
// $html .= " <div class=\"content\">\n";
// $html .= "a b c d e f g h i j k l m n o p q r s t r v w z y z<br>\n";
// $html .= " </div></div>\n";
$html .= $html_grid . $html_grid2;
$html .= $html_footer;
print( $html );
return;
}
function leds_zoomswf( $options ) {
// $xmlfile="$file"."_".$hscode."_hotspots.xml";
$http_host=$_SERVER['HTTP_HOST'];
$php_self=$_SERVER['PHP_SELF'];
// $hs_type = $_SESSION['hs_type'];
// $org_type = $_SESSION['org_type'];
$zoompath="./media/zoom/";
$zoomcode=$options[1];
$zoomxml_code="$options[2]";
$zoomfile = "$zoompath/$zoomcode";
if(( $zoomxml_code == "" ) || ( $zoomxml_code == "all" )) {
$zoomxml_file="$zoomcode"."_hotspots.xml";
}
else {
$zoomxml_file="$zoomcode"."_".$zoomxml_code."_hotspots.xml";
}
$zoom_xmlurl="http://$http_host$php_self?q=zoomxml/$zoomcode/$zoomxml_code";
if( file_exists( $zoomxml_file )) {
$zoom_xmlurl="$zoomxml_file";
}
$flashvars = "zoomifyImagePath=$zoompath$zoomcode&zoomifyHotspotsXMLPath=$zoom_xmlurl";
/// $output ="<html>\n";
// $output .= "<head>\n";
// $output .= "<title>leds_zviewer $zoom_path $zoom_file $zoom_xml</title>";
// $output .= "<body bgcolor=\"#ffffff\">\n";
// print( "<hr>\n" );
// print( "leds_zviewer MSG1985: file=$file path=$path xml=$xml<hr>\n" );
$output .= "zoom_file=[<b>$zoom_file</b>] hs_type=[<b>$hs_type</b>]<hr>\n";
$output .= "<div id=\"zoomswf\" align=\"center\">\n";
$object = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"\n";
$object .= "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0\"\n";
$object .= "width=\"900\" height=\"500\"\n";
$object .= "id=\"ZoomifyHotspotViewer\"\n";
// $object .= "id=\"ZoomifyTourViewer\"\n";
// $object .= "id=\"zoomifyviewer\"\n";
$object .= ">\n";
$object .= "<param name=\"flashvars\"\n";
$object .= "value=\"$flashvars\">\n";
$object .= "<param name=\"menu\" value=\"false\">\n";
$object .= "<param name=\"src\"\n";
$object .= "value=\"ZoomifyHotspotViewer.swf\">\n";
// $object .= "value=\"ZoomifyTourViewer.swf\">\n";
// $object .= "value=\"zoomifyviewer.swf\">\n";
$object .= "<embed\n";
$object .= "flashvars=\"$flashvars\"\n";
$object .= "src=\"ZoomifyHotspotViewer.swf\"\n";
// $object .= "src=\"ZoomifyTourViewer.swf\"\n";
// $object .= "src=\"zoomifyviewer.swf\"\n";
$object .= "menu=\"false\"\n";
$object .= "pluginspage=\"http://www.adobe.com/go/getflashplayer\"\n";
$object .= "type=\"application/x-shockwave-flash\"\n";
$object .= "width=\"900\" height=\"500\"\n";
$object .= "name=\"ZoomifyHotspotViewer\">\n";
// $object .= "name=\"ZoomifyTourViewer\">\n";
// $object .= "name=\"zoomifyviewer\">\n";
$object .= "</embed>\n";
$object .= "</object>\n";
$output .= $object;
$output .= "</div>\n";
/// $output .= "</body>\n";
/// $output .= "</html>\n";
/// print( "$output\n" );
return( $output );
}
function leds_ptobject( $options ) {
$php_self=$_SERVER['PHP_SELF'];
$output = "";
$ptpath="./java/ptviewer";
$objpath="./media/obj";
// $panofile="obj.jpg"; $width="640"; $height="480"; $nhor="25"; $nver="1";
$output = "";
if( $options[2] == "" ) {
$pdo = newpdo($GLOBALS['dbfile']);
$tblname="obj";
$output = "";
$output .= "<html><head><title>fp ptobject index</title></head>\n";
$output .= "<body bgcolor=lightblue>\n";
$output .= "<hr>fp ptviewer index<hr>\n";
$output .= "<hr>\n";
$output .= "<div class=pano>\n";
$output .= "<table>\n";
$sql = "select * from $tblname";
foreach( $pdo->query($sql) as $row ) {
// $output .= "<a href=$php_self?q=ptobject/usm_855_100_8_1.jpg/855/100/8/1 target=_blank>usm_100</a><br>\n";
$output .= "<tr><td>";
// $output .= "<a href=$php_self?q=ptobject/obj_templet.gif/600/300/nhor/nver target=_blank>pano_templet</a><br>\n";
$output .= "<a href=$php_self?q=ptobject/".$row['filename'];
$output .= "/".$row['width']."/".$row['height'];
$output .= "/".$row['nhor']."/".$row['nvert']." target=_blank>";
$output .= $row['filename']."</a></td><td>".$row['title']."</td></tr>\n";
}
$output .= "</table>\n";
$output .= "</div>\n";
$output .= "<hr>\n";
// $output .= "</body></html>\n";
// print( "$output" );
// return;
return( $output );
}
$ptpath="./java/ptviewer";
$objectpath="./media/obj";
$objectfile="obj.jpg"; $width="640"; $height="480"; $nhor="25"; $nver="1";
$objectfile=$options[1];
$full_width=$options[2];
$full_height=$options[3];
$nhor=$options[4];
$nver=$options[5];
if( $nver == "" ) { $nver="1"; }
$width = round($full_width / $nhor);
$height = round($full_height / $nver);
$objectpathfile = "$objectpath/$objectfile";
/// $output .= "<html><head><title>fp ptobject detail $objectfile $width $height $nhor $nver</title></head>\n";
/// $output .= "<body bgcolor=lightblue>\n";
$output .= "<hr>fp ptobject detail $objectfile $width $height $nhor $nver<hr>\n";
$output .= "<div id=\"ptobject\">\n";
$output .= "<applet archive=$ptpath/ptviewer.jar \n";
$output .= "code=ptviewer.class width=$width height=$height name=ptviewer>\n";
$output .= "<param name=applet0 value=\"{code=ptobject.class} {file=$objectpathfile} {nhor=$nhor} {nver=$nver}\">\n";
$output .= "<param name=inits value=\"ptviewer:startApplet(0)\">\n";
$output .= "</applet>\n";
$output .= "</div>\n";
//. $output .= "<hr>\n";
// $output .= "</body></html>\n";
return( $output );
}
function leds_zview( $options ) {
// $xmlfile="$file"."_".$hscode."_hotspots.xml";
$http_host=$_SERVER['HTTP_HOST'];
$php_self=$_SERVER['PHP_SELF'];
$hs_type = $_SESSION['hs_type'];
$org_type = $_SESSION['org_type'];
$zoom_path="./media/zoom/";
$zoom_file=$options[1];
$zoomcode=$options[1];
$zoom_xml="$options[2]";
$zoom_xml_args = explode( "_", $zoom_xml );
$zmcode = $zoom_xml_args[0];
$zmtype = $zoom_xml_args[1];
$zmrowid = $zoom_xml_args[2];
// $output .= "leds_zview_4651: zoomcode=[$zoomcode] zoom_xml=[$zoom_xml]<br>\n";
// $output .= "leds_zview_4652: zmcode=[$zmcode] zmtype=[$zmtype] zmrowid=[$zmrowid]<br>\n";
/// if( $zoom_xml != "" ) {
/// if( $hs_type != "" ) {
/// $zoom_xml="$zoom_file"."_".$hs_type."_hotspots.xml";
/// }
/// else {
/// $zoom_xml="$zoom_file"."_hotspots.xml";
/// }
/// }
// $zoom_xmlurl=$zoom_xml;
// $zoom_xmlurl="http://$http_host$php_self?q=zview_xml/$zoom_xml";
// $zoom_xmlurl="http://$http_host$php_self?q=zoomxml/$zoomcode/$hs_type";
/// $zoom_xmlurl="http://$http_host$php_self?q=zviewxml/$zoomcode/$hs_type";
$zoom_xmlurl="http://$http_host$php_self?q=zviewxml/$zmcode/$zmtype/$zmrowid";
$file=$zoom_file; $path=$zoom_path; $xml=$zoom_xml;
$flashvars = "\"zoomifyImagePath=$path$file&zoomifyHotspotsXMLPath=$zoom_xmlurl\"";
// print( "leds_zview MSG: zoom_file=$zoom_file zoom_path=$zoom_path<br>\n" );
// print( "leds_zview MSG: zoom_xml=$zoom_xml<br>\n" );
// print( "leds_zview MSG: zoom_xmlurl=$zoom_xmlurl<br>\n" );
// print( "leds_zview MSG: flashvars=[$flashvars]<br>\n" );
// print( "leds_zview MSG2638: zoom_file=[zoom_file] hs_type=[$hs_type]<br>\n" );
// return;
// $flashvars = leds_zview_xmltext() {
$flashvars = "zoomifyImagePath=$path$file&zoomifyHotspotsXMLPath=$zoom_xmlurl";
// $output .= "leds_zview_4670: zoomcode=[$zoomcode] zoom_xml=[$zoom_xml]<br>\n";
/// $output ="<html>\n";
/// $output .= "<head>\n";
/// $output .= "<title>leds_zviewer $zoom_path $zoom_file $zoom_xml</title>";
/// $output .= "<body bgcolor=\"#ffffff\">\n";
$output .= html_btn_squares( $options, "" );
// print( "<hr>\n" );
// print( "leds_zviewer MSG1985: file=$file path=$path xml=$xml<hr>\n" );
$output .= "zoom_file=[<b>$zoom_file</b>] hs_type=[<b>$hs_type</b>]<hr>\n";
$output .= "<div id=\"leds_zview\" align=\"center\">\n";
$object = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"\n";
$object .= "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0\"\n";
$object .= "width=\"900\" height=\"500\"\n";
$object .= "id=\"ZoomifyHotspotViewer\"\n";
// $object .= "id=\"ZoomifyTourViewer\"\n";
// $object .= "id=\"zoomifyviewer\"\n";
$object .= ">\n";
$object .= "<param name=\"flashvars\"\n";
// $object .= "value=\"zoomifyImagePath=$path$file&zoomifyHotspotsXMLPath=$zoom_xmlurl\">\n";
$object .= "value=\"$flashvars\">\n";
$object .= "<param name=\"menu\" value=\"false\">\n";
$object .= "<param name=\"src\"\n";
$object .= "value=\"ZoomifyHotspotViewer.swf\">\n";
// $object .= "value=\"ZoomifyTourViewer.swf\">\n";
// $object .= "value=\"zoomifyviewer.swf\">\n";
$object .= "<embed\n";
// $object .= "flashvars=\"zoomifyImagePath=$path$file&zoomifyHotspotsXMLPath=$zoom_xmlurl\"\n";
$object .= "flashvars=\"$flashvars\"\n";
$object .= "src=\"ZoomifyHotspotViewer.swf\"\n";
// $object .= "src=\"ZoomifyTourViewer.swf\"\n";
// $object .= "src=\"zoomifyviewer.swf\"\n";
$object .= "menu=\"false\"\n";
$object .= "pluginspage=\"http://www.adobe.com/go/getflashplayer\"\n";
$object .= "type=\"application/x-shockwave-flash\"\n";
$object .= "width=\"900\" height=\"500\"\n";
$object .= "name=\"ZoomifyHotspotViewer\">\n";
// $object .= "name=\"ZoomifyTourViewer\">\n";
// $object .= "name=\"zoomifyviewer\">\n";
$object .= "</embed>\n";
$object .= "</object>\n";
$output .= $object;
$output .= "</div>\n";
$http_host=$_SERVER['HTTP_HOST'];
$output .= "<hr>\n";
$output .= "<div id=\"brainmap\">\n";
$output .= "<a href=http://$http_host/hrc/fp/java/brainmap/ajax-viewer.html";
$output .= "?path=http://$http_host/hrc/fp/media/zoom/$zoomcode/&height=6600&width=10200 target=_blank>\n";
$output .= " <img src=media/zoom/$zoomcode/TileGroup0/0-0-0.jpg border=0>\n";
$output .= " </a>\n";
$output .= " <br>      <font size=2>brainmap viewer</font><br>\n";
$output .= " </div>\n";
$output .= "<hr>\n";
// phpinfo();
/// $output .= "</body>\n";
/// $output .= "</html>\n";
/// print( "$output\n" );
return( $output );
}
function leds_zview_xml( $options ) {
$php_self=$_SERVER['PHP_SELF'];
$http_host=$_SERVER['HTTP_HOST'];
$document_root=$_SERVER['DOCUMENT_ROOT'];
$xmlfile=$options[1];
$xmlfile_args=explode( "_", $xmlfile );
$fp = $xmlfile_args[0];
$fp_hs = $xmlfile_args[0];
$output = "";
// print_r( $options );
$xmlpathfile="$document_root/$options[1]";
// if( file_exists( $xmlfilepath )) {
// print( "leds_zview_xml XML: FOUND xmlpathfile=[$xmlpathfile]<br>\n" );
// }
// else {
// print( "leds_zview_xml XML: NOTFOUND xmlpathfile=[$xmlpathfile]<br>\n" );
// }
//// $xml = leds_zoomxml( $options );
//// print( "BUGS2760 leds_zview_xml<hr>\n" );
//// print( $xml );
//// return;
if( file_exists( $xmlfile )) {
// $xmldata=array();
// $xmldata = file_get_contents( $xmlfile );
// $xmldata = file( $xmlfile, FILE_BINARY );
$xmldata = file( $xmlfile, FILE_TEXT );
foreach( $xmldata as $xmlline ) {
$output .= "$xmlline\n";
// print( "$xmlline\n" );
}
// print_r( $xmldata );
// print( "xmldata=[<hr>$xmldata<hr>]\n" );
return( $output );
}
else {
// $xmldata = leds_zview_xmltext();
$xmldata = leds_zview_xmlnew( $options );
$output .= $xmldata;
return( $output );
/// print( $xmldata );
}
}
function leds_zview_details( $options ) {
$fp=$options[1];
$fp_hs=$options[2];
leds_show($options );
$output = "<hr>zview_details $options[1] $option[2]<hr>\n";
print( $output );
print_r($options);
return;
}
function leds_zview_xmltext() {
$document_root = $_SERVER['DOCUMENT_ROOT'];
$http_host = $_SERVER['HTTP_HOST'];
$php_self = $_SERVER['PHP_SELF'];
$xml = "<DATA>\n";
$xml .= " <HOTSPOTSETUP\n";
$xml .= " AUTOLOOP=\"0\"\n";
$xml .= " CHOICELIST=\"2\"\n";
$xml .= " LISTSOURCE=\"caption\"\n";
$xml .= " INITIALVISIBILITY=\"1\"\n";
$xml .= " MINSCALE=\"0.15\"\n";
$xml .= " MAXSCALE=\"2\"\n";
$xml .= " />\n";
$id=1;
$x="7000";
$y="6500";
$zoom="0";
$caption="$id. caption text";
$mediatype="url";
$media="./hrcstl_050.png";
$url = "http://$php_self?q=zlink";
$url = "http://google.com";
$urltarget="_blank";
$interval="2000";
$duration="500";
$transition="ZoomToView";
$xml .= " <HOTSPOT\n";
$xml .= " ID=\"$id\"\n";
$xml .= " X=\"$x\"\n";
$xml .= " Y=\"$y\"\n";
$xml .= " ZOOM=\"$zoom\"\n";
$xml .= " CAPTION=\"$caption\"\n";
$xml .= " MEDIATYPE=\"$mediatype\"\n";
$xml .= " MEDIA=\"$media\"\n";
$xml .= " URL=\"$url\"\n";
$xml .= " URLTARGET=\"$urltarget\"\n";
$xml .= " INTERVAL=\"$interval\"\n";
$xml .= " TRANSITION=\"$transition\"\n";
$xml .= " DURATION=\"$duration\">\n";
$xml .= " </HOTSPOT>\n";
$xml .= "</DATA>\n";
return( $xml );
}
function leds_zview_xmlnew( $options ) {
$http_host=$_SERVER['HTTP_HOST'];
$php_self=$_SERVER['PHP_SELF'];
$document_root=$_SERVER['DOCUMENT_ROOT'];
$dttm=date("Ymd_His");
$xmlfile=$options[1];
$xmlfile_args=explode( "_", $xmlfile );
$fp = $xmlfile_args[0];
$fp_hs = $xmlfile_args[0];
$fp_xmlfile=$options[1];
$fp_xmlfile_args=explode( "_", $fp_xmlfile );
$fp=$fp_xmlfile_args[0];
$fp_hs=$fp_xmlfile_args[1];
$path_btn="./imgs/btn";
if( $fp_hs != "" ) {
$path_btn_hs="$path_btn/btn_".$fp_hs.".gif";
}
else {
$path_btn_hs="$path_btn/btn_hrcstl.png";
}
$xml = leds_zoomxml( $options );
print( $xml );
return;
$xml = "<DATA>\n";
$xml .= " <HOTSPOTSETUP\n";
$xml .= " AUTOLOOP=\"0\"\n";
$xml .= " CHOICELIST=\"2\"\n";
$xml .= " LISTSOURCE=\"CAPTION\"\n";
$xml .= " INITIALVISIBILITY=\"1\"\n";
$xml .= " MINSCALE=\"0.15\"\n";
$xml .= " MAXSCALE=\"2\"\n";
$xml .= " />\n";
$xml .= " <HOTSPOT\n";
$xml .= " ID=\"1\"\n";
$xml .= " MEDIATYPE=\"url\"\n";
$xml .= " MEDIA=\"$path_btn/btn_hrcstl.png\"\n";
// $xml .= " URL=\"http://google.com\"\n";
$xml .= " URL=\"$php_self?q=zview_details/$fp/$fp_hs/1\"\n";
$xml .= " URLTARGET=\"_blank\"\n";
$xml .= " X=\"1000\"\n";
$xml .= " Y=\"1000\"\n";
$xml .= " ZOOM=\"0\"\n";
$xml .= " CAPTION=\"1: ".$fp."_hotspots.xml - overview $fp_hs (10,10) $dttm\"\n";
$xml .= " INTERVAL=\"2000\"\n";
$xml .= " TRANSITION=\"ZoomToView\" \n";
$xml .= " DURATION=\"500\" >\n";
$xml .= " </HOTSPOT>\n";
$xml .= " <HOTSPOT \n";
$xml .= " ID=\"2\"\n";
$xml .= " MEDIATYPE=\"url\"\n";
$xml .= " MEDIA=\"$path_btn_hs\"\n";
// $xml .= " URL=\"http://google.com\"\n";
$xml .= " URL=\"$php_self?q=zview_details/$fp/$fp_hs/2\"\n";
$xml .= " URLTARGET=\"_blank\"\n";
$xml .= " X=\"4660\"\n";
$xml .= " Y=\"3700\"\n";
$xml .= " ZOOM=\"55\" \n";
$xml .= " CAPTION=\"2: $fp"."_hotspots.xml - center $fp_hs (47,37) $dttm\"\n";
$xml .= " INTERVAL=\"2000\"\n";
$xml .= " TRANSITION=\"ZoomToView\" \n";
$xml .= " DURATION=\"500\" >\n";
$xml .= " </HOTSPOT>\n";
$xml .= "\n";
$xml .= " <HOTSPOT \n";
$xml .= " ID=\"3\"\n";
$xml .= " MEDIATYPE=\"url\"\n";
$xml .= " MEDIA=\"$path_btn_hs\"\n";
// $xml .= " URL=\"http://google.com\"\n";
$xml .= " URL=\"$php_self?q=zview_details/$fp/$fp_hs/3\"\n";
$xml .= " URLTARGET=\"_blank\"\n";
$xml .= " X=\"1600\"\n";
$xml .= " Y=\"3800\"\n";
$xml .= " ZOOM=\"55\" \n";
$xml .= " CAPTION=\"3: ".$fp."_hotspots.xml - center left $fp_hs (10,38) $dttm\"\n";
$xml .= " INTERVAL=\"2000\"\n";
$xml .= " TRANSITION=\"ZoomToView\" \n";
$xml .= " DURATION=\"500\" >\n";
$xml .= " </HOTSPOT>\n";
$xml .= "\n";
$xml .= "\n";
$xml .= " <HOTSPOT \n";
$xml .= " ID=\"4\"\n";
$xml .= " MEDIATYPE=\"url\"\n";
$xml .= " MEDIA=\"$path_btn_hs.gif\"\n";
// $xml .= " URL=\"http://google.com\"\n";
$xml .= " URL=\"$php_self?q=zview_details/$fp/$fp_hs/4\"\n";
$xml .= " URLTARGET=\"_blank\"\n";
$xml .= " X=\"7800\"\n";
$xml .= " Y=\"3900\"\n";
$xml .= " ZOOM=\"55\" \n";
$xml .= " CAPTION=\"4: ".$fp."_hotspots.xml - center right $fp_hs (47,38) $dttm\"\n";
$xml .= " INTERVAL=\"2000\"\n";
$xml .= " TRANSITION=\"ZoomToView\" \n";
$xml .= " DURATION=\"500\" >\n";
$xml .= " </HOTSPOT>\n";
$xml .= "\n";
$xml .= " <HOTSPOT \n";
$xml .= " ID=\"5\"\n";
$xml .= " MEDIATYPE=\"url\"\n";
$xml .= " MEDIA=\"$path_btn/btn_hrcstl_050.png\"\n";
// $xml .= " URL=\"http://google.com\"\n";
$xml .= " URL=\"$php_self?q=zview_details/$fp/$fp_hs/5\"\n";
$xml .= " URLTARGET=\"_blank\"\n";
$xml .= " X=\"9000\"\n";
$xml .= " Y=\"5800\"\n";
$xml .= " ZOOM=\"30\"\n";
$xml .= " CAPTION=\"3: ".$fp."_hotspots.xml - footprint $fp_hs (90,58) $dttm\"\n";
$xml .= " INTERVAL=\"2000\"\n";
$xml .= " TRANSITION=\"ZoomToView\" \n";
$xml .= " DURATION=\"500\" >\n";
$xml .= " </HOTSPOT>\n";
$xml .= "</DATA>\n";
return( $xml );
}
function leds_zoomxml( $options ) {
$http_host=$_SERVER['HTTP_HOST'];
$php_self=$_SERVER['PHP_SELF'];
$document_root=$_SERVER['DOCUMENT_ROOT'];
$dttm=date("Ymd_His");
$zoom_code=$options[1];
$zoomxml_code=$options[2];
$xmlfile="./$zoom_code"."_".$zoomxml_code."_hotspots.xml";
$output = "";
// use existing xml file
if( file_exists( $xmlfile )) {
// $xmldata=array();
// $xmldata = file_get_contents( $xmlfile );
// $xmldata = file( $xmlfile, FILE_BINARY );
$xmldata = file( $xmlfile, FILE_TEXT );
foreach( $xmldata as $xmlline ) {
$output .= "$xmlline";
// print( "$xmlline\n" );
}
// print_r( $xmldata );
// print( "xmldata=[<hr>$xmldata<hr>]\n" );
// return;
return( $output );
}
// $xmlfile=$options[1];
// $xmlfile_args=explode( "_", $xmlfile );
// $fp = $xmlfile_args[0];
// $fp_hs = $xmlfile_args[0];
// $fp_xmlfile=$options[1];
// $fp_xmlfile_args=explode( "_", $fp_xmlfile );
// $fp=$fp_xmlfile_args[0];
// $fp_hs=$fp_xmlfile_args[1];
$path_btn="./imgs/btn";
if( $fp_hs != "" ) {
$path_btn_hs="$path_btn/btn_".$zoomxml_code.".gif";
}
else {
$path_btn_hs="$path_btn/btn_hrcstl.png";
}
$xml = "<DATA>\n";
$xml .= " <HOTSPOTSETUP\n";
$xml .= " AUTOLOOP=\"0\"\n";
$xml .= " CHOICELIST=\"2\"\n";
$xml .= " LISTSOURCE=\"CAPTION\"\n";
$xml .= " INITIALVISIBILITY=\"1\"\n";
$xml .= " MINSCALE=\"0.15\"\n";
$xml .= " MAXSCALE=\"2\"\n";
$xml .= " />\n";
$output = "";
$output .= "<!-- leds_zoomxml: BUGS3100 o1=$options[1] o2=$options[2]<br> -->\n";
$output .= "<!-- leds_zoomxml: BUGS3101 zoom_code=$zoom_code zoomxml_code=$zoomxml_code zmlfile=$xmlfile<br> -->\n";
if( ! file_exists( $GLOBALS['dbfile'] )) {
$output .= "<hr>$php_self $dttm ERR: UNAVAILABLE dbfile=[".$GLOBALS['dbfile']."]<hr>\n";
return( $output );
}
// use xmlfile if it exits
if( file_exists( $xmlfile )) {
return( $output );
}
$pdo = newpdo($GLOBALS['dbfile']);
$tblname="zoomxml";
if( $zoomxml_code != "" ) {
if( is_numeric($zoomxml_code)) {
$sql = "select * from $tblname where code == '$zoom_code' and rowid == '$zoomxml_code'";
}
else {
$sql = "select * from $tblname where code == '$zoom_code' and type == '$zoomxml_code'";
}
// if( $fp_hs == "hotspots.xml" ) {
// $tblname="fp";
// $sql = "select * from $tblname where code == '$fp'";
// }
// else {
// $tblname=$fp_hs;
// $sql = "select * from $tblname where code == '$fp'";
// }
}
else {
$sql = "select * from $tblname where code == '$zoom_code'";
}
/// if($_GET['id']) {
/// $rowid=$_GET['id'];
/// $sql .= $sql ." and rowid='$rowid' ";
/// }
// $sql = "select * from $tblname where code == '$fp'";
// print( "<hr>zivew_xmldb MSG_3128: fp=[$fp] fp_hs=[$fp_hs] id=[$id]<br>\n" );
$output .= "<!-- <hr>zoomxml MSG_3129: sql=[$sql]<hr> -->\n";
$id=100;
foreach( $pdo->query($sql) as $row ) {
$code=$row['code'];
$x=$row['x'];
$y=$row['y'];
$mediatype=$row['mediatype'];
$media=$row['media'];
$url=$row['url'];
$urltarget=$row['urltarget'];
$zoom=$row['zoom'];
$zoom="40";
$caption=$row['caption'];
$interval=$row['interval'];
$transition=$row['transition'];
$duration=$row['duration'];
$comment=$row['comment'];
// print( "zoomxml MSG_2985: x=$x y=$y comment=$comment<br>\n" );
$xml .= " <HOTSPOT \n";
$xml .= " ID=\"$id\"\n";
$xml .= " MEDIATYPE=\"$mediatype\"\n";
$xml .= " MEDIA=\"$media\"\n";
$xml .= " URL=\"$url\"\n";
// $xml .= " URL=\"$php_self?q=zview_details/$fp/$fp_hs/5\"\n";
$xml .= " URLTARGET=\"$urltarget\"\n";
$xml .= " X=\"$x\"\n";
$xml .= " Y=\"$y\"\n";
$xml .= " ZOOM=\"$zoom\"\n";
// $xml .= " CAPTION=\"3: ".$fp."_".$fp_hs."_hotspots.xml - $comment - $dttm\"\n";
$xml .= " CAPTION=\"$caption\"\n";
$xml .= " INTERVAL=\"$interval\"\n";
$xml .= " TRANSITION=\"$transition\" \n";
$xml .= " DURATION=\"$duration\" >\n";
$xml .= " </HOTSPOT>\n";
$id++;
}
$pdo=null;
$xml .= "</DATA>\n";
$xmltext=str_replace( "<", "(", $xml );
$xmltext=str_replace( ">", ")<br>", $xmltext );
print( "$xml\n" );
// print( "$xmltext\n" );
// return( $xml );
}
// pqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpq
// jquiery functions
// bdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbd
function js_scripts() {
$http_host=$_SERVER['HTTP_HOST'];
$php_self=$_SERVER['PHP_SELF'];
$themes = $GLOBALS['themes'];
$theme = $_SESSION['theme'];
// expand collapse toggle
$output_css = "<style type=\"text/css\">\n";
// $output_css .= ".layer1 {margin: 0; padding: 0; width: 600px; }\n";
$output_css .= ".layer1 {margin: 0; padding: 0; }\n";
$output_css .= ".heading { \n";
$output_css .= " margin: 1px; color: white; padding: 3px 10px; cursor: pointer;\n";
$output_css .= " position: relative; background-color:grey;\n";
$output_css .= " }\n";
// $output_css .= ".content {padding: 5px 10px; background-color:#fafafa;}\n";
$output_css .= ".content {padding: 5px 10px; background-color:white;}\n";
$output_css .= "p { padding: 5px 0; }\n";
$output_css .= "</style>\n";
$output_css .= "\n";
$output_css .= head_jqui_css($options);
$output_css_jqui_dragdrop = "";
$output_css_jqui_dragdrop .= "<style type=\"text/css\"><!--\n";
$output_css_jqui_dragdrop .= "#drop { width:200px; height:150px; margin:3px auto; background:#eddaa8; font-size:16px;}\n";
$output_css_jqui_dragdrop .= "#drop #sw { text-decoration:underline; cursor:pointer; }\n";
$output_css_jqui_dragdrop .= "#drag { width:50px; height:40px; margin:2px auto; border:1px solid silver; font-size:16px;}\n";
$output_css_jqui_dragdrop .= "#drag .drg { margin:10px 12px; }\n";
$output_css_jqui_dragdrop .= "#drag div.drg { width:150px; height:50px; background:#07da08; border:2px solid blue;}\n";
$output_css_jqui_dragdrop .= "--></style>\n";
$output_css_jqui_resizable = "";
$output_css_jqui_resizable .= " <style>\n";
$output_css_jqui_resizable .= " #resizable { width: 150px; height: 150px; padding: 0.5em; }\n";
$output_css_jqui_resizable .= " #resizable h3 { text-align: center; margin: 0; }\n";
$output_css_jqui_resizable .= " </style>\n";
$output_css_jqui_resizable .= " <script>\n";
$output_css_jqui_resizable .= " $(function() {\n";
$output_css_jqui_resizable .= " $( \"#resizable\" ).resizable();\n";
$output_css_jqui_resizable .= " });\n";
$output_css_jqui_resizable .= " </script>\n";
// $js_output = "";
if( $GLOBALS['js_output'] ) { $js_output = $GLOBALS['js_output']; }
// theme options
$gridimgpaths['redmond1']="js/themes/redmond_save/imgs";
$gridimgpaths['redmond']="js/themes/redmond/imgs";
$gridimgpaths['humanity']="js/themes/humanity/imgs";
$gridimgpaths['frog']="js/themes/le-frog/imgs";
$gridimgpaths['swanky']="js/themes/swanky-purse/imgs";
$gridimgpaths['darkness']="js/themes/ui-darkness/imgs";
$gridimgpaths['lightness']="js/themes/ui-lightness/imgs";
$gridimgpaths['sunny']="js/themes/sunny/imgs";
$gridimgpaths['mint']="js/themes/mint-choc/imgs";
$themepaths['redmond1']="js/themes/redmond_save/jquery-ui-1.7.1.custom.css";
$themepaths['redmond']="js/themes/redmond/jquery-ui-1.7.2.custom.css";
$themepaths['humanity']="js/themes/humanity/jquery-ui-1.7.2.custom.css";
$themepaths['frog']="js/themes/le-frog/jquery-ui-1.7.2.custom.css";
$themepaths['swanky']="js/themes/swanky-purse/jquery-ui-1.7.2.custom.css";
$themepaths['darkness']="js/themes/ui-darkness/jquery-ui-1.7.2.custom.css";
$themepaths['lightness']="js/themes/ui-lightness/jquery-ui-1.7.2.custom.css";
$themepaths['sunny']="js/themes/sunny/jquery-ui-1.7.2.custom.css";
$themepaths['mint']="js/themes/mint-choc/jquery-ui-1.7.2.custom.css";
$themepath=$themepaths[$theme];
$gridimgpath=$gridimgpaths[$theme];
$_SESSION['gridimgpath']=$gridimgpath;
// "js/jqgrid.3.5.3/themes/ui.jqgrid.css"
$jq_css_includes_list = array(
"js/fg-menu/fg.menu.css",
"js/fg-menu/theme/ui.all.css",
"$themepath",
"js/jqgrid-4.4.0/themes/ui.jqgrid.css"
);
foreach( $jq_css_includes_list as $jq_css_include ) {
if(! file_exists( $jq_css_include )) {
$html_theme_links = "<!-- pdo_grid ERR_2435: NOTFOUND jq_css_include=[$jq_css_include]<br>-->\n";
}
else {
$output .= "<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"$jq_css_include\" />\n";
}
}
// $output .= "\n";
$jq_includes_list = array(
// "js/jquery-1.3.2.js",
// "js/jqgrid.3.5.3/js/jquery-1.3.2.min.js",
// "js/jqgrid-4.4.0/js/jquery-1.7.2.min.js",
// "js/jqgrid-4.4.0/js/jquery-1.7.2.min.js",
// "js/jquery-ui-1.7.2/js/jquery-ui-1.7.2.custom.min.js",
"js/jquery-1.8.3.js",
"js/jquery-ui-1.9.2.custom.js",
// "js/jquery.ui.touch-punch.js",
"js/jqgrid-4.4.0/js/i18n/grid.locale-en.js",
"js/jqgrid-4.4.0/js/jquery.jqGrid.min.js",
// "js/jqgrid.3.5.3/js/i18n/grid.locale-en.js",
// "js/jqgrid.3.5.3/js/jquery.jqGrid.min.js",
"js/tooltip/tooltip_main_screenshot.js",
// "js/tooltip/tooltip_main_tooltip.js",
// "js/tooltip/tooltip_main_preview.js",
);
foreach( $jq_includes_list as $jq_include ) {
if(! file_exists( $jq_include )) {
$output .= "<!-- pdo_grid ERR_2455: NOTFOUND jq_include=[$jq_include]<br> -->\n";
}
else {
$output .= "<script src=\"$jq_include\" type=\"text/javascript\"></script>\n";
}
}
$output .= "\n";
$output .= $output_css;
// $output .= $output_css_jqui_dragdrop;
// $output .= $output_css_jqui_resizable;
$output .= "\n";
$output .= "\n";
$output .= "<script type=\"text/javascript\"><!--\n";
$output .= "var gridimgpath = '$gridimgpath';\n";
$output .= "$(document).ready(function(){\n";
///// $output_dragdrop1 = jqui("dragdrop1");
//// $output_dragdrop2 = jqui("dragdrop2");
//// $output_dragdrop2 = "--></script>\n";
//// printf( "BUGS_13774: output=$output output_dragdrop1=$output_dragdrop1 <br>\n" );
//// printf( "BUGS_13774: output=$output output_dragdrop2=$output_dragdrop2 <br>\n" );
//// printf( "BUGS_13775: output=$output<br>\n" );
//// return;
//// $output .= " jQuery().ready(function(){\n";
$output .= $js_output;
//// $output_dragdrop = jqui("dragdrop");
//// $output .= $output_dragdrop;
//// $output .= "jQuery(document).ready(function(){\n";
//// $output .= " jQuery(\".content\").hide();\n";
//// $output .= " jQuery(\".heading\").click(function() {\n";
//// $output .= " jQuery(this).next(\".content\").slideToggle(500);\n";
//// $output .= " });\n";
//// $output .= " });\n";
//// $output .= " });\n";
$output .= jqui_script($options);
$output .= "--></script>\n";
$output .= "</script>\n";
//// $output .= "</script>\n";
$output .= "<!-- BUGS_13800 testjk --->\n";
// $output .= "\n";
// $output .= $html_theme_links;
// $output .= "\n";
//// if( $options[0] == "fgmenu_htm" ) {
//// $output .= fgmenu_js( $options );
//// }
//// if( $options[0] == "fgmenu_dyn" ) {
//// $output .= fgmenu_js( $options );
//// }
return( $output );
}
function head_jqui_css($options) {
$output .= "<style>\n";
$output .= "#ko { \n";
// $output .= " background-image: url(imgs/ko/ko_100.png); \n";
$output .= " width: 90px; \n";
$output .= " height: 25px; \n";
$output .= " padding: 0.5em; \n";
$output .= " float: left; \n";
$output .= " margin: 10px 10px 10px 0; \n";
$output .= " }\n";
$output .= "#ko_drag { \n";
$output .= " background-color:white; \n";
// $output .= " background-image: url(imgs/ko/kob.png); \n";
$output .= " width: 90px; \n";
$output .= " height: 25px; \n";
$output .= " float: left; \n";
$output .= " padding: 0.5em; \n";
$output .= " margin: 10px 10px 10px 0; \n";
$output .= " }\n";
$output .= "#ko_drop { \n";
$output .= " background-color:white; \n";
// $output .= " background-image: url(imgs/ko/kiw.png); \n";
$output .= " width: 90px; \n";
$output .= " height: 20px; \n";
$output .= " padding: 0.5em; \n";
$output .= " float: left; \n";
$output .= " margin: 10px 10px 10px 0; \n";
$output .= " }\n";
$output .= "#ko_dragdrop { \n";
// $output .= " background-color:black; \n";
// $output .= " background-image: url(imgs/ko/kib.png); \n";
$output .= " width: 90; \n";
$output .= " height: 25; \n";
$output .= " padding: 0.5em; \n";
$output .= " float: left; \n";
$output .= " margin: 10px 10px 10px 0; \n";
$output .= " }\n";
$output .= "#ko_dropdrag { \n";
$output .= " background-color:white; \n";
// $output .= " background-image: url(imgs/ko/kiw.png); \n";
$output .= " width: 90; \n";
$output .= " height: 25; \n";
$output .= " padding: 0.5em; \n";
$output .= " float: left; \n";
$output .= " margin: 10px 10px 10px 0; \n";
$output .= " }\n";
$output .= "</style>\n";
$output .= html_style_leds_context();
return($output);
}
function jqui_script($options) {
// $output .= "<script> \n";
// $output .= " $(function() {\n";
$output .= " $(\"#ko\").draggable().droppable().resizable();\n";
$output .= " $(\"#ko_drag\").draggable();\n";
$output .= " $(\"#ko_drop\").droppable();\n";
$output .= " $(\"#ko_dragdrop\").draggable().droppable();\n";
$output .= " $(\"#ko_dropdrag\").droppable().draggable();\n";
$output .= " $( \"#ko\" ).droppable({\n";
$output .= " drop: function( event, ui ) {\n";
$output .= " var draggable_id = $(ui.draggable).attr('id');\n";
$output .= " var droppable_id = $(this).attr('id');\n";
$output .= " var url= \"https://ka6/ko_center/ko_center.php?q=jqui/ko/\"+ droppable_id + \"/\"+ draggable_id;\n";
$output .= "// alert( \"droppaable: \" + draggable_id + \" drop=\" + droppable_id );\n";
$output .= " alert( \"ko: \" + url );\n";
$output .= "// window.location = \"url\";\n";
$output .= " }\n";
$output .= " });\n";
$output .= " $( \"#ko_drag\" ).droppable({\n";
$output .= " drop: function( event, ui ) {\n";
$output .= " var draggable_id = $(ui.draggable).attr('id');\n";
$output .= " var droppable_id = $(this).attr('id');\n";
$output .= " var url= \"https://ka6/ko_center/ko_center.php?q=jqui/ko_drag/\"+ droppable_id + \"/\"+ draggable_id;\n";
$output .= "// alert( \"droppaable: \" + draggable_id + \" drop=\" + droppable_id );\n";
$output .= " alert( \"ko_drag: \" + url );\n";
$output .= "// window.location = \"url\";\n";
$output .= " }\n";
$output .= " });\n";
$output .= " $( \"#ko_drop\" ).droppable({\n";
$output .= " drop: function( event, ui ) {\n";
$output .= " var draggable_id = $(ui.draggable).attr('id');\n";
$output .= " var droppable_id = $(this).attr('id');\n";
$output .= " var url= \"https://ka6/ko_center/ko_center.php?q=jqui/ko_drop/\"+ droppable_id + \"/\"+ draggable_id;\n";
$output .= "// alert( \"droppaable: \" + draggable_id + \" drop=\" + droppable_id );\n";
$output .= " alert( \"ko_drop: \" + url );\n";
$output .= "// window.location = \"url\";\n";
$output .= " }\n";
$output .= " });\n";
$output .= " $( \"#ko_dragdrop\" ).droppable({\n";
$output .= " drop: function( event, ui ) {\n";
$output .= " var draggable_id = $(ui.draggable).attr('id');\n";
$output .= " var droppable_id = $(this).attr('id');\n";
$output .= " var url= \"https://ka6/ko_center/ko_center.php?q=jqui/ko_drop/\"+ droppable_id + \"/\"+ draggable_id;\n";
$output .= "// alert( \"droppaable: \" + draggable_id + \" drop=\" + droppable_id );\n";
$output .= " alert( \"ko_dragdrop: \" + url );\n";
$output .= "// window.location = \"url\";\n";
$output .= " }\n";
$output .= " });\n";
$output .= " $( \"#ko_dropdrag\" ).droppable({\n";
$output .= " drop: function( event, ui ) {\n";
$output .= " var draggable_id = $(ui.draggable).attr('id');\n";
$output .= " var droppable_id = $(this).attr('id');\n";
$output .= " var url= \"https://ka6/ko_center/ko_center.php?q=jqui/ko_drop/\"+ droppable_id + \"/\"+ draggable_id;\n";
$output .= "// alert( \"droppaable: \" + draggable_id + \" drop=\" + droppable_id );\n";
$output .= " alert( \"drop: \" + url );\n";
$output .= "// window.location = \"url\";\n";
$output .= " }\n";
$output .= " });\n";
$output .= " });\n";
// $output .= "</script>\n";
$output .= "\n";
return( $output );
}
function js_rollover( $options ) {
$output .= "<p><ul id=\"navigation\">\n";
$output .= " <li><a href=\"#1\"><img src=\"./imgs/btn/btn_black.gif\" border=\"0\"/></a></li>\n";
$output .= " <li><a href=\"#2\"><img src=\"./imgs/btn/btn_black.gif\" border=\"0\"/></a></li>\n";
$output .= " <li><a href=\"#3\"><img src=\"./imgs/btn/btn_black.gif\" border=\"0\"/></a></li>\n";
$output .= " <li><a href=\"#4\"><img src=\"./imgs/btn/btn_black.gif\" border=\"0\"/></a></li>\n";
$output .= " <li><a href=\"#5\"><img src=\"./imgs/btn/btn_black.gif\" border=\"0\"/></a></li>\n";
$output .= " </ul></p>\n";
$output .= "\n";
print( "$output" );
}
function css_rollovers_head( $options ) {
$output = "<style media=\"screen_blobs\">\n";
$output .= "\n";
$output .= "#blobs {\n";
$output .= " width: 300px;\n";
$output .= " height: 150px;\n";
$output .= " background: url(./imgs/icons/blobs.gif);\n";
$output .= " margin: 10px auto; padding: 0;\n";
$output .= " position: relative;\n";
$output .= "}\n";
$output .= "#blobs li {margin: 0; padding: 0; list-style: none; display: block; position: absolute;}\n";
$output .= "\n";
$output .= "#blobs a {display: block;}\n";
$output .= "\n";
$output .= "#blob1 {left: 9px; top: 7px; width: 86px; height: 130px;}\n";
$output .= "#blob2 {left: 77px; top: 16px; width: 79px; height: 86px;}\n";
$output .= "#blob3 {left: 160px; top: 0px; width: 112px; height: 77px;}\n";
$output .= "#blob4 {left: 173px; top: 57px; width: 120px; height: 80px;}\n";
$output .= "#blob5 {left: 110px; top: 102px; width: 98px; height: 45px;}\n";
$output .= "#blob1 a {height: 130px;}\n";
$output .= "#blob2 a {height: 86px;}\n";
$output .= "#blob3 a {height: 77px;}\n";
$output .= "#blob4 a {height: 80px;}\n";
$output .= "#blob5 a {height: 45px;}\n";
$output .= "\n";
$output .= "#blob1 a:hover {background: url(./imgs/icons/blobs.gif) -10px -307px no-repeat;}\n";
$output .= "#blob2 a:hover {background: url(./imgs/icons/blobs.gif) -77px -166px no-repeat;}\n";
$output .= "#blob3 a:hover {background: url(./imgs/icons/blobs.gif) -160px -300px no-repeat;}\n";
$output .= "#blob4 a:hover {background: url(./imgs/icons/blobs.gif) -173px -207px no-repeat;}\n";
$output .= "#blob5 a:hover {background: url(./imgs/icons/blobs.gif) -110px -402px no-repeat;}\n";
$output .= "\n";
$output .= " </style>\n";
$output .= "\n";
return( $output );
// print( "$output" );
}
function css_rollovers_href( $options ) {
$output .= "<div id=\"screen_blobs\">\n";
$output .= " <ul id=\"blobs\">\n";
$output .= " <li id=\"blob1\"><a href=\"#1\"></a></li>\n";
$output .= " <li id=\"blob2\"><a href=\"#2\"></a></li>\n";
$output .= " <li id=\"blob3\"><a href=\"#3\"></a></li>\n";
$output .= " <li id=\"blob4\"><a href=\"#4\"></a></li>\n";
$output .= " <li id=\"blob5\"><a href=\"#5\"></a></li>\n";
$output .= " </ul>\n";
$output .= " </div>\n";
$output .= "\n";
return( $output );
// print( "$output" );
}
// pqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpq
// todo snippets
// bdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbd
// Example 602. Dump message structure
// php_self?q=mail
function ko_imap($options) {
$host="localhost"; $user="user"; $pass="pass";
if( $options[1] != "" ) { $mode=$options[1]; }
if( $options[2] != "" ) { $host=$options[2]; }
if( $options[3] != "" ) { $user=$options[3]; }
if( $options[4] != "" ) { $pass=$options[4]; }
$message=1;
if( $_GET['message'] ) { $message=$_GET['message']; }
print( "<hr>ko_imap message=$message<br>\n" );
print_r($options);
$mailmodes = array( 'status', 'ping', 'info', 'listmailbox', 'attachments', 'struct', 'nummsg' );
if( $mode == "" ) {
$output = "";
foreach( $mailmodes as $mailmode ) {
$output .= "<a href=\"$php_self?q=mail/$mailmode\" target=_blank>$mailmode</a><br>\n";
}
print( $output );
return;
}
$imap = imap_open("{$host}INBOX","$user","$pass");
// $imap = imap_open("{$host:110/pop3}INBOX", $user, $pass);
// $imap = imap_open("{imap.mycompany.com:993/imap/ssl}INBOX", $user, $pass);
if (!$imap) { print_r(imap_errors());
return;
}
if( $mode == "ping" ) {
if (imap_ping($imap)) {
echo "ko_imap MSG: ping $host $user<br>";
}
else {
echo "ko_imap ERR: ping $host $user<br>";
}
}
if( $mode == "status" ) {
$status = imap_status($imap, "{localhost}INBOX", SA_ALL);
echo "Messages: ", $status->messages, "<BR>\n";
echo "Recent: ", $status->recent, "<BR>\n";
echo "Unseen: ", $status->unseen, "<BR>\n";
echo "UIDnext: ", $status->uidnext, "<BR>\n";
echo "UIDvalidity: ", $status->uidvalidity, "<BR>\n";
echo "Flags: ", $status->flags, "<BR>\n";
var_dump($status);
}
if( $mode == "info" ) {
$info = imap_mailboxmsginfo($imap);
echo "Date: " , $info->Date, "\n";
echo "Driver: ", $info->Driver, "\n";
echo "Mailbox: ", $info->Mailbox, "\n";
echo "Number of messages: ", $info->Nmsgs, "\n";
echo "Recent: ", $info->Recent, "\n";
echo "Unread; ", $info->Unread, "\n";
echo "Deleted: ", $info->Deleted, "\n";
echo "Size: ", $info->Size, "\n";
}
if( $mode == "nummsg" ) {
$number = imap_num_msg($imap);
echo "Number of messages: $number<BR>\n";
// display message subjects
for ($i=1; $i<=$number; $i++) {
$header = imap_header($imap, $i);
echo "Subject: ", $header->Subject, "<BR>\n";
}
}
if( $mode == "struct" ) {
// duimp out every property of the message
echo "<pre>\n\n";
print_r(imap_fetchstructure($imap, $message));
echo "\n\n</pre>";
}
// list mailboxes
if( $mode == "listmailbox" ) {
$boxes = imap_listmailbox($imap, "{localhost}", "*");
for ($i=0; $i<count($boxes); $i++) {
echo "Mailbox: $boxes[$i]<BR>\n";
}
}
if( $mode == "attachments" ) {
$info = imap_fetchstructure($imap, $message);
// find out how may parts the object has
$numparts = count($info->parts);
// find if if multipart message
if ($numparts > 1) {
echo "More then one part<BR>";
foreach ($info->parts as $part) {
if ($part->disposition == "INLINE") {
// inline message. Show number of lines
printf("Inline message has %s lines<BR>", $part->lines);
} elseif ($part->disposition == "ATTACHMENT") {
// an attachment
echo "Attachment found!";
// print out the file name
echo "Filename: ", $part->dparameters[0]->value;
}
}
}
else {
// only one part so get some useful info
echo "Only one part";
}
}
imap_close($imap);
}
function ko_sessions_start() {
session_start();
$_SESSION['user'] = $_POST['user'];
$_SESSION['data'] = $_POST['data'];
$_SESSION['hash'] = $_POST['hash'];
// $output = "<input type=\"hidden\" name=\"user\" value=\"" . htmlentities($_POST['user']) . "\">";
// $output .= "<input type=\"hidden\" name=\"data\" value=\"" . htmlentities($_POST['data']) . "\">";
// $output .= "<input type=\"hidden\" name=\"hash\" value=\"" . htmlentities($_POST['hash']) . "\">";
}
function ko_sessions() {
session_start();
$user=htmlentities($_SESSION['user']);
$data=htmlentities($_SESSION['data']);
$hash=htmlentities($_SESSION['hash']);
// if( isset($_SESSION['user'])) { ; }
// if( isset($_SESSION['role'])) { unset($_SESSION['role']); session_destroy(); }
}
function ko_validata() {
$secret = 'temp_secret_hash_code';
if (! $data = pc_decode($_POST['data'], $_POST['hash'])) {
print( "ko_validate ERR: crack attempt<br>\n" );
}
// process form
// updata data
$data['user'] = $_POST['user'];
$data['stage']++;
unset($data['password']);
list ($data, $hash) = pc_encode($data);
// store data and hash in form
$output = "<form action=\"".$_SERVER['php_self']."?$query_string\" method=\"post\">";
$output .= "<input type=\"hidden\" name=\"data\" value=\"" . htmlentities($data)."\">\n";
$output .= "<input type=\"hidden\" name=\"hash\" value=\"" . htmlentities($hash)."\">\n";
$output .= "</form>\n";
}
function ko_validate_form() {
if(! ko_validate_form_user($_POST['user'])) {
$errors['user'] = "ERR: user";
}
if(! ko_validate_form_pass($_POST['pass'])) {
$errors['pass'] = "ERR: pass";
}
return $errors;
}
function ko_validate_form_user($user) {
}
function ko_validate_form_pass($pass) {
}
function ko_print_form($errors) {
$fields = array('name' => 'Name',
'rank' => 'Rank',
'serial' => 'Serial');
if( count($errors)) { print( "ko_print_form ERR: <br>\n" );}
$output = "<table>\n";
foreach( $fields as $field => $field_name) {
$output .= "<tr><td>";
if( !empty($errors[$field])) {
$output .= $errors[$field];
}
else {
$output .= " ";
}
$output .= "</td><td>";
$values = isset($_POST['field']) ? htmlentities($_POST['$field']) : '';
$output .= "$field_name";
$output .= "<input type=\"text\" name=\"$field\" value=\"$value\">";
$output .= "</td></tr>";
}
$output .= "</table>\n";
print( "$output" );
}
function ko_unique() {
$unique_id = unique_id(microtime(),1);
$output = "<input type=\"hidden\" name=\"unique_id\" value=\"".$unique_id."\">";
}
function ko_unique1() {
$GLOBALS['tblname'];
$unique_id = $pdo->quote($_POST['unique_id']);
$sth = $pdo->query("SELECT * from $tblname where unique_id = $unique_id");
if( $sth->numRows()) {
$output = "ERR ko_unique1<br>\n";
}
}
function pc_encode($data) {
$data = serialize($data);
$hash = md5($GLOBALS['secret'] . $data);
return array($data,$hash);
}
function pc_decode($data, $hash) {
if( !empty($data) && !empty($hash)) {
if( md5($GLOBALS['secret'] . $data) == $hash) {
return unserialize($data);
}
else {
error_log("pc_decode ERR: data modified");
return false;
}
}
return false;
}
// datefunctions ==========================
// get the number of seconds between the two dates
function datediff ($interval,$date1,$date2) {
$timedifference = $date2 - $date1;
switch ($interval) {
// case 'w': $retval = bcdiv($timedifference,604800); break;
// case 'd': $retval = bcdiv($timedifference,86400); break;
// case 'h': $retval = bcdiv($timedifference,3600); break;
// case 'n': $retval = bcdiv($timedifference,60); break;
// case 's': $retval = $timedifference; break;
}
return $retval;
}
function datediff_leds( $diffdays ) {
// print( "<hr>BUGS datediff_leds BEG: diffdays=[$diffdays] color=[$color] speed=[$speed]<br><hr>\n" );
switch( $diffdays ) {
case ( $diffdays > 30 ): $color="red"; $speed="00"; break;
case ( $diffdays > 14 ) && ( $diffdays < 30): $color="red"; $speed="20"; break;
case ( $diffdays > 7 ): $color="red"; $speed="40"; break;
case ( $diffdays > 3 ): $color="red"; $speed="60"; break;
case ( $diffdays > 1 ): $color="red"; $speed="70"; break;
case ( $diffdays == 1 ): $color="red"; $speed="80"; break;
case ( $diffdays == 0 ): $color="blu"; $speed="00"; break;
case ( $diffdays == "" ): $color="blu"; $speed="00"; break;
case ( $diffdays == -1 ): $color="red"; $speed="90"; break;
case ( $diffdays < -31 ): $color="grn"; $speed="00"; break;
case ( $diffdays < -30 ): $color="blu"; $speed="00"; break;
case ( $diffdays < -14 ): $color="blu"; $speed="40"; break;
case ( $diffdays < -7 ): $color="blu"; $speed="50"; break;
case ( $diffdays < -3 ): $color="blu"; $speed="60"; break;
case ( $diffdays < -2 ): $color="blu"; $speed="70"; break;
case ( $diffdays < -1 ): $color="blu"; $speed="80"; break;
}
// print( "<hr>BUGS datediff_leds END: diffdays=[$diffdays] color=[$color] speed=[$speed]<br><hr>\n" );
return array( $diffdays, $color, $speed );
}
// fgmenu ====================================================================
function fgmenu_head($options) {
$output .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
$output .= "\n";
$output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n";
$output .= "<head>\n";
$output .= "<title>fgmenu $options[0] $options[1]</title>\n";
$output .= " <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n";
$output .= " \n";
$output .= " <script type=\"text/javascript\" src=\"./js/fg-menu/jquery-1.3.2.min.js\"></script>\n";
// $output .= " <script type=\"text/javascript\" src=\"./js/fg-menu/fg.menu.js\"></script>\n";
$output .= " <script type=\"text/javascript\" src=\"./js/fg-menu/fg.menu_ko.js\"></script>\n";
/// $output .= " <script type=\"text/javascript\" src=\"./js/jqgrid.3.5.3/js/jquery.jqGrid.min.js\"></script>\n";
/// $output .= " <script type=\"text/javascript\" src=\"./js/jqgrid.3.5.3/js/i18n/grid.locale-en.js\"></script>\n";
$output .= " <script type=\"text/javascript\" src=\"./js/jqgrid-4.4.0/js/jquery.jqGrid.min.js\"></script>\n";
$output .= " <script type=\"text/javascript\" src=\"./js/jqgrid-4.4.0/js/i18n/grid.locale-en.js\"></script>\n";
$output .= " \n";
$output .= " <link type=\"text/css\" href=\"./js/fg-menu/fg.menu.css\" media=\"screen\" rel=\"stylesheet\" />\n";
$output .= " <link type=\"text/css\" href=\"./js/fg-menu/theme/ui.all.css\" media=\"screen\" rel=\"stylesheet\" />\n";
$output .= " \n";
$output .= " <!-- styles for this example page only -->\n";
$output .= " <style type=\"text/css\">\n";
$output .= " body { font-size:62.5%; margin:0; padding:0; }\n";
$output .= " #menuLog { font-size:1.4em; margin:20px; }\n";
$output .= " .hidden { position:absolute; top:0; left:-9999px; width:1px; height:1px; overflow:hidden; }\n";
$output .= " \n";
$output .= " .fg-button { clear:left; margin:0 4px 40px 20px; padding: .4em 1em; text-decoration:none !important; cursor:pointer; position: relative; text-align: center; zoom: 1; }\n";
$output .= " .fg-button .ui-icon { position: absolute; top: 50%; margin-top: -8px; left: 50%; margin-left: -8px; }\n";
$output .= " a.fg-button { float:left; }\n";
$output .= " button.fg-button { width:auto; overflow:visible; } /* removes extra button width in IE */n";
$output .= " \n";
$output .= " .fg-button-icon-left { padding-left: 2.1em; }\n";
$output .= " .fg-button-icon-right { padding-right: 2.1em; }\n";
$output .= " .fg-button-icon-left .ui-icon { right: auto; left: .2em; margin-left: 0; }\n";
$output .= " .fg-button-icon-right .ui-icon { left: auto; right: .2em; margin-left: 0; }\n";
$output .= " .fg-button-icon-solo { display:block; width:8px; text-indent: -9999px; } /* solo icon buttons must have block properties for the text-indent to work */ n";
$output .= " \n";
$output .= " .fg-button.ui-state-loading .ui-icon { background: url(spinner_bar.gif) no-repeat 0 0; }\n";
$output .= " </style>\n";
$output .= " \n";
$output .= " <!-- style exceptions for IE 6 -->\n";
$output .= " <!--[if IE 6]>\n";
$output .= " <style type=\"text/css\">\n";
$output .= " .fg-menu-ipod .fg-menu li { width: 95%; }\n";
$output .= " .fg-menu-ipod .ui-widget-content { border:0; }\n";
$output .= " </style>\n";
$output .= " <![endif]--> \n";
$output .= " \n";
// $output = "";
// $output .= "<hr>fgmenu_head<hr>\n";
return( $output );
}
function fgmenu_js($options) {
$role=$_SESSION['role'];
// $role=$options[1];
$output .= " <script type=\"text/javascript\"> \n";
$output .= " $(function(){\n";
$output .= " // BUTTONS\n";
$output .= " $('.fg-button').hover(\n";
$output .= " function(){ $(this).removeClass('ui-state-default').addClass('ui-state-focus'); },\n";
$output .= " function(){ $(this).removeClass('ui-state-focus').addClass('ui-state-default'); }\n";
$output .= " );\n";
$output .= " \n";
// $output .= " // MENUS \n";
// $output .= " $('#flat').menu({ \n";
// $output .= " content: $('#flat').next().html(), // grab content from this page\n";
// $output .= " showSpeed: 400 \n";
// $output .= " });\n";
// $output .= " \n";
// $output .= " $('#hierarchy').menu({\n";
// $output .= " content: $('#hierarchy').next().html(),\n";
// $output .= " crumbDefaultText: ' '\n";
// $output .= " });\n";
// $output .= " \n";
$output .= " $('#hierarchybreadcrumb').menu({\n";
$output .= " content: $('#hierarchybreadcrumb').next().html(),\n";
$output .= " backLink: false\n";
$output .= " });\n";
$output .= " \n";
$output .= " });\n";
$output .= " </script>\n";
$output .= " \n";
// $output .= " <!-- theme switcher button -->\n";
// $output .= " <script type=\"text/javascript\" src=\"http://ui.jquery.com/applications/themeroller/themeswitchertool/\"></script>\n";
// $output .= " <script type=\"text/javascript\"> $(function(){ $('<div style=\"position: absolute; top: 20px; right: 300px;\" />').appendTo('body').themeswitcher(); }); </script>\n";
$output .= "</head>\n";
$output .= "\n";
return( $output );
}
function fgmenu_htm($options) {
$php_self=$_SERVER['PHP_SELF'];
$role=$_SESSION['role'];
// $role=$options[1];
$output = "<hr>$php_self fgmenu [".$options[0]."][".$options[1]."][".$options[2]."]<br><hr>\n";
$output .= fgmenu_head($options);
$output .= fgmenu_js($options);
$output .= html_btn_squares( $options, "" );
$output .= fgmenu_htm_body($options);
print( "$output\n" );
}
function fgmenu_htm_body($options) {
$php_self=$_SERVER['PHP_SELF'];
$role=$_SESSION['role'];
// $role=$options[1];
if( $role == "" ) {
$menucontent="./js/fg-menu/menuContent.html";
}
else {
$menucontent="./js/fg-menu/menuContent_$role.html";
}
$output = "";
$output .= "<p id=\"menuLog\">menuSelection_html $role: <span id=\"menuSelection\"></span></p>\n";
$output .= " <script type=\"text/javascript\"> \n";
$output .= " $.get('$menucontent', function(data){\n";
$output .= " $('#hierarchybreadcrumb').menu({ content: data, backLink: false });\n";
// $output .= " $('#hierarchybreadcrumb').menu({ content: data, hierarchybreadcrumb: true });\n";
$output .= " });\n";
$output .= " </script>\n";
$output .= "<a tabindex=\"0\" href=\"#fgmenu_htm_$role\" ";
$output .= " class=\"fg-button fg-button-icon-right ui-widget ui-state-default ui-corner-all\" ";
$output .= " id=\"hierarchybreadcrumb\"><span class=\"ui-icon ui-icon-triangle-1-s\"></span>\n";
$output .= " fgmenu_htm_$role\n";
$output .= " </a>\n";
$output .= "<div id=\"fgmenu_htm_$role\" class=\"hidden\">\n";
// $output .= "<ul>\n";
// $output .= " <li><a href=\"#$php_self?q=menu/1\">Menu_1</a>\n";
// $output .= " <ul>\n";
// $output .= " <li><a href=\"#$php_self?q=menu/1/1\">Menu_1_1</a></li>\n";
// $output .= " <li><a href=\"#$php_self?q=menu/1/2\">Menu_1_2</a></li>\n";
// $output .= " <li><a href=\"#$php_self?q=menu/1/3\">Menu_1_3</a></li>\n";
// $output .= " </ul>\n";
// $output .= " </li>\n";
// $output .= " </ul>\n";
$output .= " </div>\n";
return( $output );
}
function fgmenu_dyn($options) {
$php_self=$_SERVER['PHP_SELF'];
$role=$_SESSION['role'];
// $role=$options[1];
$output = "<hr>$php_self fgmenu [".$options[0]."][".$options[1]."][".$options[2]."]<br><hr>\n";
$output .= fgmenu_head($options);
$output .= fgmenu_js($options);
$output .= "<body bgcolor=\"lightblue\">\n";
$output .= fgmenu_dyn_body($options);
$output .= "</body>\n";
$output .= "</html>\n";
print( "$output\n" );
}
function fgmenu_dyn_body($options) {
$php_self=$_SERVER['PHP_SELF'];
$role=$_SESSION['role'];
print( "<hr>fgmenu_dyn_body MSG3339: role=[$role] <hr>\n" );
// $role=$options[1];
$menu_id=$role;
$menus[""][] = "?fgmenu/menu1,menu1";
$menus[""][] = "?fgmenu/menu2,menu2";
$menus[""][] = "?fgmenu/menu3,menu3";
$menus[""][] = "?fgmenu/menu4,menu4";
$menus[1][] = "?fgmenu/1,menu1";
$menus[1][] = "?fgmenu/2,menu2";
$menus[1][] = "?fgmenu/3,menu3";
$menus[1][] = "?fgmenu/4,menu4";
$menus[1][] = "?fgmenu/5,menu5";
$menus[1][] = "?fgmenu/6,menu6";
$menus[1][] = "?fgmenu/7,menu7";
$menus[2][] = "?fgmenu/2/1,menu1";
$menus[2][] = "?fgmenu/2/1/1,!menu11";
$menus[2][] = "?fgmenu/2/1/2,!menu12";
$menus[2][] = "?fgmenu/2/1/3,!menu13";
$menus[2][] = "?fgmenu/2/1/4,!menu14";
$menus[2][] = "?fgmenu/2/1/5,!menu15";
$menus[2][] = "?fgmenu/2/1/6,!menu16";
// $menus[2][] = "?fgmenu/2/1/1/1,!!menu111";
// $menus[2][] = "?fgmenu/2,menu3";
$menus[3][] = "?fgmenu/3/1,menu1";
$menus[3][] = "?fgmenu/3/2,menu2";
$menus[3][] = "?fgmenu/3/2/1,!menu2-1";
$menus[3][] = "?fgmenu/3/2/2,!menu2-2";
$menus[3][] = "?fgmenu/3/2/3,!menu2-3";
$menus[3][] = "?fgmenu/3/3,menu3";
$menus[3][] = "?fgmenu/3/3/1,!menu3-1";
$menus[3][] = "?fgmenu/3/3/2,!menu3-2";
$menus[3][] = "?fgmenu/3/3/2/1,!!menu3-2-1";
$menus[3][] = "?fgmenu/3/3/2/2,!!menu3-2-2";
$menus[3][] = "?fgmenu/3/3/2/3,!!menu3-2-3";
$menus[5][] = "?fgmenu/5/1,menu5-1";
$menus[5][] = "?fgmenu/5/1/1,!menu5-11";
$menus[anon][] = "?login/,login";
$menus[anon][] = "?logout/,logout";
$menus[anon][] = "?logout/,logout";
$menus[anon][] = "?menu/,menu";
$menus[anon][] = "?view/,view";
$menus[anon][] = "?update/,update";
$menus[admin][] = "?fgmenu/admin/db,db";
$menus[admin][] = "?fgmenu/admin/unload,!unload";
$menus[admin][] = "?fgmenu/admin/load,!load";
$menus[admin][] = "?fgmenu/admin/query,!query";
$menus[admin][] = "?fgmenu/admin/media,media";
$menus[admin][] = "?fgmenu/zoom,!zoom";
$menus[admin][] = "?fgmenu/objects,!object";
$menus[admin][] = "?fgmenu/pano,!pano";
$menus[users][] = "?fgmenu/users/update,update";
$menus[users][] = "?fgmenu/users/zoom,zoom";
$menus[users][] = "?fgmenu/users/object,object";
$menus[users][] = "?fgmenu/users/pano,pano";
$menus[op][] = "?fgmenu/op/iperms,iperms";
$menus[op][] = "?fgmenu/op/iperms,!periods_p";
$menus[op][] = "?fgmenu/op/iperms,!periods_pp";
$menus[op][] = "?fgmenu/op/iperms,!job2db";
$menus[op][] = "?fgmenu/op/iperms,!!mkwl";
$menus[op][] = "?fgmenu/op/iperms,!!viwl";
$menus[op][] = "?fgmenu/op/iperms,!!catwl";
$menus[op][] = "?fgmenu/op/iperms,!!runwl";
$menus[op][] = "?fgmenu/op/aors,!aors";
$menus[op][] = "?fgmenu/op/aors/txt2tif,!!txt2tif";
$menus[op][] = "?fgmenu/op/aors/txt2tif/mkwl,!!!mkwl";
$menus[op][] = "?fgmenu/op/aors/txt2tif/catwl,!!!catwl";
$menus[op][] = "?fgmenu/op/aors/txt2tif/runwl,!!!runwl";
$menus[op][] = "?fgmenu/op/aors/tif2api,!!tif2api";
$menus[op][] = "?fgmenu/op/aors/tif2api/mkwl,!!!mkwl";
$menus[op][] = "?fgmenu/op/aors/tif2api/catwl,!!!catwl";
$menus[op][] = "?fgmenu/op/aors/tif2api/runwl,!!!runwl";
$menus[op][] = "?fgmenu/op/ltrs,!ltrs";
$menus[op][] = "?fgmenu/op/ltrs/txt2tif,!!txt2tif";
$menus[op][] = "?fgmenu/op/ltrs/txt2tif/mkwl,!!!mkwl";
$menus[op][] = "?fgmenu/op/ltrs/txt2tif/catwl,!!!catwl";
$menus[op][] = "?fgmenu/op/ltrs/txt2tif/runwl,!!!runwl";
$menus[op][] = "?fgmenu/op/ltrs/tif2api,!!tif2api";
$menus[op][] = "?fgmenu/op/ltrs/tif2api/mkwl,!!!mkwl";
$menus[op][] = "?fgmenu/op/ltrs/tif2api/catwl,!!!catwl";
$menus[op][] = "?fgmenu/op/ltrs/tif2api/runwl,!!!runwl";
$menus[op][] = "?fgmenu/op/db/,db";
$menus[jk][] = "?fgmenu/jk/1,jk_menu1";
if( $menu_id == "" ) {
$j=0;
foreach( $menus as $key => $val ) {
$j++;
// print( "$j $key $val<br>\n" );
}
return;
}
if(! array_key_exists( $menu_id, $menus )) {
// print( "ERR_301: NOTFOUND menu_id=$menu_id <br>\n" );
return;
}
$output = "";
$output .= "<p id=\"menuLog\">menuSelection_dyn $role: <span id=\"menuSelection\"></span></p>\n";
$output .= "<a tabindex=\"0\"\n";
$output .= " href=\"#fgmenu_dyn_$role\" ";
$output .= " class=\"fg-button fg-button-icon-right ui-widget ui-state-default ui-corner-all\"\n";
$output .= " id=\"hierarchybreadcrumb\">\n";
$output .= " <span class=\"ui-icon ui-icon-triangle-1-s\"></span>\n";
$output .= " fgmenu_dyn_$role\n";
$output .= " </a>\n";
$output .= "<div id=\"fgmenu_dyn_$role\" class=\"hidden\">\n";
$fg_output = ""; $item_id=0;
// fatal error menutree( &$item_id, $menus[$role], &$fg_output );
// $item_id=0; $level=0; $fg_output="";
// foreach( $menus[$menu_id] as $menu_items ) {
// $menu_item = explode( ",", $menu_items );
// $menu_href=$menu_item[0];
// $menu_item=$menu_item[1];
// print( "items=$items<br>\n" );
// print( "menu_id=$menu_id [$menu_href] [$menu_item]<br>\n" );
// print( "menu_id=$menu_id $item_id $item<br>\n" );
// menutree( $menu_id, $item_id, $menus, &$fg_output );
// $item_id++;
// }
$output .= $fg_output;
$output .= "</div><hr>\n";
// $output = "<div id=\"fgmenu_dyn_$role\" class=\"hidden\">\n";
// $output .= "<ul>\n";
// $output .= " <li><a href=\"#$php_self?q=menu/1\">Menu_1</a>\n";
// $output .= " <ul>\n";
// $output .= " <li><a href=\"#$php_self?q=menu/1/1\">Menu_1_1</a></li>\n";
// $output .= " <li><a href=\"#$php_self?q=menu/1/2\">Menu_1_2</a></li>\n";
// $output .= " <li><a href=\"#$php_self?q=menu/1/3\">Menu_1_3</a></li>\n";
// $output .= " </ul>\n";
// $output .= " </li>\n";
// $output .= " </ul>\n";
// $output .= " </div>\n";
$tmp_output=$fg_output;
$tmp_output=str_replace( "<a href", "(a href", $tmp_output );
$tmp_output=str_replace( "</a>", "(/a)<br>", $tmp_output );
$tmp_output=str_replace( "<li>", "(li)", $tmp_output );
$tmp_output=str_replace( "</li>", "(/li)<br>", $tmp_output );
$tmp_output=str_replace( "<ul>", "(ul)", $tmp_output );
$tmp_output=str_replace( "</ul>", "(/ul)<br>", $tmp_output );
print( "<hr>BUGS_3421 fgmenu_dyn_body<br>\n" );
print_r($menus[$role]);
print( "<hr>\n" );
print( $tmp_output );
print( "<hr>\n" );
return( $output );
}
function menutree( &$item_id, $menu, &$output ) {
$last_item_id=count($menu);
if( $item_id > $last_item_id ) return( $output );
$item_href=$items[0];
$item_levels=$items[1];
$item_level=count( explode( "!", $item_levels ));
$item_text=str_replace( "!", "", $item_levels );
for( $l=0; $l<$item_level; $l++ ) {$output .= " ";}
$output .= "<ul>\n";
while( $item_id < $last_item_id ) {
$items=explode( ",", $menu[$item_id] );
$item_href=$items[0];
$item_levels=$items[1];
$item_level=count( explode( "!", $item_levels ));
$item_text=str_replace( "!", "", $item_levels );
$next_item_id=$item_id+1;
$next_items=explode( ",", $menu[$next_item_id] );
$next_item_href=$next_items[0];
$next_item_levels=$next_items[1];
$next_item_level=count( explode( "!", $next_item_levels ));
$next_item_text=str_replace( "!", "", $next_item_levels );
print( "MENUTREE_CURR: item_id=[$item_id] level=[$item_level] item_href=[$item_href] item_text=[$item_text] last_item_id=[$last_item_id]<br>\n" );
print( "MENUTREE_NEXT: item_id=[$next_item_id] level=[$next_item_level] item_href=[$next_item_href] item_text=[$next_item_text]<hr>\n" );
if( $item_level == $next_item_level ) {
for( $l=0; $l<$item_level; $l++ ) {$output .= " ";}
$output .= "<li><a href=\"$item_href\">$item_text</a></li>\n";
}
if( $item_level < $next_item_level ) {
for( $l=0; $l<$item_level; $l++ ) {$output .= " ";}
$output .= "<li><a href=\"$item_href\">$item_text</a>\n";
$item_id++;
// fagal error menutree( &$item_id, $menu, &$output );
for( $l=0; $l<$item_level; $l++ ) {$output .= " ";}
$output .= "</li>\n";
}
if( $item_level > $next_item_level ) {
for( $l=0; $l<$item_level; $l++ ) {$output .= " ";}
$output .= "<li><a href=\"$item_href\">$item_text</a></li>\n";
last;
}
$item_id++;
}
for( $l=0; $l<$item_level; $l++ ) {$output .= " "; }
$output .= "</ul>\n";
return($output);
}
function menutree1( $item_id, $menus, &$output ) {
$next_item_id=$item_id+1;
$item_id_last = count( $menus );
if(! array_key_exists( $item_id, $menus[$menu_id] )) {
// print( "menutree ERR_315: menu_id=[$menu_id] next_item_id=$next_item_id<br>\n" );
$output .= "</li></ul><br>\n";
return;
}
if(! array_key_exists( $next_item_id, $menus[$menu_id] )) {
// print( "menutree ERR_316: menu_id=[$menu_id] next_item_id=$next_item_id<br>\n" );
$next_item="";
$next_levels="";
$next_level=0;
}
else {
$next_item=$menus[$menu_id][$next_item_id];
$next_levels= explode( ",", $next_item );
$next_level=count($next_levels);
}
$menu_items=$menus[$menu_id][$item_id];
$menu_item = explode( ",", $menu_items );
$menu_href=$menu_item[0];
$menu_item=$menu_item[1];
$levels= explode( "!", $menu_item );
$level=count($levels);
// print( "menutree: item_id=$item_id l=$level item=[$item] next=$next_level [$next_item]<br>\n" );
print( "menutree: [$menu_id][$item_id] <a href=$menu_href>$menu_item</a><br>\n");
if( $item_id == 0 ) {
if( $next_level == $level ) {
$output .= "<ul>\n";
$output .= "<li><a href=\"$menu_href\" >$item_id $menu_item</a></li>\n";
}
if( $next_level > $level ) {
$output .= "<ul>\n";
$output .= "<li><a href=\"$menu_href\" >$item_id $menu_item</a><ul>\n";
// fatal error menutree( $menu_id, $next_id, $menus, &$output );
}
}
if( $item_id != 0 ) {
if( $next_level == $level ) {
$output .= "<li><a href=\"#$item_id\" >$item_id $item</a></li>\n";
}
if( $next_level > $level ) {
$output .= "<li><a href=\"#$item_id\" >$item_id $item</a>\n";
// fatal error menutree( $menu_id, $next_id, $menus, &$output );
}
if( $next_item_id == 0 ) {
$output .= "<li><a href=\"#$item_id\" >$item_id $item</a></li></ul>\n";
}
if( $next_level == 0 ) {
$output .= "<li><a href=\"#$item_id\" >$item_id $item</a></li>\n";
$output .= "</ul>\n";
}
}
if( $item_id == $item_id_last ) {
}
}
// grid new db new table
function dbs_init( $options ) {
// CREATE TABLE sqlite_master ( type TEXT, name TEXT, tbl_name TEXT, rootpage INTEGER, sql TEXT );
// $drvltr="C";
// if( is_dir( "L:/xampp/htdocs" )) { $drvltr="L"; }
// if( is_dir( "N:/xampp/htdocs" )) { $drvltr="N"; }
// if( $drvltr != "" ) { $rootpath = "$drvltr:/xampp/htdocs"; }
// else {
// $rootpath = "/var/www"
// }
// print( "drvltr=$drvltr<br>\n" );
switch( true ) {
case ( is_dir( "C:/xampp/htdocs" )): $rootpath = "C:/xampp/htdocs"; break;
case ( is_dir( "S:/xampp/htdocs" )): $rootpath = "S:/xampp/htdocs"; break;
case ( is_dir( "L:/xampp/htdocs" )): $rootpath = "L:/xampp/htdocs"; break;
case ( is_dir( "N:/xampp/htdocs" )): $rootpath = "N:/xampp/htdocs"; break;
case ( is_dir( "X:/xampp/htdocs" )): $rootpath = "X:/xampp/htdocs"; break;
case ( is_dir( "/var/www/htdocs" )): $rootpath = "/var/www/htdocs"; break;
case ( is_dir( "$document_root" )): $rootpath = "/var/www/html"; break;
}
switch( true ) {
case ( is_dir( "C:/iperms" )): $rootpath_iperms = "C:/iperms"; break;
case ( is_dir( "L:/iperms" )): $rootpath_iperms = "L:/iperms"; break;
case ( is_dir( "N:/iperms" )): $rootpath_iperms = "N:/iperms"; break;
case ( is_dir( "X:/iperms" )): $rootpath_iperms = "X:/iperms"; break;
case ( is_dir( "/var/iperms" )): $rootpath_iperms = "/var/iperms"; break;
case ( is_dir( "/home/ko" )): $rootpath_ko = "/home/ko"; break;
}
$roles = array( 'admin', 'local', 'op', 'mgrs', 'users', 'anon' );
$roles = array( 'admin', 'local', 'users', 'anon' );
$GLOBALS['roles'] = $roles;
$document_root=$_SERVER['DOCUMENT_ROOT'];
$dbfiles['admin']['ko_center']['dbfile']="$document_root/ko_center/ko_center.db3";
$dbfiles['admin']['ko_center']['tables']= array( 'fp', 'leds', 'rpts', 'roles', 'users', 'dbs', 'menus', 'nodes', 'zoom', 'zoomxml', 'pano',
'ko_hw',
'ko_plans',
'hw',
'hw_chi',
'defrag_plan',
'defrag_plansum',
'hrc_dc_unix',
'hrc_dc_win',
'hrc_datacenters_equipment',
'hrc_datacenters_equipment_defrag',
'moveplan_details',
'hrc_dc_1307comm',
'hrc_dc_1307unix',
'hrc_dc_1307win',
'hrc_dc_btu',
'hrc_dc_comm',
'hrc_dc_explain',
'hrc_dc_hrc',
'hrc_dc_indy138k',
'hrc_dc_indy139k',
'hrc_dc_ports',
'hrc_dc_power',
'moveplan_details',
'obj' );
// $dbfiles['admin']['jtfdcr']['dbfile']="$rootpath/us/jtfdcr/jtfdcr.db3";
$dbfiles['admin']['jtfdcr']['dbfile']="jtfdcr.db3";
$dbfiles['admin']['jtfdcr']['tables']= array( 'files', 'jpg', 'mp4', 'tl', 'av', 'fb', 'kids', 'stalkarounds', 'neighbors', 'tmp' );
/// $dbfiles['admin']['kohpx_vgtest']['dbfile']="$document_root/ko_center/db3/kohpx_vgtest.db3";
/// $dbfiles['admin']['kohpx_vgtest']['dbfile']="/home/ko/vg/kohpx_vgtest.db3";
/// $dbfiles['admin']['kohpx_vgtest']['tables']= array( 'snapdrive', 'vgdisplay', 'sanlun', 'sanlunp', 'ioscand' );
/// $dbfiles['admin']['kohpx_vg']['dbfile']="/home/ko/vg/kohpx_vg.db3";
/// $dbfiles['admin']['kohpx_vg']['dbfile']="/home/ko/vg/kohpx_vg.db3";
/// $dbfiles['admin']['kohpx_vg']['tables']= array( 'snapdrive', 'vgdisplay', 'sanlun', 'sanlunp', 'ioscand', 'sard', 'sard_sas', 'ps', 'pw', 'machinfo', 'hs', 'bp', 'db', 'sard', 'sarh', 'sarl' );
/// $dbfiles['admin']['www_kohpx_vg']['dbfile']="/home/ko/vg/www_kohpx_vg.db3";
/// $dbfiles['admin']['www_kohpx_vg']['tables']= array( 'snapdrive', 'vgdisplay', 'sanlun', 'sanlunp', 'ioscand', 'sard', 'sard_sas', 'ps', 'pw', 'machinfo', 'hs', 'bp', 'db', 'sard', 'sarh', 'sarl' );
/// $dbfiles['admin']['kohpx_vg_20120424']['dbfile']="$document_root/ko_center/db3/kohpx_vg_20120424.db3";
/// $dbfiles['admin']['kohpx_vg_20120424']['tables']= array( 'snapdrive', 'vgdisplay', 'sanlun', 'sanlunp', 'ioscand', 'sard', 'sarh', 'sard_aix', 'sard_hpx','sarh2', 'ps', 'pw', 'hosts' );
/// $dbfiles['admin']['kohpx_vg_20120209']['dbfile']="$document_root/ko_center/db3/kohpx_vg_20120209.db3";
/// $dbfiles['admin']['kohpx_vg_20120209']['tables']= array( 'snapdrive', 'vgdisplay', 'sanlun', 'sanlunp', 'ioscand', 'sard', 'sarh', 'sard_aix', 'sard_hpx','sarh2', 'ps', 'pw', 'hosts' );
// $dbfiles['admin']['koaix_vg']['dbfile']="$document_root/ko_center/db3/koaix_vg.db3";
// $dbfiles['admin']['koaix_vg']['tables']= array( 'hosts', 'sanlun', 'sarhraw', 'sarraw', 'ioscand', 'sard', 'ps', 'pw', 'hosts' );
$dbfiles['admin']['kohpx_hs']['dbfile']="$document_root/ko_center/db3/kohpx_hs.db3";
$dbfiles['admin']['kohpx_hs']['tables']= array( 'hs' );
$dbfiles['admin']['kohpx_us']['dbfile']="$document_root/ko_center/db3/kohpx_us.db3";
$dbfiles['admin']['kohpx_us']['tables']= array( 'us', 'users', 'pw','getprpw', 'rpcinfo', 'kctune', 'netstatan', 'netstata', 'ndd' );
$dbfiles['admin']['koaix_us']['dbfile']="$document_root/ko_center/db3/koaix_us.db3";
// $dbfiles['admin']['koaix_us']['tables']= array( 'us', 'users', 'pw','getprpw', 'rpcinfo', 'kctune', 'netstatan', 'netstata', 'ndd' );
$dbfiles['admin']['koaix_us']['tables']= array( 'us', 'users', 'pw','getprpw' );
$dbfiles['admin']['korhe_us']['dbfile']="$document_root/ko_center/db3/korhe_us.db3";
$dbfiles['admin']['korhe_us']['tables']= array( 'us', 'hs', 'pw','ps' );
$dbfiles['admin']['kohpx_sw']['dbfile']="$document_root/ko_center/db3/kohpx_sw.db3";
$dbfiles['admin']['kohpx_sw']['tables']= array( 'swlist' );
$dbfiles['admin']['kohpx_kb']['dbfile']="$document_root/ko_center/db3/kohpx_kb.db3";
$dbfiles['admin']['kohpx_kb']['tables']= array( 'kb' );
$dbfiles['admin']['koaac_kb']['dbfile']="$document_root/ko_center/db3/koaac_kb.db3";
$dbfiles['admin']['koaac_kb']['tables']= array( 'kb', 'rpts' );
$dbfiles['admin']['ko_center_hosts']['dbfile']="$document_root/ko_center/db3/ko_center_hosts.db3";
$dbfiles['admin']['ko_center_hosts']['tables']= array( 'ko_center_hosts', 'ko_center_servers', 'rsn_servers', 'hrc_servers', 'hrc_hosts', 'datacall', 'tmp', 'rpts' );
$dbfiles['admin']['ko_center_cons']['dbfile']="$document_root/ko_center/db3/ko_center_cons.db3";
$dbfiles['admin']['ko_center_cons']['tables']= array( 'rsncons', 'req', 'rpts' );
$dbfiles['admin']['ko_center_kb']['dbfile']="$document_root/ko_center/db3/ko_center_kb.db3";
$dbfiles['admin']['ko_center_kb']['tables']= array( 'kb', 'rpts' );
$dbfiles['admin']['ko_center_certs']['dbfile']="$document_root/ko_center/db3/ko_center_certs.db3";
$dbfiles['admin']['ko_center_certs']['tables']= array( 'certs', 'rpts', 'hrc_certs', 'rsn_certs' );
$dbfiles['admin']['ko_centerd']['dbfile']="$document_root/ko_center/db3/ko_centerd.db3";
$dbfiles['admin']['ko_centerd']['tables']= array( 'moves', 'rpts', 'teams', 'rfc' );
$dbfiles['admin']['kohpx_bp']['dbfile']="$document_root/ko_center/db3/kohpx_bp.db3";
$dbfiles['admin']['kohpx_bp']['tables']= array( 'bexdir', 'bexdir1', 'bexdir2', 'tapes' );
$dbfiles['admin']['ko_hs']['dbfile']="$document_root/ko_center/db3/ko_hs.db3";
$dbfiles['admin']['ko_hs']['tables']= array( 'hs' );
// $dbfiles['admin']['kohpx_cons']['dbfile']="$document_root/ko_center/db3/kohpx_cons.db3";
// $dbfiles['admin']['kohpx_cons']['tables']= array( 'cons' );
// $dbfiles['admin']['iperms']['dbfile']="$rootpath_iperms/ko/bin/iperms.db";
// $dbfiles['admin']['iperms']['tables']= array( 'periods', 'wl' );
// $dbfiles['admin']['aors_test']['dbfile']="$rootpath_iperms/aors/bin/aors_test.db";
// $dbfiles['admin']['aors_test']['tables']= array( 'wl', 'aors' );
// $dbfiles['admin']['ltrs_test']['dbfile']="$rootpath_iperms/ltrs/bin/ltrs_test.db";
// $dbfiles['admin']['ltrs_test']['tables']= array( 'wl', 'ltrs' );
$dbfiles['local']['fp']['dbfile']="$rootpath/fp/fp.db3";
$dbfiles['local']['fp']['tables']= array( 'fp', 'leds', 'roles', 'users', 'dbs', 'menus', 'nodes', 'zoom', 'zoomxml', 'pano', 'obj' );
$dbfiles['local']['iperms']['dbfile']="$rootpath_iperms/ko/bin/iperms_test.db";
$dbfiles['local']['iperms']['tables']= array( 'periods', 'wl' );
$dbfiles['local']['aors']['dbfile']="$rootpath_iperms/aors/bin/aors_test.db";
$dbfiles['local']['aors']['tables']= array( 'wl', 'aors' );
$dbfiles['local']['ltrs']['dbfile']="$rootpath_iperms/ltrs/bin/ltrs_test.db";
$dbfiles['local']['ltrs']['tables']= array( 'wl', 'ltrs' );
$dbfiles['iperms']['fp']['dbfile']="$rootpath/fp/fp.db3";
$dbfiles['iperms']['fp']['tables']= array( 'fp', 'leds', 'users', 'roles', 'nodes', 'zoom', 'zoomxml', 'pano', 'obj' );
$dbfiles['iperms']['iperms']['dbfile']="$rootpath_iperms/ko/bin/iperms.db";
$dbfiles['iperms']['iperms']['tables']= array( 'periods', 'wl' );
$dbfiles['iperms']['aors']['dbfile']="$rootpath_iperms/aors/bin/aors.db";
$dbfiles['iperms']['aors']['tables']= array( 'wl', 'aors' );
$dbfiles['iperms']['ltrs']['dbfile']="$rootpath_iperms/ltrs/bin/ltrs.db";
$dbfiles['iperms']['ltrs']['tables']= array( 'wl', 'ltrs' );
$dbfiles['tester']['fp']['dbfile']="$rootpath/hrc/fp/fp.db3";
$dbfiles['tester']['fp']['tables']= array( 'fp', 'leds', 'users', 'roles', 'nodes', 'zoom', 'zoomxml', 'pano', 'obj' );
$dbfiles['tester']['iperms']['dbfile']="$rootpath_iperms/ko/bin/iperms_test.db";
$dbfiles['tester']['iperms']['tables']= array( 'periods', 'wl' );
$dbfiles['tester']['aors']['dbfile']="$rootpath_iperms/aors/bin/aors_test.db";
$dbfiles['tester']['aors']['tables']= array( 'wl', 'aors' );
$dbfiles['tester']['ltrs']['dbfile']="$rootpath_iperms/ltrs/bin/ltrs_test.db";
$dbfiles['tester']['ltrs']['tables']= array( 'wl', 'ltrs' );
$dbfiles['op']['fp']['dbfile']="$rootpath/hrc/fp/fp.db3";
$dbfiles['op']['fp']['tables']= array( 'fp', 'leds', 'users', 'roles', 'nodes', 'zoom', 'zoomxml', 'pano', 'obj' );
$dbfiles['op']['iperms']['dbfile']="$rootpath_iperms/ko/bin/iperms_test.db";
$dbfiles['op']['iperms']['tables']= array( 'periods', 'wl' );
$dbfiles['op']['aors']['dbfile']="$rootpath_iperms/aors/bin/aors_test.db";
$dbfiles['op']['aors']['tables']= array( 'wl', 'aors' );
$dbfiles['op']['ltrs']['dbfile']="$rootpath_iperms/ltrs/bin/ltrs_test.db";
$dbfiles['op']['ltrs']['tables']= array( 'wl', 'ltrs' );
$dbfiles['mgrs']['fp']['dbfile']="$rootpath/hrc/fp/fp.db3";
$dbfiles['mgrs']['fp']['tables']= array( 'fp', 'leds', 'users', 'roles', 'nodes', 'zoom', 'zoomxml', 'pano', 'obj' );
$dbfiles['mgrs']['iperms']['dbfile']="$rootpath/iperms/ko/bin/iperms_test.db";
$dbfiles['mgrs']['iperms']['tables']= array( 'periods', 'wl' );
$dbfiles['mgrs']['aors']['dbfile']="$rootpath_iperms/aors/bin/aors_test.db";
$dbfiles['mgrs']['aors']['tables']= array( 'wl', 'aors' );
$dbfiles['mgrs']['ltrs']['dbfile']="$rootpath_iperms/ltrs/bin/ltrs_test.db";
$dbfiles['mgrs']['ltrs']['tables']= array( 'wl', 'ltrs' );
$dbfiles['users']['fp']['dbfile']="$rootpath/hrc/fp/fp.db3";
$dbfiles['users']['fp']['tables']= array( 'zoom', 'zoomxml', 'pano', 'obj' );
$dbfiles['anon']['fp']['dbfile']="$rootpath/hrc/fp/fp.db3";
$dbfiles['anon']['fp']['tables']= array( 'zoom', 'pano', 'obj' );
$GLOBALS['dbfiles'] = $dbfiles;
}
function pdo_cr_dbs() {
$dbfile = $GLOBALS['dbfile'];
$tblname="dbs";
$sql="CREATE TABLE IF NOT EXISTS $tblname ( ";
$sql .= "dbs_id INTEGER PRIMARY KEY DESC, ";
$sql .= "role VARCHAR, ";
$sql .= "dbcode VARCHAR, ";
$sql .= "dbfile VARCHAR, ";
$sql .= "tbl_name VARCHAR, ";
$sql .= "col_name VARCHAR, ";
$sql .= "col_index VARCHAR, ";
$sql .= "col_width VARCHAR, ";
$sql .= "col_sorttype VARCHAR, ";
$sql .= "col_editable VARCHAR, ";
$sql .= "col_editrules VARCHAR, ";
$sql .= "col_hidden VARCHAR, ";
$sql .= "col_display VARCHAR, ";
$sql .= "col_misc VARCHAR, ";
$sql .= "notes VARCHAR";
$sql .= ");";
print( "BUGS_5304 pdo_cr_dbs( $dbfile, $tblname, $sql )<br>\n" );
pdo_create( $dbfile, $tblname, $sql );
}
function pdo_cr_kb() {
$kbfile = $GLOBALS['kbfile'];
if( ! file_exists( $kbfile )) { system( "touch $kbfile" ); }
if( file_exists( $kbfile )) {
printf( "$progid $dttm MSG: FOUND kbfile=[$kbfile]<br>\n" );
}
else {
printf( "$progid $dttm ERR: NOTFOUND kbfile=[$kbfile]<br>\n" );
return;
}
printf( "$progid $dttm BUGS: pdo_cr_kb BEG<hr>\n" );
$tblname="kb";
$sql="CREATE TABLE IF NOT EXISTS $tblname ( ";
$sql .= "id INTEGER PRIMARY KEY DESC, ";
$sql .= "kbid varchar, ";
$sql .= "kb_dttm varchar, ";
$sql .= "kb_user varchar, ";
$sql .= "kb_host varchar, ";
$sql .= "kb_ip varchar, ";
$sql .= "kb_os varchar, ";
$sql .= "kb_org varchar, ";
$sql .= "kb_grp varchar, ";
$sql .= "kb_sys varchar, ";
$sql .= "kb_cat varchar, ";
$sql .= "status varchar, ";
$sql .= "status_reason varchar, ";
$sql .= "impact varchar, ";
$sql .= "urgency varchar, ";
$sql .= "priority varchar, ";
$sql .= "source varchar, ";
$sql .= "request_type varchar, ";
$sql .= "root_cause varchar, ";
$sql .= "publish varchar, ";
$sql .= "errtxt varchar, ";
$sql .= "fixtxt varchar, ";
$sql .= "errtext varchar, ";
$sql .= "fixtext varchar, ";
$sql .= "searchable varchar, ";
$sql .= "attachements varchar, ";
$sql .= "filecount varchar, ";
$sql .= "filelist varchar, ";
$sql .= "locked varchar, ";
$sql .= "view_access varchar, ";
$sql .= "vendor_name varchar, ";
$sql .= "vendor_contact varchar, ";
$sql .= "vendor_ticket_num varchar, ";
$sql .= "vendor_phone varchar, ";
$sql .= "vendor_email varchar, ";
$sql .= "vendor_reported_dttm varchar, ";
$sql .= "vendor_responded_dttm varchar, ";
$sql .= "comment varchar, ";
$sql .= "notes VARCHAR";
$sql .= ");";
/// printf( "$progid $dttm BUGS: pdo_cr_kb END<hr>\n"" );
print( "BUGS_8940 pdo_cr_kb( $kbfile, $tblname, $sql )<br>\n" );
pdo_create( $kbfile, $tblname, $sql );
}
function pdo_cr_flds() {
$kbfile = $GLOBALS['kbfile'];
if( ! file_exists( $kbfile )) { system( "touch $kbfile" ); }
if( file_exists( $kbfile )) {
printf( "$progid $dttm MSG: FOUND kbfile=[$kbfile]<br>\n" );
}
else {
printf( "$progid $dttm ERR: NOTFOUND kbfile=[$kbfile]<br>\n" );
return;
}
$tblname="flds";
$sql="CREATE TABLE IF NOT EXISTS $tblname ( ";
$sql .= "id INTEGER PRIMARY KEY DESC, ";
$sql .= "fldname varchar, ";
$sql .= "fldtype varchar, ";
$sql .= "fldval varchar, ";
$sql .= "flddesc varchar, ";
$sql .= "notes VARCHAR";
$sql .= ");";
print( "BUGS_8950 pdo_cr_flds( $dbfile, $tblname, $sql )<br>\n" );
pdo_create( $kbfile, $tblname, $sql );
}
function pdo_insert_dbs( $options ) {
$role=$_SESSION['role'];
$dbfiles = $GLOBALS['dbfiles'];
$roles = $GLOBALS['roles'];
$dbs = $dbfiles[$role];
$GLOBALS['dbs'] = $dbs;
$dbcode="fp";
$dbfile_dbs=$dbfiles['admin'][$dbcode]['dbfile'];
$dbtable = "dbs";
print( "pdo_cr_dbs MSG_5092: role=[$role] dbfile_dbs=[$dbfile_dbs] dbfile1=[$dbfile1] dbcode=[$dbcode] dbtable=[$dbtable]<br>\n" );
$rolenum=1;
$csvout ="dbs_id,role,dbcode,dbfile,tbl_name,col_name,col_index,col_width,col_sorttype,col_editable,col_editrules,col_hidden,col_display,col_misc,notes\n";
// $csvout ="rowid,role,dbcode,dbfile,tbl_name,col_name,col_index,col_width,col_sorttype,note\n";
// $csvout ="role,dbcode,dbfile,tbl_name,col_name,col_index,col_width,col_sorttype,note\n";
$dbs_id=1;
foreach( $roles as $role ) {
print( "role: $rolenum $role<br>\n" );
foreach( $dbfiles[$role] as $dbfile ) {
$my_dbfile=$dbfile['dbfile'];
print( "! dbs_role $role: ". $my_dbfile." <br>\n" );
$dbfile_basename = basename( $my_dbfile );
$dbcode = str_replace( ".db3", "", $dbfile_basename );
$sql_table = "select name FROM sqlite_master where type='table' order by name;";
print( "! dbcode=$dbcode my_dbfile=$my_dbfile [$sql_table]<br>\n" );
print( "! sql[$sql_table]<br>\n" );
if( file_exists( $dbfile['dbfile'] )) {
$pdo_table = newpdo( $dbfile['dbfile'] );
foreach( $pdo_table->query($sql_table) as $row_table ) {
$output = $row_table['type'] . ' - ' . $row_table['name'];
print( "! ! sql row_table=$output<br>\n" );
$sql_col="PRAGMA table_info(".$row_table['name'].");";
// print( "! ! sql[$sql_col]<br>\n" );
$pdo_col = newpdo($dbfile['dbfile']);
foreach( $pdo_col->query($sql_col) as $col_table ) {
$output_colinfo = $col_table['cid'] . ' - ' . $col_table['name'] . ' - ' . $col_table['type'];
// print( "! ! ! sql_col=[$output_colinfo]<br>\n" );
$csvout .= "$dbs_id,";
$csvout .= "$role,"; // role
$csvout .= "$dbcode,"; // dbcode
$csvout .= "$my_dbfile,"; // db_pathfile
$csvout .= $row_table['name'].","; // table_name
$csvout .= $col_table['name'].","; // col_name
$csvout .= $col_table['name'].","; // col_index
$csvout .= "60,"; // col_width
$csvout .= ","; // col_sorttype (int,date,float)
if(( $role == "admin" )
|| ( $role == "local" )) {
$csvout .= "true,"; // col_editable
$csvout .= ","; // col_editrules
$csvout .= "false,"; // col_hidden
$csvout .= "false,"; // col_display
}
else {
$csvout .= "false,"; // col_editable
$csvout .= ","; // col_editrules
$csvout .= "true,"; // col_hidden
$csvout .= "true,"; // col_display
}
$csvout .= "misc,"; // col_misc
$csvout .= ""; // notes
$csvout .= "\n";
// $csvout .= "{name:'".$col_table['name']."',index:'".$col_table['name']."', width:60, sorttype:'int'},<br>\n";
// date $csvout .= " {name:'date',index:'date', width:90, sorttype:\"date\"},\n";
// float $csvout .= " {name:'amount',index:'amount', width:80, align:\"right\",sorttype:\"float\"},\n";
$dbs_id++;
}
$pdo_col = null;
}
$pdo_table = null;
}
foreach( $dbfile['tables'] as $table ) {
print( "dbs_role $role table: $table<br>\n" );
}
}
$rolenum++;
}
$dttm=date("Ymd_His");
$csvfil="fp_dbs_$dttm.csv";
$csvfil="fp_dbs.csv";
$csvfil="dbs.csv";
$fp = fopen( $csvfil, "w" );
// $fp = fopen( $csvfil, "a" );
fwrite( $fp, $csvout );
// print( $csvout );
fclose($fp);
// $csvarray = explode( "\n", "<br>\n", $csvout );
// $csvhtm = str_replace( "\n", "<br>\n", $csvout );
// print( $csvhtm );
// foreach( $csvarray as $csvtmp ) {
// print( "$csvtmp" );
// }
// $sql = "select name FROM sqlite_master where type='table' order by name;";
// $ sqlite3 -header fp.db3 "PRAGMA table_info(roles)"
// cid|name|type|notnull|dflt_value|pk
// 0|role_id|INTEGER|0||1
// 1|role_code|VARCHAR|0||0
// 2|role_status|VARCHAR|0||0
// 3|role_comment|VARCHAR|0||0
$options = array( "db", "load", "fp", "dbs" );
// set_time_limit(120); // disable
set_time_limit(0); // disable
// pdo_load( $options );
print( $csvout );
print( "BUGS_5287 pdo_cr_dbs: pdo_insert( $dbfile_dbs, $dbtable, csvout )<br>\n" );
pdo_insert( $dbfile_dbs, $dbtable, $csvout );
set_time_limit(30); // enable to 30 seconds
}
function localcmds( $options ) {
$http_host=$_SERVER['HTTP_HOST'];
$php_self=$_SERVER['PHP_SELF'];
$role = $_SESSION['role'];
$user_location = $_SESSION['user_location'];
$server_os = $_SESSION['server_os'];
if( $user_location != "local" ) { return; }
if( $server_os == "Windows" ) { return; }
if(( $role != "admin" ) & ( $role != "local" )) { return; }
$cmds = array(
'crypt'=>'tc',
'view'=>'iv',
'scrt'=>'scrt',
'sftp'=>'sftp',
'edit'=>'wi'
);
$output = "<div = \"localcmds\">\n";
$output .= "<hr>\n";
$output .= "<a href=\"http://$http_host$php_self?q=local\"><b>localcmds</b></a><br>\n";
if( $options[1] == "" ) {
foreach( $cmds as $col => $val ) {
$output .= "<a href=\"http://$http_host/$php_self?q=local/$val\">$col</a><br>\n";
}
$output .= "</div>\n";
print( $output );
return;
}
if( $options[1] == "wi" ) {$cmd="wi.exe ".$options[2]." ".$options[3]." ".$options[4]; }
if( $options[1] == "tc" ) {$cmd="tc.exe ".$options[2]." ".$options[3]." ".$options[4]; }
if( $options[1] == "iv" ) {$cmd="i_view32.exe ".$options[2]." ".$options[3]." ".$options[4]; }
if( $options[1] == "scrt" ) {
$scrt_wincmd="\"C:\\Program Files\\VanDyke Software\Clients\\SecureCRT.exe\"";
$cmd="$scrt_wincmd ".$options[2]." ".$options[3]." ".$options[4];
}
if( $options[1] == "sftp" ) {
$sftp_wincmd="\"C:\\Program Files\\Ipswitch\\WS_FTP Pro\\wsftpgui.exe\"";
$cmd="$sftp_wincmd ".$options[2]." ".$options[3]." ".$options[4];
}
// set_time_limit(0);
$output .= "<hr>cmd=[$cmd]<hr>\n";
$output .= "</div>\n";
print( $output );
system($cmd);
// set_time_limit(30);
}
function telnet($options) {
require_once "PHPTelnet.php";
$telnet = new PHPTelnet();
$host=$options[1];
$user=$options[2];
switch( $options[1] ) {
case "host1":
$host="host1";
$user="host1_user";
$pass="****";
break;
default:
$host="localhost";
$host="127.0.0.1";
$user="localhost_user";
$pass="***";
break;
}
print( "<hr>host=$host user=$user<hr>\n" );
$telnet = new PHPTelnet();
print( "<hr>telnet->Connect($host,$user,****)<hr>\n" );
return;
// pfsockeopen
$file = 'somefile.txt';
$remote_file = 'readme.txt';
$ftp_server = '127.0.0.1';
$ftp_user_name = 'user';
$ftp_user_pass = 'pass';
$conn_id = ftp_connect($ftp_server);
ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
ftp_nb_put($conn_id, $remote_file, $file, FTP_ASCII);
echo "$file sent to $ftp_server as $remote_file\n";
ftp_close($conn_id);
// finished copying the input.dat to the till now, just need to execute the print command.
// That will copy somefile.txt in the same folder as this .php file to the ftp server root dir.
// $header1=chr(0xFF).chr(0xFB).chr(0x1F).chr(0xFF).chr(0xFB).chr(0x20).chr(0xFF).chr(0xFB).chr(0x18).chr(0xFF).chr(0xFB).chr(0x27).chr(0xFF).chr(0xFD).chr(0x01).chr(0xFF).chr(0xFB).chr(0x03).chr(0xFF).chr(0xFD).chr(0x03).chr(0xFF).chr(0xFC).chr(0x23).chr(0xFF).chr(0xFC).chr(0x24).chr(0xFF).chr(0xFA).chr(0x1F).chr(0x00).chr(0x50).chr(0x00).chr(0x18).chr(0xFF).chr(0xF0).chr(0xFF).chr(0xFA).chr(0x20).chr(0x00).chr(0x33).chr(0x38).chr(0x34).chr(0x30).chr(0x30).chr(0x2C).chr(0x33).chr(0x38).chr(0x34).chr(0x30).chr(0x30).chr(0xFF).chr(0xF0).chr(0xFF).chr(0xFA).chr(0x27).chr(0x00).chr(0xFF).chr(0xF0).chr(0xFF).chr(0xFA).chr(0x18).chr(0x00).chr(0x58).chr(0x54).chr(0x45).chr(0x52).chr(0x4D).chr(0xFF).chr(0xF0);
$fp=pfsockopen("127.0.0.1",23);
echo "Telnet session opening ...";
sleep(4);
fputs($fp,$header1); sleep(4);
fputs($fp,"$user\r"); sleep(2); fputs($fp,"$pass\r");
sleep(2); fputs($fp,"notepad\r");
sleep(3);
echo "Telnet session closing ...";
fclose($fp);
return;
// PECL ssh2 => 0.9.0 connection
$methods = array(
'kex' => 'diffie-hellman-group1-sha1',
'client_to_server' => array(
'crypt' => '3des-cbc',
'comp' => 'none'),
'server_to_client' => array(
'crypt' => 'aes256-cbc,aes192-cbc,aes128-cbc',
'comp' => 'none'));
$callbacks = array('disconnect' => 'my_ssh_disconnect');
// phpinfo();
$connection = ssh2_connect('$host', 22, $methods, $callbacks);
if (!$connection) die('Connection failed');
return;
//telnet connection
$result = $telnet->Connect($host,$user,$pass );
switch ($result) {
case 0:
$telnet->DoCommand('pwd', $result);
echo $result;
$telnet->DoCommand('date', $result);
echo $result;
$telnet->Disconnect();
break;
case 1:
echo '[PHP Telnet] Connect failed: Unable to open network connection';
break;
case 2:
echo '[PHP Telnet] Connect failed: Unknown host';
break;
case 3:
echo '[PHP Telnet] Connect failed: Login failed';
break;
case 4:
echo '[PHP Telnet] Connect failed: Your PHP version does not support PHP Telnet';
break;
}
return;
}
function my_ssh_disconnect($reason, $message, $language) {
printf("Server disconnected with reason code [%d] and message: %s\n",$reason, $message);
}
function rptsxml($options) {
$kbid=$option3;
$flds_list="rpt_id rpt_status rpt_code rpt_title rpt_sql rpt_file rpt_notes";
$flds = explode( " ", $flds_list );
// foreach( $flds as $fld ) { print( "fld=[$fld]<br>\n" ); }
// return;
$jqgrid = "<script type=\"text/javascript\">\n";
$jqgrid .= "var gridimgpath = 'js/themes/swanky-purse/imgs';\n";
$jqgrid .= "jQuery(document).ready(function(){\n";
$jqgrid .= " jQuery().ready(function(){\n";
$jqgrid .= " jQuery(\"#list_ko_centerd_rpts___\").jqGrid({\n";
// $jqgrid .= "url:'https://147.238.94.126/ko_center/ko_center.php?q=kb/rpts/$kbid&fmt=xml///',\n";
$jqgrid .= "url:'/ko_center/ko_center.php?q=kb/rpts/$kbid&fmt=xml///',\n";
// $jqgrid .= "editurl:'https://147.238.94.126/ko_center/ko_center.php?q=kb/rpts/$kbid&fmt=xml///',\n";
$jqgrid .= "editurl:'/ko_center/ko_center.php?q=kb/rpts/$kbid&fmt=xml///',\n";
$jqgrid .= "datatype: \"xml\",\n";
$jqgrid .= " colNames:[\n";
$colnames = "'rpt_id','rpt_status','rpt_code','rpt_title','rpt_sql','rpt_file','rpt_notes'";
$colnames = "";
foreach( $flds as $fld ) { $colnames .= "'$fld', "; }
$colnames .= ")";
$colnames = str_replace( ', )', '', $colnames );
$jqgrid .= $colnames;
$jqgrid .= " ],\n";
$jqgrid .= " colModel:[\n";
// $colmodel = "";
// $colmodel .= "{name:'rpt_id',index:'rpt_id', width:40, editable:true },\n";
// $colmodel .= "{name:'rpt_id',index:'rpt_id', width:40, editable:true },\n";
// $colmodel .= "{name:'rpt_status',index:'rpt_status', width:40, editable:true },\n";
// $colmodel .= "{name:'rpt_code',index:'rpt_code', width:40, editable:true },\n";
// $colmodel .= "{name:'rpt_title',index:'rpt_title', width:40, editable:true },\n";
// $colmodel .= "{name:'rpt_sql',index:'rpt_sql', width:40, editable:true },\n";
// $colmodel .= "{name:'rpt_file',index:'rpt_file', width:40, editable:true },\n";
$colmodel = "";
foreach( $flds as $fld ) {
$colmodel .= "{name:'$fld',index:'$fld', width:40, editable:true }\n";
}
// printf( "BUGS_11820<br>colmodel=[$colmodel]<br>\n" );
// return;
$jqgrid .= $colmodel;
$jqgrid .= " ],\n";
$jqgrid .= "imgpath: gridimgpath,\n";
$jqgrid .= "height:400,\n";
$jqgrid .= "rowNum: 10,\n";
$jqgrid .= "autowidth: true,\n";
$jqgrid .= "rowList:[10,20,30,50, 100, 500, 1000],\n";
$jqgrid .= "pager: jQuery('#pager_ko_centerd_rpts___'),\n";
$jqgrid .= "sortname: 'rpt_id',\n";
$jqgrid .= "viewrecords: true,\n";
$jqgrid .= "sortorder: \"asc\",\n";
$jqgrid .= "caption: \"ko_centerd rpts \"\n";
$jqgrid .= " }).navGrid('#pager_ko_centerd_rpts___',{edit:true,add:true,del:true});\n";
$jqgrid .= " jQuery(\".content\").hide();\n";
$jqgrid .= " jQuery(\".heading\").click(function() {\n";
$jqgrid .= " jQuery(this).next(\".content\").slideToggle(500);\n";
$jqgrid .= " });\n";
$jqgrid .= " });\n";
$jqgrid .= " });\n";
$jqgrid .= "</script>\n";
$jqgrid .= "</head>\n";
printf( $jqgrid );
return;
return( $jqgrid );
}
function email_headers(){
//BUILD EMAIL HEADERS
$headers = "From: Some Person <person@website.com>\n";
$headers .= "Reply-To: person@website.com\n";
$headers .= "Return-Path: person@website.com\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
//SET EMAIL PRIORITY
$headers .= "X-Priority: 1 (Highest)\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "Importance: High\n";
//SEND EMAIL
// mail("to@website.com","Subject","Body",$headers);
}
function rpts($options) {
$option0=$options[0];
$option1=$options[1];
$option2=$options[2];
$option3=$options[3];
$page = $_GET['page']; // get the requested page
$limit = $_GET['rows']; // get how many rows we want to have into the grid
$sidx = $_GET['sidx']; // get index row - i.e. user click to sort
$sord = $_GET['sord']; // get the direction
if(!$sidx) $sidx =1;
$fmt=$_GET['fmt'];
// $kbfile=$GLOBALS['kbfile'];
$kbfile=$GLOBALS['dbfile'];
$tablename="rpts";
printf( "<hr>MSG_11770: fmt=$fmt o0=[$option0] o1=[$option1] o2=[$option2] o3=[$option3] kbfile=[$kbfile]<hr>\n" );
return;
if( $option2 != "" ) {
$rpt_code=$option2;
$pdo = newpdo($kbfile);
$sql="select * from $tablename where rpt_code='$option2'";
try {
$output .= "<table>\n";
$output .= "<tr>\n";
$pdo = newpdo($kbfile);
// $result = $stmg->fetch(PDO::FETCH_ASSOC);
$output .= "<table border=1>\n";
$output .= "<tr>\n";
foreach( $pdo->query($sql) as $row ) {
$rpt_code=$row['rpt_code'];
$rpt_sql=$row['rpt_sql'];
$rpt_title=$row['rpt_title'];
$output .= "<td>$rpt_code - $rpt_sql</td>\n";
}
$output .= "</tr>\n";
$output .= "</table>\n";
$pdo = null;
}
catch(PDOException $e) { $output .= $e->getMessage(); }
// connect to the database
try {
$pdo = newpdo($kbfile);
$stmt = $pdo->query($rpt_sql);
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$output .= "<table border=1>\n";
$output .= "<tr>\n";
foreach( $result as $key=>$val) {
$output .= "<td>$key</td>\n";
}
$output .= "</tr>\n";
$output .= "</table>\n";
$pdo = null;
}
catch(PDOException $e) { $output .= $e->getMessage(); }
try {
$pdo = newpdo($kbfile);
$j=0;
$output .= "<table>\n";
$output .= "<tr>\n";
foreach( $pdo->query($rpt_sql) as $row ) {
foreach( $result as $key=>$val ) {
// $output .= "<td>$j key=$key val=$val</td>";
$rowkey=$row[$key];
$output .= "<td>$rowkey</td>\n";
}
$output .= "</tr>\n";
}
$output .= "</tr>\n";
$output .= "</table>\n";
$pdo=null;
}
catch(PDOException $e) { $output .= $e->getMessage(); }
printf( "<hr>BUGS_11825 option2=[$option2] rpt_sql=[$rpt_sql]<hr>\n" );
printf( $output );
return;
$count = $row['count'];
if( $count >0 ) {
$total_pages = ceil($count/$limit);
}
else {
$total_pages = 0;
}
if ($page > $total_pages) $page=$total_pages;
$start = $limit*$page - $limit; // do not put $limit*($page - 1)
if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {
header("Content-type: application/xhtml+xml;charset=utf-8");
}
else {
header("Content-type: text/xml;charset=utf-8");
}
$et = ">";
$output .= "<?xml version='1.0' encoding='utf-8'?$et\n";
$output .= "<rows>";
$output .= "<page>".$page."</page>";
$output .= "<total>".$total_pages."</total>";
$output .= "<records>".$count."</records>";
// be sure to put text data in CDATA
// while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
foreach( $pdo->query($rpt_sql) as $row ) {
foreach( $result as $key=>$val ) {
$output .= "<row id='". $row[id]."'>";
$output .= "<cell>". $row[$key]."</cell>";
// $output .= "<cell><![CDATA[". $row[name]."]]></cell>";
// $output .= "<cell><![CDATA[". $row[note]."]]></cell>";
$output .= "</row>";
}
}
$output .= "</rows>";
}
print( $output );
}
function jqui($jqui) {
$http_host=$_SERVER['HTTP_HOST'];
$php_self=$_SERVER['PHP_SELF'];
if( $jqui == "dragdrop" ) {
$output= "";
//// $output.= "<!--\n";
$output.= " // sets the draggable\n";
$output.= " $('#drag .drg').draggable({\n";
$output.= " cursor: 'move', // sets the cursor apperance\n";
$output.= " revert: 'valid'\n";
$output.= " });\n";
$output.= "\n";
$output.= " // sets droppable\n";
$output.= " $('#drop').droppable({\n";
$output.= " drop: function(event, ui) {\n";
$output.= " // after the draggable is droped, hides it with a hide() effect\n";
$output.= " ui.draggable.hide(1000);\n";
$output.= " }\n";
$output.= " });\n";
$output.= "\n";
$output.= " // when the \"#sw\" element (inside the \"#drop\") is clicked\n";
$output.= " // show the items with class \"drg\", contained in \"#drag\"\n";
$output.= " $('#drop #sw').click(function(){\n";
$output.= " // $('#drag .drg').slideDown(1000);\n";
//// $output.= " $('#drag .drg').location(url);\n";
$output.= " var url = \"https://$http_host/$php_self?q=jqui/dragdrop1/\"\n";
//// $output.= " $(location).attr('href',url);\n";
$output.= " $(location).attr('href',url);\n";
$output.= " });\n";
$output.= "});\n";
//// $output.= "--></script>\n";
return($output);
}
if( $jqui == "dragdrop2" ) {
$output_dragdrop2 = "";
$output_dragdrop2 = " // sets the draggable and define its options\n";
$output_dragdrop2 = " $('#drag .drg').draggable({\n";
$output_dragdrop2 = " cursor: 'move', // sets the cursor apperance\n";
$output_dragdrop2 = " revert: 'invalid', // makes the item to return if it isn't placed into droppable\n";
$output_dragdrop2 = " revertDuration: 900, // duration while the item returns to its place\n";
$output_dragdrop2 = " opacity: 0.35 // opacity while the element is dragged\n";
$output_dragdrop2 = " });\n";
$output_dragdrop2 = "\n";
$output_dragdrop2 = " // define options for droppable\n";
$output_dragdrop2 = " $('#drop').droppable({\n";
$output_dragdrop2 = " accept: 'img.drg', // accept only imgs with class 'drg'\n";
$output_dragdrop2 = " activeClass: 'drp', // add class \"drp\" while an accepted item is dragged\n";
$output_dragdrop2 = " drop: function(event, ui) {\n";
$output_dragdrop2 = " // after the draggable is droped, hides it with a hide() effect\n";
$output_dragdrop2 = " ui.draggable.hide(1000);\n";
$output_dragdrop2 = " }\n";
$output_dragdrop2 = " });\n";
return( $output_dragdrop2 );
}
return("");
}
?>
<?php
/**
ko.php v0.94 20230220_1600 contacts leds
ko.php v0.94 20230219_1414 leds_flds leds_vals
ko.php v0.94 20230217_0300 ?lists=items contacts letter leds monkeytraps turtleposts floods coffee()
ko.php v0.93 20230128_2033 gd txt2imgs()
ko.php v0.93 20230128_2033 gd txt2img()
ko.php v0.93 20230127_0127 sophia renee=imgs
ko.php v0.93 20230126_1430 todo=imgs
ko.php v0.92 20221129_0030 22316
ko.php v0.92 20221121_1630 22305 stripe syntax error
ko.php v0.92 20221112_1500 pt btc btctxt eth ethtxt
ko.php v0.91 20221031_2200 shopify
ko.php v0.91 20221031_2100 bitcoin
ko.php v0.91 20221031_1830 stripe spotify squareup
ko.php v0.90 20221030_0730 sql3 ko_coffeeshop rm vm li dr dm gp js wm zh
ko.php v0.90 20221030_0730 sql3 ko_coffeeshop rm vm li dr dm gp js wm zh
ko.php v0.90 20221020_0130 ko_coffeeshop htmtbls main coffee media smedia contacts
ko.php v0.90 20221019_2100 ko_coffeeshop add gab tr
ko.php v0.90 /ko.php?todo=sql3_ko_coffeeshop
ko.php v0.90 /ko.php?todo=sql3_ko_coffeeshop
ko.php v0.90 /ko.php?todo=cat_ko_coffeeshop_psv
ko.php v0.90 /ko.php?todo=cat_ko_coffeeshop_csv
ko.php v0.90 /ko.php?todo=ko_coffeeshop_sql3
ko.php v0.90 /ko.php?todo=ko_coffeeshop_psv
ko.php v0.90 /ko.php?todo=ko_coffeeshop_csv
ko.php v0.80 20210124_0630 todos=ko_coffeeshop
ko.php v0.80 20210124_0630 todos=ko_media ko_coffee
ko.php v0.80 20210124_0630 todos=jsons txts
ko.php v0.80 20211208_1700 <link href="favicon_ko64.ico"
ko.php v0.80 20211208_1530 todo=ko
ko.php v0.80 20211207_1530 todo=todi&fmt=json
ko.php v0.80 20211203_1730 todo=kogo
ko.php v0.80 20211202_1200
ko.php v0.75 202111130_0845 debug file=<h1 target=_blank>
ko.php v0.75 202111119_1400 s/findid/todo
ko.php v0.75 202111119_1400 findid fbd_filter
ko.php v0.75 202111118_2300 ?findid=
ko.php v0.75 202111118_2300 ?ls=
ko.php v0.75 202111118_1730 ?find= new parsing
ko.php v0.74 202111117_1730 ls
ko.php v0.72 20211109_1930 jqgrid
ko.php v0.72 kolog
ko.php v0.71 $htmout=read_htmlfile($htmlfile);
ko.php v0.70 bookmarksusb
ko.php v0.66 0.66_20200429_2200 dirlist
ko.php v0.65 0.64_20200225_1212
ka1.php v0.64 0.64_20180708_0000 json chat
ka1.php v0.64 0.64_20180704_0000
ka1.php v0.64 0.64_20121210_0500 leds_dragdrop
ka1.php v0.64 0.64_20121207_1500 ko_ajax
ka1.php v0.64 0.64_20121207_1500 ko_dragdrop
ka1.php v0.64 0.64_20121207_1500 ko_im
ka1.php v0.64 0.64_20121202_0930 reports/rpts img if cab cab1 cab2 item
ka1.php v0.64 0.64_20121202_0930 leds/set/ledcode/r b g 0 1 5 9/cab1 cab2 cab/id
ka1.php v0.64 0.64_20121202_0930 ip_dttm reqform
ka1.php v0.63 0.63_20121202_0330 reports/sql
ka1.php v0.62 0.61_20121202_2300 reports/sql
ka1.php v0.61 0.61_20121109_0315 defrag/report
ka1.php v0.60 0.60_20121027_2015 passthru()
ka1.php v0.59 0.59_20121027_2015 hostos win logic
ka1.php v0.57 0.56_20120927_1145 gui mods/allow
ka1.php v0.57 0.56_20120927_1145 gui mods/allow
ka1.php v0.56 0.56_20120926_1000 (datacall)
ka1.php v0.55 0.55_20120918_1100 ka1_hosts.db3 (datacall)
ka1.php v0.54 0.53_20120918_1100 ka1_cons.db3
ka1.php v0.53 0.53_20120829_1015 new /pat url
ka1.php v0.53 0.53_20120829_1015 /nap
ka1.php v0.52 0.52_20120829_1015 ?q=kb/rpts/rpt_id&fmt=xml &fmt=csv
ka1.php v0.51 0.51_20120828_1410 rptsxml
ka1.php v0.50 0.50_20120828_1145 jqgrid-4.4.0
ka1.php v0.49 0.49_20120824_1130 errtxt, fixtxt to files and fmt4search
ka1.php v0.48 0.48_20120824_1000 ka1.db3 nodes tables & reports
ka1.php v0.47 0.47_20120823_1340 ka1_certs
ka1.php v0.46 0.46_20120823_1000 kb upload size increase
ka1.php v0.45 0.45_20120822_1330 ka1d rpts view grids
ka1.php v0.44 0.44_20120822_1130 mod views
ka1.php v0.43 0.43_20120817_1000 mod views
ka1.php v0.42 0.42_20120816_1400 now logins for led tweets
ka1.php v0.41 0.40_20120816_1230 ?q=certs/rpts
ka1.php v0.40 0.40_20120816_1030 ?q=kb/rpts
ka1.php v0.39 0.39_20120814_1330 ?ka1 ka1e mn page org
ka1.php v0.38 0.38_20120813_0940 ?q=kb/view kb/mod dbgrid links for kb certs
ka1.php v0.37 0.37_20120809_1511 links reorg + certs
ka1.php v0.36 0.33_20120809_1511 ?q=kb
ka1.php v0.35 0.33_20120809_1150 itil to links
ka1.php v0.35 0.33_20120808_1305 ka1_certs.dbe
ka1.php v0.34 0.33_20120803_1200 dyn pchart example link & debug
ka1.php v0.33 0.33_20120801_1000 pchart link
ka1.php v0.32 0.32_20120730_0945 pdo_cr_kb, pdo_cr_flds, new/add mod/upd view
ka1.php v0.31 0.31_20120730_0945 pdo_cr_kb, pdo_cr_flds
ka1.php v0.30 0.30_20120727_1300 pdo_cr_kb
ka1.php v0.29 0.29_20120727_1100 newpass1 newpass2
ka1.php v0.28 0.28_20120727_1000 user=hosts.allow[2]
ka1.php v0.27 q=sql/cr/kb
ka1.php v0.26 newpass1 newpass2
ka1.php v0.25 user info from hosts.allow
ka1.php v0.24 0.22_20120720_1201 if(( isset($_SESSION['role'] )) && ( ! $_SESSION['role'] == "" )) {
ka1.php v0.23 0.22_20120720_1201 es/hs,vg,bp/ ...
ka1.php v0.22 0.22_20120720_1200 es/us/koSYS_us.php ka1/us/koSYS_us.php
ka1.php v0.21 0.21_20120627_1130 rename scrub update to scrub
ka1.php v0.20 0.19_20120619_1630 korhe_us.db3
ka1.php v0.19 0.19_20120619_1000 koaix_us.db3
ka1.php v0.18 0.18_20120618_1140 add kb, bp tables
ka1.php v0.17 0.17_20120608_1140 add kb, bp tables
ka1.php v0.16 0.16_20120605_0920 add ka1 tables
ka1.php v0.15 0.15_20120601_0920 add hs tables
ka1.php v0.14 0.14_20120531_1330 add grid tables users us
ka1.php v0.13 0.13_20120531_1320 $files=getfilka1( $path, $mask );
ka1.php v0.12 0.12_20120531_1038 gunzip scrubfile accomodation
ka1.php v0.11 0.11_20120531_1030 add serena link
ka1.php v0.10 0.10_20120516_1400 refresh to kohpx_vg.php kohpx_us.php kohpx_sw.php
ka1.php v0.09 0.05_20120425_1011 db3 grid from /home/ko/vg/kohpx_vg.db3 /var/www/html/ka1/db3
ka1.php v0.08 0.05_20120313_1311 q=links
ka1.php v0.08 0.05_20120313_1311 sw reports pending
ka1.php v0.07 0.05_20120313_1311 btn_footers
ka1.php v0.06 0.05_20120313_1311 q=scrub consolodate upload exampls
ka1.php v0.05 0.04_20120216_1530 ko_upload scrub2 ...:
ka1.php v0.04 0.04_20120216_1530 ko_upload scrub ...:
ka1.php v0.03 0.03_20120207_1400
ka1.php v0.02 0.02_20120207
ka1.php v0.01 0.01_20120205
*/
# phpinfo();
# print( "BUGS_100 ko2.us/index.php;<hr>" );
# exit;
$whitespace = ' \t\n\r\v\f';
$ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz';
$ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$ascii_letters = $ascii_lowercase . $ascii_uppercase;
$digits = '0123456789';
$hexdigits = $digits . 'abcdef' . 'ABCDEF';
$octdigits = '01234567';
# $punctuation = '!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~';
$punctuation = "!\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~";
$printable = $digits . $ascii_letters . $punctuation . $whitespace;
# print( "MSG_100 whitespace=$whitespace<br>\n");
# print( "MSG_100 ascii_lowercase=$ascii_lowercase<br>\n");
# print( "MSG_100 ascii_uppercase=$ascii_uppercase<br>\n");
# print( "MSG_100 ascii_letters=$ascii_letters<br>\n");
# print( "MSG_100 digits=$digits<br>\n");
# print( "MSG_100 hexdigits=$hexdigits<br>\n");
# print( "MSG_100 octdigits=$octdigits<br>\n");
# print( "MSG_100 punctuation=$punctuation<br>\n");
# print( "MSG_100 printable=$printable<br>\n");
# print( "MSG_100 © &trade ® & " &apos <br>\n");
# print( "MSG_101 asterisk *<br>\n");
# print( "MSG_102 percent %<br>\n");
# print( "MSG_103 left curly_brace { }<br>\n");
# print( "MSG_104 square_bracket [ ]<br>\n");
# print( "MSG_105 parenthesis ( )<br>\n");
# print( "MSG_106 ltgt < > ( )<br>\n");
# # preg_replace();
# $stringWithoutNonLetterCharacters = preg_replace("/[\/\&%#\$]/", "_", $yourString);
# $stringWithQuotesReplacedWithSpaces = preg_replace("/[\"\']/", " ", $stringWithoutNonLetterCharacters);
# $res = str_replace( array( '\'', '"', ',' , ';', '<', '>' ), ' ', $str);
// https://generatedata.com
// https://news.json-generate.com
// $fileSize = $_FILES['myFile']['size'];
// $tmpFile = $_FILES['myFile']['tmp_name'];
// $fileName = $_FILES['myFile']['name'];
// $contentType = $_FILES['myFile']['type'];
// $user = $_GET['user'];
/*
// .jpg image/jpeg`
// .gif image/gif
// .png image/png
// .wbmp image/vnd.wap.wbmp
// .txt text/plain
*/
# if( !empty($_REQUEST['a'])) { $a=$_REQUEST['a']; }
# <script>location.href='https://www.attacker.com'</script>
# $username = trim(htmlspecialchars($_POST['username']));
# $email = trim(htmlspecialchars($_POST['email']));
# $email = filter_var($email, FILTER_VALIDATE_EMAIL );
# $number = filter_var($number, FILTER_VALIDATE_INT );
# $number = filter_var($number, FILTER_VALIDATE_FLOAT );
# if (!filter_var($ip, FILTER_VALIDATE_IP) === false) { echo("MSG_100 VALID ip=$ip"); }
# Input::$error = false;
# Input::check(['email', 'password'], $_REQUEST);
# validate an integer
# $number = Input::int($_POST['number']);
# validate a string
# $name = Input::str($_POST['name']);
# convert to boolean
# $bool = Input::bool($_POST['boolean']);
# validate an email
# $email = Input::email($_POST['email']);
# validate a URL
# $url = Input::url($_POST['url']);
#
# $website = input($_POST["site"]);
# if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$website)) { $websiteErr = "Invalid URL"; }
include( '../safer/ko_startup.php' );
# include( '../../safer/ko_startup.php' );
# $server="localhost"; $dbname="dgs"; $user="dgsmstr"; $pass="=dgsmstr=
$http_host="ko2.us";
if( isset( $_SERVER['HTTP_HOST'] )) { $http_host = $_SERVER['HTTP_HOST']; }
$server=kocfg($http_host,'server');
$dbname=kocfg($http_host,'dbname');
$tbl=kocfg($http_host,'tbl');
$sql=kocfg($http_host,'sql');
$user=kocfg($http_host,'user');
$pass=kocfg($http_host,'pass');
$db2=db2conn($server,$dbname,$user,$pass );
$progid="ko"; $db2id="ko";
if ($db2 ) {
# print( "MSG_172 DB2CONN_DONE http_host=$http_host progid=$progid server=$server dbname=$dbname user=$user");
# print( "MSG_172 DB2CONN_DONE http_host=$http_host progid=$progid db2id=$db2id");
}
else {
# $dbname_short=explode("_",$dbname)[1];
# print( "ERR_173 DB2CONN_FAIL http_host=$http_host progid=$progid server=$server dbname=$dbname user=$user");
# print( "ERR_173 DB2CONN_FAIL http_host=$http_host progid=$progid server=$server dbname=$dbname");
# print( "ERR_173 DB2CONN_FAIL http_host=$http_host progid=$progid db2id=$db2id");
# print( "ERR_173 DB2CONN_FAIL http_host=$http_host progid=$progid server=$server dbname=$dbname_short" );
}
$a=""; if( isset( $_REQUEST['a'])) { $a=trim(htmlspecialchars($_REQUEST['a'])); }
$a=""; if( isset( $_REQUEST['a'])) { $a=trim(htmlspecialchars($_REQUEST['a'])); }
$b=""; if( isset( $_REQUEST['b'])) { $b=trim(htmlspecialchars($_REQUEST['b'])); }
$c=""; if( isset( $_REQUEST['c'])) { $c=trim(htmlspecialchars($_REQUEST['c'])); }
$d=""; if( isset( $_REQUEST['d'])) { $d=trim(htmlspecialchars($_REQUEST['d'])); }
$e=""; if( isset( $_REQUEST['e'])) { $e=trim(htmlspecialchars($_REQUEST['e'])); }
$f=""; if( isset( $_REQUEST['f'])) { $f=trim(htmlspecialchars($_REQUEST['f'])); }
$g=""; if( isset( $_REQUEST['g'])) { $g=trim(htmlspecialchars($_REQUEST['g'])); }
$h=""; if( isset( $_REQUEST['h'])) { $h=trim(htmlspecialchars($_REQUEST['h'])); }
$i=""; if( isset( $_REQUEST['i'])) { $i=trim(htmlspecialchars($_REQUEST['i'])); }
$j=""; if( isset( $_REQUEST['j'])) { $j=trim(htmlspecialchars($_REQUEST['j'])); }
$k=""; if( isset( $_REQUEST['k'])) { $k=trim(htmlspecialchars($_REQUEST['k'])); }
$l=""; if( isset( $_REQUEST['l'])) { $l=trim(htmlspecialchars($_REQUEST['l'])); }
$m=""; if( isset( $_REQUEST['m'])) { $m=trim(htmlspecialchars($_REQUEST['m'])); }
$n=""; if( isset( $_REQUEST['n'])) { $n=trim(htmlspecialchars($_REQUEST['n'])); }
$o=""; if( isset( $_REQUEST['o'])) { $o=trim(htmlspecialchars($_REQUEST['o'])); }
$p=""; if( isset( $_REQUEST['p'])) { $p=trim(htmlspecialchars($_REQUEST['p'])); }
$q=""; if( isset( $_REQUEST['q'])) { $q=trim(htmlspecialchars($_REQUEST['q'])); }
$r=""; if( isset( $_REQUEST['r'])) { $r=trim(htmlspecialchars($_REQUEST['r'])); }
$s=""; if( isset( $_REQUEST['s'])) { $s=trim(htmlspecialchars($_REQUEST['s'])); }
$t=""; if( isset( $_REQUEST['t'])) { $t=trim(htmlspecialchars($_REQUEST['t'])); }
$u=""; if( isset( $_REQUEST['u'])) { $u=trim(htmlspecialchars($_REQUEST['u'])); }
$v=""; if( isset( $_REQUEST['v'])) { $v=trim(htmlspecialchars($_REQUEST['v'])); }
$w=""; if( isset( $_REQUEST['w'])) { $w=trim(htmlspecialchars($_REQUEST['w'])); }
$x=""; if( isset( $_REQUEST['x'])) { $x=trim(htmlspecialchars($_REQUEST['x'])); }
$y=""; if( isset( $_REQUEST['y'])) { $y=trim(htmlspecialchars($_REQUEST['y'])); }
$z=""; if( isset( $_REQUEST['z'])) { $z=trim(htmlspecialchars($_REQUEST['z'])); }
$db3=""; if( isset( $_REQUEST['db3'])) { $db3=trim(htmlspecialchars($_REQUEST['db3'])); }
$tbl=""; if( isset( $_REQUEST['tbl'])) { $tbl=trim(htmlspecialchars($_REQUEST['tbl'])); }
$sel=""; if( isset( $_REQUEST['sel'])) { $sel=trim(htmlspecialchars($_REQUEST['sel'])); }
$fld=""; if( isset( $_REQUEST['fld'])) { $fld=trim(htmlspecialchars($_REQUEST['fld'])); }
$val=""; if( isset( $_REQUEST['val'])) { $val=trim(htmlspecialchars($_REQUEST['val'])); }
$fmt=""; if( isset( $_REQUEST['fmt'])) { $fmt=trim(htmlspecialchars($_REQUEST['fmt'])); }
$lim=""; if( isset( $_REQUEST['lim'])) { $lim=trim(htmlspecialchars($_REQUEST['lim'])); }
$matches="";
$matches2="";
main();
function main() {
# phpinfo();
$progid="ko_";
$dttm=date('Ymd_His');
# $img="/fb/pages/zn/zn_1.jpg";
# $img="/fb/byrdbellvjk/pages/zn/zn_1.jpg";
# $dr=$_SERVER['DOCUMENT_ROOT'];
# $drimg = $dr.$img;
# $htmout="";
# $w=100; $h=150;
# $tn=img2tn($drimg,$w,$h);
# $htmout .= "img=$img<br>\n";
# $htmout .= "drimg=$drimg<br>\n";
# $htmout .= "<a href=$img target=_blank>";
# $htmout .= " <img src=$img height=$h border=0>";
# $htmout .= " </a>\n";
# print( $htmout );
# exit;
# if( isset($_REQUEST['kups'])) {
# $kups=$_REQUEST['kups'];
# $htmout = kups($kups);
# printf( $htmout );
# exit;
# }
if( isset($_REQUEST['plupload'])) {
// printf( "BUGS_305 PLUPLOAD<br>\n" );
$args="args";
$htmout=plupload($args);
printf( $htmout );
exit;
}
if( isset($_REQUEST['contacts'])) {
$htmout="";
$htmout=contacts('');
# printf($htmout);
exit;
}
if( isset($_REQUEST['kov'])) {
$htmout="";
$htmout=kov('');
# printf($htmout);
exit;
}
if( isset($_REQUEST['leds'])) {
$htmout=leds('');
printf( $htmout );
exit;
}
if( isset($_REQUEST['lists'])) {
# $file=""; $dr=""; $j=0; $k=0; $htmout=""; $db3="ko.db3"; $tbl="items";
$file=""; $dr=""; $j=0; $k=0; $htmout=""; $db3="ko_todo.db3"; $tbl="items";
$lists=$_REQUEST['lists'];
$tbl=$lists;
if($_SERVER['DOCUMENT_ROOT']) { $dr=$_SERVER['DOCUMENT_ROOT']; }
$drfile="$dr$file";
$drdb3="$dr$db3";
if( isset($_REQUEST['db3'])) {
$htmout=""; $j=0; $k=0;
$db3=$_REQUEST['db3'];
$db3fil="$dr/$db3";
$sql="select * from $tbl";
$fld="";
if( ! is_file($db3fil)) {
printf( "BUGS_313 NOTFOUND db3fil=$db3fil<br>\n" );
exit;
}
// $htmout .= sqlq( $db3fil, $sql, $fld );
$pdo = newpdo($db3fil);
if( $tbl == "letter" ) {
$sql="select rowid,text,desc from $tbl";
$psv="rowid|text|desc\n";
$sql="select rowid,text,desc from $tbl";
foreach( $pdo->query($sql) as $row ) {
$rowid=$row['rowid'];
$text=$row['text'];
$desc=$row['desc'];
$psv.="$rowid|$text|$desc\n";
}
printf( $htmout."\n".$psv );
exit;
}
if( $tbl == "contacts" ) {
$sql="select rowid,* from $tbl";
$psv="rowid|id|name|phn|firm|url|email|note|action\n";
$sql="select rowid,* from $tbl";
foreach( $pdo->query($sql) as $row ) {
$rowid=$row['rowid'];
$id=$row['id'];
$name=$row['name'];
$phn=$row['phn'];
$firm=$row['firm'];
$url=$row['url'];
$email=$row['email'];
$note=$row['note'];
$action=$row['action'];
$psv.="$rowid|$id|$name|$phn|$firm|$url|$email|$note|$action\n";
}
printf( $htmout."\n".$psv );
exit;
}
if( $tbl == "leds" ) {
$sql="select rowid,* from $tbl";
$psv="ROWID|led_id|led_status|led_code|led_name|led_dttm|led_color|led_speed|led_type|led_date|led_cmd|led_cmdout|led_desc|led_misc|led_city|led_bldg|led_loc_code|led_floor|led_group|led_orgs|led_title|led_published|led_width|led_height|led_comment|led_filename|led_user|led_user_ip|led_referer|led_remote_port|led_viewrole|led_user_agent|led_unique_id|led_err|led_fix|led_os";
$sql="select * from $tbl";
$rowid="";
$j=0;
foreach( $pdo->query($sql) as $row ) {
$j=$j+1;
// $rowid=$row['rowid'];
$led_id=$row['led_id'];
$led_status=$row['led_status'];
$led_code=$row['led_code'];
$led_name=$row['led_name'];
$led_dttm=$row['led_dttm'];
$led_color=$row['led_color'];
$led_speed=$row['led_speed'];
// printf( "BUGS_370 LEDS led_id=$led_id led_code=$led_code led_name=$led_name $led_color $led_speed\n" );
$led_type=$row['led_type'];
$led_date=$row['led_date'];
$led_cmd=$row['led_cmd'];
$led_cmdout=$row['led_cmdout'];
$led_desc=$row['led_desc'];
$led_misc=$row['led_misc'];
$led_city=$row['led_city'];
$led_bldg=$row['led_bldg'];
$led_loc_code=$row['led_loc_code'];
$led_floor=$row['led_floor'];
$led_group=$row['led_group'];
$led_orgs=$row['led_orgs'];
$led_title=$row['led_title'];
$led_published=$row['led_published'];
$led_width=$row['led_width'];
$led_height=$row['led_height'];
$led_comment=$row['led_comment'];
$led_filename=$row['led_filename'];
$led_user=$row['led_user'];
$led_user_ip=$row['led_user_ip'];
$led_referer=$row['led_referer'];
$led_remote_port=$row['led_remote_port'];
$led_viewrole=$row['led_viewrole'];
$led_user_agent=$row['led_user_agent'];
$led_unique_id=$row['led_unique_id'];
$led_err=$row['led_err'];
$led_fix=$row['led_fix'];
$led_os=$row['led_os'];
$psv.="$rowid|$led_id|$led_status|$led_code|$led_name|$led_dttm|$led_color|$led_speed|$led_type|$led_date|$led_cmd|$led_cmdout|$led_desc|$led_misc|$led_city|$led_bldg|$led_loc_code|$led_floor|$led_group|$led_orgs|$led_title|$led_published|$led_width|$led_height|$led_comment|$led_filename|$led_user|$led_user_ip|$led_referer|$led_remote_port|$led_viewrole|$led_user_agent|$led_unique_id|$led_err|$led_fix|$led_os<br>\n";
// printf( "BUGS_400 j=$j psv=$psv\n" );
}
printf( $psv );
exit;
}
$psv="rowid|pathfile|path|file|base|ext|dttm|exif_dt|exif_tm|desc|\n";
$sql="select rowid,pathfile,path,file,base,ext,dttm,exif_dt,exif_tm,desc from $tbl";
foreach( $pdo->query($sql) as $row ) {
$rowid=$row['rowid'];
$pathfile=$row['pathfile'];
$path=$row['path'];
$file=$row['file'];
$base=$row['base'];
$ext=$row['ext'];
$exif_dt=$row['exif_dt'];
$exif_tm=$row['exif_tm'];
$desc=$row['desc'];
$psv.="$rowid|$pathfile|$path|$file|$base|$ext|$dttm|$exif_dt|$exif_tm|$desc|\n";
}
printf( $htmout."\n".$psv );
exit;
}
if( $lists == "items" ) { $file="/ko/lists_items.txt"; }
if( $lists == "contacts" ) { $file="/ko/lists_contacts.txt"; }
if( $lists == "letter" ) { $file="/ko/lists_letter.txt"; }
if( $lists == "monkeytraps" ) { $file="/ko/lists_monkeytraps.txt"; }
if( $lists == "floods" ) { $file="/ko/lists_floods.txt"; }
if( $lists == "postturtles" ) { $file="/lists_postturtles.txt"; }
if( $lists == "coffee" ) { $file="/lists_coffee.txt"; }
$drfile="$dr$file";
if( is_file($drfile)) {
// printf( "BUGS_313 ___FOUND lists=$lists dr=$dr file=$file drfile=$drfile\n" );
$htmout=htmout_load($drfile);
}
else {
printf( "BUGS_313 NOTFOUND lists=$lists dr=$dr file=$file drfile=$drfile\n" );
exit;
}
printf( $htmout );
exit;
}
if( isset($_REQUEST['kups'])) {
$kups=$_REQUEST['kups'];
if( $kups == "" ) {
$htmout = kups('');
}
if( $kups == "review" ) {
$htmout = kups_review('');
}
# printf( "BUGS_295 isset _FILES<br>\n" );
if( $kups == "go" ) {
$htmout = img2dirs();
}
printf( $htmout );
exit;
}
if( isset($_FILES["kups"])) {
printf( "BUGS_295 isset _FILES<br>\n" );
$htmout = img2dirs();
printf( $htmout );
exit;
}
if( isset($_REQUEST["k9"])) {
$k9=$_REQUEST['k9'];
printf( "BUGS_295 isset _K9 k9=$k9<br>\n" );
$htmout = k9($k9);
printf( $htmout );
exit;
}
if( isset($_REQUEST['img2b64'] )) {
# img2b64( $imgfil, $fmt );
# img2b64("./imgs/btn/kobrd.png","png","b64" );
# img2b64("./imgs/bg/ko_colorado_white.jpg","jpg","b64" );
# img2b64("./imgs/btn/kobrd.png","png","html" );
# img2b64("./imgs/btn/kobrd.png","png","" );
$htmout = "";
$htmout .= "<html><head><title>/ka/ko.php?img2b64 20230129_1700</title></head>\n";
$img2b64=$_REQUEST['img2b64'];
$htm_koeye = gdImgToHTML( "./imgs/btn/koeye.png", $format='png' );
$htm_kobrd = gdImgToHTML( "./imgs/btn/kobrd.png", $format='png' );
$img_koeye = img2b64("./imgs/btn/koeye.png","png","html");
$img_kobrd = img2b64("./imgs/btn/kobrd.png","png","html");
$b64_koeye = img2b64("./imgs/btn/koeye.png","png","b64");
$b64_kobrd = img2b64("./imgs/btn/kobrd.png","png","b64");
$htmout .= "<a href=./imgs/btn/koeye.png target=_blank>\n";
$htmout .= $htm_koeye;
$htmout .= "</a><br>\n";
$htmout .= "<a href=./imgs/btn/kobrd.png target=_blank>\n";
$htmout .= $htm_kobrd;
$htmout .= "</a><br>\n";
$htmout .= "<hr color=black>\n";
$htmout .= "<a href=./imgs/btn/koeye.png target=_blank>\n";
$htmout .= $img_koeye;
$htmout .= "</a><br>\n";
$htmout .= "<a href=./imgs/btn/kobrd.png target=_blank>\n";
$htmout .= $img_kobrd;
$htmout .= "</a><br>\n";
$htmout .= "<hr color=black>\n";
$htmout .= "<a href=./imgs/btn/koeye.png target=_blank>\n";
$htmout .= "<img src=".$b64_koeye." height=30 border=0>\n";
$htmout .= "</a><br>\n";
$htmout .= "<a href=./imgs/btn/kobrd.png target=_blank>\n";
$htmout .= "<img src=". $b64_kobrd." height=30 border=0>\n";
$htmout .= "</a><br>\n";
$htmout .= " </body>\n";
$htmout .= " </html>\n";
printf( $htmout);
exit;
}
if( isset($_FILES["image"])) {
printf( "BUGS_295 isset _FILES<br>\n" );
$htmout = img2dirs();
printf( $htmout );
exit;
}
if( isset($_REQUEST['txt2imgs'])) {
$htmout=txt2imgs('');
printf($htmout);
exit;
}
if( isset($_REQUEST['txt2img'])) {
$htmout="";
$img="./imgs/btn/koeye.png";
$fmt="b64";
$imgfil="./imgs/btn/kobrd.png";
$fontid="yokkmokk";
$text="sophia";
$fmt="";
$savefile="./imgs/btn/koeye_sophia.png";
$htmout=txt2img($imgfil,$fontid,$text,$fmt,$save);
printf($htmout);
exit;
}
if( isset($_REQUEST['gd'])) {
$options="";
$gd=$_REQUEST['gd'];
$htmout = gd($gd);
printf($htmout);
exit;
}
if( isset($_REQUEST['img2tn'])) {
$htmout = "";
$img=$_REQUEST['img2tn'];
if( $img == "" ) { $img="/fb/pages/zn/zn_1.jpg"; }
$htmout .= "<h1>BUGS_290 img2tn img=$img</h1>";
$htmout=img2tn($img);
printf( $htmout );
}
if( isset($_REQUEST['kin'])) {
$htmout = "";
$options="kin_options";
$htmout .= "<h1>BUGS_291 kin options=$options</h1>";
kin($options);
}
if( isset($_REQUEST['kup'])) {
printf( "<h1>BUGS_292 kup ko_kup</h1>" );
startup();
}
if( isset($_REQUEST['ko_kup'])) {
printf( "<h1>BUGS_293 ko_kup</h1>" );
ko_kup();
}
$args=array();
$id="";
$query_string="";
if( isset($_REQUEST['QUERY_STRING'])) {
$query_string = $_REQUEST['QUERY_string'];
}
# print( "\n<h1>BUGS_101 ko.php MAIN query_string=$query_string</h1><br>\n" );
if( isset($_REQUEST['ko_form']) || isset($_REQUEST['ko_form'] )) {
ko_form('');
exit;
}
if( isset($_REQUEST['ko_form_submit']) || isset($_REQUEST['ko_form_submit'] )) {
phpinfo();
exit;
}
if( isset($_REQUEST['scrub_upload_form']) || isset($_REQUEST['scrub_upload_form'] )) {
$options="";
scrub_upload_form( $options );
exit;
}
if( isset($_REQUEST['ko_upload']) || isset($_REQUEST['ko_upload2'] )) {
$options="";
$htmout=ko_upload2();
printf( "$htmout" );
exit;
}
if( isset($_REQUEST['ko_uploads']) || isset($_REQUEST['ko_uploads'] )) {
$options="";
$htmout=ko_uploads($options);
printf( "$htmout" );
exit;
}
if( isset($_REQUEST['bugs']) || isset($_REQUEST['bugs'] )) {
$options="";
$htmout=bugs($options);
printf( "<h1>BUGS_100 $htmout </h1>\n" );
exit;
}
$dbname="dgs";
$db3fil="$dbname.db3";
if( isset($_REQUEST['db2']) || isset($_REQUEST['db2'] )) {
$request_db2=$_REQUEST['db2'];
$server="localhost";
$user="root";
$pass="..root";
$htmout = "";
# $htmout .= htmout_head('db2');
$htmout .= "<html><head>\n";
$htmout .= htmout_load('ko_scripts.html');
$htmout .= htmout_load('ko_styles.html');
$htmout .= " </head>";
$htmout .= "<body bgcolor=linen onload=\"startup('db2);return false;\" >\n";
$htmout .= "<img src=\"/imgs/btn/koeye.png\" onclick=\"toggle('div_db2'); return false;\" height=24>\n";
$htmout .= "<div id=div_db2>\n";
$htmout .= " <hr color=goldenrod>\n";
$htmout .= " <h1>div_db2<h1>\n";
$server="localhost";
$dbname="dgs";
$sql2="show tables;";
$sql2="select * from ko_temp";
$sql2="select * from Players";
$dbname="zc"; $sql2="select * from Products";
$dbname="zc"; $sql2="select * from Categories";
$dbname="zc"; $sql2="select count(*) from Products";
$dbname="dgs"; $sql2="describe Players";
$dbname="dgs"; $sql2="show tables;";
$dbname="zc"; $sql2="show tables;";
$dbname="dgs"; $sql2="show tables;";
$db3fil="$dbname.db3";
$tblnum=1;
$dbname="dgs";
$j=0;
if( preg_match("/show/", $request_db2 )) {
$dbname="dgs"; $tbl="ko_temp";
$sql="show tables";
if( preg_match("/show_dgs/", $request_db2 )) { $dbname="dgs"; }
if( preg_match("/show_zc/", $request_db2 )) { $dbname="zc"; }
# print( "<h3>MSG_716 DB2 SHOW tbl=$tbl sql=$sql</h3>" );
$htmout_db2_query=db2_query( $server,$dbname,$tbl,$sql, $db3fil, $user,$pass );
print( $htmout_db2_query );
}
# print( "<h3>MSG_290 DB2 SELECT HEAD</h3>" );
if( preg_match("/select/", $request_db2 )) {
$tbl="ko_temp";
if( count(explode("_",$request_db2)) > 0 ) {
$tbl=explode("select_", $request_db2)[1];
}
$sql="select * from $tbl";
# print( "<h3>MSG_291 DB2 SELECT dbname=$dbname tbl=$tbl sq1=$sql</h3>" );
$htmout_db2_query=db2_query( $server,$dbname,$tbl,$sql, $db3fil, $user,$pass );
print( $htmout_db2_query );
}
if (( $_REQUEST['db2'] == "creates" ) || ( $_REQUEST['db2'] == "creates" )) {
# print( "<h3>BUGS_275 dbname=$dbname db3fil=$db3fil tbls_len=$tbls_len</h3>\n" );
$tbls=explode("\n", show_tables($dbname));
$tbls_len=count($tbls);
# print( "<h3>BUGS_270 dbname=$dbname db3fil=$db3fil tbls_len=$tbls_len</h3>\n" );
foreach( $tbls as $tbl ) {
if( $tbl == "" ) {
# print( "<h1>BUGS_270 SKIP j=$j tbl=$tbl</h1>" );
continue;
}
$j=$j+1;
$sql2="describe $tbl;";
$sql="";
print( "<h2>BUGS_280 j=$j dbname=$dbname tbl=$tbl sql=$sql db3fil=$db3fil</h2>" );
# mysql2sql3_insert( $server,$dbname,$tbl,$user,$pass,$db3fil);
mysql2sql3_create( $server,$dbname,$tbl,$user,$pass,$db3fil);
}
}
if (( $_REQUEST['db2'] == "inserts" ) || ( $_REQUEST['db2'] == "inserts" )) {
# print( "<h3>BUGS_275 dbname=$dbname db3fil=$db3fil tbls_len=$tbls_len</h3>\n" );
$tbls=explode("\n", show_tables($dbname));
$tbls_len=count($tbls);
# print( "<h3>BUGS_270 dbname=$dbname db3fil=$db3fil tbls_len=$tbls_len</h3>\n" );
foreach( $tbls as $tbl ) {
if( $tbl == "" ) {
# print( "<h1>BUGS_270 SKIP j=$j tbl=$tbl</h1>" );
continue;
}
$j=$j+1;
$sql2="describe $tbl;";
$sql="";
print( "<h2>BUGS_280 j=$j dbname=$dbname tbl=$tbl sql=$sql db3fil=$db3fil</h2>" );
mysql2sql3_insert( $server,$dbname,$tbl,$user,$pass,$db3fil);
mysql2sql3_create( $server,$dbname,$tbl,$user,$pass,$db3fil);
}
}
$user="root"; $pass="..root";
print( "<h1>BUGS_100 DB2</h1>" );
if( isset( $_REQUEST['db2'] )) { $dbname=$_REQUEST['db2']; }
if( isset( $_REQUEST['user'] )) { $user=$_REQUEST['user']; }
if( isset( $_REQUEST['db3fil'] )) { $db3fil=$_REQUEST['db3fil']; }
if( isset( $_REQUEST['sql'] )) { $sql=$_REQUEST['sql']; }
if( isset( $_REQUEST['fmt'] )) { $fmt=$_REQUEST['fmt']; }
$j=0; $k=0; $i=0;
if( isset( $_REQUEST['tbl'] )) { $tbl=$_REQUEST['tbl']; }
$dbname="zc"; $tbl="ko_temp";
$dbname="dgs"; $tbl="ko_temp";
$dbname="dgs"; $tbl="Players";
if( $dbname == "" ) { $dbname="dgs"; }
if( $dbname == "" ) { $dbname="zc"; }
# $db2=db2_connect($server,$dbname,$user,$pass);
# $htmout_db2_query = db2_query($db2,$dbname,$sql2 );
# $htmout_db2_exec = db2_exec($db2,$dbname,$sql2 );
print( "<h1>BUGS_310 j=$j k=$k dbname=$dbname tbl=$tbl sql2=$sql2</h1>" );
$htmout .= " </div>\n";
$htmout .= htmout_load('ko_divs.html');
$htmout .= htmout_tail('db2');
print($htmout);
exit;
}
if( isset($_REQUEST['db3']) || isset($_REQUEST['db3'] )) {
$htmout = "";
# $htmout .= htmout_head('db3');
$htmout .= "<html><head>\n";
$htmout .= " <title>$progid $dttm db3</title>\n";
$htmout .= htmout_load('ko_styles.html');
$htmout .= htmout_load('ko_scripts.html');
$htmout .= " </head>\n";
$htmout .= "<body bgcolor=linen onload=\"startup('db3);return false;\" >\n";
$htmout .= "<img src=\"/imgs/btn/koeye.png\" onclick=\"toggle('div_db3'); return false;\" height=24>\n";
$htmout .= "<div id=div_db3>\n";
$htmout .= " <hr color=goldenrod>\n";
$htmout .= " <h1>div_db3<h1>\n";
$htmout .= db3($db3fil);
$htmout .= " </div>\n";
$htmout .= htmout_load('ko_divs.html');
$htmout .= htmout_tail('db3');
print($htmout);
exit;
}
if( isset($_REQUEST['file']) || isset($_REQUEST['file'] )) {
$filnam=$_REQUEST['file'];
if( file_exists( $filnam )) {
$filtxt=read_htmlfile($filnam);
print($filtxt);
}
else {
print( "ERR_430: NOTFOUND filnam=$filnam<br>\n" );
}
exit;
}
if( isset($_REQUEST['ko_coffeeshop']) || isset($_REQUEST['ko_coffeeshop'] )) {
$gid=""; $fmt="";
if( isset( $_REQUEST['db3'] )) { $db3=$_REQUEST['db3']; }
if( isset( $_REQUEST['fmt'] )) { $fmt=$_REQUEST['fmt']; }
$request="ko_coffeeshop";
$txt=""; $csv=""; $psv="";
$htmout=""; $htmout_table_head=""; $htmout_table_body="";
// print( "<h1>BUGS_400 gid=$gid fmt=$fmt</h1>" );
$json="{ \"$request\": [\n";
$htmout_table_head = "<table id=table_$request>\n";
$htmout_table_head .= "<tr><td style='text-align:center' colspan=14>gameid: $gid</td></tr>\n";
$htmout_table_head .= "<tr>";
$htmout_table_head .= "<td>row</td>";
$htmout_table_head .= "<td>ord</td>";
$htmout_table_head .= "<td>no</td>";
$htmout_table_head .= "<td>id</td>";
$htmout_table_head .= "<td>status</td>";
$htmout_table_head .= "<td>dttm</td>";
$htmout_table_head .= "<td>grp</td>";
$htmout_table_head .= "<td>item</td>";
$htmout_table_head .= "<td>logo</td>";
$htmout_table_head .= "<td>coffee_id</td>";
$htmout_table_head .= "<td>coffee_url</td>";
$htmout_table_head .= "<td>coffee_tn</td>";
$htmout_table_head .= "<td>logo</td>";
$htmout_table_head .= "<td>hostid</td>";
$htmout_table_head .= "<td>host</td>";
$htmout_table_head .= "<td>pdf</td>";
$htmout_table_head .= "<td>pdftxt</td>";
$htmout_table_head .= "<td>fb</td>";
$htmout_table_head .= "<td>fbtxt</td>";
$htmout_table_head .= "<td>gif</td>";
$htmout_table_head .= "<td>giftxt</td>";
$htmout_table_head .= "<td>mp3</td>";
$htmout_table_head .= "<td>mp3txt</td>";
$htmout_table_head .= "<td>mp4</td>";
$htmout_table_head .= "<td>mp4txt</td>";
$htmout_table_head .= "<td>bc</td>";
$htmout_table_head .= "<td>bctxt</td>";
$htmout_table_head .= "<td>yt</td>";
$htmout_table_head .= "<td>yttxt</td>";
$htmout_table_head .= "<td>pn</td>";
$htmout_table_head .= "<td>pntxt</td>";
$htmout_table_head .= "<td>sl</td>";
$htmout_table_head .= "<td>sltxt</td>";
$htmout_table_head .= "<td>tl</td>";
$htmout_table_head .= "<td>tltxt</td>";
$htmout_table_head .= "<td>tx</td>";
$htmout_table_head .= "<td>txtxt</td>";
$htmout_table_head .= "<td>zm</td>";
$htmout_table_head .= "<td>zmtxt</td>";
$htmout_table_head .= "<td>hostid</td>";
$htmout_table_head .= "<td>host</td>";
$htmout_table_head .= "<td>home</td>";
$htmout_table_head .= "<td>name</td>";
$htmout_table_head .= "<td>email</td>";
$htmout_table_head .= "<td>phn</td>";
$htmout_table_head .= "<td>fab</td>";
$htmout_table_head .= "<td>gab</td>";
$htmout_table_head .= "<td>pl</td>";
$htmout_table_head .= "<td>pt</td>";
$htmout_table_head .= "<td>ss</td>";
$htmout_table_head .= "<td>ts</td>";
$htmout_table_head .= "<td>tw</td>";
$htmout_table_head .= "<td>jitsi</td>";
$htmout_table_head .= "<td>chat</td>";
$htmout_table_head .= "<td>item</td>";
$htmout_table_head .= "<td>cnt</td>";
$htmout_table_head .= "<td>amt</td>";
$htmout_table_head .= "<td>note</td>";
$htmout_table_head .= "</tr>\n";
$psvhdr=""; $psvdta ="";
$psvhdr .= "row|ord|no|id|status|dttm|grp|item|logo|";
$psvhdr .= "coffee_id|coffee_url|coffee_tn|";
$psvhdr .= "fb|fbtxt|pdf|pdftxt|gif|giftxt|";
$psvhdr .= "mp3|mp3txt|mp4|mp4txt|bc|bctxt|rm|rmtxt|vm|vmtxt|yt|yttxt|";
$psvhdr .= "pn|pntxt|sl|sltxt|tl|tltxt|tx|txtxt|zm|zmtxt|";
$psvhdr .= "hostid|host|home|name|email|phn|";
$psvhdr .= "fab|gab|li|pl|pt|ss|ts|tw|jitsi|chat|";
$psvhdr .= "dm|dmtxt|dr|drtxt|gp|gptxt|js|jstxt|wm|wmtxt|zh|zhtxt|";
$psvhdr .= "itm|cnt|amt|note";
$psvhdr .= "\n";
$db3fil="ko.db3"; $fld=""; $output = "";
$sql="select * from ko_coffeeshop";
// $sql="select * from ko_coffeeshop where gid='$gid'";
// $bxbys = sqlq( $db3fil, $sql, $fld );
$pdo = newpdo($db3fil);
foreach( $pdo->query($sql) as $row ) {
$rowno=$row['rowno'];
$ord=$row['ord'];
$no=$row['no'];
$id=$row['id'];
$status=$row['status'];
$dttm=$row['dttm'];
$grp=$row['grp'];
$item=$row['item'];
$logo=$row['logo'];
$coffee_id=$row['coffee_id'];
$coffee_url=$row['coffee_url'];
$coffee_tn=$row['coffee_tn'];
$fb=$row['fb'];
$fbtxt=$row['fbtxt'];
$pdf=$row['pdf'];
$pdftxt=$row['pdftxt'];
$gif=$row['gif'];
$giftxt=$row['giftxt'];
$mp3=$row['mp3'];
$mp3txt=$row['mp3txt'];
$mp4=$row['mp4'];
$mp4txt=$row['mp4txt'];
$bc=$row['bc'];
$bctxt=$row['bctxt'];
$rm=$row['rm'];
$rmtxt=$row['rmtxt'];
$vm=$row['vm'];
$vmtxt=$row['vmtxt'];
$yt=$row['yt'];
$yttxt=$row['yttxt'];
$pn=$row['pn'];
$pntxt=$row['pntxt'];
$sl=$row['sl'];
$sltxt=$row['sltxt'];
$tl=$row['tl'];
$tltxt=$row['tltxt'];
$tx=$row['tx'];
$txtxt=$row['txtxt'];
$zm=$row['zm'];
$zmtxt=$row['zmtxt'];
$hostid=$row['hostid'];
$host=$row['host'];
$home=$row['home'];
$name=$row['name'];
$email=$row['email'];
$phn=$row['phn'];
$fab=$row['fab'];
$gab=$row['gab'];
$li=$row['li'];
$pl=$row['pl'];
$pt=$row['pt'];
$ss=$row['ss'];
$ts=$row['ts'];
$tw=$row['tw'];
$jitsi=$row['jitsi'];
$chat=$row['chat'];
$dm=$row['dm'];
$dmtxt=$row['dmtxt'];
$dr=$row['dr'];
$drtxt=$row['drtxt'];
$gp=$row['gp'];
$gbtxt=$row['gbtxt'];
$js=$row['js'];
$jstxt=$row['jstxt'];
$wm=$row['wm'];
$wmtxt=$row['wmtxt'];
$zh=$row['zh'];
$zhtxt=$row['zhtxt'];
$itm=$row['itm'];
$cnt=$row['cnt'];
$amt=$row['amt'];
$note=$row['note'];
$psvdta .= "$rowno|";
$psvdta .= "$ord|";
$psvdta .= "$no|";
$psvdta .= "$id|";
$psvdta .= "$status|";
$psvdta .= "$dttm|";
$psvdta .= "$grp|";
$psvdta .= "$item|";
$psvdta .= "$logo|";
$psvdta .= "$coffee_id|";
$psvdta .= "$coffee_url|";
$psvdta .= "$coffee_tn|";
$psvdta .= "$fb|";
$psvdta .= "$fbtxt|";
$psvdta .= "$pdf|";
$psvdta .= "$pdftxt|";
$psvdta .= "$gif|";
$psvdta .= "$giftxt|";
$psvdta .= "$mp3|";
$psvdta .= "$mp3txt|";
$psvdta .= "$mp4|";
$psvdta .= "$mp4txt|";
$psvdta .= "$bc|";
$psvdta .= "$bctxt|";
$psvdta .= "$rm|";
$psvdta .= "$rmtxt|";
$psvdta .= "$vm|";
$psvdta .= "$vmtxt|";
$psvdta .= "$yt|";
$psvdta .= "$yttxt|";
$psvdta .= "$pn|";
$psvdta .= "$pntxt|";
$psvdta .= "$sl|";
$psvdta .= "$sltxt|";
$psvdta .= "$tl|";
$psvdta .= "$tltxt|";
$psvdta .= "$tx|";
$psvdta .= "$txtxt|";
$psvdta .= "$zm|";
$psvdta .= "$zmtxt|";
$psvdta .= "$hostid|";
$psvdta .= "$host|";
$psvdta .= "$home|";
$psvdta .= "$name|";
$psvdta .= "$email|";
$psvdta .= "$phn|";
$psvdta .= "$fab|";
$psvdta .= "$gab|";
$psvdta .= "$li|";
$psvdta .= "$pl|";
$psvdta .= "$pt|";
$psvdta .= "$ss|";
$psvdta .= "$ts|";
$psvdta .= "$tw|";
$psvdta .= "$jitsi|";
$psvdta .= "$chat|";
$psvdta .= "$bitchute|";
$psvdta .= "$bitchutetxt|";
$psvdta .= "$shopify|";
$psvdta .= "$shopifytxt|";
$psvdta .= "$squareup|";
$psvdta .= "$squareuptxt|";
$psvdta .= "$stripe|";
$psvdta .= "$stripetxt|";
$psvdta .= "$dm|";
$psvdta .= "$dmtxt|";
$psvdta .= "$dr|";
$psvdta .= "$drtxt|";
$psvdta .= "$gp|";
$psvdta .= "$gptxt|";
$psvdta .= "$js|";
$psvdta .= "$jstxt|";
$psvdta .= "$wm|";
$psvdta .= "$wmtxt|";
$psvdta .= "$zh|";
$psvdta .= "$zhtxt|";
$psvdta .= "$itm|";
$psvdta .= "$cnt|";
$psvdta .= "$amt|";
$psvdta .= "$note<br>\n";
$json .= "{\n";
$json .= "\"rowno\":\"$rowno\",\n";
$json .= "\"ord\":\"$ord\",\n";
$json .= "\"no\":\"$no\",\n";
$json .= "\"id\":\"$id\",\n";
$json .= "\"status\":\"$status\",\n";
$json .= "\"dttm\":\"$dttm\",\n";
$json .= "\"grp\":\"$grp\",\n";
$json .= "\"item\":\"$item\",\n";
$json .= "\"logo\":\"$host\",\n";
$json .= "\"coffee_id\":\"$coffee_id\",\n";
$json .= "\"coffee_url\":\"$coffee_url\",\n";
$json .= "\"coffee_tn\":\"$coffee_tn\",\n";
$json .= "\"fb\":\"$fb\",\n";
$json .= "\"fbtxt\":\"$fbtxt\",\n";
$json .= "\"pdf\":\"$pdf\",\n";
$json .= "\"pdftxt\":\"$pdftxt\",\n";
$json .= "\"gif\":\"$gif\",\n";
$json .= "\"giftxt\":\"$giftxt\",\n";
$json .= "\"mp3\":\"$mp3\",\n";
$json .= "\"mp3txt\":\"$mp3txt\",\n";
$json .= "\"mp4\":\"$mp4\",\n";
$json .= "\"mp4txt\":\"$mp4txt\",\n";
$json .= "\"bc\":\"$bc\",\n";
$json .= "\"bctxt\":\"$bctxt\",\n";
$json .= "\"rm\":\"$rm\",\n";
$json .= "\"rmtxt\":\"$rmtxt\",\n";
$json .= "\"vm\":\"$vm\",\n";
$json .= "\"vmtxt\":\"$vmtxt\",\n";
$json .= "\"yt\":\"$yt\",\n";
$json .= "\"yttxt\":\"$yttxt\",\n";
$json .= "\"pn\":\"$pn\",\n";
$json .= "\"pntxt\":\"$pntxt\",\n";
$json .= "\"sl\":\"$sl\",\n";
$json .= "\"sltxt\":\"$sltxt\",\n";
$json .= "\"tl\":\"$tl\",\n";
$json .= "\"tltxt\":\"$tltxt\",\n";
$json .= "\"tx\":\"$tx\",\n";
$json .= "\"txtxt\":\"$txtxt\",\n";
$json .= "\"zm\":\"$zm\",\n";
$json .= "\"zmtxt\":\"$zmtxt\",\n";
$json .= "\"hostid\":\"$hostid\",\n";
$json .= "\"host\":\"$host\",\n";
$json .= "\"home\":\"$home\",\n";
$json .= "\"name\":\"$name\",\n";
$json .= "\"email\":\"$email\",\n";
$json .= "\"phn\":\"$phn\",\n";
$json .= "\"fab\":\"$fab\",\n";
$json .= "\"gab\":\"$gab\",\n";
$json .= "\"pl\":\"$pl\",\n";
$json .= "\"pt\":\"$pt\",\n";
$json .= "\"ss\":\"$ss\",\n";
$json .= "\"ts\":\"$ts\",\n";
$json .= "\"tw\":\"$tw\",\n";
$json .= "\"jitsi\":\"$jitsi\",\n";
$json .= "\"chat\":\"$chat\",\n";
$json .= "\"dm\":\"$dm\",\n";
$json .= "\"dmtxt\":\"$dmtxt\",\n";
$json .= "\"dr\":\"$dr\",\n";
$json .= "\"drtxt\":\"$drtxt\",\n";
$json .= "\"gp\":\"$gp\",\n";
$json .= "\"gptxt\":\"$gptxt\",\n";
$json .= "\"js\":\"$js\",\n";
$json .= "\"jstxt\":\"$jstxt\",\n";
$json .= "\"wm\":\"$wm\",\n";
$json .= "\"wmtxt\":\"$wmtxt\",\n";
$json .= "\"zh\":\"$zh\",\n";
$json .= "\"zhtxt\":\"$zhtxt\",\n";
$json .= "\"itm\":\"$itm\",\n";
$json .= "\"cnt\":\"$cnt\",\n";
$json .= "\"amt\":\"$amt\",\n";
$json .= "\"note\":\"$note\"\n";
$json .= "},\n";
$htmout_table_body .= "<tr>";
$htmout_table_body .= "<td>".$row['rowno']."</td>";
$htmout_table_body .= "<td>".$row['ord']."</td>";
$htmout_table_body .= "<td>".$row['no']."</td>";
$htmout_table_body .= "<td>".$row['id']."</td>";
$htmout_table_body .= "<td>".$row['status']."</td>";
$htmout_table_body .= "<td>".$row['dttm']."</td>";
$htmout_table_body .= "<td>".$row['grp']."</td>";
$htmout_table_body .= "<td>".$row['item']."</td>";
$htmout_table_body .= "<td>".$row['logo']."</td>";
$htmout_table_body .= "<td>".$row['coffee_id']."</td>";
$htmout_table_body .= "<td>".$row['coffee_url']."</td>";
$htmout_table_body .= "<td>".$row['coffee_tn']."</td>";
$htmout_table_body .= "<td>".$row['fb']."</td>";
$htmout_table_body .= "<td>".$row['fbtxt']."</td>";
$htmout_table_body .= "<td>".$row['pdf']."</td>";
$htmout_table_body .= "<td>".$row['pdftxt']."</td>";
$htmout_table_body .= "<td>".$row['gif']."</td>";
$htmout_table_body .= "<td>".$row['giftxt']."</td>";
$htmout_table_body .= "<td>".$row['mp3']."</td>";
$htmout_table_body .= "<td>".$row['mp3txt']."</td>";
$htmout_table_body .= "<td>".$row['mp4']."</td>";
$htmout_table_body .= "<td>".$row['mp4txt']."</td>";
$htmout_table_body .= "<td>".$row['bc']."</td>";
$htmout_table_body .= "<td>".$row['bctxt']."</td>";
$htmout_table_body .= "<td>".$row['rm']."</td>";
$htmout_table_body .= "<td>".$row['rmtxt']."</td>";
$htmout_table_body .= "<td>".$row['vm']."</td>";
$htmout_table_body .= "<td>".$row['vmtxt']."</td>";
$htmout_table_body .= "<td>".$row['yt']."</td>";
$htmout_table_body .= "<td>".$row['yttxt']."</td>";
$htmout_table_body .= "<td>".$row['pn']."</td>";
$htmout_table_body .= "<td>".$row['pntxt']."</td>";
$htmout_table_body .= "<td>".$row['sl']."</td>";
$htmout_table_body .= "<td>".$row['sltxt']."</td>";
$htmout_table_body .= "<td>".$row['tl']."</td>";
$htmout_table_body .= "<td>".$row['tltxt']."</td>";
$htmout_table_body .= "<td>".$row['tx']."</td>";
$htmout_table_body .= "<td>".$row['txtxt']."</td>";
$htmout_table_body .= "<td>".$row['zm']."</td>";
$htmout_table_body .= "<td>".$row['zmtxt']."</td>";
$htmout_table_body .= "<td>".$row['hostid']."</td>";
$htmout_table_body .= "<td>".$row['host']."</td>";
$htmout_table_body .= "<td>".$row['home']."</td>";
$htmout_table_body .= "<td>".$row['name']."</td>";
$htmout_table_body .= "<td>".$row['email']."</td>";
$htmout_table_body .= "<td>".$row['phn']."</td>";
$htmout_table_body .= "<td>".$row['fab']."</td>";
$htmout_table_body .= "<td>".$row['gab']."</td>";
$htmout_table_body .= "<td>".$row['li']."</td>";
$htmout_table_body .= "<td>".$row['pl']."</td>";
$htmout_table_body .= "<td>".$row['pt']."</td>";
$htmout_table_body .= "<td>".$row['ss']."</td>";
$htmout_table_body .= "<td>".$row['ts']."</td>";
$htmout_table_body .= "<td>".$row['tw']."</td>";
$htmout_table_body .= "<td>".$row['jitsi']."</td>";
$htmout_table_body .= "<td>".$row['dm']."</td>";
$htmout_table_body .= "<td>".$row['dmtxt']."</td>";
$htmout_table_body .= "<td>".$row['dr']."</td>";
$htmout_table_body .= "<td>".$row['drtxt']."</td>";
$htmout_table_body .= "<td>".$row['gp']."</td>";
$htmout_table_body .= "<td>".$row['gptxt']."</td>";
$htmout_table_body .= "<td>".$row['js']."</td>";
$htmout_table_body .= "<td>".$row['jstxt']."</td>";
$htmout_table_body .= "<td>".$row['wm']."</td>";
$htmout_table_body .= "<td>".$row['wmtxt']."</td>";
$htmout_table_body .= "<td>".$row['zh']."</td>";
$htmout_table_body .= "<td>".$row['zhtxt']."</td>";
$htmout_table_body .= "<td>".$row['itm']."</td>";
$htmout_table_body .= "<td>".$row['cnt']."</td>";
$htmout_table_body .= "<td>".$row['amt']."</td>";
$htmout_table_body .= "<td>".$row['note']."</td>";
$htmout_table_body .= "</tr>\n";
}
$psv = $psvhdr . $psvdta;
$csv=str_replace("|",",",$psv);
$txt=str_replace("|"," ",$psv);
$json .= "{\n";
$json .= "\"rowno\":\"$rowno\",\n";
$json .= "\"ord\":\"$ord\",\n";
$json .= "\"no\":\"$no\",\n";
$json .= "\"id\":\"$id\",\n";
$json .= "\"status\":\"$status\",\n";
$json .= "\"dttm\":\"$dttm\",\n";
$json .= "\"grp\":\"$grp\",\n";
$json .= "\"item\":\"$item\",\n";
$json .= "\"logo\":\"$logo\",\n";
$json .= "\"coffee_id\":\"$coffee_id\",\n";
$json .= "\"coffee_url\":\"$coffee_url\",\n";
$json .= "\"coffee_tn\":\"$coffee_tn\",\n";
$json .= "\"fb\":\"$fb\",\n";
$json .= "\"fbtxt\":\"$fbtxt\",\n";
$json .= "\"pdf\":\"$pdf\",\n";
$json .= "\"pdftxt\":\"$pdftxt\",\n";
$json .= "\"gif\":\"$gif\",\n";
$json .= "\"giftxt\":\"$giftxt\",\n";
$json .= "\"mp3\":\"$mp3\",\n";
$json .= "\"mp3txt\":\"$mp3txt\",\n";
$json .= "\"mp4\":\"$mp4\",\n";
$json .= "\"mp4txt\":\"$mp4txt\",\n";
$json .= "\"bc\":\"$bc\",\n";
$json .= "\"bctxt\":\"$bctxt\",\n";
$json .= "\"rm\":\"$rm\",\n";
$json .= "\"rmtxt\":\"$rmtxt\",\n";
$json .= "\"vm\":\"$vm\",\n";
$json .= "\"vmtxt\":\"$vmtxt\",\n";
$json .= "\"yt\":\"$yt\",\n";
$json .= "\"yttxt\":\"$yttxt\",\n";
$json .= "\"pn\":\"$pn\",\n";
$json .= "\"pntxt\":\"$pntxt\",\n";
$json .= "\"sl\":\"$sl\",\n";
$json .= "\"sltxt\":\"$sltxt\",\n";
$json .= "\"tl\":\"$tl\",\n";
$json .= "\"tltxt\":\"$tltxt\",\n";
$json .= "\"tx\":\"$tx\",\n";
$json .= "\"txtxt\":\"$txtxt\",\n";
$json .= "\"zm\":\"$zm\",\n";
$json .= "\"zmtxt\":\"$zmtxt\",\n";
$json .= "\"fab\":\"$fab\",\n";
$json .= "\"gab\":\"$gab\",\n";
$json .= "\"pl\":\"$pl\",\n";
$json .= "\"pt\":\"$pt\",\n";
$json .= "\"ss\":\"$ss\",\n";
$json .= "\"ts\":\"$ts\",\n";
$json .= "\"tw\":\"$tw\",\n";
$json .= "\"jitsi\":\"$jitsi\",\n";
$json .= "\"chat\":\"$chat\",\n";
$json .= "\"btc\":\"$btc\",\n";
$json .= "\"btctxt\":\"$btctxt\",\n";
$json .= "\"eth\":\"$eth\",\n";
$json .= "\"ethtxt\":\"$ethtxt\",\n";
$json .= "\"shopify\":\"$shopify\",\n";
$json .= "\"shopifytxt\":\"$shopifytxt\",\n";
$json .= "\"squareup\":\"$squareup\",\n";
$json .= "\"squareuptxt\":\"$squareuptxt\",\n";
$json .= "\"stripe\":\"$stripe\",\n";
$json .= "\"stripetxt\":\"$stripetxt\",\n";
$json .= "\"dm\":\"$dm\",\n";
$json .= "\"dmtxt\":\"$dmtxt\",\n";
$json .= "\"dr\":\"$dr\",\n";
$json .= "\"drtxt\":\"$drtxt\",\n";
$json .= "\"gp\":\"$gp\",\n";
$json .= "\"gptxt\":\"$gptxt\",\n";
$json .= "\"js\":\"$js\",\n";
$json .= "\"jstxt\":\"$jstxt\",\n";
$json .= "\"wm\":\"$wm\",\n";
$json .= "\"wmtxt\":\"$wmtxt\",\n";
$json .= "\"zh\":\"$zh\",\n";
$json .= "\"zhtxt\":\"$zhtxt\",\n";
$json .= "\"itm\":\"$itm\",\n";
$json .= "\"cnt\":\"$cnt\",\n";
$json .= "\"amt\":\"$amt\",\n";
$json .= "\"note\":\"$note\"\n";
$json .= "}\n";
$json .= "]}";
$htmout .= $htmout_table_head;
$htmout .= $htmout_table_body;
$htmout .= " </table>\n";
// printf( "BUGS_2390: val=[$val] fld=[$fld] row=[$row]<br>\n" );
if( $fmt == "psv" ) { print($psv); exit; }
if( $fmt == "csv" ) { print($csv); exit; }
if( $fmt == "json" ) {
header('Content-type: application/json');
print($json); exit;
}
if( $fmt == "txt" ) { print($txt); exit; }
if( $fmt == "html" ) { print($htmout); exit; }
print( $psv );
// main rowno|ord|no|id|status|dttm|grp|item|logo|
// coffee coffee_id|coffee_url|coffee_tn|
// books fb|fbtxt|pdf|pdftxt|gif|giftxt|
// media mp3|mp3txt|mp4|mp4txt|bc|bctxt|rm|rmtxt|vm|vmtxt|yt|yttxt|
// views pn|pntxt|sl|sltxt|tl|tltxt|tx|txtxt|zm|zmtxt|
// contacts hostid|host|home|name|email|phn|
// smedia fab|gab|li|pl|ss|ts|tw|jitsi|chat|
// biz btc|btctxt|eth|ethtxt|shopify|shopifytxt|squareup|squareuptxt|stripe|stripetxt|
// amedia dm|dmtxt|dr|drtxt|gp|gptxt|js|jstxt|wm|wmtxt|zh|zhtxt|
// notes itm|cnt|amt|note
exit;
}
if( isset($_REQUEST['kogo_db3']) || isset($_REQUEST['kogo_db3'] )) {
$gid=""; $fmt="";
if( isset( $_REQUEST['kogo_db3'] )) { $gid=$_REQUEST['kogo_db3']; }
if( isset( $_REQUEST['fmt'] )) { $fmt=$_REQUEST['fmt']; }
$txt=""; $csv=""; $psv="";
$htmout=""; $htmout_table_head=""; $htmout_table_body="";
// print( "<h1>BUGS_400 gid=$gid fmt=$fmt</h1>" );
$json="{ \"kogo\": [\n";
$htmout_table_head = "<table id=table_$gid>\n";
$htmout_table_head .= "<tr><td style='text-align:center' colspan=14>gameid: $gid</td></tr>\n";
$htmout_table_head .= "<tr>";
$htmout_table_head .= "<td>gid</td>";
$htmout_table_head .= "<td>dttm</td>";
$htmout_table_head .= "<td>pb</td>";
$htmout_table_head .= "<td>pw</td>";
$htmout_table_head .= "<td>bxlim</td>";
$htmout_table_head .= "<td>bylim</td>";
$htmout_table_head .= "<td>bhandi</td>";
$htmout_table_head .= "<td>t</td>";
$htmout_table_head .= "<td>x</td>";
$htmout_table_head .= "<td>y</td>";
$htmout_table_head .= "<td>td</td>";
$htmout_table_head .= "<td>tdx</td>";
$htmout_table_head .= "<td>tdy</td>";
$htmout_table_head .= "<td>note</td>";
$htmout_table_head .= "</tr>\n";
$db3fil="kogo.db3"; $fld=""; $output = "";
$sql="select * from games where gid='$gid'";
// $bxbys = sqlq( $db3fil, $sql, $fld );
$pdo = newpdo($db3fil);
foreach( $pdo->query($sql) as $row ) {
$dttm=$row['dttm'];
$pb=$row['pb'];
$pw=$row['pw'];
$bxlim=$row['bxlim'];
$bylim=$row['bylim'];
$bhandi=$row['bhandi'];
$bhandi=$row['bhandi'];
$t=$row['t'];
$x=$row['x'];
$y=$row['y'];
$td=$row['td'];
$tdx=$row['tdx'];
$tdy=$row['tdy'];
$note=$row['note'];
$psv .= "$gid|";
$psv .= "$dttm|";
$psv .= "$pb|";
$psv .= "$pw|";
$psv .= "$bxlim|";
$psv .= "$bylim|";
$psv .= "$bhandi|";
$psv .= "$t|";
$psv .= "$x|";
$psv .= "$y|";
$psv .= "$td|";
$psv .= "$tdx|";
$psv .= "$tdy|";
$psv .= "$note<br>\n";
$json .= "{\n";
$json .= "\"gid\":\"$gid\",\n";
$json .= "\"dttm\":\"$dttm\",\n";
$json .= "\"pb\":\"$pb\",\n";
$json .= "\"pw\":\"$pw\",\n";
$json .= "\"bxlim\":\"$bxlim\",\n";
$json .= "\"bylim\":\"$bylim\",\n";
$json .= "\"bhandi\":\"$bhandi\",\n";
$json .= "\"t\":\"$t\",\n";
$json .= "\"x\":\"$x\",\n";
$json .= "\"y\":\"$y\",\n";
$json .= "\"td\":\"$td\",\n";
$json .= "\"tdx\":\"$tdx\",\n";
$json .= "\"tdy\":\"$tdy\",\n";
$json .= "\"note\":\"$note\"\n";
$json .= "},\n";
$htmout_table_body .= "<tr>";
$htmout_table_body .= "<td>".$row['gid']."</td>";
$htmout_table_body .= "<td>".$row['dttm']."</td>";
$htmout_table_body .= "<td>".$row['pb']."</td>";
$htmout_table_body .= "<td>".$row['pw']."</td>";
$htmout_table_body .= "<td>".$row['bxlim']."</td>";
$htmout_table_body .= "<td>".$row['bylim']."</td>";
$htmout_table_body .= "<td>".$row['bhandi']."</td>";
$htmout_table_body .= "<td>".$row['t']."</td>";
$htmout_table_body .= "<td>".$row['x']."</td>";
$htmout_table_body .= "<td>".$row['y']."</td>";
$htmout_table_body .= "<td>".$row['td']."</td>";
$htmout_table_body .= "<td>".$row['tdx']."</td>";
$htmout_table_body .= "<td>".$row['tdy']."</td>";
$htmout_table_body .= "<td>".$row['note']."</td>";
$htmout_table_body .= "</tr>\n";
}
$csv=str_replace("|",",",$psv);
$txt=str_replace("|"," ",$psv);
$json .= "{\n";
$json .= "\"gid\":\"$gid\",\n";
$json .= "\"dttm\":\"$dttm\",\n";
$json .= "\"pb\":\"$pb\",\n";
$json .= "\"pw\":\"$pw\",\n";
$json .= "\"bxlim\":\"$bxlim\",\n";
$json .= "\"bylim\":\"$bylim\",\n";
$json .= "\"bhandi\":\"$bhandi\",\n";
$json .= "\"t\":\"$t\",\n";
$json .= "\"x\":\"\",\n";
$json .= "\"y\":\"\",\n";
$json .= "\"td\":\"\",\n";
$json .= "\"tdx\":\"$tdx\",\n";
$json .= "\"tdy\":\"$tdy\",\n";
$json .= "\"note\":\"nextmove\"\n";
$json .= "}\n";
$json .= "]}";
$htmout .= $htmout_table_head;
$htmout .= $htmout_table_body;
$htmout .= " </table>\n";
// printf( "BUGS_2390: val=[$val] fld=[$fld] row=[$row]<br>\n" );
if( $fmt == "psv" ) { print($psv); exit; }
if( $fmt == "csv" ) { print($csv); exit; }
if( $fmt == "json" ) {
header('Content-type: application/json');
print($json); exit;
}
if( $fmt == "txt" ) { print($txt); exit; }
if( $fmt == "html" ) { print($htmout); exit; }
print( $psv );
exit;
}
if( isset($_REQUEST['kogo_bxbys']) || isset($_REQUEST['kogo_bxbys'] )) {
$bxbyid=$_REQUEST['kogo_bxbys'];
$htmout = "";
$bxbys=""; $t=1; $bxlim=19; $bylim=19;
$bxbyss = array();
$bxbyss['a'] = "1,1 1,2 1,3 1,4";
$bxbyss['b'] = "10,1 10,2 10,3 10,4";
$bxbyss['c'] = "19,1 19,2 19,3 19,4";
$bxbyss['ko'] = "1,2 3,2 2,1 2,3 2,3 3,4";
$bxbys=""; $bxbys_head=""; $bxbys_body="";$pb="pd"; $pw="pw";
$bxlim=19; $bylim=19; $bhandi=9;$t=0;$x=0;$y=0;$td=0;$tlim=0;$tdx=0;$tdy=0;
$dttm="20211203_1830";
if( $bxbyid == "" ) {
$htmout = "<h1>MSG_421 KOGO_BXBYS=$bxbyid $progid?kogo_bxbys=$bxbyid<h1>\n";
$tlim=$bxlim*$bylim;
for( $bx=1; $bx<$bxlim; $bx++ ) {
for( $by=1; $by<$bylim; $by++ ) {
$bxbys_body .= "$bxbyid,$t,$bx,$by,$td,$tdx,$tdy<br>\n";
$t=$t+1;
}
}
$bxbys_head="$bxbyid,$dttm,$pb,$pw,$bxlim,$bylim,$bhandi,$tlim,$tdx,$tdy<br>\n";
}
else {
$bxbys_body="";
if( ! isset( $bxbyss[$bxbyid] )) { print( "<h1>ERR_420 NOTFOUND bxbyid=$bxbyid</h1>"); exit;}
$bxbys = $bxbyss[$bxbyid]; $xyd="";
$tlim = count(explode(" ",$bxbys));
for( $t=0; $t<$tlim; $t++ ) {
$bx=""; $by=""; $td="";
$xyd=explode(" ",$bxbys);
$commas=count(explode(",",$xyd[$t]));
$bx = explode(",",$xyd[$t])[0];
if( $commas>1 ) {
$by = explode(",",$xyd[$t])[1];
}
if( $commas>2 ) {
$td = explode(",",$xyd[$t])[2];
if( isOdd($td)) { $tdx=$tdx+1; } else { $tdy=$tdx+1; }
}
$t1=$t+1;
$bxbys_body .= "$bxbyid,$t1,$bx,$by,$td<br>\n";
}
$bxbys_head="$bxbyid,$dttm,$pb,$pw,$bxlim,$bylim,$bhandi,$tlim,$tdx,$tdy<br>\n";
}
$bxbys = "";
$bxbys .= $bxbys_head . $bxbys_body;
# $htmout = "<h1>MSG_412 KOGO_BXBYS= $progid?todo=$kogo_bxbys<h1>\n";
print($bxbys);
exit;
}
if( isset($_REQUEST['kogo']) || isset($_REQUEST['kogo'] )) {
$kogo=$_REQUEST['kogo'];
if( $kogo == "" ) {
$htmout = "<h1>MSG_411 TODO=KOGO $progid?todo=$todo<h1>\n";
}
$htmout = "<h1>MSG_412 TODO=KOGO $progid?todo=$todo<h1>\n";
print($htmout);
exit;
}
if( isset($_REQUEST['todo']) || isset($_REQUEST['todo'] )) {
$todo="";
# if( isset($_REQUEST['todo'] )) {
# $request=$_REQUEST['todo'];
# if( $request != "" ) { $todo=$request; }
# print( "\n<h1>MSG_130 FINDIDS todo=$todo request=$request</h1><br>\n");
# }
if( isset($_REQUEST['fmt'] )) {$fmt=$_REQUEST['fmt'];}
$idfinds_ko='mp3s mp4s pdfs fbs zms yts bcs txts htmls';
# yts|find yt/txt -type f -maxdepth 1 -name "ytlist_202111*.txt" -exec cat {} \; | grep "youtube" | head -100
# bcs|find yt/txt -type f -maxdepth 1 -name "ytlist_202111*.txt" -exec cat {} \; | grep "bitchute" | head -100
# htmls|find yt/txt -type f -maxdepth 1 -name "ytlist_202111*.txt" -exec cat {} \; | grep ".html" | head -100
$idfinds='
mp4s_root|find /kb/vid -type f -maxdepth 3 -name "*.mp4" -o -name "*.webm"
mp4s_dotdot|find ../kb/vid -type f -maxdepth 3 -name "*.mp4" -o -name "*.webm"
mp4s|find ./mp4 -type f -maxdepth 3 -name "*.mp4" -o -name "*.webm"
mp3s|find ../kb/aud/mp3 -type f -name "*.mp3"
pdfs|find pdf -type f -name "*.pdf"
fbs|find fb -type d -name "pages" # fb
zms|find zm -type f -name "0-0-0.jpg" # zm
ka_mp4s|find ka/vid -type f -name "*.mp4" -o -name "*.webm"
ka_mp3s|find ka/aud -type f -name "*.mp3"
ka_pdfs|find ka/pdf -type f -name "*.pdf"
ka_fbs|find ka/fb -type d -name "pages" # fb
ka_zms|find ka/zm -type f -name "0-0-0.jpg" # zm
';
# ka_fbs|find fb -type f -name "index.html" # fb
# ka_zms|find zm -type f -name "zm*.htm*" # zm
# fbs|find ../zm -type f -name "zm*.htm*" # fb
# zms|find ../zm -type f -name "zm*.htm*" # zm
$idfinds_big='
mp4s|find /kb/vid -type f -maxdepth 3 -name "*.mp4" -o -name "*.webm"
mp3s|find /kb/aud/mp3 -type f -name "*.mp3"
pdfs|find /pdf -type f -name "*.pdf"
ka_pdfs|find pdf -type f -name "*.pdf"
ko|find pdf -type f -maxdepth 1 -name "*.pdf"
kups|find ./kups -type f -name "*.*"
imgs|find ./imgs -type f -name "*.*"
jsons|find pdf -type f -name "*.json"
host_list|cat ./kb/media/host_list.psv
host_list_ka|cat ./kb/media/host_list_ka.psv
media_list|cat ./kb/media/media_list.psv
media_list_ka|cat ./kb/media/media_list_ka.psv
coffeec_list|cat ./kb/media/coffeec_list.psv
coffeec_list_ka|cat /kb/media/coffeec_list_ka.psv
coffee_list|cat /kb/media/coffee_list.psv
cat_ko_coffeeshop_psv|cat ko_coffeeshop.psv
cat_ko_coffeeshop_csv|cat ko_coffeeshop.csv
sql3_kups|select * from kups
sql3_ko_coffeeshop|select * from ko_coffeeshop
sql3_host_list|select * from host_list
sql3_host_list_ka|select * from host_list_ka
sql3_media_list|select * from media_list
sql3_media_list_ka|select * from media_list_ka
sql3_coffeec_list|select * from coffeec_list
sql3_coffeec_list_ka|select * from coffeec_list_ka
sql3_coffee_list|select * from coffee_list
sql3_coffee_list_ka|select * from coffee_list_ka
txts|find txt -type f -name "*.txt"
pns|find pn/imgs -type f -maxdepth 1 -name "*.jpg"
pdf_ko|find pdf -type f -name "*ko*.pdf"
pdf_iperms|find pdf -type f -name "*iperms*.pdf"
pdf_jtfdc|find pdf -type f -name "*jtfdc*.pdf"
pdf1|find pdf -type f -maxdepth 1 -name "*.pdf"
mp3s1|find kb/aud/mp3 -type f -maxdepth 1 -name "*.mp3"
yts|find kb/media/ -type f -maxdepth 1 -name "ko_media_yt.txt" -exec cat {} \; | grep "youtube" | head -100
bcs|find kb/media -type f -maxdepth 1 -name "ko_media_bc.txt" -exec cat {} \; | grep "bitchute" | head -100
htmls|find kb/media -type f -maxdepth 1 -name "ko_media_ht.txt" -exec cat {} \; | grep ".html" | head -100
pagesimgs|find ./pages -type f -maxdepth 1 -name "*.jpg"; find ./imgs -type f -maxdepth 1 -name "*.jpg" | grep -v "tn/";
pages|find fb/pages -type f -maxdepth 1 -name "*.jpg"
pdfs1|find pdf -type f -maxdepth 1 -name "*.pdf"
fbd1|find fb -type d -maxdepth 1 -name "*"
txts|find txt -type f -maxdepth 2 -name "*.txt"
htms|find . -type f -maxdepth 1 -name "??.html"
dirs_mp3|find kb/aud -type d -maxdepth 3 -name "*"
dirs_mp4|find kb/vid -type d -maxdepth 3 -name "*"
dirs_pdf|find pdf -type d -maxdepth 3 -name "*"
dirs_yts|find yt/txt -type d -maxdepth 3 -name "ytlist_*.txt"
dirs_fb|find fb -type d -maxdepth 1 -name "*"
dirs_pn|find pn -type d -maxdepth 3 -name "*"
dirs_tl|find tl -type d -maxdepth 3 -name "*"
dirs_zn|find tl -type d -maxdepth 3 -name "*"
';
$idfinds_tests='
mp3_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
mp4_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
pdf_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
txt_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
htm_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
yt_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
fb_today|fb/mars
pn_today|pn/imgs/pano_creek.jpg
tl_todatoday|
zm_todatoday|
mp3s_n|find kb/aud/mp3 -type f -name "<n>.mp3"
mp4s2|find kb/vid/jkwii -type f -maxdepth <d> f -name "<n>.mp4"
mp4s_p|find kb/vid/<p> -type f -maxdepth <d> -name "<n>.mp4"
mp4s_n|find kb/vid/<p> -type f -maxdepth <d> -name "<n>.mp4"
mp4_p|find kb/vid -type d -maxdepth <d> -name "<n>"
yts|cat /yt/txt/ytlist.txt | grep "<n>" | head -100
yts_lim|cat /yt/txt/ytlist.txt | grep "<n>" | head -<lim>
ht_mp3|kb/aud/mp3/library_of_congress.mp3
ht_mp4|kb/vid/jkwii/dutch_jackson_weightup.mp4
ht_yt||https://www.youtube.com/watch?v=wQz5aG2tnd4|vladvt_megalithic_inca
ht_png|imgs/btn/koeye.png
ht_jpg|imgs/bg/bg_newton05b.jpg
ht_gif|imgs/gif/gifset_knots/knot1.gif
ht_zm|/index_zm.html
ht_zmd|/zm
ht_tl|/index_tl.html
ht_tld|/tl
find|find <p> -type f -maxdepth <lim> -name "<n>"
mp4s_jtfdc|find kb/vid -type f -name "jtfdc*.mp4"
gifd1|find imgs/gif -type d -maxdepth 2 -name "*"
gifs|find imgs/gif -type f -maxdepth 2 -name "*.gif"
pdfs|find pdf -type f -name "*.pdf"
pdfs2|find pdf/pdf -type f -maxdepth 1 -name "*.pdf"
fbd1|find fb -type d -maxdepth 1 -name "*"
fbds|find fb -type d -name "*"
pages|find fb/pages -type f -maxdepth 1 -name "*.jpg" \| head -5
pages_fb|find fb/pages -type f -maxdepth 1 -name "*.jpg"
pagesimgs|find ./pages -type f -maxdepth 1 -name "*.jpg"; find ./imgs -type f -maxdepth 1 -name "*.jpg";
topdirs|find / -type d -maxdepth 1 -name "??";
sh_ka1|./ka1.sh
sh_cp|find ./pages -type f -maxdepth 1 -name "*.jpg" | awk \'{ print "convert "$0" -resize 200x tn/tn_"$0" # "NF }\' | sed "s/jpg /png /"
sql3_sel_db3tbllim|sqlite3 <db3> "sel * from <tbl> limit <lim>";
sql3_sel_tbllim|sqlite3 ko.db3 "sel * from <tbl> limit <lim>";
sql3_tables|sqlite3 ko.db3 .tables
sql3_schema|sqlite3 ko.db3 .schema
sql3_files|sqlite3 ko.db3 "select * from files"
sql3_ko_coffee|sqlite3 ko.db3 "select * from coffee_list"
sql3_ko_media|sqlite3 ko.db3 "select * from media_list"
sql3_mp3|sqlite3 ko.db3 "select * from mp3"
sql3_mp4|sqlite3 ko.db3 "select * from mp4"
sql3_mp3|sqlite3 ko.db3 "select * from jpg"
sql3_books|sqlite3 ko.db3 "select * from books"
fb/iperms/pages|find fb/iperms/pages -type f -maxdepth 1 -name "*.jpg"
fb/konet/pages|find fb/konet/pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfdc/pages|find fb/jtfdc_pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfdcr/pages|find fb/jtfdcr/pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfinc/pages|find fb/jtfinc/pages -type f -maxdepth 1 -name "*.jpg"
fb/kt/pages|find fb/kt/pages -type f -maxdepth 1 -name "*.jpg"
fb/iperms/pages|find fb/iperms/pages -type f -maxdepth 1 -name "*.jpg"
fb/konet/pages|find fb/konet/pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfdc/pages|find fb/jtfdc_pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfdcr/pages|find fb/jtfdcr/pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfinc/pages|find fb/jtfinc/pages -type f -maxdepth 1 -name "*.jpg"
fb/kt/pages|find fb/kt/pages -type f -maxdepth 1 -name "<n>.jpg"
fb/go/pages|find fb/go/pages -type f -maxdepth 1 -name "<n>.jpg"
fb/kou/pages|find fb/kou/pages -type f -maxdepth 1 -name "<n>.jpg"
fb/royal1/pages|find fb/royal1/pages -type f -maxdepth 1 -name "<n>.jpg"
fb/iperms/imgs|find fb/iperms/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/konet/imgs|find fb/konet/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/jtfdc/imgs|find fb/jtfdc_imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/jtfdcr/imgs|find fb/jtfdcr/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/jtfinc/imgs|find fb/jtfinc/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/kt/imgs|find fb/kt/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/go/imgs|find fb/go/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/kou/imgs|find fb/kou/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/royal1/imgs|find fb/royal1/imgs -type f -maxdepth 1 -name "<n>.jpg"
tls|find tl -type f -maxdepth 1 -name "<*>.json"
zms|find zm -type f -name "0-0-0.jpg"
pns|find pn -type f -name "*.jpg"
du|du -h -d 1 .
du_dp|du -h -d <d>
';
# du -h --max-depth 1 . # bh
# du -h -d 1 . # depth 1
# du -h -depth . # depthtot
// print( "<h1>BUGS_760 todo=$todo idfinds=$idfinds</h1><br>\n" );
$ids=explode("\n",$idfinds);
$htmout="";
$list="";
$todo="";
if( isset($_REQUEST['todo'])) { $todo=$_REQUEST['todo']; }
$db2=""; if( isset($_REQUEST['db2'])) { $db3=$_REQUEST['db2']; }
$db3=""; if( isset($_REQUEST['db3'])) { $db3=$_REQUEST['db3']; }
$tbl=""; if( isset($_REQUEST['tbl'])) { $tbl=$_REQUEST['tbl']; }
$sel=""; if( isset($_REQUEST['sel'])) { $sel=$_REQUEST['sel']; }
$fld=""; if( isset($_REQUEST['fld'])) { $fld=$_REQUEST['fld']; }
$val=""; if( isset($_REQUEST['val'])) { $val=$_REQUEST['val']; }
$fmt=""; if( isset($_REQUEST['fmt'])) { $fmt=$_REQUEST['fmt']; }
$lim=""; if( isset($_REQUEST['lim'])) { $lim=$_REQUEST['lim']; }
$a=""; if( isset($_REQUEST['a'])) { $a=$_REQUEST['a']; }
$b=""; if( isset($_REQUEST['b'])) { $b=$_REQUEST['b']; }
$c=""; if( isset($_REQUEST['c'])) { $c=$_REQUEST['c']; }
$d=""; if( isset($_REQUEST['d'])) { $d=$_REQUEST['d']; }
$d=""; if( isset($_REQUEST['d'])) { $d=$_REQUEST['d']; }
$e=""; if( isset($_REQUEST['e'])) { $e=$_REQUEST['e']; }
$f=""; if( isset($_REQUEST['f'])) { $f=$_REQUEST['f']; }
$g=""; if( isset($_REQUEST['g'])) { $g=$_REQUEST['g']; }
$h=""; if( isset($_REQUEST['h'])) { $h=$_REQUEST['h']; }
$i=""; if( isset($_REQUEST['i'])) { $i=$_REQUEST['i']; }
$j=""; if( isset($_REQUEST['j'])) { $j=$_REQUEST['j']; }
$k=""; if( isset($_REQUEST['k'])) { $k=$_REQUEST['k']; }
$l=""; if( isset($_REQUEST['l'])) { $l=$_REQUEST['l']; }
$m=""; if( isset($_REQUEST['m'])) { $m=$_REQUEST['m']; }
$n=""; if( isset($_REQUEST['n'])) { $n=$_REQUEST['n']; }
$o=""; if( isset($_REQUEST['o'])) { $o=$_REQUEST['o']; }
$p=""; if( isset($_REQUEST['p'])) { $p=$_REQUEST['p']; }
$q=""; if( isset($_REQUEST['q'])) { $q=$_REQUEST['q']; }
$r=""; if( isset($_REQUEST['r'])) { $r=$_REQUEST['r']; }
$s=""; if( isset($_REQUEST['s'])) { $s=$_REQUEST['s']; }
$t=""; if( isset($_REQUEST['t'])) { $t=$_REQUEST['t']; }
$u=""; if( isset($_REQUEST['u'])) { $u=$_REQUEST['u']; }
$v=""; if( isset($_REQUEST['v'])) { $v=$_REQUEST['v']; }
$w=""; if( isset($_REQUEST['w'])) { $w=$_REQUEST['w']; }
$x=""; if( isset($_REQUEST['x'])) { $x=$_REQUEST['x']; }
$y=""; if( isset($_REQUEST['y'])) { $y=$_REQUEST['y']; }
$z=""; if( isset($_REQUEST['z'])) { $z=$_REQUEST['z']; }
$ids=explode("\n",$idfinds);
$htmout="";
$list="";
$fmt="";
# if( $todo == "" ) { print("<h1>BUGS_811 TODO=BLANK todo=$todo</h1>" ); }
# if( $todo == 0 ) { print("<h1>BUGS_812 TODO=NUM0 todo=$todo</h1>" ); }
# if( $todo == "0" ) { print("<h1>BUGS_813 TODO=NUMCHR todo=$todo</h1>" ); }
# if( $todo == "menu" ) { print("<h1>BUGS_814 TODO=MENU todo=$todo</h1>" ); }
# print("<h1>BUGS_1840 TODO todo=$todo</h1>" );
if( isset($_REQUEST['fmt'])) { $fmt=$_REQUEST['fmt']; }
if(( $todo == "" )
|| ( $todo == "0" )
|| ( $todo == "list" )
|| ( $todo == "menu" )) {
print( "<h1>BUGS_815 MENU todo=$todo</h1><br>\n" );
$htmout .= "<html>\n";
$htmout .= "<head>\n";
$htmout .= " <title>$progid $dttm todo</title>\n";
$htmout .= " </head>\n";
$htmout .= "<body bgcolor=linen>\n";
# $htmout .= "<h1>todo</h1>\n";
$htmout .= "<a href=/index.html target=_blank>";
$htmout .= "<img src=ko.png height=20>";
$htmout .= "</a>\n";
$htmout .= "       ";
$htmout .= "$progid $dttm";
$htmout .= "<hr color=goldenrod>\n";
$htmout .= "<table id=table_todo>";
$htmout .= "<tr><td>j</td><td width=100 >url</td><td width=125>id</td><td width=400>find</td></tr>\n";
for( $j=0; $j<count($ids); $j++ ) {
$line=$ids[$j];
$list .= $line;
if( $line === "" ) { continue; }
if( preg_match("/^#/", $line, $matches )) { continue; }
if( preg_match("/^</", $line, $matches)) {
# $list .= $line;
# $htmout .= $line;
# print( "<h2>MSG_385 HTMFMT line=$line</h2><br>\n" );
continue;
}
$id=explode("|",$line)[0];
if( $id === "" ) { continue; }
$find=""; $findtype="";
if( count(explode("|", $line)) > 1 ) {
$idpipe=$id."|";
$find=str_replace($idpipe,"",$line);
}
else {
$find=explode("|",$line)[1];
}
$matches2="";
// print( "<h1>BUGS_680 todo=$todo j=$j id=$id line=$line</h1><br>\n" );
// if( str_contains( $find, "# fb" )) { $findtype="fb"; }
// if( str_contains( $find, "# zm" )) { $findtype="zm"; }
$find=str_replace('<fmt>',$fmt, $find, $matches2);
$find=str_replace('<lim>',$lim, $find, $matches2);
$find=str_replace('<db3>',$db3, $find, $matches2);
$find=str_replace('<tbl>',$tbl, $find, $matches2);
$find=str_replace('<sel>',$sel, $find, $matches2);
$find=str_replace('<fld>',$fld, $find, $matches2);
$find=str_replace('<a>',$a, $find, $matches2);
$find=str_replace('<b>',$b, $find, $matches2);
$find=str_replace('<c>',$c, $find, $matches2);
$find=str_replace('<d>',$d, $find, $matches2);
$find=str_replace('<e>',$e, $find, $matches2);
$find=str_replace('<f>',$f, $find, $matches2);
$find=str_replace('<g>',$g, $find, $matches2);
$find=str_replace('<h>',$h, $find, $matches2);
$find=str_replace('<i>',$i, $find, $matches2);
$find=str_replace('<j>',$j, $find, $matches2);
$find=str_replace('<k>',$k, $find, $matches2);
$find=str_replace('<l>',$l, $find, $matches2);
$find=str_replace('<m>',$m, $find, $matches2);
$find=str_replace('<n>',$n, $find, $matches2);
$find=str_replace('<o>',$o, $find, $matches2);
$find=str_replace('<p>',$p, $find, $matches2);
$find=str_replace('<q>',$q, $find, $matches2);
$find=str_replace('<r>',$r, $find, $matches2);
$find=str_replace('<s>',$s, $find, $matches2);
$find=str_replace('<t>',$t, $find, $matches2);
$find=str_replace('<u>',$u, $find, $matches2);
$find=str_replace('<v>',$v, $find, $matches2);
$find=str_replace('<w>',$w, $find, $matches2);
$find=str_replace('<x>',$x, $find, $matches2);
$find=str_replace('<y>',$y, $find, $matches2);
$find=str_replace('<x>',$z, $find, $matches2);
# print( "<h3>BUGS_460 j=$j id=$id p=$p find=$find</h3>\n") ;
$k=$j+1;
$htmout .= "<tr>";
$htmout .= "<td>$k</td>";
$htmout .= "<td width=100>";
# $htmout .= "<a href=/ko.php?todo=$id target=_blank>\n";
$htmout .= "<a href=./ko_center.php?todo=$id target=_blank>\n";
$htmout .= "<img src=/imgs/btn/koeye.png height=25>";
$htmout .= "</a>";
$htmout .= "</td>\n";
$htmout .= "<td width=125><b>$id</b></td>";
$htmout .= "<td width=470>$find</td>";
$htmout .= "</tr>";
}
$htmout .= " </table>";
$htmout .= "<hr color=goldenrod>\n";
$htmout .= " </body>\n";
$htmout .= " </html>\n";
if( $fmt == "list" ) { print( $list ); }
else { print( $htmout ); }
exit;
}
if( isset( $_REQUEST['todo'] )) {
$todo=$_REQUEST['todo'];
}
if( $todo == "ko_coffeeshop" ) {
$output=ko_coffeeshop('');
header('Content-type: text/plain');
print( $output );
}
if( $todo == "ko_coffeeshop_psv" ) {
$psvfil="ko_coffeeshop.psv";
$fmt="psv";
$options=array($psvfil,$fmt);
if( file_exists( $psvfil )) {
$psv=psv_ko_coffeeshop($options);
}
else {
$psv="ERR_2011 NOTFOUND psvfil=$psvfil fmt=$fmt";
}
print($psv);
exit;
}
if( $todo == "ko_coffeeshop_csv" ) {
$csvfil="ko_coffeeshop.csv";
$fmt="csv";
$options=array($csvfil,$fmt);
if( file_exists( $csvfil )) {
$csv=csv_ko_coffeeshop($options);
}
else {
$psv="ERR_2011 NOTFOUND csvfil=$csvfil fmt=$fmt";
}
print($psv);
exit;
}
if( $todo == "ko_media_psv" ) {
$psvfil="ko_media.psv";
$fmt="psv";
$options=array($psvfil,$fmt);
if( file_exists( $psvfil )) {
$psv=psv_ko_media($options);
}
else {
$psv="ERR_2021 NOTFOUND psvfil=$psvfil fmt=$fmt";
}
print($psv);
exit;
}
if( $todo == "ko_coffeeshop_sql3" ) {
$db3fil="ko.db3";
$fmt="html";
$options=array($db3fil,$fmt);
$sqlout=sql3_ko_coffeeshop($options);
print_r($sqlout);
exit;
}
if( $todo == "sql3_ko_media" ) {
$db3fil="ko.db3";
$fmt="html";
$options=array($db3fil,$fmt);
$sqlout=sql3_ko_media($options);
print($sqlout);
exit;
}
$min=1; $max=3;
if( $todo == "ko" ) {
$id=$todo;
$min=0;$max=0;
$min=1; $max=count(explode(" ",$idfinds_ko))-1;
$random=random_int($min,$max);
$todo=explode(" ",$idfinds_ko)[$random];
}
for( $j=0; $j<count($ids); $j++) {
$line=$ids[$j];
$id=explode("|",$line)[0];
# print( "<h1>BUGS_871 j=$j id=$id line=$line todo=$todo</h1><br>\n" );
if( $id === "" ) { continue; }
if( $id != $todo ) {continue; }
# print( "<h1>BUGS_873 MATCH j=$j id=$id= todo=$todo= line=$line todo=$todo</h1><br>\n" );
# $find=explode("|",$line)[1];
$find=str_replace("$id|","", $line);
# print( "<h1>BUGS_675 id=$id find=$find line=$line</h1>" );
$list="";
$url=$find;
$url = urlcheck($url);
# print( "<h1>MSG_661 query_string=$query_string name=name id=$id find=$find</h1><br>\n" );
$find=str_replace_all($find);
# $find=str_replace("<n>", "$name", $find );
# print( "<h1>MSG_900 j=$j k=$k todo=$todo id=$id find=$find</h1><br>\n" );
$out = "";
# print( "<h1>BUGS_2056 find=$find</h1>" );
# pqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpq
exec( $find, $out, $err );
# bdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbd
$outcnt=count($out);
print( "BUGS_18400 find=$find outcnt=$outcnt<br>\n" );
print_r($out);
$script_filename=$_SERVER['SCRIPT_FILENAME']; # /Volumes/ka1tbr2/ht/ka/ko.php
$request_uri=$_SERVER['REQUEST_URI']; # /ka/ko.php?todo=ka_zms
$php_self=$_SERVER['PHP_SELF']; # /ka/ko.php
$query_string=$_SERVER['QUERY_STRING']; # todo=ka_zms
# if( $outcnt == 0 ) {
# $htmout = "";
# $htmout .= "<html><head><title>$request_uri NOTFOUND</title></head>\n";
# $htmout .= "<body bgcolor=wheat>\n";
# $htmout .= "<a href=$php_self target=_blank>";
# $htmout .= "<img src=/imgs/btn/ko.png height=50 border=0>$php_self</a>\n";
# $htmout .= "<h2>ERR_2080 NOTFOUND find=$find</h2>\n";
# $htmout .= "<h3>request_uri=$request_uri</h3>\n";
# $htmout .= "</body></html>\n";
# print( $htmout );
# phpinfo();
# $errtxt="<h2>ERR_2070 NOTFOUND find=$find</h2>\n";
# return($errtxt);
# }
# print( "<h1>BUGS_2060 outcnt=$outcnt fmt=$fmt out=".$out[2]."</h1>" );
$psv="";
$csv="";
$txt="";
$json="";
$json.="{\"todo\": [\n";
$dttm=date('Ymd_His');
$htmout = "";
$htmout .= "<html>\n";
$htmout .= "<head>\n";
$htmout .= " <title>todo=$todo $dttm</title>\n";
$icon="./favicon_ko64.ico";
# $htmout .= "<link rel=\"icon\" href=\"$icon\" type=\"image/icon\">\n";
$icon_png="koeye.png";
$icon_png="ko.png";
$icon_gif="koeye_handhither.gif";
# $htmout .= "<link rel=\"icon\" href=\"$icon_png\" type=\"image/png\">\n";
$htmout .= "<link rel=\"icon\" href=\"$icon_gif\" type=\"image/gif\">\n";
$htmout .= " </head>\n";
$htmout .= "<body bgcolor=linen>\n";
$htmout .= " <div id=div_todo_$todo>\n";
$htmout .= " <h1>div_todo_$todo</h1>\n";
$htmout .= " <hr color=goldenrod>\n";
print( "BUGS_18447 todos" );
for( $j=0; $j< count($out); $j++ ) {
$line= $out[$j];
$txt .= $line."\n";
$psv .= $line."|\n";
$csv .= $line.",";
$json .= "{ \"j\":\"".$j."\", \"line\":\"".$line."\" },\n";
}
$psv .= preg_replace("/|$/", "", $psv );
$csv .= preg_replace("/|/", ",", $psv );
// $json .= preg_replace("/},$/", "}", $json );
// $json .= str_lreplace( ",$", "", $json );
$j=""; $line="";
$json .= "{ \"j\":\"".$j."\", \"line\":\"".$line."\" }\n";
// $json .= str_replace_last( ",", "" , $json );
$json .="]}\n\n";
$fmt="";
if( isset( $_REQUEST['fmt'] )) {$fmt=$_REQUEST['fmt']; }
// print( "<h1>BUGS_925 fmt=$fmt</h1>\n" );
if( $fmt == "txt" ) {
header('Content-type: text/plain');
print($txt); exit();
}
if( $fmt == "list" ) { print($txt);exit(); }
if( $fmt == "psv" ) { print($psv); exit(); }
if( $fmt == "csv" ) {
header('Content-type: text/csv');
print($csv); exit();
}
if( $fmt == "json" ) {
header('Content-type: application/json');
print( $json );
exit();
}
$k=1;
# if(! isset( $out[$k] )) {
# print( "<h1>MSG_2100 k=$k NOTFOUND \$out</h1>\n" );
# $url="./index.html?err=out";
# header('Location: '.$url);
# die();
# print( "<h1>MSG_2100 k=$k NOTFOUND \$out</h1>\n" );
# return($k);
# exit();
# }
$line="";
# $out = [];
if( count($out) > 0 ) { $line=$out[$k]; }
# print( "<h1>MSG_2110 k=$k line=$line</h1>" );
# print( "<h1>MSG_2111 k=$k id=$id find=$find outcnt=$outcnt out0=".$out[0]." </h1><br>\n" );
# print( "<h2>MSG_704 out4=".$out[4]."</h2>" );
# print( "<h2>MSG_705 out5=".$out[5]."</h2>" );
# print( "<h2>MSG_706 out6=".$out[6]."</h2>" );
# print( "<h2>MSG_707 out7=".$out[7]."</h2>" );
$htmout_table = "";
$htmout_table .= "<table id=table_media>\n";
$htmout_table .= "<tr>";
$htmout_table .= "<td>j</td>";
$htmout_table .= "<td>k</td>";
$htmout_table .= "<td>tot</td>";
$htmout_table .= "<td>link</td>";
$htmout_table .= "<td>group</td>";
$htmout_table .= "<td width=400>base bugs_18520</td>";
$htmout_table .= "</tr>";
# $htmout_table .= "</table>";
$txt = "";
$psv = "";
$csv = "";
$sql = "";
$sql .= "insert into table files (\n";
$json = "";
$json .= "{\n";
# print( "<h1>BUGS_710 skiplist $htmout_table</table></h1>" );
$out_skiplist = skiplist($out);
$out=$out_skiplist;
$outcnt=count($out);
$j=0; $k=0;
print( "BUGS_18530 j=$j k=$k outcnt=$outcnt <br>" );
for( $j=0; $j<count($out); $j++ ) {
$k=$j+1;
$line = $out[$j]."\n";
$list .= $line."\n";
$pathfile = $line;
# print( "<h1>BUGS_950 j=$j k=$k line=$line</h1>" );
print( "BUGS_18540 j=$j k=$k line=$line<br>\n" );
# $extension = pathinfo($pathfile, PATHINFO_EXTENSION);
$dirname=dirname($pathfile);
$group = str_replace("/","_", $dirname );
$temp= explode('.',$pathfile);
$ext = end($temp);
$base=basename($pathfile,".$ext");
$link = htmout_link($pathfile,'',$find);
# $url=$pathfile;
# $tn="/imgs/btn/koeye.png";
$txt .= "$line\n";
$psv .= "$j|$k|$outcnt|$pathfile|$link|$group|$base\n";
$csv .= "$j,$k,$outcnt,$pathfile,$link,$group,$base\n";
$sql .= "( 'j','k','outcnt',pathfile,'link','group','base' ),";
$json .= "{\n";
$json .= "'j':'$k', ";
$json .= " 'k':'$k', ";
$json .= "'outcnt':'$outcnt', ";
$json .= "'pathfile':'$pathfile', ";
$json .= "'link':'$link', ";
$json .= "'group':'$group', ";
$json .= "'base':'$base' ";
$json .= "},\n";
$htmout_table .= "<tr>";
$htmout_table .= "<td>$j</td>";
$htmout_table .= "<td>$k</td>";
$htmout_table .= "<td>$outcnt</td>";
$htmout_table .= "<td>".htmout_link($pathfile,'',$find)."</td>";
# $htmout_table .= "<td><img src=/imgs/btn/koeye_handhither.gif height=100></td>";
$htmout_table .= "<td>$group</td>";
$htmout_table .= "<td>$base</td>";
$htmout_table .= "</tr>\n";
# print( "<h3>BUGS_740 j=$j k=$k outcnt=$outcnt group=$group base=$base ext=$ext </h3>" );
$htmout_link=htmout_link($pathfile,'',$find);
# print( "<h3>BUGS_2020 j=$j k=$k pathfile=<$pathfile></h3>" );
# print( "<h3>BUGS_2021 j=$j k=$k htmout_link=<$htmout_link> find=$find</h3>" );
}
$json .= " }\n";
$matches = "";
$json = preg_replace( "/,}$/", "}", $matches );
$sql = preg_replace( "/,\)$/", ")", $matches );
$psv = preg_replace( "/|$/", "", $matches );
$csv = preg_replace( "/,$/", "", $matches );
$htmout_table .= " </table>";
$htmout .= "<hr color=goldenrod>";
$htmout .= $htmout_table;
$htmout .= "<hr color=goldenrod>";
$htmout .= " </body>\n";
$htmout .= " </html>\n";
$fmt="";
if( isset($_REQUEST['fmt'])) { $fmt=$_REQUEST['fmt']; }
# print( "<h1>BUGS_1000 find=$find fmt=$fmt</h1>" );
if( $fmt == "txt" ) { print( $txt ); exit; }
if( $fmt == "psv" ) { print( $psv ); exit; }
if( $fmt == "csv" ) { print( $csv ); exit; }
if( $fmt == "sql" ) { print( $sql ); exit; }
if( $fmt == "json" ) {
header('Content-type: application/json');
print( $json );
exit;
}
if( $fmt == "html" ) { print( $htmout ); exit; }
print($htmout); exit;
print( "<h3>BUGS_1021 j=$j k=$k outcnt=$outcnt group=$group base=$base ext=$ext </h3>" );
}
# if( count($out) < 1 ) { print( "<h2>ERR_2160 NOTFOUND find=$find</h2>\n" ); }
$outcnt="";
$group="";
$base="";
$ext="";
# print( "<h3>BUGS_1022 j=$j k=$k outcnt=$outcnt group=$group base=$base ext=$ext </h3>" );
return($htmout);
exit;
}
if( isset($_REQUEST['ls-lat']) || isset($_REQUEST['ls'] )) {
if( isset($_REQUEST['ls-lat'])) {
$request_path=$_REQUEST['ls-lat'];
}
else {
$request_path=$_REQUEST['ls'];
}
# print( "<h1>BUGS_183 request_path=$request_path</h1><br>\n" );
if( $request_path === "" ) { exit; }
$pathparts = pathinfo($request_path);
$dirname=$pathparts['dirname'];
$basename=$pathparts['basename'];
$ext="";
if( isset($pathparts['extension'])) {
$ext=$pathparts['extension'];
}
$path=$dirname;
if( ! is_dir($path)) {
print( "\n<h1>ERR_122 LSLAT NOTFOUND path=$path</h1><br>\n");
exit;
}
$lscmd="ls $request_path";
if( isset($_SERVER['ls-lat'])) {
$lscmd="ls -lat $request_path";
}
# print( "\n<h1>MSG_199 LSLAT lscmd=$lscmd</h1><br>\n");
$htmout = "";
exec( $lscmd, $out, $err );
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
print( $htmout );
exit;
}
if( isset($_REQUEST['find'])) {
# 1 ?find=/fb/zc/pages/*.jpg
# 4 ?find=find $path -name $names
# 6 ?find=find $path -type d -name $names
# 6 ?find=find $path -maxdepth 2 -name $names
# 8 ?find=find $path -type d -maxdepth 2 -name $names
# 4 ?find=find $path -type d
# 6 ?find=find $path -type d -maxdepth $maxdepth
$request_find=""; $findargs=""; $findargs_len=0;
$request_find=$_REQUEST['find'];
$findargs = explode( " ", $request_find );
$findargs_len=count($findargs);
for( $j=0; $j<count($findargs); $j++ ) {
$findargs[$j]=str_replace("\"","",$findargs[$j]);
$findargs[$j]=str_replace("'","",$findargs[$j]);
}
# print( "<h1>BUGS_140 findargs_len=$findargs_len request_find=$request_find</h1><br>\n" );
$path="";
if( count($findargs) === 1 ) {
// print( "<h1>BUGS_141 findargs_len=$findargs_len request_find=$request_find</h1><br>\n" );
// $pathparts = pathinfo($request_find);
// $dirname=$pathparts['dirname'];
// $basename=$pathparts['basename'];
// $ext="";
// if( isset($pathparts['extension'])) {
// $ext=$pathparts['extension'];
// }
// print( "<h1>BUGS_161 dirname=$dirname basename=$basename request_find=$request_find</h1><br>\n" );
// $path=$dirname;
// $name=$basename;
$path="fb";
$type="d";
$maxdepth="1";
$name="??";
if( ! is_dir($path)) {
print( "<h1>ERR_163 NOTFOUND path=$path</h1><br>\n" );
exit;
}
$find="find $path -type $type -maxdepth $maxdepth -name \"$name\"";
// print( "<h1>MSG_164 FOUND path=$path name=$name</h1><br>\n" );
print( "<h1>MSG_2340 FOUND find=$find </h1><br>\n" );
exec( $find, $out, $err );
$htmout="";
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
// print( "<h1>MSG_161 find=$find htmout=$htmout</h1><br>\n" );
print( $htmout );
exit;
}
# print( "<h1>BUGS_150 path=$path request_find=$request_find</h1><br>\n" );
$path="";
$maxdepth="";
$type="";
$names="";
$query_string="";
if( isset( $_SERVER['QUERY_STRING'])) {
$query_string=$_SERVER['QUERY_STRING'];
}
# print( "<h1>BUGS_300 findargs_len=$findargs_len request_find=$request_find query_string=$query_string</h1><br>\n" );
if( $findargs_len === 2 ) {
print( "<h1>BUGS_142 findargs_len=$findargs_len request_find=$request_find</h1><br>\n" );
$path=$findargs[1];
$path=str_replace("\"","",$path );
if( ! is_dir($path)) {
print( "<h1>ERR_143 NOTFOUND path=$path=- request_find=$request_find</h1><br>\n" );
exit;
}
$path="fb"; $type="d"; $maxdepth="1"; $names="??";
$find="find $path -type $type -maxdepth $maxdepth -name \"$names\"";
exec($find,$out,$err);
print( "<h1>BUGS_2380 find=$find</h1><br>\n" );
$htmout="";
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
print( $htmout );
// phpinfo();
// $request_find=str_replace("%20"," ",$request_find);
exit;
}
if( $findargs_len === 3 ) {
print( "<h1>BUGS_303 findargs_len=$findargs_len $request_find=$request_find query_string=$query_string</h1><br>\n" );
exit;
}
// if( $findargs_len === 4 ) {
// print( "<h1>BUGS_304 findargs_len=$findargs_len $request_find=$request_find query_string=$query_string</h1><br>\n" );
// }
if( $findargs_len === 1 ) {
$path="fb";
$type="d";
$maxdepth="1";
$names="??";
$find="find $path -type $type -maxdepth $maxdepth -name \"$names\"";
exec( $find, $out, $err );
print( "BUGS_311 find=$find<br>\n" );
$htmout="";
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
print( $htmout );
// print_r($out);
exit;
}
// if( $findargs_len === 2 ) { exit; }
// if( $findargs_len === 3 ) { exit; }
// if( $findargs_len === 5 ) { exit; }
// if( $findargs_len === 7 ) { exit; }
if( $findargs_len > 8 ) { exit; }
// print( "<h1>BUGS_350 findargs_len=$findargs_len query_string=$query_string</h1>\n" );
if( $findargs_len === 1 ) {
# if( is_file($request_find)) {
# print( "<h1>BUGS_101 is_file FOUND request_find=$request_find</h1>");
# }
# else {
# print( "<h1>BUGS_102 is_file NOTFOUND request_find=$request_find</h1>");
# }
if( $request_find != "" ) {
$pathparts = pathinfo($request_find);
$dirname=$pathparts['dirname'];
$basename=$pathparts['basename'];
$ext="";
if( isset($pathparts['extension'])) {
$ext=$pathparts['extension'];
}
$path=$dirname;
$names=$basename;
$type="f";
if( $ext === "" ) {
$path=$request_find;
$type="";
$names="";
}
# print( "BUGS_150 dirname=$dirname names=$names ext=$ext<br>\n" );
# if( $basename === "" ) { $names=""; }
}
}
# ?find=find $path -name $names
# ?find=find $path -type $type
if( $findargs_len === 4 ) {
$path = $findargs[1];
if ($findargs[2] === "-type" ) { $type=$findargs[3]; }
if ($findargs[2] === "-maxdepth" ) { $maxdepth=$findargs[3]; }
if ($findargs[2] === "-name" ) { $names=$findargs[3]; }
# print( "<h1>BUGS_240 findargs3=".$findargs[3]." request_find=$request_find</h1><br>\n") ;
if( ! is_dir($path)) {
print( "<h1>BUGS_241 NOTFOUND path=$path request_find=$request_find</h1><br>\n") ;
exit;
}
# print( "<h1>BUGS_242 FOUND path=$path request_find=$request_find</h1><br>\n") ;
$find="find $path";
if( $type != "" ) { $find .= " -type $type"; }
if( $maxdepth != "" ) { $find .= " -maxdepth $maxdepth"; }
if( $names != "" ) { $find .= " -name \"$names\""; }
# print( "<h1>BUGS_243 type=$type find=$find request_find=$request_find</h1><br>\n") ;
$htmout="";
exec($find, $out, $err );
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
# print( "<h1>BUGS_249 find=$find htmout=$htmout</h1><br>\n") ;
print( $htmout );
exit;
}
# ?find=find $path -type f -name $names
# ?find=find $path -maxdepth $maxdepth -name $names
# ?find=find $path -type d -maxdepth 1
if( $findargs_len === 6 ) {
# print( "<h1>BUGS_601 request_find=$request_find</h1><br>\n" );
$path="";
$type="";
$maxdepth="";
$names="";
$path = $findargs[1];
if( $findargs[2] === "-type" ) { $type=$findargs[3]; }
if( $findargs[2] === "-maxdepth" ) { $maxdepth=$findargs[3]; }
if( $findargs[2] === "-name" ) { $names=$findargs[3]; }
if( $findargs[4] === "-type" ) { $type=$findargs[5]; }
if( $findargs[4] === "-maxdepth" ) { $maxdepth=$findargs[5]; }
if( $findargs[4] === "-name" ) { $names=$findargs[5]; }
$find="find $path";
if( $type != "" ) { $find .= " -type $type"; }
if( $maxdepth != "" ) { $find .= " -maxdepth $maxdepth"; }
if( $names != "" ) { $find .= " -name \"$names\""; }
$htmout="";
exec( $find, $out, $err );
for($j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
print( $htmout );
exit;
}
# ?find=find $path -type f -maxdepth $maxdepth -name $names
if( $findargs_len === 8 ) {
$path = $findargs[1];
if( ! is_dir($path)) { print( "<h1>NOTFOUND path=$path</h1><br>\n" ); exit; }
$find = "find $path";
if( $findargs[2] === "-type" ) { $type=$findargs[3]; }
if( $findargs[2] === "-maxdepth" ) { $maxdepth=$findargs[3]; }
if( $findargs[2] === "-name" ) { $names=$findargs[3]; }
if( $findargs[4] === "-type" ) { $type=$findargs[5]; }
if( $findargs[4] === "-maxdepth" ) { $maxdepth=$findargs[5]; }
if( $findargs[4] === "-name" ) { $names=$findargs[5]; }
if( $findargs[6] === "-type" ) { $type=$findargs[7]; }
if( $findargs[6] === "-maxdepth" ) { $maxdepth=$findargs[7]; }
if( $findargs[6] === "-name" ) { $names=$findargs[7]; }
if( $type != "" ) { $find .= " -type $type"; }
if( $maxdepth != "" ) { $find .= " -maxdepth $maxdepth"; }
if( $names != "" ) { $find .= " -name \"$names\""; }
$htmout="";
# print( "<h1>BUGS_800 find=$find request_find=$request_find</h1><br>\n" );
exec( $find, $out, $err );
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
print( $htmout );
exit;
}
$find="find $path";
if( $type != "" ) { $find .= " -type $type"; }
if( $maxdepth != "" ) { $find .= " -maxdepth $maxdepth"; }
if( $names != "" ) {
$names=str_replace("\"","",$names);
$names=str_replace("'","",$names);
$find .= " -name \"$names\"";
}
// $find="find $path -type $type -maxdepth $maxdepth -name \"$names\"";
// if( $names === "" ) {
// $find="find $path -type $type -maxdepth $maxdepth";
// }
# print( "<h1>BUGS_101 find=$find</h1>\n");
$htmout="";
$types="http html htm php mp4 mp3 jps png gif";
$l=0;
foreach( $types as $types ) {
if( preg_match( "/$type/", $find, $matches )) {
print( "MSG_680 l=$l type=$type find=$find<br>\n");
window.location($find);
exit;
}
$l++;
}
$url=$find;
# print( "MSG_681 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.http/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_682 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.html/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_683 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.htm/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_684 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.php/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_685 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.mp4/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_686 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.mp3/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_687 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.gif/", $url, $matches )) { window.open($url); exit; }
if( preg_match( "/.jpg/", $url, $matches )) { window.open($url); exit; }
if( preg_match( "/.png/", $url, $matches )) { window.open($url); exit; }
#// $path="fb";
#// $find="find $path -type f -maxdepth 1 -name \"*.*\"";
# if( is_dir($path)) {
#// print( "<h1>MSG_271 find=$find</h1>\n" );
# exec( $find, $out, $err );
#
#// print( "<h1>MSG_272 OUT find=$find</h1>\n" );
# $query_string="";
# if( isset($_SERVER['QUERY_STRING'] )) {
# $query_string=$_SERVER['QUERY_STRING'];
# }
#// print( "<h1>MSG_273 OUT query_string=$query_string</h1>\n" );
#// print_r($out);
# print_r($err);
# $outlen=count($out);
# $htmout="";
# $htmout .= "<hr color=goldenrod>\n";
# $list="";
# for( $j=0; $j<$outlen; $j++ ) {
# $htmout .= $out[$j]."<br>\n";
# $list .= $out[$j]."\n";
# }
# $htmout .= "<hr color=goldenrod>\n";
## print( "<h1>MSG_104 ERR</h1>\n" );
## print_r($err);
# $process = proc_open( $cmd, $descriptorspec, $pipes, $cwd_process );
# print( "<h1>MSG_250 LS DONE find=$find outlen=$outlen</h1>" );
# }
# else {
# print( "<h1>ERR_500 NOTFOUND path=$path request_find=$request_find query_string=$query_string</h1>\n" );
# exit();
# }
print( "<h1>MSG_900 LS DONE find=$find</h1>\n" );
if( $fmt == "list" ) { print ( $list ); return($list); }
if( $fmt == "list" ) { print ( $list ); return($list); }
print( $list );
return( $list );
# exit;
# }
// $path="fb";
// $find="find $path -type f -maxdepth 1 -name \"*.*\"";
if( is_dir($path)) {
// print( "<h1>MSG_271 find=$find</h1>\n" );
exec( $find, $out, $err );
// print( "<h1>MSG_272 OUT find=$find</h1>\n" );
$query_string="";
if( isset($_SERVER['QUERY_STRING'] )) {
$query_string=$_SERVER['QUERY_STRING'];
}
// print( "<h1>MSG_273 OUT query_string=$query_string</h1>\n" );
// print_r($out);
print_r($err);
$outlen=count($out);
$htmout="";
$htmout .= "<hr color=goldenrod>\n";
$list="";
for( $j=0; $j<$outlen; $j++ ) {
$htmout .= $out[$j]."<br>\n";
$list .= $out[$j]."\n";
}
$htmout .= "<hr color=goldenrod>\n";
# print( "<h1>MSG_104 ERR</h1>\n" );
# print_r($err);
# $process = proc_open( $cmd, $descriptorspec, $pipes, $cwd_process );
print( "<h1>MSG_250 LS DONE find=$find outlen=$outlen</h1>" );
}
else {
print( "<h1>ERR_500 NOTFOUND path=$path request_find=$request_find query_string=$query_string</h1>\n" );
exit();
}
# print( "<h1>MSG_109 LS DONE find=$find</h1>\n" );
# print( $htmout );
print( $list );
exit;
}
if( isset($_REQUEST['kolog'])) {
$db3file="ko.db3"; $tblname="kologs";
$todo=$_REQUEST['kolog'];
if( $todo == "" ) {$htmout=kolog($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "new" ) {$htmout=kolog_new($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "add" ) {$htmout=kolog_add($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "del" ) {$htmout=kolog_del($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "upd" ) {$htmout=kolog_upd($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "sel" ) {$htmout=kolog_sel($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "create" ) {$htmout=kolog_create($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "form" ) {$htmout=kolog_form($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "submit" ) {$htmout=kolog_submit($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "list" ) {$htmout=kolog_list($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "bugs" ) {$htmout=kolog_bugs($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "logs" ) {$htmout=kologs($db3file, $tblname, $args); print( $htmout ); exit; }
exit;
}
if( isset($_REQUEST['id'])) {
$id=$_REQUEST['id'];
if( $id == "bookmarkusb" ) {
$htmout=bookmarkusb();
# $htmout=bookmarkusb_form();
exit;
}
if( $id == "bookmarkusb_list" ) {
$htmout=bookmarkusb_list();
exit;
}
if( $id == "bookmarkusb_select" ) {
$htmout=bookmarkusb_select();
exit;
}
if( $id == "bookmarkusb_form" ) {
$htmout=bookmarkusb_form();
exit;
}
# print( "<h1>BUGS_100c REQUEST_id id=$id REQ=".$_REQUEST['id']."</h1><br>" );
}
# startup_ls();
# main_ka1();
# main_tl();
# $htmlfile="index.html";
# $htmout=read_htmlfile($htmlfile);
# print( $htmout );
return;
# exit;
# startup();
# exit;
}
function str_replace_last( $search , $replace , $str ) {
if( ( $pos = strrpos( $str , $search ) ) !== false ) {
$search_length = strlen( $search );
$str = substr_replace( $str , $replace , $pos , $search_length );
}
return $str;
}
function isOdd($n) {
if($n % 2 == 0 ) {return(0); } else { return(1); }
}
function urlcheck($url) {
if( is_dir($url)) { window.location($url); exit; }
$urltypes = ".php .html .htm .mp3 .mp4 .jpg .pdf .txt";
if( preg_match("/http/", $url, $matches )) { window.location($url); exit; }
# print( "<h1>MSG_650 query_string=$query_string id=$id find=$find</h1><br>\n" );
# $name="*";
foreach( explode(" ", $urltypes) as $urltype ) {
if( preg_match("/$urltype$/", $url, $matches )) {
$htmout_link = "";
# $htmout_link .= "<a href=$url target=_blank>";
# $htmout_link .= "<img src=/imgs/btn/koeye.png height=20>";
# $htmout_link .= "</a><br>\n";
# $htmout_link .= "<img src=/imgs/btn/koeye.png height=20 onclick=\"window.location('$url');return false;\" >";
print( "<h2>MSG_651 MATCH id=$id url=$url urltype=$urltype </h2><br>\n" );
print( $htmout_link );
# if( is_file($url)) { window.location($url); exit; }
}
}
return($url);
}
function skiplist($out) {
#$fbid1_skiplist="
#fb/chap01
#fb/chap02
#fb/chap03
#fb/imgs
#fb/i
#fb/extras
#";
# for( $k=0; $k<count($out); $k++ ) {
# if( $id === "fbd1" ) {
# $skiplist=explode("\n",$fbid1_skiplist );
# $skiplist_len=count($skiplist);
# $fbid=$out[$k];
# $tn=$fbid."/pages/tn/tn_1.png";
#
#// print( "<h1>BUGS_240 $k fbid=$fbid tn=$tn</h1>\n" );
# if(! is_file($tn)) { continue; }
# for($i=0; $i<$skiplist_len; $i++ ) {
# if( $skiplist[$i] === "" ) { continue; }
# if( $fbid === $skiplist[$i] ) { continue; }
# }
# }
# }
return($out);
}
function htmout_head($args) {
$htmout = "";
$htmout .= "<html><head><title>ko.php 20211126_2030 $args</title>\n";
$htmout .= " </head>\n";
$htmout .= "<body bgcolor=\"linen\" onload=\"startup($args); return false;\">\n";
return($htmout);
}
function htmout_load($htmfil) {
$htmout = "";
$f = fopen( $htmfil, "r" ) or die("<h1>ERR_100 OPEN htmfil=$htmfil</h1>" );
$htmout .= fread($f, filesize($htmfil));
fclose($f);
return($htmout);
}
function htmout_tail($args) {
$htmout = "";
$htmout .= " </body>\n";
$htmout .= " </html>\n";
return( $htmout );
}
function htmout_link($pathfile,$tn,$find) {
# print( "<h3>BUGS_2860 htmout_link pathfile=$pathfile tn=$tn find=$find</h3>" );
$htmout="";
$findtype="";
if( str_contains( $find, "# fb" )) { $findtype="fb"; }
if( str_contains( $find, "# zm" )) { $findtype="zm"; }
# print( "<h3>BUGS_2861 htmout=$htmout htmout_link pathfile=$pathfile tn=$tn findtype=$findtype find=$find</h3>" );
if( $pathfile == "" ) { return(""); }
if( $tn == "" ) { $tn="/imgs/btn/koeye.png"; }
if( preg_match("/.pdf/", $pathfile, $matches )) {
$pathfile=str_replace("\n","",$pathfile );
$tn="/imgs/btn/btn_pdf1.png";
# $tn="/imgs/btn/koeye_pdf.png";
# $htmout .= "<a href=\"/pdf/web/viewer.html?file=/$pathfile\" target=_blank>";
# $htmout .= "<a href=\"/pdf/web/viewer.html?file=/$pathfile\" target=_blankk >";
# $htmout .= "<a href=/pdf/web/viewer.html?file=/$pathfile target=_blank>";
$htmout_pdf = "";
# $htmout_pdf .= "<a href=/pdf/web/viewer.html?file=/$pathfile>";
$htmout_pdf .= "<a href=/ka/pdf/web/viewer.html?file=/ka/$pathfile>";
# $htmout_pdf .= "<img src=$tn alt=$tn height=50>";
$htmout_pdf .= "<img src=/imgs/btn/koeye_pdf.png height=60>";
$htmout_pdf .= "</a>\n";
# print( "<h1>BUGS_1320 htmout_pdf=$htmout_pdf</h1>" );
$query_string="";
if( isset( $_SERVER['QUERY_STRING'] )) {
$query_string = $_SERVER['QUERY_STRING'];
}
$htmout .= "<h1>BUGS_1610 pathfile=$pathfile query_string=$query_string</h1>";
# $htmout = "<h1>BUGS BUGS BUGS_1325</h1>";
# print( "<h1>BUGS_1324 htmout pathfile >>>>$pathfile<<<<</h1>" );
# print( "<h1>BUGS_1325 htmout htmout_pdf >>>>$htmout_pdf<<<</h1>" );
# print( "<h1>BUGS_1326 htmout query_string >>>>$query_string<<<<h1>" );
return( $htmout_pdf );
}
if( preg_match("/.mp3/", $pathfile, $matches )) {
$tn="/imgs/btn/koeye_mp3.png";
$htmout .= "<a href=\"$pathfile\" target=_blank>";
$htmout .= " <img src=$tn alt=$tn height=50>\n";
$htmout .= " </a>\n";
}
if( preg_match("/.mp4/", $pathfile, $matches )) {
$tn="/imgs/btn/koeye_mp4.png";
$htmout .= "<a href=\"$pathfile\" target=_blank>";
$htmout .= " <img src=$tn alt=$tn height=50>\n";
$htmout .= " </a>\n";
}
if( preg_match("/.txt/", $pathfile, $matches )) {
$tn="/imgs/btn/koeye_txt.png";
$htmout .= "<a href=\"$pathfile\" target=_blank>";
$htmout .= " <img src=$tn alt=$tn height=50>\n";
$htmout .= " </a>\n";
}
if( $findtype == "fb" ) {
# find fb -type d -name "pages";
$tn="/imgs/btn/koeyeb_fb.png";
$fb_pathfile=str_replace("/pages","/index.html", $pathfile );
$fb_tn=str_replace("/pages","/pages/tn/tn_1.png", $pathfile );
$htmout .= "<a href=\"$fb_pathfile\" target=_blank>";
$htmout .= " <img src=$fb_tn alt=$tn height=100>\n";
$htmout .= " </a>\n";
# print( "<h2>BUGS_2910 fb_pathfile=$fb_pathfile fb_tn=$fb_tn htmout=$htmout</h2><br>\n" );
# print( "<h2>BUGS_2911 htmbug=$htmbug</h2>\n" );
}
if( $findtype == "zm" ) {
$script_filename=$_SERVER['SCRIPT_FILENAME']; # /Volumes/ka1tbr2/ht/ka/ko.php
$request_uri=$_SERVER['REQUEST_URI']; # /ka/ko.php?todo=ka_zms
$php_self=$_SERVER['PHP_SELF']; # /ka/ko.php
$query_string=$_SERVER['QUERY_STRING']; # todo=ka_zms
$ht=str_replace($php_self,"",$script_filename);
# find fb -type f -name "0-0-0.jpg";
# $zm_pathfile=str_replace("/TileGroup0/0-0-0.jpg",".html",$pathfile );
$tn="/imgs/btn/koeye_zm.png";
$zm_tn=$pathfile;
$pathfile_000jpg=$pathfile;
$zm_pathfile=$pathfile;
$pathfile=str_replace("/TileGroup0/0-0-0.jpg","",$pathfile_000jpg );
$pathfile=str_replace("\n","",$pathfile );
$dirname=dirname($pathfile);
$basename=basename($pathfile);
# basename(dirname(__FILE__));
# basename(dirname(__DIR__));
# print( "<h2>bugs_2960 pathfile=$pathfile dirname=$dirname basename=$basename </h2>\n" );
$pathfile_idxhtml="$pathfile/index.html";
$pathfile_idxhtm="$pathfile/index.htm";
$pathfile_html="$dirname/$basename.html";
$pathfile_htm="$dirname/$basename.htm";
$zm_pathfile_html="$dirname/zm_$basename.html";
$zm_pathfile_htm="$dirname/zm_$basename.htm";
$zm5_pathfile_html="$dirname/zm5_$basename.html";
$zm5_pathfile_htm="$dirname/zm5_$basename.htm";
# print( "<h2>BUGS_2950 pathfile=$pathfile</h2>\n" );
# print( "<h2>BUGS_2951 pathfile_idxhtml=$pathfile_idxhtml</h2>\n" );
# print( "<h2>BUGS_2952 pathfile_idxhtm=$pathfile_idxhtm</h2>\n" );
# print( "<h2>BUGS_2951 pathfile_html=$pathfile_html</h2>\n" );
# print( "<h2>BUGS_2952 pathfile_htm=$pathfile_htm</h2>\n" );
# print( "<h2>BUGS_2953 zm_pathfile_html=$zm_pathfile_html</h2>\n" );
# print( "<h2>BUGS_2954 zm_pathfile_htm=$zm_pathfile_htm</h2>\n" );
# print( "<h2>BUGS_2955 zm5_pathfile_html=$zm5_pathfile_html</h2>\n" );
# print( "<h2>BUGS_2956 zm5_pathfile_htm=$zm5_pathfile_htm</h2>\n" );
$findflag="";
if( $findflag == "" ) {
$ht_zm_pathfile_html=str_replace("../../","/","$ht/$zm_pathfile_html" );
$ht_zm_pathfile_html=str_replace("../","/","$ht/$zm_pathfile_html" );
if( file_exists( "$ht_zm_pathfile_html" )) {
$findflag="found";
$zm_pathfile=$zm_pathfile_html;
# print( "<h2>bugs_2061 ___FOUND zm_pathfile_html=$zm_pathfile_html</h2>\n" );
}
# else {
# print( "<h2>bugs_2061 NOTFOUND $ht/$zm_pathfile_html zm_pathfile_html=$zm_pathfile_html</h2>\n" );
# }
}
if( $findflag == "" ) {
$ht_zm_pathfile_htm=str_replace("../../","/","$ht/$zm_pathfile_htm" );
$ht_zm_pathfile_htm=str_replace("../","/","$ht/$zm_pathfile_htm" );
if( file_exists( "$ht_zm_pathfile_htm" )) {
$findflag="found";
$zm_pathfile=$zm_pathfile_htm;
# print( "<h2>bugs_2062 ___FOUND zm_pathfile_htm=$zm_pathfile_htm</h2>\n" );
}
# else {
# print( "<h2>bugs_2062 NOTFOUND $ht/$zm_pathfile_htm zm_pathfile_htm=$zm_pathfile_htm</h2>\n" );
# }
}
if( $findflag == "" ) {
$ht_zm5_pathfile_html=str_replace("../../","/","$ht/$zm5_pathfile_html" );
$ht_zm5_pathfile_html=str_replace("../","/","$ht/$zm5_pathfile_html" );
if( file_exists( "$ht_zm5_pathfile_html" )) {
$findflag="found";
$zm_pathfile=$zm5_pathfile_html;
# print( "<h2>bugs_2063 ___FOUND zm5_pathfile_html=$zm5_pathfile_html</h2>\n" );
}
# else {
# print( "<h2>bugs_2063 NOTFOUND $ht/$zm5_pathfile_html zm5_pathfile_html=$zm5_pathfile_html</h2>\n" );
# }
}
if( $findflag == "" ) {
$ht_zm5_pathfile_htm=str_replace("../../","/","$ht/$zm5_pathfile_htm" );
$ht_zm5_pathfile_htm=str_replace("../","/","$ht/$zm5_pathfile_htm" );
if( file_exists( "$ht_zm5_pathfile_htm" )) {
$findflag="found";
$zm_pathfile=$zm5_pathfile_htm;
# print( "<h2>bugs_2064 ___FOUND zm5_pathfile_htm=$zm5_pathfile_htm</h2>\n" );
}
# else {
# print( "<h2>bugs_2064 NOTFOUND $ht/$zm5_pathfile_htm zm5_pathfile_htm=$zm5_pathfile_htm</h2>\n" );
# }
}
if( $findflag == "" ) {
$ht_pathfile_html=str_replace("../../","/","$ht/$pathfile_html" );
$ht_pathfile_html=str_replace("../","/","$ht/$pathfile_html" );
if( file_exists( "$ht_pathfile_html" )) {
$findflag="found";
$zm_pathfile=$pathfile_html;
# print( "<h2>bugs_2065a ___FOUND pathfile_html=$pathfile_html</h2>\n" );
}
# else {
# print( "<h2>bugs_2065a NOTFOUND $ht/$pathfile_html pathfile_html=$pathfile_html</h2>\n" );
# }
}
if( $findflag == "" ) {
$ht_pathfile_htm=str_replace("../../","/","$ht/$pathfile_htm" );
$ht_pathfile_htm=str_replace("../","/","$ht/$pathfile_htm" );
if( file_exists( "$ht_pathfile_htm" )) {
$findflag="found";
$zm_pathfile=$pathfile_htm;
# print( "<h2>bugs_2066 ___FOUND pathfile_htm=$pathfile_htm</h2>\n" );
}
# else {
# print( "<h2>bugs_2066 NOTFOUND $ht/$pathfile_htm pathfile_htm=$pathfile_htm</h2>\n" );
# }
}
if( $findflag == "" ) {
$ht_pathfile_idxhtml=str_replace("../../","/","$ht/$pathfile_idxhtml" );
$ht_pathfile_idxhtml=str_replace("../","/","$ht/$pathfile_idxhtml" );
if( file_exists( "$ht_pathfile_idxhtml" )) {
$findflag="found";
$zm_pathfile=$pathfile_idxhtml;
# print( "<h2>bugs_2068 ___FOUND $ht/$pathfile_idxhtml pathfile_idxhtml=$pathfile_idxhtml</h2>\n" );
}
# else {
# print( "<h2>bugs_2068 NOTFOUND $ht/$pathfile_idxhtml pathfile_idxhtml=$pathfile_idxhtml</h2>\n" );
# }
}
if( $findflag == "" ) {
$ht_pathfile_idxhtm=str_replace("../../","/","$ht/$pathfile_idxhtm" );
$ht_pathfile_idxhtm=str_replace("../","/","$ht/$pathfile_idxhtm" );
if( file_exists( "$ht_pathfile_idxhtm" )) {
$findflag="found";
$zm_pathfile=$pathfile_idxhtm;
# print( "<h2>bugs_2069 ___FOUND pathfile_idxhtm=$pathfile_idxhtm</h2>\n" );
}
# else {
# print( "<h2>bugs_2069 NOTFOUND $ht/$pathfile_idxhtm pathfile_idxhtm=$pathfile_idxhtm</h2>\n" );
# }
}
# if( $findflag == "" ) {
# print( "<hr color=goldenrod>\n" );
# print( "<h2>bugs_3000 NOTFOUND $zm_pathfile</h2>\n" );
# print( "<hr color=goldenrod>\n" );
# }
# else {
if( $findflag != "" ) {
$htmout .= "<a href=\"$zm_pathfile\" target=_blank>";
$htmout .= " <img src=$zm_tn alt=$zm_pathfile width=100 height=50>\n";
$htmout .= " </a>\n";
}
else {
$htmout .= "<a href=\"$zm_pathfile\" target=_blank>";
$htmout .= " <img src=$zm_pathfile alt=$zm_pathfile width=100 height=50>\n";
$htmout .= " </a>\n";
$htmout .= " - zoom notfound: <br>\n";
}
}
if( $findtype != "zm" ) {
if( preg_match("/.jpg/", $pathfile, $matches )) {
$basename=basename($pathfile);
$path=str_replace($basename,"",$pathfile );
$tn="$path/tn/tn_$basename";
$tn=str_replace(".jpg", ".png",$tn );
$htmout .= "<a href=\"$pathfile\" target=_blank>";
$htmout .= " <img src=$tn alt=$tn height=50>\n";
$htmout .= " </a>\n";
}
}
# if( $findtype == "zm" ) {
# if( preg_match("/.jpg/", $pathfile, $matches )) {
# $basename=basename($pathfile);
# $path=str_replace($basename,"",$pathfile );
# $tn="$path/tn/tn_$basename";
# $tn=str_replace(".jpg", ".png",$tn );
# $htmout .= "<a href=\"$pathfile\" target=_blank>";
# $htmout .= " <img src=$pathfile alt=$tn height=50>\n";
# $htmout .= " </a>\n";
# }
# }
if( preg_match("/bitchute.com/", $pathfile, $matches )) {
$line=$pathfile;
$bcid="";
$url="";
if( count( explode("video/", $line)) > 0 ) {
$bcid=explode("video/",$line)[1];
}
# print( "<h1>BUGS_1350 bcid=$bcid url=$url line=$line</h1>" );
# https://www.bitchute.com/video/gDceXFTxSDk9/
$url="https://www.bitchute.com/video/$bcid";
$htmout_bitchute = "";
$htmout_bitchute .= "<a href=$url target=_blank>";
$htmout_bitchute .= "<img src=/imgs/btn/koeye_youtube.png height=50>";
$htmout_bitchute .= "</a>";
# $htmout_bitchute .= "<br>";
# $htmout_bitchute .= $url;
# $htmout_bitchute .= "<br>";
# $htmout_bitchute .= "<iframe src=https://www.bitchute.com/embed/$bcid/ width=100% height=100></iframe>";
# $htmout_bitchute .= "<iframe src=https://www.bitchute.com/embed/yecefLsE44U/ width=100% height=300></iframe>";
# $htmout_bitchute .= "iframe src=https://www.bitchute.com/embed/$bcid/ width=100% height=500"
$htmout .= $htmout_bitchute;
return($htmout);
}
if( preg_match("/youtube.com/", $pathfile, $matches )) {
$ytid="";
if( preg_match("/www.youtube.com\/embed\//", $pathfile, $matches )) {
$ytid=explode("embed/", $pathfile)[1];
}
else {
$line=$pathfile;
if( count(explode("=",$line)) > 0 ) {
if( isset( explode("=", $pathfile)[1])) {
$ytid=explode("=",$pathfile)[1];
}
}
else {
$ytid=$pathfile;
}
}
$ytid = str_lreplace("\n","", $ytid );
$label=explode("|",$pathfile)[0];
$tn="https://img.youtube.com/vi/$ytid/default.jpg";
# https://www.youtube.com/watch?v=BtccrKwRTEA
$url="https://www.youtube.com/watch?v=$ytid";
# print( "<h2>BUGS_1360 YOUTUBE ytid=$ytid </h2>" );
# print( "<h3>BUGS_1362 tn=$tn<h3>" );
# print( "<h3>BUGS_1363 label=$label<h3>" );
# print( "<h3>BUGS_1364 url=$url<h3>" );
$htmout .= "<a href=\"$url\" target=_blank>";
$htmout .= " <img src=$tn alt=$tn height=50>\n";
$htmout .= " </a>\n";
# print( "<h1>BUGS_1381 YOUTUBE htmout=$htmout</h1>" );
# print( "<h1>BUGS_1380 YOUTUBE pathfile=$pathfile</h1>" );
# print( "<h1>BUGS_1381 YOUTUBE url=$url</h1>" );
# print( "<h1>BUGS_1382 YOUTUBE label=$label</h1>" );
return($htmout);
}
if( $htmout == "" ) {
$htmout .= "<a href=\"$pathfile\" target=_blank>";
$htmout .= " <img src=$tn height=50>\n";
$htmout .= " </a>\n";
}
return($htmout);
}
function str_lreplace($search, $replace, $subject) {
$pos = strpos($subject, $search);
if($pos !== false) {
$subject = substr_replace($subject, $replace, $pos, strlen($search));
}
return $subject;
}
function htmout_list( $id, $list, $fmt ) {
print( "<h1>BUGS_1100 fmt=$fmt id=$id</h1>\n" );
# $fmt="json";
# if( $fmt == "" ) { $fmt="html"; }
#
$urlcols = "";
$pipecount=0;
$spacecount=0;
$j=0;$k=0; $filetest="";
$lines=explode("\n", $list );
$lines_len=count($lines);
print( "<h1>BUGS_1180 lines_len=$lines_len</h1><br>\n" );
# check for url columns
# print( "<h1>BUGS_1085 j=$j k=$k filetest=$filetest utlcols=$urlcols</h1><br>\n" );
$lines = "";
$htmout = "";
$htmout .= "<div id=div_list_$id>\n";
$htmout .= " <h1>div_list_$id</h1>\n";
$htmout .= " <hr color=goldenrod>\n";
$htmout .= " <table id=table_$id>\n";
$htmout .= "<tr>";
for( $k=0; $k<$delim_len; $k++ ) {
$fld=explode("$delim", $line)[$k];
$htmout .= "<td>";
$htmout .= $fld;
$htmout .= "</td>";
}
$htmout .= "</tr>\n";
$htmout .= " <tr><td>j</td><td>line</td></tr>\n";
$json = "";
$json = '{"list":[';
$list_len=count(explode("\n",$list));
print( "<h1>BUGS_1100 fmt=$fmt list_len=$list_len </h1>\n");
# print_r($list);
# $fmt="html";
# $delim="|";
if( $fmt == "list" ) {
print( "<h1>BUGS_851 LIST j=$j list_len=$list_len line=$line </h1>\n");
$lines .= "$line\n";
print( "<h1>BUGS_852 LIST j=$j list_len=$list_len lines=$lines </h1>\n");
}
print( "BUGS_1140 fmt=$fmt json=$json" );
if( $fmt == "json" ) {
$json .= "{";
for( $k=0; $k<$delim_len; $k++ ) {
$fld=explode($delim,$line)[$k];
$json .= '"fld_$k":"$fld",';
}
$json .= "},";
}
# }
$json .= "]}";
$htmout .= " </table>\n";
$htmout .= " <hr color=goldenrod>\n";
$htmout .= " </div>\n";
alert( "<h1>BUGS_1800 ko.php htmout=$htmout</h1>" );
if( $fmt == "list" ) { return($lines); }
if( $fmt == "html" ) { return($htmout); }
if( $fmt == "json" ) {
header('Content-type: application/json');
print( $json );
exit();
}
return($htmout);
}
function str_replace_first($search, $replace, $subject) {
$search = '/'.preg_quote($search, '/').'/';
return preg_replace($search, $replace, $subject, 1);
}
function str_replace_all($find) {
$a=""; $b=""; $c=""; $e=""; $f="";
$g=""; $h=""; $i=""; $j=""; $k="";
$l=""; $m=""; $n=""; $o=""; $p="";
$q=""; $r=""; $s=""; $t=""; $u="";
$v=""; $w=""; $x=""; $y=""; $z="";
$fmt=""; $lim=""; $db3=""; $tbl=""; $sel=""; $fld=""; $val="";
$matches="";
$a=""; if( isset($_REQUEST['a'] )) { $a=$_REQUEST['a']; }
$b=""; if( isset($_REQUEST['b'] )) { $b=$_REQUEST['b']; }
$c=""; if( isset($_REQUEST['c'] )) { $c=$_REQUEST['c']; }
$d=""; if( isset($_REQUEST['d'] )) { $d=$_REQUEST['d']; }
$e=""; if( isset($_REQUEST['e'] )) { $e=$_REQUEST['e']; }
$f=""; if( isset($_REQUEST['f'] )) { $f=$_REQUEST['f']; }
$g=""; if( isset($_REQUEST['g'] )) { $g=$_REQUEST['g']; }
$g=""; if( isset($_REQUEST['g'] )) { $g=$_REQUEST['g']; }
$h=""; if( isset($_REQUEST['h'] )) { $h=$_REQUEST['h']; }
$i=""; if( isset($_REQUEST['i'] )) { $i=$_REQUEST['i']; }
$j=""; if( isset($_REQUEST['j'] )) { $j=$_REQUEST['j']; }
$k=""; if( isset($_REQUEST['k'] )) { $k=$_REQUEST['k']; }
$l=""; if( isset($_REQUEST['l'] )) { $l=$_REQUEST['l']; }
$m=""; if( isset($_REQUEST['m'] )) { $m=$_REQUEST['m']; }
$n=""; if( isset($_REQUEST['n'] )) { $n=$_REQUEST['n']; }
$o=""; if( isset($_REQUEST['o'] )) { $o=$_REQUEST['o']; }
$p=""; if( isset($_REQUEST['p'] )) { $p=$_REQUEST['p']; }
$q=""; if( isset($_REQUEST['q'] )) { $q=$_REQUEST['q']; }
$r=""; if( isset($_REQUEST['r'] )) { $r=$_REQUEST['r']; }
$s=""; if( isset($_REQUEST['s'] )) { $s=$_REQUEST['s']; }
$t=""; if( isset($_REQUEST['t'] )) { $t=$_REQUEST['t']; }
$u=""; if( isset($_REQUEST['u'] )) { $u=$_REQUEST['u']; }
$v=""; if( isset($_REQUEST['v'] )) { $v=$_REQUEST['v']; }
$w=""; if( isset($_REQUEST['w'] )) { $w=$_REQUEST['w']; }
$x=""; if( isset($_REQUEST['x'] )) { $x=$_REQUEST['x']; }
$y=""; if( isset($_REQUEST['y'] )) { $y=$_REQUEST['y']; }
$z=""; if( isset($_REQUEST['z'] )) { $z=$_REQUEST['z']; }
$j=""; if( isset($_REQUEST['j'] )) { $j=$_REQUEST['j']; }
$j=""; if( isset($_REQUEST['j'] )) { $j=$_REQUEST['j']; }
$j=""; if( isset($_REQUEST['j'] )) { $j=$_REQUEST['j']; }
$j=""; if( isset($_REQUEST['j'] )) { $j=$_REQUEST['j']; }
$j=""; if( isset($_REQUEST['j'] )) { $j=$_REQUEST['j']; }
$j=""; if( isset($_REQUEST['j'] )) { $j=$_REQUEST['j']; }
$j=""; if( isset($_REQUEST['j'] )) { $j=$_REQUEST['j']; }
$j=""; if( isset($_REQUEST['j'] )) { $j=$_REQUEST['j']; }
$j=""; if( isset($_REQUEST['j'] )) { $j=$_REQUEST['j']; }
$j=""; if( isset($_REQUEST['j'] )) { $j=$_REQUEST['j']; }
$j=""; if( isset($_REQUEST['j'] )) { $j=$_REQUEST['j']; }
$j=""; if( isset($_REQUEST['j'] )) { $j=$_REQUEST['j']; }
$j=""; if( isset($_REQUEST['j'] )) { $j=$_REQUEST['j']; }
$j=""; if( isset($_REQUEST['j'] )) { $j=$_REQUEST['j']; }
$fmt=""; if( isset($_REQUEST['fmt'] )) { $a=$_REQUEST['fmt']; }
$lim=""; if( isset($_REQUEST['lim'] )) { $a=$_REQUEST['lim']; }
$db3=""; if( isset($_REQUEST['db3'] )) { $a=$_REQUEST['db3']; }
$tbl=""; if( isset($_REQUEST['tbl'] )) { $a=$_REQUEST['tbl']; }
$sel=""; if( isset($_REQUEST['sel'] )) { $a=$_REQUEST['sel']; }
$fld=""; if( isset($_REQUEST['fld'] )) { $a=$_REQUEST['fld']; }
$val=""; if( isset($_REQUEST['val'] )) { $a=$_REQUEST['val']; }
str_replace("<a>", $a, $find, $matches );
str_replace("<b>", $b, $find, $matches );
str_replace("<c>", $c, $find, $matches );
str_replace("<d>", $d, $find, $matches );
str_replace("<e>", $e, $find, $matches );
str_replace("<f>", $f, $find, $matches );
str_replace("<g>", $g, $find, $matches );
str_replace("<h>", $h, $find, $matches );
str_replace("<i>", $i, $find, $matches );
str_replace("<j>", $j, $find, $matches );
str_replace("<k>", $k, $find, $matches );
str_replace("<l>", $l, $find, $matches );
str_replace("<m>", $m, $find, $matches );
str_replace("<n>", $n, $find, $matches );
str_replace("<o>", $o, $find, $matches );
str_replace("<p>", $p, $find, $matches );
str_replace("<q>", $q, $find, $matches );
str_replace("<r>", $r, $find, $matches );
str_replace("<s>", $s, $find, $matches );
str_replace("<t>", $t, $find, $matches );
str_replace("<v>", $v, $find, $matches );
str_replace("<w>", $w, $find, $matches );
str_replace("<x>", $x, $find, $matches );
str_replace("<y>", $y, $find, $matches );
str_replace("<z>", $z, $find, $matches );
str_replace("<fmt>", $fmt, $find, $matches );
str_replace("<lim>", $lim, $find, $matches );
str_replace("<db3>", $db3, $find, $matches );
str_replace("<tbl>", $tbl, $find, $matches );
str_replace("<sel>", $sel, $find, $matches );
str_replace("<fld>", $fld, $find, $matches );
str_replace("&lval3>", $val, $find, $matches );
return($find);
}
# str_replace(html_entity_decode('–', ENT_COMPAT, 'UTF-8'), '', $string);
// Fix for mb overloading strlen option
function decodeString($str) {
if (function_exists('mb_strlen')) {
$len = mb_strlen($str, '8bit');
}
else {
$len = strlen($str);
}
$ret = '';
for ($i = 0; $i < $len; $i++) {
$ret .= dechex(ord($str[$i])).' ';
}
return trim($ret);
}
function decode1($str) {
$arr1 = explode(",","0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F");
$arr2 = explode(",","B,C,D,E,F");
foreach($arr2 as $t1){
foreach($arr1 as $t2){
$val = $t1.$t2;
$desc = str_replace(chr(hexdec($val)),"",$desc);
}
}
// if need removing individual value
$desc = str_replace(chr(hexdec('A2')),"",$desc);
# $string = str_replace("\x96", "-", $string);
# $new_string = str_replace('–', 'or', $string);
# $arr_needle = array("This", "function");
# $arr_replace = array("That", "method");
# $source_string= "This is a replace string tutorial by using str_replace function.";
# $str_replaced = str_replace($arr_needle, $arr_replace, $source_string);
}
class Input {
static $errors = true;
static function check($arr, $on = false) {
if ($on === false) {
$on = $_REQUEST;
}
foreach ($arr as $value) {
if (empty($on[$value])) {
self::throwError('Data is missing', 900);
}
}
}
static function int($val) {
$val = filter_var($val, FILTER_VALIDATE_INT);
if ($val === false) {
self::throwError('Invalid Integer', 901);
}
return $val;
}
static function str($val) {
if (!is_string($val)) {
self::throwError('Invalid String', 902);
}
$val = trim(htmlspecialchars($val));
return $val;
}
static function bool($val) {
$val = filter_var($val, FILTER_VALIDATE_BOOLEAN);
return $val;
}
static function email($val) {
$val = filter_var($val, FILTER_VALIDATE_EMAIL);
if ($val === false) {
self::throwError('Invalid Email', 903);
}
return $val;
}
static function url($val) {
$val = filter_var($val, FILTER_VALIDATE_URL);
if ($val === false) {
self::throwError('Invalid URL', 904);
}
return $val;
}
static function throwError($error = 'Error In Processing', $errorCode = 0) {
if (self::$errors === true) {
throw new Exception($error, $errorCode);
}
}
}
function db2($dbname,$server,$user,$pass) {
$htmout = "";
$htmout .= "<h3>MSGS_1540 DB2 dbname=$dbname server=$server user=$user</h3>\n";
print( $htmout );
return($htmout);
}
function db3($db3fil) {
$htmout = "";
$htmout .= "<h3>MSGS_1550 DB3 dbname=$dbname server=$server user=$user</h3>\n";
print( $htmout );
return($htmout);
}
function ko_form($args) {
$fids="a b c d e f g h i j k l m n o p q r s t u v w x y z db3 tbl sel fld val fmt lim";
$htmout = "";
$htmout .= "<div id=div_ko_form>\n";
$htmout .= "<h1>div_ko_form</h1>\n";
$htmout .= '<form method=\"POST\" action="ko.php?ko_form_submit">\n';
$htmout .= ' <input onkeydown="ko_onkeydown(event)" ><br>\n';
$htmout .= " </input>\n";
foreach( $fids as $fid ) {
$htmout .= ' <div id=div_form_$fid> <label for="$fid">$fid: </label> <input id="$fid" type="text"> </div>\n';
}
$htmout .= ' <div id=div_form_date> <label for="date">date: </label> <input id="date" type="date"> </div>\n';
$htmout .= ' <div id=div_form_time> <label for="time">time: </label> <input id="time" type="time"> </div>\n';
$htmout .= ' <div id=div_form_color> <label for="color">color: </label> <input id="color" type="color"> </div>\n';
$htmout .= ' <div id=div_form_textarea> <label for="textarea">textarea: </label> <textarea name="comment" id="comment" type="textarea"></textarea> </div>\n';
$htmout .= ' <div id=div_form_radio> <label for="radio">radio: </label><br>\n';
$htmout .= ' <input id="radio" name="gender" value="m" type="radio">m<br>\n';
$htmout .= ' <input id="radio" name="gender" value="f" type="radio">f<br>\n';
$htmout .= ' </div>\n';
$htmout .= ' <div id=div_form_checkbox> <label for="checkbox">checkbox: </label>\n';
$htmout .= ' <input id="checkbox" name="checkbox" value="box1" type="checkbox">box1<br>\n';
$htmout .= ' <input id="checkbox" name="checkbox" value="box1"type="checkbox">box2<br>\n';
$htmout .= ' <input id="checkbox" name="checkbox" value="box1" type="checkbox">box3<br>\n';
$htmout .= ' <input id="checkbox" name="checkbox" value="box1" type="checkbox">box4<br>\n';
$htmout .= ' </div>\n';
$htmout .= ' <div id=div_form_dropdown> <label for="dropdown">dropdown: </label> <input id="dropdown" type="dropdown"> </div>\n';
$htmout .= ' <div id=div_form_email> <label for="email">email: </label> <input id="email" type="email"> </div>\n';
$htmout .= ' <div id=div_form_submit> <label for="submit">submit: </label> <input id="submit" type="submit"> </div>\n';
$htmout .= ' <div id=div_form_cancel> <label for="cancel">cancel: </label> <input id="cancel" type="cancel"> </div>\n';
$htmout .= "</div>\n";
$htmout .= " </form>\n";
}
# kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk 1302
function kolog_htmout_head($progid,$funid) {
$dttm=date('Ymd_His');
$htmout = "";
$htmout .= "<html>";
$htmout .= "<head>";
$htmout .= " <title>$progid $dttm $funid</title>";
$htmout .= " </head>";
$htmout .= "<body bgcolor=linen>";
$htmout .= "<a href=?kolog target=_blank><img src=/imgs/btn/koeye.png height=50></a>";
return($htmout);
}
// $db3file="/ko.db3";
// $tblname="kolog";
function kolog($db3file,$tblname,$args) {
$progid="ko"; $funid="kolog"; $dttm=date('Ymd_His');
$htmout = "";
$htmout .= kolog_htmout_head($progid,$funid);
$htmout .= "<div id=div_$funid>";
$htmout .= "<h1>$funid</h1><h2>$dttm</h2>";
$htmout .= "<a href=/ko.php?kolog target=_blank><img src=/imgs/btn/koeye.png height=50>kolog</a><br>";
$htmout .= "<a href=/ko.php?kolog=new target=_blank><img src=/imgs/btn/koeye.png height=50>kolog_new</a><br>";
$htmout .= "<a href=/ko.php?kolog=add target=_blank><img src=/imgs/btn/koeye.png height=50>kolog_add</a><br>";
$htmout .= "<a href=/ko.php?kolog=del target=_blank><img src=/imgs/btn/koeye.png height=50>kolog_del</a><br>";
$htmout .= "<a href=/ko.php?kolog=upd target=_blank><img src=/imgs/btn/koeye.png height=50>kolog_upd</a><br>";
$htmout .= "<a href=/ko.php?kolog=sel target=_blank><img src=/imgs/btn/koeye.png height=50>kolog_sel</a><br>";
$htmout .= "<a href=/ko.php?kolog=bugs target=_blank><img src=/imgs/btn/koeye.png height=50>kolog_bugs</a><br>";
$htmout .= "<a href=/ko.php?kolog=create target=_blank><img src=/imgs/btn/koeye.png height=50>kolog_create</a><br>";
$htmout .= "<a href=/ko.php?kolog=form target=_blank><img src=/imgs/btn/koeye.png height=50>kolog_form</a><br>";
$htmout .= "<a href=/ko.php?kolog=submit target=_blank><img src=/imgs/btn/koeye.png height=50>kolog_submit</a><br>";
$htmout .= "<a href=/ko.php?kolog=list target=_blank><img src=/imgs/btn/koeye.png height=50>kolog_list</a><br>";
$htmout .= "<a href=/ko.php?kolog=logs target=_blank><img src=/imgs/btn/koeye.png height=50>kologs</a><br>";
// $htmout .= "<a href=/ko.php?id=kolog target=_blank><img src=/imgs/btn/koeye.png height=50>kolog</a><br>";
// $htmout .= "<a href=/ko.php?id=kolog_new target=_blank><img src=/imgs/btn/koeye.png height=50>kolog_new</a><br>";
// $htmout .= "<a href=/ko.php?id=kolog_add target=_blank><img src=/imgs/btn/koeye.png height=50>kolog_add</a><br>";
// $htmout .= "<a href=/ko.php?id=kolog_del target=_blank><img src=/imgs/btn/koeye.png height=50>kolog_del</a><br>";
// $htmout .= "<a href=/ko.php?id=kolog_upd target=_blank><img src=/imgs/btn/koeye.png height=50>kolog_upd</a><br>";
// $htmout .= "<a href=/ko.php?id=kolog_sel target=_blank><img src=/imgs/btn/koeye.png height=50>kolog_sel</a><br>";
// $htmout .= "<a href=/ko.php?id=kologs target=_blank><img src=/imgs/btn/koeye.png height=50>kologs</a><br>";
$htmout .= " </div>";
$htmout .= "<h1>db3file=$db3file tblname=$tblname</h1>";
$htmout .= " </body>";
$htmout .= " </html>";
return($htmout);
}
function kolog_new($db3file, $tblname, $args) {
$progid="ko"; $funid="kolog_new"; $dttm=date('Ymd_His');
$htmout="";
$htmout .= kolog_htmout_head($progid,$funid);
$htmout .= "<div id=div_$funid>";
$htmout .= "<h1>$funid</h1><h2>$dttm</h2>";
$htmout .= "$funid $dttm";
return($htmout);
}
function kolog_add($db3file, $tblname, $args) {
$progid="ko"; $funid="kolog_add"; $dttm=date('Ymd_His');
$htmout = "";
$htmout .= kolog_htmout_head($progid,$funid);
$htmout .= "<div id=div_$funid>";
$htmout .= "<h1>$funid</h1><h2>$dttm</h2>";
$htmout .= "$funid $dttm";
$htmout .= " </div>";
$htmout .= " </body>";
$htmout .= " </html>";
// print( "BUGS_200 kolog_add htmout=$htmout<br>" );
$htmout = "";
// $htmout .= "<!DOCTYPE html>";
$htmout .= "";
$htmout .= "<html lang=\"en\">";
$htmout .= "<head>";
// print( "BUGS_201 kolog_add htmout=<pre>$htmout</pre><br>" );
$htmout .= " <!-- The jQuery library is a prerequisite for all jqSuite products -->\n";
$htmout .= " <script type=\"text/ecmascript\" src=\"/jq/js/jquery.min.js\"></script>\n ";
$htmout .= " <!-- We support more than 40 localizations -->\n";
$htmout .= " <script type=\"text/ecmascript\" src=\"/jq/js/trirand/i18n/grid.locale-en.js\"></script>\n";
$htmout .= " <!-- This is the Javascript file of jqGrid --> \n ";
$htmout .= " <script type=\"text/ecmascript\" src=\"/jq/js/trirand/jquery.jqGrid.min.js\"></script>\n";
$htmout .= " <!-- A link to a Boostrap and jqGrid Bootstrap CSS siles-->\n";
$htmout .= " <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css\"> \n";
$htmout .= " <link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"/jq/css/trirand/ui.jqgrid-bootstrap.css\" />\n";
// print( "BUGS_202 kolog_add htmout=<pre>$htmout</pre><br>" );
$htmout .= " <script id=script_jq_defaults>\n";
$htmout .= " $.jgrid.defaults.width = 780;\n";
$htmout .= " $.jgrid.defaults.responsive = true;\n";
$htmout .= " $.jgrid.defaults.styleUI = 'Bootstrap';\n";
$htmout .= " </script>\n";
$htmout .= " <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js\"></script>\n";
$htmout .= " <meta charset=\"utf-8\" />\n";
$htmout .= " <title>/ko.php?kolog=add jqGrid Loading Data - Dialogs - Edit, Add, Delete</title>\n";
$htmout .= "</head>\n";
$htmout .= "<body bgcolor=linen>\n";
// print( "BUGS_204 kolog_add htmout=$htmout<br>" );
$htmout .= "<div style=\"margin-left:20px\">\n";
$htmout .= " <table id=\"jqGrid\"></table>\n";
$htmout .= " <div id=\"jqGridPager\"></div>\n";
$htmout .= " </div>\n";
$htmout .= " <script id=script_js_ready type=\"text/javascript\">\n";
$htmout .= "\n";
$htmout .= " $(document).ready(function () {\n";
$htmout .= " $(\"#jqGrid\").jqGrid({\n";
$htmout .= " url: '/jq/bootstrap/edit_add_delete/dialogs/data.json',\n";
$htmout .= " // we set the changes to be made at client side using predefined word clientArray\n";
$htmout .= " editurl: 'clientArray',\n";
$htmout .= " datatype: \"json\",\n";
$htmout .= " colModel: [\n";
$htmout .= " {\n";
$htmout .= " label: 'Customer ID',\n";
$htmout .= " name: 'CustomerID',\n";
$htmout .= " width: 75,\n";
$htmout .= " key: true,\n";
$htmout .= " editable: true,\n";
$htmout .= " editrules : { required: true}\n";
$htmout .= " },\n";
$htmout .= " {\n";
$htmout .= " label: 'Company Name',\n";
$htmout .= " name: 'CompanyName',\n";
$htmout .= " width: 140,\n";
$htmout .= " editable: true // must set editable to true if you want to make the field editable\n";
$htmout .= " },\n";
$htmout .= " {\n";
$htmout .= " label : 'Phone',\n";
$htmout .= " name: 'Phone',\n";
$htmout .= " width: 100,\n";
$htmout .= " editable: true\n";
$htmout .= " },\n";
$htmout .= " {\n";
$htmout .= " label: 'Postal Code',\n";
$htmout .= " name: 'PostalCode',\n";
$htmout .= " width: 80,\n";
$htmout .= " editable: true\n";
$htmout .= " },\n";
$htmout .= " {\n";
$htmout .= " label: 'City',\n";
$htmout .= " name: 'City',\n";
$htmout .= " width: 140,\n";
$htmout .= " editable: true\n";
$htmout .= " }\n";
$htmout .= " ],\n";
$htmout .= " sortname: 'CustomerID',\n";
$htmout .= " sortorder : 'asc',\n";
$htmout .= " loadonce: true,\n";
$htmout .= " viewrecords: true,\n";
$htmout .= " height: 200,\n";
$htmout .= " rowNum: 10,\n";
$htmout .= " pager: \"#jqGridPager\"\n";
$htmout .= " });\n";
$htmout .= "\n";
$htmout .= " $('#jqGrid').navGrid('#jqGridPager',\n";
$htmout .= " // the buttons to appear on the toolbar of the grid\n";
$htmout .= " { edit: true, add: true, del: true, search: false, refresh: false, view: false, position: \"left\", cloneToTop: false },\n";
$htmout .= " // options for the Edit Dialog\n";
$htmout .= " {\n";
$htmout .= " editCaption: \"The Edit Dialog\",\n";
$htmout .= " recreateForm: true,\n";
$htmout .= " checkOnUpdate : true,\n";
$htmout .= " checkOnSubmit : true,\n";
$htmout .= " closeAfterEdit: true,\n";
$htmout .= " errorTextFormat: function (data) {\n";
$htmout .= " return 'Error: ' + data.responseText\n";
$htmout .= " }\n";
$htmout .= " },\n";
$htmout .= " // options for the Add Dialog\n";
$htmout .= " {\n";
$htmout .= " closeAfterAdd: true,\n";
$htmout .= " recreateForm: true,\n";
$htmout .= " errorTextFormat: function (data) {\n";
$htmout .= " return 'Error: ' + data.responseText\n";
$htmout .= " }\n";
$htmout .= " },\n";
$htmout .= " // options for the Delete Dailog\n";
$htmout .= " {\n";
$htmout .= " errorTextFormat: function (data) {\n";
$htmout .= " return 'Error: ' + data.responseText\n";
$htmout .= " }\n";
$htmout .= " });\n";
$htmout .= " });\n";
$htmout .= "\n";
$htmout .= " </script>\n";
$htmout .= "\n";
$htmout .= "</body>\n";
$htmout .= "</html>\n";
return($htmout);
}
function kolog_del($db3file, $tblname, $args) {
$progid="ko"; $funid="kolog_del"; $dttm=date('Ymd_His');
$htmout = "";
$htmout .= kolog_htmout_head($progid,$funid);
$htmout .= "<div id=div_$funid>";
$htmout .= "<h1>$funid</h1><h2>$dttm</h2>";
$htmout .= "$funid $dttm";
$htmout .= " </div>";
$htmout .= " </body>";
$htmout .= " </html>";
return($htmout);
}
function kolog_upd($db3file, $tblname, $args) {
$progid="ko"; $funid="kolog_upd"; $dttm=date('Ymd_His');
$htmout = "";
$htmout .= kolog_htmout_head($progid,$funid);
$htmout .= "<div id=div_$funid>";
$htmout .= "<h1>$funid</h1><h2>$dttm</h2>";
$htmout .= "$funid $dttm";
$htmout .= " </div>";
$htmout .= " </body>";
$htmout .= " </html>";
return($htmout);
}
function kolog_sel($db3file, $tblname, $args) {
$progid="ko"; $funid="kolog_sel"; $dttm=date('Ymd_His');
$htmout = "";
$htmout .= kolog_htmout_head($progid,$funid);
$htmout .= "<div id=div_$funid>";
$htmout .= "<h1>$funid</h1><h2>$dttm</h2>";
$htmout .= "$funid $dttm";
$htmout .= " </div>";
$htmout .= " </body>";
$htmout .= " </html>";
// jjjjjjjjjjjjjjjjjjj
$htmout = "";
// $htmout .= "<!DOCTYPE html>\n";
$htmout .= "\n";
$htmout .= "<html lang=\"en\">\n";
$htmout .= "<head>\n";
$htmout .= " <!-- The jQuery library is a prerequisite for all jqSuite products -->\n";
$htmout .= " <script type=\"text/ecmascript\" src=\"/jq/js/jquery.min.js\"></script> \n";
$htmout .= " <!-- We support more than 40 localizations -->\n";
$htmout .= " <script type=\"text/ecmascript\" src=\"/jq/js/trirand/i18n/grid.locale-en.js\"></script>\n";
$htmout .= " <!-- This is the Javascript file of jqGrid --> \n";
$htmout .= " <script type=\"text/ecmascript\" src=\"/jq/js/trirand/jquery.jqGrid.min.js\"></script>\n";
$htmout .= " <!-- A link to a Boostrap and jqGrid Bootstrap CSS siles-->\n";
// $htmout .= " <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css\"> \n";
$htmout .= " <link rel=\"stylesheet\" href=\"/jq/css/jq_bootstrap.css\"> \n";
$htmout .= " <link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"/jq/css/trirand/ui.jqgrid-bootstrap.css\" /> \n";
$htmout .= " <script>\n";
$htmout .= " $.jgrid.defaults.width = 780;\n";
$htmout .= " $.jgrid.defaults.responsive = true;\n";
$htmout .= " $.jgrid.defaults.styleUI = 'Bootstrap';\n";
$htmout .= " </script>\n";
// $htmout .= " <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js\"></script>\n";
$htmout .= " <script src=\"/jq/js/jq_bootstrap.js\"></script>\n";
$htmout .= " <meta charset=\"utf-8\" />\n";
$htmout .= " <title>jqGrid Loading Data - Master / Detail</title>\n";
$htmout .= "</head>\n";
$htmout .= "<body bgcolor=linen>\n";
$htmout .= "<div style=\"margin-left:8px;\">\n";
$htmout .= " <table id=\"jqGrid\"></table>\n";
$htmout .= " <div id=\"jqGridPager\"></div>\n";
$htmout .= "\n";
$htmout .= " <br /><br />\n";
$htmout .= "\n";
$htmout .= " <div id=\"detailsPlaceholder\">\n";
$htmout .= " <table id=\"jqGridDetails\"></table>\n";
$htmout .= " <div id=\"jqGridDetailsPager\"></div>\n";
$htmout .= " </div>\n";
$htmout .= " </div>\n";
$htmout .= " <script id=\"script_jq_ready\" type=\"text/javascript\"> \n";
$htmout .= " \n";
$htmout .= " $(document).ready(function () {\n";
$htmout .= " \n";
$htmout .= "// master grid\n";
$htmout .= " $(\"#jqGrid\").jqGrid({\n";
$htmout .= " url: '/jq/bootstrap/selection/master_detail/data.json',\n";
$htmout .= " datatype: \"json\",\n";
$htmout .= " colModel: [\n";
$htmout .= " { label: 'ID', name: 'CustomerID', key: true, width: 75 },\n";
$htmout .= " { label: 'Company Name', name: 'CompanyName', width: 150 },\n";
$htmout .= " { label: 'Contact Name', name: 'ContactName', width: 150 },\n";
$htmout .= " { label: 'Phone', name: 'Phone', width: 150 },\n";
$htmout .= " { label: 'City', name: 'City', width: 150 }\n";
$htmout .= " ],\n";
$htmout .= " width: 780,\n";
$htmout .= " height: 150,\n";
$htmout .= " rowNum: 7,\n";
$htmout .= " viewrecords: true,\n";
$htmout .= " loadonce: true,\n";
$htmout .= " caption: 'Master Grid',\n";
$htmout .= " onSelectRow: function(rowid, selected) {\n";
$htmout .= " if(rowid != null) {\n";
$htmout .= " jQuery(\"#jqGridDetails\").jqGrid('setGridParam',{url: \"/jq/bootstrap/selection/master_detail/\"+rowid+\".json\",datatype: 'json'}); // the last setting is for demo only\n";
$htmout .= " jQuery(\"#jqGridDetails\").jqGrid('setCaption', 'Detail Grid::'+rowid);\n";
$htmout .= " jQuery(\"#jqGridDetails\").trigger(\"reloadGrid\");\n";
$htmout .= " } \n";
$htmout .= " }, // use the onSelectRow that is triggered on row click to show a details grid\n";
$htmout .= " onSortCol : clearSelection,\n";
$htmout .= " onPaging : clearSelection,\n";
$htmout .= " pager: \"#jqGridPager\"\n";
$htmout .= " });\n";
$htmout .= " });\n";
$htmout .= "// detail grid\n";
$htmout .= " $(\"#jqGridDetails\").jqGrid({\n";
$htmout .= " url: '/jq/bootstrap/selection/master_detail/empty.json',\n";
$htmout .= " mtype: \"GET\",\n";
$htmout .= " datatype: \"json\",\n";
$htmout .= " page: 1,\n";
$htmout .= " colModel: [\n";
$htmout .= " { label: 'Order ID', name: 'OrderID', key: true, width: 75 },\n";
$htmout .= " { label: 'Required Date', name: 'RequiredDate', width: 100 },\n";
$htmout .= " { label: 'Ship Name', name: 'ShipName', width: 100 },\n";
$htmout .= " { label: 'Ship City', name: 'ShipCity', width: 100 },\n";
$htmout .= " { label: 'Freight', name: 'Freight', width: 75 }\n";
$htmout .= " ],\n";
$htmout .= " width: 780,\n";
$htmout .= " rowNum: 5,\n";
$htmout .= " loadonce: true,\n";
$htmout .= " height: '100',\n";
$htmout .= " viewrecords: true,\n";
$htmout .= " caption: 'Detail grid::',\n";
$htmout .= " pager: \"#jqGridDetailsPager\"\n";
$htmout .= " });\n";
$htmout .= "\n";
$htmout .= " function clearSelection() {\n";
$htmout .= " jQuery(\"#jqGridDetails\").jqGrid('setGridParam',{url: \"/jq/bootstrap/selection/master_detail/empty.json\", datatype: 'json'}); // the last setting is for demo purpose only\n";
$htmout .= " jQuery(\"#jqGridDetails\").jqGrid('setCaption', 'Detail Grid:: none');\n";
$htmout .= " jQuery(\"#jqGridDetails\").trigger(\"reloadGrid\");\n";
$htmout .= " \n";
$htmout .= " }\n";
$htmout .= " </script>\n";
$htmout .= "\n";
// $htmout .= " <!-- This code is related to code tabs -->\n";
// $htmout .= " <br />\n";
// $htmout .= " <span style=\"margin-left:18px; font-family: Tahoma\">Click on the Tabs below the see the relevant code for the example:</span>\n";
// $htmout .= " <br /><br />\n";
// $htmout .= " <div id=\"codetabs\" style=\"width:780px; height: 400px; font-size:65%;\"></div>\n";
// $htmout .= " \n";
// $htmout .= " <script type=\"text/ecmascript\" src=\"/jq/js/prettify/prettify.js\"></script>\n";
// $htmout .= " <link rel=\"stylesheet\" href=\"/jq/css/prettify.css\" />\n";
// $htmout .= " <script type=\"text/ecmascript\" src=\"/jq/js/codetabs-b.js\"></script> \n";
// $htmout .= " \n";
// $htmout .= " <script type=\"text/javascript\">\n";
// $htmout .= "\n";
// $htmout .= " var tabData =\n";
// $htmout .= " [\n";
// $htmout .= " { name: \"HTML\", url: \"/jq/bootstrap/selection/master_detail/index.html\", lang: \"lang-html\" },\n";
// $htmout .= " { name: \"Data.JSON\", url: \"/jq/bootstrap/selection/master_detail/data.json\", lang: \"lang-json\" },\n";
// $htmout .= " { name: \"Description\", url: \"/jq/bootstrap/selection/master_detail/description.html\", lang: \"lang-html\" },\n";
// $htmout .= " ];\n";
// $htmout .= "\n";
// $htmout .= " codeTabs(tabData);\n";
// $htmout .= "\n";
// $htmout .= " </script>\n";
// $htmout .= " <!-- End of code related to code tabs -->\n";
$htmout .= "</body>\n";
$htmout .= "</html>\n";
// kkkkkkkkkkkkkkkkkkkkkkkkk
return($htmout);
}
function kolog_bugs($db3file, $tblname, $args) {
$progid="ko"; $funid="kolog_bugs"; $dttm=date('Ymd_His');
$htmout = "";
$htmout .= kolog_htmout_head($progid,$funid);
$htmout .= "<div id=div_$funid>";
$htmout .= "<h1>$funid</h1><h2>$dttm</h2>";
$htmout .= "$funid $dttm";
// echo strtotime("now"), "\n";
// echo strtotime("10 September 2000"), "\n";
// echo strtotime("+1 day"), "\n";
// echo strtotime("+1 week"), "\n";
// echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n";
// echo strtotime("next Thursday"), "\n";
// echo strtotime("last Monday"), "\n"// ;
// $str = 'Not Good';
// if (($timestamp = strtotime($str)) === false) {
// print( "The string ($str) is bogus" );
// }
// else {
// print( "$str == " . date('l dS \o\f F Y h:i:s A', $timestamp));
// }
$date1 = new DateTimeImmutable('2000-01-01');
$date2 = $date1->add(new DateInterval('P6M5DT24H'));
// print( "date1=".$date1->format('Y-m-d') . "<br>" );
// print( "date2=".$date2->format('Y-m-d') . "<br>" );
$j=0; $k=0;
$sql = "";
// $dttm_beg=date("H:i:s", strtotime("+0 hours"));
// $dttm_end8=date("D Y-m-d H:i:s", strtotime("+8 hours"));
// $dttm_end11=date("D Y-m-d H:i:s", strtotime("+11 hours"));
// $dttm_end14=date("D Y-m-d H:i:s", strtotime("+14 hours"));
// $dttm_end=date("D Y-m-d H:i:s", strtotime("+14 hours"));
// $htmout .= "<hr color=goldenrod width=200>";
// $htmout .= "<table id=table_dttm_head>";
// $htmout .= " <tr><td>   </td><td>   </td></tr>\n";
// $htmout .= " <tr><td>dttm_beg</td><td>$dttm_beg</td></tr>";
// $htmout .= " <tr><td>dttm_end8</td><td>$dttm_end8</td></tr>";
// $htmout .= " <tr><td>dttm_end11</td><td>$dttm_end11</td></tr>";
// $htmout .= " <tr><td>dttm_end14</td><td>$dttm_end14</td></tr>";
// $htmout .= " <tr><td>dttm_end</td><td>$dttm_end</td></tr>";
// $htmout .= " </table>";
// for( $dttm=$dttm_beg; $dttm<$dttm_end14; $dttm=date("H:i:s", strtotime("+1 hours"))) {
// $j=$j+1;
// $htmout .= "j=$j dttm=$dttm<br>";
// }
// $interval = DateInterval::createFromDateString('1 hour');
// $period = new DatePeriod($dttm_beg, $interval, $dttm_end);
// $j=0;
// foreach ($period as $dt) {
// $j=$j+1;
// $dttm=$dt->format("l Y-m-d H:i:s\n");
// $htmout .= "foreach period as dt j=$j dttm=$dttm<br>";
// }
// Loop between timestamps, 24 hours at a time
// $dttm_beg = strtotime( '2021-11-07 12:00' );
// $dttm_end = strtotime( '2021-11-08 12:00' );
// for ( $i = $dttm_beg; $i <= $dttm_end; $i = $i + 86400 ) {
// $thisDate = date( 'Y-m-d', $i ); // 2010-05-01, 2010-05-02, etc
// $htmout .= "for i j=$j i=$i<br>";
// }
// $htmout .= "<hr color=goldenrod>";
// $dttm_beg = $month = strtotime('2021-11-07');
// $dttm_end = strtotime('2021-11-14');
// while($month < $dttm_end) {
// $j=$j+1;
// $htmout .= "j=$j ".date('F Y', $month);
// $month = strtotime("+1 month", $month);
// }
// $dttm_beg = new DateTime('2010-12-02');
// $dttm_beg->modify('first day of this month');
// $dttm_end = new DateTime('2012-05-06');
// $dttm_end->modify('first day of next month');
// $interval = DateInterval::createFromDateString('1 month');
// $dttm_beg = $dttm_now;
// $dttm_end = $dttm_beg;
// $dttm_end8 = $dttm_beg;
// $dttm_end8->modify('+8 hours');
// $dttm_end11 = $dttm_beg;
// $dttm_end11->modify('+11 hours');
// $dttm_end14 = $dttm_beg;
// $dttm_end14->modify("+14 hours');
// $dttm_end = $dttm_end14;
// $dttm_now = new DateTime('now');
$dttm_now=date("D Y-m-d H:i:s", strtotime("+0 hours"));
$dttm_beg=date("D Y-m-d H:i:s", strtotime("+0 hours"));
$dttm_end8=date("D Y-m-d H:i:s", strtotime("+8 hours"));
$dttm_end11=date("D Y-m-d H:i:s", strtotime("+11 hours"));
$dttm_end14=date("D Y-m-d H:i:s", strtotime("+14 hours"));
$dttm_end=date("D Y-m-d H:i:s", strtotime("+14 hours"));
$htmout .= "<a href=?kolog target=_blank><img src=/imgs/btn/koeye.png height=50></a>";
$htmout .= "<hr color=goldenrod width=200>";
$htmout .= "<table id=table_head>";
$htmout .= "<tr><td>dttm_now</td><td>".date("D Y-m-d H:i:s", strtotime( $dttm_now ))."</td></tr>\n";
$htmout .= "<tr><td>dttm_beg</td><td>".date("D Y-m-d H:i:s", strtotime( $dttm_beg ))."</td></tr>\n";
$htmout .= "<tr><td>dttm_end</td><td>".date("D Y-m-d H:i:s", strtotime( $dttm_end ))."</td></tr>\n";
$htmout .= "<tr><td>dttm_end8</td><td>".date("D Y-m-d H:i:s", strtotime( $dttm_end8 ))."</td></tr>\n";
$htmout .= "<tr><td>dttm_end11</td><td>".date("D Y-m-d H:i:s", strtotime( $dttm_end11 ))."</td></tr>\n";
$htmout .= "<tr><td>dttm_end14</td><td>".date("D Y-m-d H:i:s", strtotime( $dttm_end14 ))."</td></tr>\n";
$htmout .= " </table>";
$htmout .= "<hr color=goldenrod width=200>";
$j=0;
$dttm = $dttm_beg;
$htmout .= "<table id=table_body>";
$htmout .= "<tr><td>hr</td><td>type</td><td>rem</td><td>time</td><td>act</td><td>desc</td></tr>";
while( $dttm < $dttm_end ) {
$j=$j+1;
$desc="desc hour $j";
$act="action_$j";
$type="t__";
$interval = DateInterval::createFromDateString("1 hour");
$dttm = date("H:i:s", strtotime( "+$j hours" ));
if( strtotime($dttm) < strtotime($dttm_end14)) {
// print( "BUGS_381 dttm=$dttm dttm_end14=$dttm_end14<br>\n" );
$type="t14";
}
if( strtotime($dttm) < strtotime($dttm_end11)) {
// print( "BUGS_382 dttm=$dttm dttm_end11=$dttm_end11<br>\n" );
$type="t11";
}
if( strtotime($dttm) < strtotime($dttm_end8)) {
// print( "BUGS_383 dttm=$dttm dttm_end8=$dttm_end8<br>\n" );
$type="t8";
}
$rem = date("H:i:s", strtotime($dttm_end) - strtotime($dttm));
// $dttm = date("l Y-m-d H:i:s", strtotime( "$dttm +.5 hours"));
// $dttm_day1nextmonth=$dttm_beg->modify("first day of next month");
// $interval = DateInterval::createFromDateString("1 month");
// $htmout .= "j=$j dttm=" .date("l Y-m-d H:i:s", strtotime( $dttm ))."<br>\n";
// $htmout .= "<tr><td>$j</td><td>" .date("D Y-m-d H:i:s", strtotime( "+$j hours" ))."</td></tr>\n";
$htmout .= "<tr>";
$htmout .= "<td width=20>$j</td>";
$htmout .= "<td width=10>$type</td>";
$htmout .= "<td width=10>$rem</td>";
$htmout .= "<td width=200>" .date("D Y-m-d H:i:s", strtotime( "+$j hours" ))."</td>";
$htmout .= "<td width=100>$act</td>";
$htmout .= "<td width=100>$desc</td>";
$htmout .= "</tr>\n";
if( $j > 50 ) { break; }
// if( date(strtotime($dttm)) > date(strtotime($dttm_end))) { break; }
// if( strtotime($dttm) > strtotime($dttm_end)) {
$dttm=date("D Y-m-d H:i:s", strtotime("+$j hours"));
if( date(strtotime($dttm)) > date(strtotime($dttm_end))) {
// print( "BUGS_401 BREAK dttm=$dttm dttm_end=$dttm_end<br>" );
break;
}
}
$htmout .= " </table>";
// for( $j=0; $j<100; $j++ ) {
// $dttm = $
// if( $j>5 ) { break; }
// $htmout .= "BUGS j=$j<br>";
// }
// $htmout .= "dttm_now=".$dttm_now->format("l Y-m-d H:i:s\n");
// $htmout .= "dttm_beg=".$dttm_beg->format("l Y-m-d H:i:s\n")."<br>";
// $htmout .= "dttm_end8=".$dttm_end8->format("l Y-m-d H:i:s\n")."<br>";
// $htmout .= "dttm_end11=".$dttm_end11->format("l Y-m-d H:i:s\n")."<br>";
// $htmout .= "dttm_end14=".$dttm_end14->format("l Y-m-d H:i:s\n")."<br>";
// $htmout .= "dttm_end=".$dttm_end->format("l Y-m-d H:i:s\n")."<br>";
$interval = DateInterval::createFromDateString('1 hour');
// $period = new DatePeriod($dttm_beg, $interval, $dttm_end);
$j=0;
// foreach ($period as $dt) {
// $j=$j+1;
// $htmout .= $dt->format("Y-m") . "<br>\n";
// }
// $pdo = newpdo($db3file);
// $pdo->exec($sql);
// $pdo=null;
$htmout .= " </div>";
$htmout .= " </body>";
$htmout .= " </html>";
return($htmout);
}
function kologs($db3file, $tblname,$args) {
$progid="ko"; $funid="kologs"; $dttm=date('Ymd_His');
$htmout = "";
$htmout .= kolog_htmout_head($progid,$funid);
$htmout .= "<div id=div_$funid>";
$htmout .= "<h1>$funid</h1><h2>$dttm</h2>";
$htmout .= "$funid $dttm";
$htmout .= " </div>";
$htmout .= " </body>";
$htmout .= " </html>";
return($htmout);
}
function kolog_create($db3file, $tblname, $args) {
$progid="ko"; $funid="create"; $dttm=date('Ymd_His');
$htmout="";
$sqldrop="";
$sqldrop .= "drop table if exists $tblname;";
$pdo = newpdo($db3file);
$pdo->exec($sqldrop);
$pdo=null;
$sqlcr_tblname="";
$sqlcr_tblname .= "create table if not exists $tblname ( ";
$sqlcr_tblname .= "progid text, ";
$sqlcr_tblname .= "dttm text, ";
$sqlcr_tblname .= "status text, ";
$sqlcr_tblname .= "id text, ";
$sqlcr_tblname .= "ip text, ";
$sqlcr_tblname .= "agent text, ";
$sqlcr_tblname .= "referer text, ";
$sqlcr_tblname .= "type text, ";
$sqlcr_tblname .= "effdt text, ";
$sqlcr_tblname .= "end8 text, ";
$sqlcr_tblname .= "rem8 text, ";
$sqlcr_tblname .= "end11 text, ";
$sqlcr_tblname .= "rem11 text, ";
$sqlcr_tblname .= "end14 text, ";
$sqlcr_tblname .= "rem14 text, ";
$sqlcr_tblname .= "loc text, ";
$sqlcr_tblname .= "act text, ";
$sqlcr_tblname .= "who text, ";
$sqlcr_tblname .= "notes text, ";
$sqlcr_tblname .= "desc text ";
$sqlcr_tblname .= " );";
// $pdo = newpdo($GLOBALS['dbfile']);
// $pdo->exec($sqlcr);
$pdo = newpdo($db3file);
$pdo->exec($sqlcr_tblname);
$pdo=null;
$htmout .= kolog_htmout_head($progid,$funid);
$htmout .= "<div id=div_$funid>";
$htmout .= "<h1>$funid</h1><h2>$dttm</h2>";
$htmout .= "$funid $dttm";
$htmout .= "<h1>db3file=$db3file tblname=$tblname</h1>";
$htmout .= "<h2>sqlcr=$sqlcr_tblname</h2>";
$sqldrop = "";
$sqldrop .= "drop table if exists kologs;";
$pdo = newpdo($db3file);
$pdo->exec($sqldrop);
$pdo=null;
$sqlcr_kologs = "";
$sqlcr_kologs .= "create table if not exists kologs ";
$sqlcr_kologs .= "as select * from files limit 1;";
$pdo = newpdo($db3file);
$pdo->exec($sqlcr_kologs);
$pdo=null;
$htmout .= "<h2>sql_kologs=$sqlcr_kologs</h2>";
$htmout .= "<a href=$progid.php?kolog ><img src=/imgs/btn/koeye.png height=50></a>";
$htmout .= " </body>";
$htmout .= " </html>";
return($htmout);
}
/**
* Converts current time for given timezone (considering DST)
* to 14-digit UTC timestamp (YYYYMMDDHHMMSS)
*
* DateTime requires PHP >= 5.2
*
* @param $str_user_timezone
* @param string $str_server_timezone
* @param string $str_server_dateformat
* @return string
*/
function now($str_user_timezone,
$str_server_timezone = CONST_SERVER_TIMEZONE,
$str_server_dateformat = CONST_SERVER_DATEFORMAT) {
// set timezone to user timezone
date_default_timezone_set($str_user_timezone);
$date = new DateTime('now');
$date->setTimezone(new DateTimeZone($str_server_timezone));
$str_server_now = $date->format($str_server_dateformat);
// return timezone to server default
date_default_timezone_set($str_server_timezone);
return $str_server_now;
}
// jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
function kolog_submit() {
$htmout=""; $j=0;$k=0;
print( "<h1>kolog FORM</h1>" );
# foreach($_REQUEST as $key=>$value) { $j=$j+1; }
$acts="";
$locs="";
$whos="";
$select_acts=array();
$select_locs=array();
$select_whos=array();
$html_acts="";
$html_locs="";
$html_whos="";
$html_select_acts="";
$html_select_locs="";
$html_select_whos="";
$db3file="ko.db3";
$tblname="kologs";
$sql="";
$selects=array();
$select="";
$fbid="";
$desc="";
$media="";
if( isset($_REQUEST['acts'])) { $acts=$_REQUEST['acts']; }
if( isset($_REQUEST['locs'])) { $locs=$_REQUEST['locs']; }
if( isset($_REQUEST['whos'])) { $whos=$_REQUEST['whos']; }
if( isset($_REQUEST['select_acts'])) { $select_acts=$_REQUEST['select_acts']; }
if( isset($_REQUEST['select_locs'])) { $select_locs=$_REQUEST['select_locs']; }
if( isset($_REQUEST['select_whos'])) { $select_whos=$_REQUEST['select_whos']; }
# print( "BUGS_101 db3file=$db3file<br>");
# print( "BUGS_102b acts=$acts<br>");
# print( "BUGS_102m locs=$locs<br>");
# print( "BUGS_102u whos=$whos<br>");
# print( "BUGS_103b select_acts=$select_acts<br>");
# print( "BUGS_103m select_locs=$select_locs<br>");
# print( "BUGS_103u select_whos=$select_whos<br>");
$acts_amt=0;
$locs_amt=0;
$whos_amt=0;
$kolog_amt=0;
$types="acts locs whos";
foreach(explode(" ",$types) as $type) {
$j=0;
if( preg_match("/acts/", $type, $matchs )) {
$tblname=$type;
$list=$acts;
$select=$select_acts;
# print( "BUGS_101 ACTS type=$type tblname=$tblname<br>");
}
if( preg_match("/locs/", $type, $matchs )) {
$tblname=$type;
$list=$locs;
$select=$select_locs;
# print( "BUGS_102 LOCS type=$type tblname=$tblname<br>");
}
if( preg_match("/whos/", $type, $matchs )) {
$tblname=$type;
$list=$whos;
$select=$select_whos;
# print( "BUGS_103 WHOS type=$type tblname=$tblname<br>");
}
# phpinfo();
# print( "BUGS_200 db3file=$db3file tblname=$tblname j=$j selects=$selects fbid=$fbid desc=$desc media=$media<br>" );
$sql="select * from $tblname";
if( is_array($select)) {
$select=implode(" ",$select);
}
$sql="select * from $tblname where fbid='$select'";
# $sql="select * from $tblname where fbid='".implode(" ",$select)."'";
# print( "BUGS_201 select=$select sql=$sql<br>" );
$pdo = newpdo($db3file);
foreach( $pdo->query($sql) as $row ) {
$j=$j+1;
$fbid="";
$grp="";
$media="";
$tn="";
$link="";
$credit="";
$caption="";
$text;
$desc="";
$fbid=$row['fbid'];
$grp=$row['grp'];
$media=$row['media'];
$tn=$row['tn'];
$link=$row['link'];
$credit=$row['credit'];
$amt=$credit;
$caption=$row['caption'];
$text=$row['text'];
$desc=$row['desc'];
if( preg_match( "/acts/", $type, $matches )) {
$acts_amt=$acts_amt+$amt;
}
if( preg_match( "/locs/", $type, $matches )) {
$locs_amt=$locs_amt+$amt;
}
if( preg_match( "/whos/", $type, $matches )) {
$whos_amt=$whos_amt+$amt;
}
// print( "BUGS_250 MATCH j=$j grp=$grp type=$type select=$select sql=$sql fbid=$fbid<br>");
$html_tbl = "";
$html_tbl .= "<table id=table_select_$fbid>";
$html_tbl .= "<tr>";
$html_tbl .= "<td width=200>img</td>";
$html_tbl .= "<td>   </td>";
$html_tbl .= "<td>id</td>";
$html_tbl .= "<td>   </td>";
$html_tbl .= "<td>grp</td>";
$html_tbl .= "<td>   </td>";
$html_tbl .= "<td>type</td>";
$html_tbl .= "<td>   </td>";
$html_tbl .= "<td>amt</td>";
$html_tbl .= "<td>   </td>";
$html_tbl .= "<td>caption</td>";
$html_tbl .= "<td>   </td>";
$html_tbl .= "<td>text</td>";
$html_tbl .= "<td>   </td>";
$html_tbl .= "<td>desc</td>";
$html_tbl .= "</tr>";
$html_tbl .= "<tr>";
$html_tbl .= "<td width=200>";
$html_tbl .= "<a href=".$media." target=_blank>";
$html_tbl .= " <img src=".$tn." height=50 >";
$html_tbl .= " </a>";
$html_tbl .= " </td>";
$html_tbl .= "<td>     </td>";
$html_tbl .= "<td>$fbid</td>";
$html_tbl .= "<td>     </td>";
$html_tbl .= "<td>$grp</td>";
$html_tbl .= "<td>     </td>";
$html_tbl .= "<td>$type</td>";
$html_tbl .= "<td>     </td>";
$html_tbl .= "<td>\$credit</td>";
$html_tbl .= "<td>     </td>";
$html_tbl .= "<td>$caption</td>";
$html_tbl .= "<td>     </td>";
$html_tbl .= "<td>$text</td>";
$html_tbl .= "<td>     </td>";
$html_tbl .= "<td>$desc</td>";
$html_tbl .= "</tr>";
$html_tbl .= " </table>";
$html = $html_tbl;
if( preg_match("/acts/", $type, $matches )) {
$html_select_acts .= $html;
}
if( preg_match("/locs/", $type, $matches )) {
$html_select_locs .= $html;
}
if( preg_match("/whos/", $type, $matches )) {
$html_select_whos .= $html;
}
$progid="ko";
$dttm=date('Ymd_His');
$remote_addr="";
$remote_port="";
$referer="";
$http_user_agent="";
$query_string="";
if( isset( $_SERVER['REMOTE_ADDR'])) {
$remote_addr=$_SERVER['REMOTE_ADDR'];
$remote_addr=str_replace(".","-",$remote_addr);
}
if( isset( $_SERVER['HTTP_USER_AGENT'])) {
$http_user_agent=$_SERVER['HTTP_USER_AGENT'];
$http_user_agent=str_replace(" ","",$http_user_agent );
$http_user_agent=str_replace(".","",$http_user_agent );
$http_user_agent=str_replace(";","",$http_user_agent );
$http_user_agent=str_replace(":","",$http_user_agent );
$http_user_agent=str_replace("/","",$http_user_agent );
$http_user_agent=str_replace("\n","",$http_user_agent );
$http_user_agent=str_replace("(","",$http_user_agent );
$http_user_agent=str_replace(")","",$http_user_agent );
}
if( isset( $_SERVER['REMOTE_PORT'])) { $remote_port=$_SERVER['REMOTE_PORT']; }
if( isset( $_SERVER['REFERER'])) { $referer=$_SERVER['REFERER']; }
if( isset( $_SERVER['QUERY_STRING'])) {
$query_string=$_SERVER['QUERY_STRING'];
$query_string=str_replace("%27","",$query_string);
}
$progid="ko";
$krow="ko";
$grp=$type;
$pathfile=$media;
$db3file="ko.db3";
$tblname="kologs";
# $pdo = newpdo($db3file);
foreach( $pdo->query($sql) as $row ) {
$j=$j+1;
$fbid=$row['fbid'];
$grp=$row['grp'];
$media=$row['media'];
$tn=$row['tn'];
$link=$row['link'];
$credit=$row['credit']; $amt=$credit;
$caption=$row['caption'];
$text=$row['text'];
$desc=$row['desc'];
$sql = "";
$sql .= "insert or replace into $tblname (";
$sql .= "'progid',";
$sql .= "'krow',";
$sql .= "'dttm',";
$sql .= "'remote_addr',";
$sql .= "'remote_port',";
$sql .= "'referer',";
$sql .= "'user_agent',";
$sql .= "'query_string',";
$sql .= "'pathfile',";
$sql .= "'fbid',";
$sql .= "'grp',";
$sql .= "'media',";
$sql .= "'tn',";
$sql .= "'link',";
$sql .= "'credit',";
$sql .= "'caption',";
$sql .= "'text',";
$sql .= "'desc'";
$sql .= " ) values ( ";
$sql .= "'$progid',";
$sql .= "'$krow',";
$sql .= "'$dttm',";
$sql .= "'$remote_addr',";
$sql .= "'$remote_port',";
$sql .= "'$referer',";
$sql .= "'$http_user_agent',";
$sql .= "'$query_string',";
$sql .= "'$pathfile',";
$sql .= "'$fbid',";
$sql .= "'$grp',";
$sql .= "'$media',";
$sql .= "'$tn',";
$sql .= "'$link',";
$sql .= "'$credit',";
$sql .= "'$caption',";
$sql .= "'$text',";
$sql .= "'$desc'";
$sql .= " ) ";
# print( "BUGS_2370 sql=$sql<br>" );
$pdo->exec($sql);
}
# print( "BUGS_2500 type=$type tblname=$tblname j=$j select=$select fbid=$fbid desc=$desc media=$media<br>" );
}
$pdo = null;
# print( "BUGS_2530 type=$type tblname=$tblname j=$j select=$select fbid=$fbid desc=$desc media=$media<br>" );
}
$dttm=date('Ymd_His');
$html="";
$html .= "<html>";
$html .= "<head>";
$html .= " <title>/ko.php $dttm</title>";
$html .= " <script id=script_hideshow>";
$html .= " function script_hideshow(args) {";
$html .= " divid=args;";
$html .= " alert( \"BUGS_123 script_hideshow args=\"+args );";
$html .= " if( document.getElementByID(divid)) { ";
$html .= " if( document.getElementByID(divid).style.display == \"inline\") { ";
$html .= " document.getElementById(divid).style.display = \"none\"; ";
$html .= " }";
$html .= " else {";
$html .= " document.getElementById(divid).style.display = \"none\"; ";
$html .= " }";
$html .= " }";
$html .= " return(htmout);";
$html .= " }";
$html .= " </script>";
$html .= " </head>";
$html .= "<body bgcolor=linen>";
$html .= "<hr color=goldenrod>";
// $html .= "<img src=ko.png onclick=\"script_hideshow('div_head'); return false;\" height=50><br>";
$html .= "<a href=?kolog target=_blank><img src=/imgs/btn/koeye.png height=50></a>";
$html .= "<hr color=goldenrod>";
$html .= "<div id=div_head>";
$html .= " <h1>div_head</h1>";
$html .= " </div>";
$html .= "<br>";
$html .= "<hr bgcolor=goldenrod>";
$html .= "<h1>kolog: selects</h1>";
$html .= "<h2>select_acts</h2>";
$html .= $html_select_acts;
$html .= "acts_amt=$acts_amt<br>";
$html .= "<h2>select_locs</h2>";
$html .= $html_select_locs;
$html .= "locs_amt=$locs_amt<br>";
$html .= "<h2>select_whos</h2>";
$html .= $html_select_whos;
$html .= "whos_amt=$whos_amt<br>";
$html .= "<hr color=goldenrod>";
$kolog_amt=0;
$kolog_amt=$kolog_amt+$acts_amt;
$kolog_amt=$kolog_amt+$locs_amt;
$kolog_amt=$kolog_amt+$whos_amt;
$html .= "kolog_amt=$kolog_amt<br>";
print( $html );
return($htmout);
}
function kolog_form() {
$db3file="ko.db3";
$htmout=""; $j=0;$k=0;
$dttm=date('Ymd_His');
print("<hr color=black>");
print("<hr color=white>");
print("<a href=/ target=_blank ><img src=ko.png height=10></a>");
print("<hr color=white>");
print("<hr color=black>");
print( "<h1>kolog FORM $dttm</h1>" );
print("<h2>$dttm</h2>" );
$html_select_acts="";
$html_select_locs="";
$html_select_whos="";
$acts="";
$locs="";
$whos="";
if( isset($_REQUEST['acts'])) { $acts=$_REQUEST['acts']; }
if( isset($_REQUEST['locs'])) { $marks=$_REQUEST['locs']; }
if( isset($_REQUEST['whos'])) { $usbs=$_REQUEST['whos']; }
$html_form="";
// $html_form .= "<form id=\"form_kologs\" method=\"post\" action=\"?kolog=submit\" >";
$html_form .= "<input type=\"hidden\" id=\"acts\" name=\"acts\" value=\"".$acts."\" >";
$html_form .= "<input type=\"hidden\" id=\"locs\" name=\"locs\" value=\"".$locs."\" >";
$html_form .= "<input type=\"hidden\" id=\"whos\" name=\"whos\" value=\"".$whos."\" >";
$html_form .= "<table id=\"table_form_kologs\">";
$html_form .= "<tr><td>form_fname</td><td><input type=\"text\" id=\"form_fname\" name=\"form_fname\"></input></td></tr>";
$html_form .= "<tr><td>form_lname</td><td><input type=\"text\" id=\"form_lname\" name=\"form_lname\"></input></td></tr>";
$html_form .= "<tr><td>form_addr</td><td><input type=\"text\" id=\"form_addr\" name=\"form_addr\"></input></td></tr>";
$html_form .= "<tr><td>form_city</td><td><input type=\"text\" id=\"form_city\" name=\"form_city\"></input></td></tr>";
$html_form .= "<tr><td>form_zip</td><td><input type=\"text\" id=\"form_zip\" name=\"form_zip\"></input></td></tr>";
$html_form .= "<tr><td>form_note</td><td><input type=\"text\" id=\"form_note\" name=\"form_note\"></input></td></tr>";
$html_form .= "<tr><td>form_file</td><td><input type=\"file\" id=\"form_file\" name=\"form_file\"></input></td></tr>";
$html_form .= "<tr><td>form_checkbox</td><td><input type=\"checkbox\" id=\"form_checkbox\" name=\"form_checkbox\"></input></td></tr>";
$html_form .= "<tr><td>form_checkbox</td><td><input type=\"checkbox\" id=\"form_checkbox\" name=\"form_checkbox\"></input></td></tr>";
$html_form .= "<tr><td>form_checkbox</td><td><input type=\"checkbox\" id=\"form_checkbox\" name=\"form_checkbox\"></input></td></tr>";
$html_form .= "<tr><td>form_date</td><td><input type=\"date\" id=\"form_date\" name=\"form_date\"></td><td></input></td></tr>";
$html_form .= "<tr><td>form_mail</td><td><input type=\"email\" id=\"form_email\" name=\"form_email\"></td><td></input></td></tr>";
$html_form .= "<tr><td>form_radio</td><td><input type=\"radio\" id=\"form_radio\" name=\"form_radio\"></td><td></input></td></tr>";
$html_form .= "<tr><td>form_radio</td><td><input type=\"radio\" id=\"form_radio\" name=\"form_radio\"></td><td></input></td></tr>";
$html_form .= "<tr><td>form_radio</td><td><input type=\"radio\" id=\"form_radio\" name=\"form_radio\"></td><td></input></td></tr>";
$html_form .= "<tr><td>form_tel</td><td><input type=\"tel\" id=\"form_tel\" name=\"form_tel\"></td><td></input></td></tr>";
$html_form .= "<tr><td>form_url</td><td><input type=\"url\" id=\"form_url\" name=\"form_url\"></td><td></input></td></tr>";
$html_form .= "<tr><td>form_week</td><td><input type=\"week\" id=\"form_week\" name=\"form_week\"></td><td></input></td></tr>";
$html_form .= "<tr><td>form_image</td><td><input type=\"image\" id=\"form_image\" name=\"form_image\"></td><td></input></td></tr>";
$html_form .= "<tr><td>form_month</td><td><input type=\"month\" id=\"form_month\" name=\"form_month\"></td><td></input></td></tr>";
$html_form .= "<tr><td>form_number</td><td><input type=\"number\" id=\"form_number\" name=\"form_number\"></td><td></input></td></tr>";
$html_form .= "<tr><td>form_password</td><td><input type=\"password\" id=\"form_password\" name=\"form_password\"></td><td></input></td></tr>";
$html_form .= "<tr><td>form_range</td><td><input type=\"range\" id=\"form_range\" name=\"form_range\"></td><td></input></td></tr>";
$html_form .= "<tr><td>form_time</td><td><input type=\"time\" id=\"form_time\" name=\"form_time\"></td><td></input></td></tr>";
$html_form .= "<tr><td>form_search</td><td><input type=\"search\" id=\"kolog_search\" name=\"form_search\"></td><td></input></td></tr>";
$html_form .= " </table>";
// $html_form .= "<input type=\"submit\">";
// $html_form .= "</form>";
$dttm=date('Ymd_His');
$html = "";
$html .= "<html>";
$html .= " <head>";
$html .= " <title>ko.php?id=kolog_form $dttm</title>";
$html .= " </head>";
$html .= "<body bgcolor=linen >";
$html .= "<a href=?kolog target=_blank><img src=/imgs/btn/koeye.png height=100></a>";
$html .= "<hr color=goldenrod>";
$html .= "<hr color=red>";
$html .= "<hr color=white>";
$html .= "<hr color=blue>";
// $html .= "<h1>BUGS_1001</h1>";
// $html .= $html_form;
// $html .= "<h1>BUGS_1002</h1>";
$html .= "<hr color=red>";
$html .= "<hr color=white>";
$html .= "<hr color=blue>";
# $html .= "<form method=\"post\" id=form_kologs action=\"ko.php?kolog=submit\" >";
# $html .= "<form method=\"post\" id=form_kologs action=\"ko.php?kolog=submit\" >";
$types="acts locs whos";
foreach( explode(" ", $types) as $type ) {
# $html .= "<select class=\"select\" id=select_$type name=select_$type multiple size=\"20\" >";
$tblname=$type;
# if( preg_match("/acts/", $type, $matches )) { $tblname=$type; $lists=$acts; }
# if( preg_match("/locs/", $type, $matches )) { $tblname=$type; $lists=$locs; }
# if( preg_match("/whos/", $type, $matches )) { $tblname=$type; $lists=$whos; }
# $sql="select * from $tblname where fbid='$select'";
$sql="select * from $tblname";
# print( "BUGS_300 type=$type sql=$sql<br>" );
$fbid="";
$grp="";
$media="";
$tn="";
$link="";
$credit="";
$caption="";
$desc="";
$html_select = "";
# $html_select .= "<select id=select_$type multiple size=25 >";
if( preg_match("/acts/", $type, $matches )) {
$html_select_acts = "";
$html_select_acts .= "<select id=select_$type multiple size=25 >";
}
if( preg_match("/locs/", $type, $matches )) {
$html_select_locs = "";
$html_select_locs .= "<select id=select_$type multiple size=25 >";
}
if( preg_match("/whos/", $type, $matches )) {
$html_select_whos = "";
$html_select_whos .= "<select id=select_$type multiple size=25 >";
}
# print( "BUGS_301 html=$html" );
$pdo = newpdo($db3file);
foreach( $pdo->query($sql) as $row ) {
$j=$j+1;
$fbid=$row['fbid'];
$grp=$row['grp'];
$media=$row['media'];
$tn=$row['tn'];
$link=$row['link'];
$credit=$row['credit'];
$caption=$row['caption'];
$text=$row['text'];
$desc=$row['desc'];
# print( "BUGS_601 j=$j fbid=$fbid credit=$credit desc=$desc<br>" );
# print( "BUGS_602 j=$j fbid=$fbid html_select=<hr>$html_select<hr>" );
$html_select="";
$html_select .= "<option ";
$html_select .= " id=\"select_$type\" ";
$html_select .= " name=\"select_$type\" ";
$html_select .= ">";
$html_select .= "$j ";
$html_select .= "$grp ";
$html_select .= "$fbid ";
$html_select .= "$credit ";
$html_select .= "$caption ";
$html_select .= "$text ";
$html_select .= "$desc ";
$html_select .= " </option>";
$html_select .= "<br>";
# print( "BUGS_1050 html_select=$html_select<br>" );
if( preg_match("/acts/", $type, $matches )) {
$html_select_acts .= $html_select;
# $html_select_acts .= " </select>";
# printf( "BUGS_1051 $j $fbid html_select_acts=$html_select_acts" );
}
if( preg_match("/locs/", $type, $matches )) {
$html_select_locs .= $html_select;
# $html_select_locs .= " </select>";
# printf( "BUGS_1052 html_select_locs=$html_select_locs" );
}
if( preg_match("/whos/", $type, $matches )) {
$html_select_whos .= $html_select;
# $html_select_whos .= " </select>";
# printf( "BUGS_1053 html_select_whos=$html_select_whos" );
}
}
if( preg_match("/acts/", $type, $matches )) { $html_select_acts .= " </select>";
# print( "BUGS_631 html_select_acts=$html_select_acts<br>");
}
if( preg_match("/locs/", $type, $matches )) { $html_select_locs .= " </select>";
# print( "BUGS_632 html_select_locs=$html_select_locs<br>");
}
if( preg_match("/whos/", $type, $matches )) { $html_select_whos .= " </select>";
# print( "BUGS_633html_select_whos=$html_select_whos<br>");
}
# print( "BUGS_650 type=$type html=$html" );
}
$html_select="";
$html_select .= "<hr color=goldenrod>";
$html_select .= "<hr color=black>";
$html_select .= "<table id=table_form>";
$html_select .= "<tr><td>acts</td><td width=10>   </td><td>locs</td><td>   </td><td>whos</td></tr>";
$html_select .= "<tr>";
$html_select .= " <td>";
$html_select .= $html_select_acts;
$html_select .= " </td>";
$html_select .= " <td width=20>   </td>";
$html_select .= " <td>";
$html_select .= $html_select_locs;
$html_select .= " </td>";
$html_select .= " <td width=20>   </td>";
$html_select .= " <td>";
$html_select .= $html_select_whos;
$html_select .= " </td>";
$html_select .= " </tr>";
$html_select .= " </table>";
$html_select .= "<hr color=black>";
$html_select .= "<hr color=goldenrod>";
# $html_select .= "BUGS_3000<br>";
# print( $html );
$html_flds = "";
$html_flds .= "<table id=table_flds>";
$html_flds .= "<tr><td></td><td><input type=\"hidden\" id=\"acts\" value=\"$acts\" ></input></td></tr>";
$html_flds .= "<tr><td></td><td><input type=\"hidden\" id=\"locs\" value=\"$locs\" ></input></td></tr>";
$html_flds .= "<tr><td></td><td><input type=\"hidden\" id=\"whos\" value=\"$whos\" ></input></td></tr>";
$html_flds .= "<tr><td>fname</td><td><input type=\"text\" id=\"form_fname\"></input></td></tr>";
$html_flds .= "<tr><td>lname</td><td><input type=\"text\" id=\"form_lname\"></input></td></tr>";
$html_flds .= "<tr><td>addr</td><td><input type=\"text\" id=\"form_addr\"></input></td></tr>";
$html_flds .= "<tr><td>city</td><td><input type=\"text\" id=\"form_city\"></input></td></tr>";
$html_flds .= "<tr><td>zip</td><td><input type=\"text\" id=\"form_zip\"></input></td></tr>";
$html_flds .= "<tr><td>country</td><td><input type=\"text\" id=\"form_country\"></input></td></tr>";
$html_flds .= "<tr><td>notes</td><td><input type=\"text\" id=\"form_notes\"></input></td></tr>";
$html_flds .= "<tr><td>tel</td><td><input type=\"tel\" id=\"form_phn\"></input></td></tr>";
$html_flds .= "<tr><td>email</td><td><input type=\"email\" id=\"form_email\"></input></td></tr>";
$html_flds .= "<tr><td>url</td><td><input type=\"url\" id=\"form_url\"></input></td></tr>";
$html_flds .= "<tr><td>file</td><td><input type=\"text\" id=\"form_file\"></input></td></tr>";
$html_flds .= "<tr><td>checkbox</td><td><input type=\"text\" id=\"form_checkbox\"></input></td></tr>";
$html_flds .= "<tr><td>date</td><td><input type=\"text\" id=\"form_date\"></input></td></tr>";
$html_flds .= "<tr><td>radio</td><td><input type=\"text\" id=\"form_radio\"></input></td></tr>";
$html_flds .= "<tr><td>number</td><td><input type=\"text\" id=\"form_number\"></input></td></tr>";
$html_flds .= "<tr><td>image</td><td><input type=\"text\" id=\"form_image\"></input></td></tr>";
$html_flds .= "<tr><td>date</td><td><input type=\"text\" id=\"form_date\"></input></td></tr>";
$html_flds .= "<tr><td>month</td><td><input type=\"text\" id=\"form_month\"></input></td></tr>";
$html_flds .= "<tr><td>week</td><td><input type=\"text\" id=\"form_week\"></input></td></tr>";
$html_flds .= "<tr><td>submit</td><td><input type=\"submit\" id=\"form_submit\"></input></td></tr>";
$html_flds .= " </table>";
$html_flds .= "<hr color=black>";
# print( "BUGS_2960 html_flds=$html_flds" );
$html_kludge="";
$html_kludge .= "<hr color=blue>";
$html_kludge .= "<hr color=white>";
$html_kludge .= "<hr color=red>";
$html_kludge .= "<h1>form</h1>";
$html_kludge .= "<form method=\"post\" id=\"form_kolog\" action=\"ko.php?kolog=submit\">";
$html_kludge .= " <hr color=white>";
$html_kludge .= $html_select;
$html_kludge .= " <hr color=black>";
$html_kludge .= $html_flds;
$html_kludge .= " <hr color=white>";
$html_kludge .= " </form>";
$html_kludge .= "<hr color=red>";
$html_kludge .= "<hr color=white>";
$html_kludge .= "<hr color=blue>";
$html_kludge .= "<h1>BUGS_END</h1>";
$html_kludge .= "</body>";
$html_kludge .= "</html>";
# print( "BUGS_730 html_kludge=$html_kludge" );
$dttm=date('Ymd_His');
$html = "";
$html .= "<html>";
$html .= "<head>";
$html .= " <title>ko.php?kolog=submit $dttm</title>";
$html .= " </head>";
$html .= "<body bgcolor=linen>";
// $html .= "<h1>BUGS_1201</h1>";
$html .= "<a href=ko.php?kolog target=_blank><img src=/imgs/btn/koeye.png height=50></a>";
$html .= "<hr color=goldenrod>";
$html .= "<form method=\"post\" id=\"form_kologs\" action=\"ko.php?kolog=submit\">";
$html .= $html_select;
// $html .= $html_flds;
$html .= $html_form;
$html .= "<input type=\"submit\">";
$html .= " </form>";
// $html .= "<h1>BUGS_1202</h1>";
$html .= " </body>";
$html .= " </html>";
// print($html);
// print( "<form method=\"post\" id=\"form_kologs\" action=\"ko.php?kolog=submit\">");
// print( $html_select );
// print( $html_flds );
// print( " </form>" );
return($html);
}
function kolog_list() {
$db3file="ko.db3";
$htmout=""; $j=0;$k=0;
print( "<h1>kolog LIST $db3file</h1>" );
$html_acts="";
$html_locs="";
$html_whos="";
$acts="";
$locs="";
$whos="";
if( isset($_REQUEST['acts'])) { $acts=$_REQUEST['acts']; }
if( isset($_REQUEST['locs'])) { $locs=$_REQUEST['locs']; }
if( isset($_REQUEST['whos'])) { $whos=$_REQUEST['whos']; }
# print( "BUGS_300 acts=$acts<br>");
# print( "BUGS_300 locs=$locs<br>");
# print( "BUGS_300 whos=$whos<br>");
$types="acts locs whos";
foreach( explode(" ", $types) as $type ) {
if( preg_match("/acts/", $type, $matches )) { $tblname=$type; $lists=$acts; }
if( preg_match("/locs/", $type, $matches )) { $tblname=$type; $lists=$locs; }
if( preg_match("/whos/", $type, $matches )) { $tblname=$type; $lists=$whos; }
# jjjjjjjjjjjjjjjjjjjjjjj
# $sql="select * from $tblname where fbid='$select'";
$sql="select * from $tblname";
# print( "BUGS_300 type=$type sql=$sql<br>" );
$fbid="";
$grp="";
$media="";
$tn="";
$link="";
$credit="";
$caption="";
$desc="";
$html = "";
$html .= "<table id=table_$type>";
$html .= "<tr>";
$html .= "<td width=200>img</td>";
$html .= "<td>   </td>";
$html .= "<td>id</td>";
$html .= "<td>   </td>";
$html .= "<td>grp</td>";
$html .= "<td>   </td>";
$html .= "<td>type</td>";
$html .= "<td>   </td>";
$html .= "<td>amt</td>";
$html .= "<td>   </td>";
$html .= "<td>caption</td>";
$html .= "<td>   </td>";
$html .= "<td>text</td>";
$html .= "<td>   </td>";
$html .= "<td>desc</td>";
$html .= "</tr>";
# print( "BUGS_301 html=$html" );
$pdo = newpdo($db3file);
foreach( $pdo->query($sql) as $row ) {
$j=$j+1;
$fbid=$row['fbid'];
$grp=$row['grp'];
$media=$row['media'];
$tn=$row['tn'];
$link=$row['link'];
$credit=$row['credit'];
$caption=$row['caption'];
$text=$row['text'];
$desc=$row['desc'];
$html .= "<tr>";
$html .= "<td width=200>";
$html .= "<a href=".$media." target=_blank>";
$html .= " <img src=".$tn." height=50 >";
$html .= " </a>";
$html .= " </td>";
$html .= "<td>     </td>";
$html .= "<td>$fbid</td>";
$html .= "<td>     </td>";
$html .= "<td>$grp</td>";
$html .= "<td>     </td>";
$html .= "<td>$type</td>";
$html .= "<td>     </td>";
$html .= "<td>\$$credit</td>";
$html .= "<td>     </td>";
$html .= "<td>$caption</td>";
$html .= "<td>     </td>";
$html .= "<td>$text</td>";
$html .= "<td>     </td>";
$html .= "<td>$desc</td>";
$html .= "</tr>";
}
$html .= " </table>";
print( "BUGS_2860 type=$type html=$html" );
if( preg_match("/acts/", $type, $matches )) { $html_acts=$html; }
if( preg_match("/locs/", $type, $matches )) { $html_locs=$html; }
if( preg_match("/whos/", $type, $matches )) { $html_whos=$html; }
}
$html .= "<h1>kolog $dttm</h2>";
$html .= "<h2>acts</h2>";
$html .= $html_acts;
$html .= "<h2>locs</h2>";
$html .= $html_locs;
$html .= "<h2>whos</h2>";
$html .= $html_whos;
return($htmout);
}
// kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
function bookmarkusb_form() {
$htmout=""; $j=0;$k=0;
print( "<h1>BOOKMARKUSB_FORM</h1>" );
# foreach($_REQUEST as $key=>$value) { $j=$j+1; }
$books="";
$marks="";
$usbs="";
$select_books=array();
$select_marks=array();
$select_usbs=array();
$html_books="";
$html_marks="";
$html_usbs="";
$html_select_books="";
$html_select_marks="";
$html_select_usbs="";
$db3file="ko.db3";
$tblname="orders";
$sql="";
$selects=array();
$select="";
$fbid="";
$desc="";
$media="";
if( isset($_REQUEST['books'])) { $books=$_REQUEST['books']; }
if( isset($_REQUEST['marks'])) { $marks=$_REQUEST['marks']; }
if( isset($_REQUEST['usbs'])) { $usbs=$_REQUEST['usbs']; }
if( isset($_REQUEST['select_books'])) { $select_books=$_REQUEST['select_books']; }
if( isset($_REQUEST['select_marks'])) { $select_marks=$_REQUEST['select_marks']; }
if( isset($_REQUEST['select_usbs'])) { $select_usbs=$_REQUEST['select_usbs']; }
# print( "BUGS_101 db3file=$db3file<br>");
# print( "BUGS_102b books=$books<br>");
# print( "BUGS_102m marks=$marks<br>");
# print( "BUGS_102u usbs=$usbs<br>");
# print( "BUGS_103b select_books=$select_books<br>");
# print( "BUGS_103m select_marks=$select_marks<br>");
# print( "BUGS_103u select_usbs=$select_usbs<br>");
$books_amt=0;
$marks_amt=0;
$usbs_amt=0;
$bookmarkusb_amt=0;
$types="books marks usbs";
foreach(explode(" ",$types) as $type) {
$j=0;
if( preg_match("/books/", $type, $matchs )) {
$tblname=$type;
$list=$books;
$select=$select_books;
# print( "BUGS_101 BOOKS type=$type tblname=$tblname<br>");
}
if( preg_match("/marks/", $type, $matchs )) {
$tblname=$type;
$list=$marks;
$select=$select_marks;
# print( "BUGS_102 MARKS type=$type tblname=$tblname<br>");
}
if( preg_match("/usbs/", $type, $matchs )) {
$tblname=$type;
$list=$usbs;
$select=$select_usbs;
# print( "BUGS_103 USBS type=$type tblname=$tblname<br>");
}
# phpinfo();
# print( "BUGS_200 db3file=$db3file tblname=$tblname j=$j selects=$selects fbid=$fbid desc=$desc media=$media<br>" );
$sql="select * from $tblname";
if( is_array($select)) {
$select=implode(" ",$select);
}
$sql="select * from $tblname where fbid='$select'";
# $sql="select * from $tblname where fbid='".implode(" ",$select)."'";
# print( "BUGS_201 select=$select sql=$sql<br>" );
$pdo = newpdo($db3file);
foreach( $pdo->query($sql) as $row ) {
$j=$j+1;
$fbid="";
$grp="";
$media="";
$tn="";
$link="";
$credit="";
$caption="";
$text;
$desc="";
$fbid=$row['fbid'];
$grp=$row['grp'];
$media=$row['media'];
$tn=$row['tn'];
$link=$row['link'];
$credit=$row['credit'];
$amt=$credit;
$caption=$row['caption'];
$text=$row['text'];
$desc=$row['desc'];
if( preg_match( "/books/", $type, $matches )) {
$books_amt=$books_amt+$amt;
}
if( preg_match( "/marks/", $type, $matches )) {
$marks_amt=$marks_amt+$amt;
}
if( preg_match( "/usbs/", $type, $matches )) {
$usbs_amt=$usbs_amt+$amt;
}
// print( "BUGS_250 MATCH j=$j grp=$grp type=$type select=$select sql=$sql fbid=$fbid<br>");
$html_tbl = "";
$html_tbl .= "<table id=table_select_$fbid>";
$html_tbl .= "<tr>";
$html_tbl .= "<td width=200>img</td>";
$html_tbl .= "<td>   </td>";
$html_tbl .= "<td>id</td>";
$html_tbl .= "<td>   </td>";
$html_tbl .= "<td>grp</td>";
$html_tbl .= "<td>   </td>";
$html_tbl .= "<td>type</td>";
$html_tbl .= "<td>   </td>";
$html_tbl .= "<td>amt</td>";
$html_tbl .= "<td>   </td>";
$html_tbl .= "<td>caption</td>";
$html_tbl .= "<td>   </td>";
$html_tbl .= "<td>text</td>";
$html_tbl .= "<td>   </td>";
$html_tbl .= "<td>desc</td>";
$html_tbl .= "</tr>";
$html_tbl .= "<tr>";
$html_tbl .= "<td width=200>";
$html_tbl .= "<a href=".$media." target=_blank>";
$html_tbl .= " <img src=".$tn." height=50 >";
$html_tbl .= " </a>";
$html_tbl .= " </td>";
$html_tbl .= "<td>     </td>";
$html_tbl .= "<td>$fbid</td>";
$html_tbl .= "<td>     </td>";
$html_tbl .= "<td>$grp</td>";
$html_tbl .= "<td>     </td>";
$html_tbl .= "<td>$type</td>";
$html_tbl .= "<td>     </td>";
$html_tbl .= "<td>\$$credit</td>";
$html_tbl .= "<td>     </td>";
$html_tbl .= "<td>$caption</td>";
$html_tbl .= "<td>     </td>";
$html_tbl .= "<td>$text</td>";
$html_tbl .= "<td>     </td>";
$html_tbl .= "<td>$desc</td>";
$html_tbl .= "</tr>";
$html_tbl .= " </table>";
$html = $html_tbl;
if( preg_match("/books/", $type, $matches )) {
$html_select_books .= $html;
}
if( preg_match("/marks/", $type, $matches )) {
$html_select_marks .= $html;
}
if( preg_match("/usbs/", $type, $matches )) {
$html_select_usbs .= $html;
}
$progid="ko";
$dttm=date('Ymd_His');
$remote_addr="";
$remote_port="";
$referer="";
$http_user_agent="";
$query_string="";
if( isset( $_SERVER['REMOTE_ADDR'])) {
$remote_addr=$_SERVER['REMOTE_ADDR'];
$remote_addr=str_replace(".","-",$remote_addr);
}
if( isset( $_SERVER['HTTP_USER_AGENT'])) {
$http_user_agent=$_SERVER['HTTP_USER_AGENT'];
$http_user_agent=str_replace(" ","",$http_user_agent );
$http_user_agent=str_replace(".","",$http_user_agent );
$http_user_agent=str_replace(";","",$http_user_agent );
$http_user_agent=str_replace(":","",$http_user_agent );
$http_user_agent=str_replace("/","",$http_user_agent );
$http_user_agent=str_replace("\n","",$http_user_agent );
$http_user_agent=str_replace("(","",$http_user_agent );
$http_user_agent=str_replace(")","",$http_user_agent );
}
if( isset( $_SERVER['REMOTE_PORT'])) { $remote_port=$_SERVER['REMOTE_PORT']; }
if( isset( $_SERVER['REFERER'])) { $referer=$_SERVER['REFERER']; }
if( isset( $_SERVER['QUERY_STRING'])) {
$query_string=$_SERVER['QUERY_STRING'];
$query_string=str_replace("%27","",$query_string);
}
$progid="ko";
$krow="ko";
$grp=$type;
$pathfile=$media;
$db3file="ko.db3";
$tblname="orders";
# $pdo = newpdo($db3file);
foreach( $pdo->query($sql) as $row ) {
$j=$j+1;
$fbid=$row['fbid'];
$grp=$row['grp'];
$media=$row['media'];
$tn=$row['tn'];
$link=$row['link'];
$credit=$row['credit']; $amt=$credit;
$caption=$row['caption'];
$text=$row['text'];
$desc=$row['desc'];
$sql = "";
$sql .= "insert or replace into $tblname (";
$sql .= "'progid',";
$sql .= "'krow',";
$sql .= "'dttm',";
$sql .= "'remote_addr',";
$sql .= "'remote_port',";
$sql .= "'referer',";
$sql .= "'user_agent',";
$sql .= "'query_string',";
$sql .= "'pathfile',";
$sql .= "'fbid',";
$sql .= "'grp',";
$sql .= "'media',";
$sql .= "'tn',";
$sql .= "'link',";
$sql .= "'credit',";
$sql .= "'caption',";
$sql .= "'text',";
$sql .= "'desc'";
$sql .= " ) values ( ";
$sql .= "'$progid',";
$sql .= "'$krow',";
$sql .= "'$dttm',";
$sql .= "'$remote_addr',";
$sql .= "'$remote_port',";
$sql .= "'$referer',";
$sql .= "'$http_user_agent',";
$sql .= "'$query_string',";
$sql .= "'$pathfile',";
$sql .= "'$fbid',";
$sql .= "'$grp',";
$sql .= "'$media',";
$sql .= "'$tn',";
$sql .= "'$link',";
$sql .= "'$credit',";
$sql .= "'$caption',";
$sql .= "'$text',";
$sql .= "'$desc'";
$sql .= " ) ";
# print( "BUGS_3150 sql=$sql<br>" );
$pdo->exec($sql);
}
# print( "BUGS_3270 type=$type tblname=$tblname j=$j select=$select fbid=$fbid desc=$desc media=$media<br>" );
}
$pdo = null;
# print( "BUGS_3300 type=$type tblname=$tblname j=$j select=$select fbid=$fbid desc=$desc media=$media<br>" );
}
$dttm=date('Ymd_His');
$html="";
$html .= "<html>";
$html .= "<head>";
$html .= " <title>/ko.php $dttm</title>";
$html .= " <script id=script_hideshow>";
$html .= " function script_hideshow(args) {";
$html .= " divid=args;";
$html .= " alert( \"BUGS_123 script_hideshow args=\"+args );";
$html .= " if( document.getElementByID(divid)) { ";
$html .= " if( document.getElementByID(divid).style.display == \"inline\") { ";
$html .= " document.getElementById(divid).style.display = \"none\"; ";
$html .= " }";
$html .= " else {";
$html .= " document.getElementById(divid).style.display = \"none\"; ";
$html .= " }";
$html .= " }";
$html .= " return(htmout);";
$html .= " }";
$html .= " </script>";
$html .= " </head>";
$html .= "<body bgcolor=linen>";
$html .= "<hr color=goldenrod>";
$html .= "<img src=ko.png onclick=\"script_hideshow('div_head'); return false;\" height=50><br>";
$html .= "<hr color=goldenrod>";
$html .= "<div id=div_head>";
$html .= " <h1>div_head</h1>";
$html .= " </div>";
$html .= "<br>";
$html .= "<hr bgcolor=goldenrod>";
$html .= "<h1>bookmarkusb: selects</h1>";
$html .= "<h2>select_books</h2>";
$html .= $html_select_books;
$html .= "books_amt=$books_amt<br>";
$html .= "<h2>select_marks</h2>";
$html .= $html_select_marks;
$html .= "books_amt=$marks_amt<br>";
$html .= "<h2>select_usbs</h2>";
$html .= $html_select_usbs;
$html .= "usbs_amt=$usbs_amt<br>";
$html .= "<hr color=goldenrod>";
$bookmarkusb_amt=0;
$bookmarkusb_amt=$bookmarkusb_amt+$books_amt;
$bookmarkusb_amt=$bookmarkusb_amt+$marks_amt;
$bookmarkusb_amt=$bookmarkusb_amt+$usbs_amt;
$html .= "bookmarkusb_amt=$bookmarkusb_amt<br>";
print( $html );
return($htmout);
}
function bookmarkusb_select() {
$db3file="ko.db3";
$htmout=""; $j=0;$k=0;
$dttm=date('Ymd_His');
print("<hr color=black>");
print("<hr color=white>");
print("<a href=/ target=_blank ><img src=ko.png height=10></a>");
print("<hr color=white>");
print("<hr color=black>");
print( "<h1>BOOKMARKUSB_SELECT $dttm</h1>" );
print("<h2>$dttm</h2>" );
$html_select_books="";
$html_select_marks="";
$html_select_usbs="";
$books="";
$marks="";
$usbs="";
if( isset($_REQUEST['books'])) { $books=$_REQUEST['books']; }
if( isset($_REQUEST['marks'])) { $marks=$_REQUEST['marks']; }
if( isset($_REQUEST['usbs'])) { $usbs=$_REQUEST['usbs']; }
# print( "BUGS_300 books=$books<br>");
# print( "BUGS_300 marks=$marks<br>");
# print( "BUGS_300 usbs=$usbs<br>");
$html = "";
$html .= "<html>";
$html .= " <head>";
$html .= " <title>ko.php?id=bookmarkusb_form 20211024_1230</title>";
$html .= " </head>";
$html .= "<body bgcolor=linen >";
$html .= "<hr color=red>";
$html .= "<hr color=white>";
$html .= "<hr color=blue>";
# $html .= "<form method=\"post\" id=form_bookmarkusb action=\"ko.php?id=bookmarkusb_form\" >";
# $html .= "<form method=\"post\" id=form_bookmarkusb action=\"ko_selects.php\" >";
$types="books marks usbs";
foreach( explode(" ", $types) as $type ) {
# $html .= "<select class=\"select\" id=select_$type name=select_$type multiple size=\"20\" >";
$tblname=$type;
# if( preg_match("/books/", $type, $matches )) { $tblname=$type; $lists=$books; }
# if( preg_match("/marks/", $type, $matches )) { $tblname=$type; $lists=$marks; }
# if( preg_match("/usbs/", $type, $matches )) { $tblname=$type; $lists=$usbs; }
# jjjjjjjjjjjjjjjjjjjjjjj
# $sql="select * from $tblname where fbid='$select'";
$sql="select * from $tblname";
# print( "BUGS_300 type=$type sql=$sql<br>" );
$fbid="";
$grp="";
$media="";
$tn="";
$link="";
$credit="";
$caption="";
$desc="";
# $html .= "<table id=table_$type>";
# $html .= "<tr>";
# $html .= "<td width=200>img</td>";
# $html .= "<td>   </td>";
# $html .= "<td>id</td>";
# $html .= "<td>   </td>";
# $html .= "<td>grp</td>";
# $html .= "<td>   </td>";
# $html .= "<td>type</td>";
# $html .= "<td>   </td>";
# $html .= "<td>amt</td>";
# $html .= "<td>   </td>";
# $html .= "<td>caption</td>";
# $html .= "<td>   </td>";
# $html .= "<td>text</td>";
# $html .= "<td>   </td>";
# $html .= "<td>desc</td>";
# $html .= "</tr>";
#
#
$html_select = "";
# $html_select .= "<select id=select_$type multiple size=25 >";
if( preg_match("/books/", $type, $matches )) {
$html_select_books = "";
$html_select_books .= "<select id=select_$type multiple size=25 >";
}
if( preg_match("/marks/", $type, $matches )) {
$html_select_marks = "";
$html_select_marks .= "<select id=select_$type multiple size=25 >";
}
if( preg_match("/usbs/", $type, $matches )) {
$html_select_usbs = "";
$html_select_usbs .= "<select id=select_$type multiple size=25 >";
}
# print( "BUGS_301 html=$html" );
$pdo = newpdo($db3file);
foreach( $pdo->query($sql) as $row ) {
$j=$j+1;
$fbid=$row['fbid'];
$grp=$row['grp'];
$media=$row['media'];
$tn=$row['tn'];
$link=$row['link'];
$credit=$row['credit'];
$caption=$row['caption'];
$text=$row['text'];
$desc=$row['desc'];
# print( "BUGS_601 j=$j fbid=$fbid credit=$credit desc=$desc<br>" );
# print( "BUGS_602 j=$j fbid=$fbid html_select=<hr>$html_select<hr>" );
$html_select="";
$html_select .= "<option ";
$html_select .= " id=\"select_$type\" ";
$html_select .= " name=\"select_$type\" ";
$html_select .= ">";
$html_select .= "$j ";
$html_select .= "$grp ";
$html_select .= "$fbid ";
$html_select .= "$credit ";
$html_select .= "$caption ";
$html_select .= "$text ";
$html_select .= "$desc ";
$html_select .= " </option>";
$html_select .= "<br>";
# print( "BUGS_610 html_select=$html_select<br>" );
if( preg_match("/books/", $type, $matches )) {
$html_select_books .= $html_select;
# $html_select_books .= " </select>";
# printf( "BUGS_611 $j $fbid html_select_books=$html_select_books" );
}
if( preg_match("/marks/", $type, $matches )) {
$html_select_marks .= $html_select;
# $html_select_marks .= " </select>";
# printf( "BUGS_502 html_select_marks=$html_select_marks" );
}
if( preg_match("/usbs/", $type, $matches )) {
$html_select_usbs .= $html_select;
# $html_select_usbs .= " </select>";
# printf( "BUGS_503 html_select_usbs=$html_select_usbs" );
}
}
if( preg_match("/books/", $type, $matches )) { $html_select_books .= " </select>";
# print( "BUGS_631 html_select_books=$html_select_books<br>");
}
if( preg_match("/marks/", $type, $matches )) { $html_select_marks .= " </select>";
# print( "BUGS_632 html_select_marks=$html_select_marks<br>");
}
if( preg_match("/usbs/", $type, $matches )) { $html_select_usbs .= " </select>";
# print( "BUGS_633html_select_usbs=$html_select_usbs<br>");
}
# print( "BUGS_650 type=$type html=$html" );
# kkkkkkkkkkkkkkkkkkkkkkk
}
$html_select="";
$html_select .= "<hr color=goldenrod>";
$html_select .= "<hr color=black>";
$html_select .= "<table id=table_select>";
$html_select .= "<tr><td>books</td><td width=10>   </td><td>marks</td><td>   </td><td>usbs</td></tr>";
$html_select .= "<tr><td>books</td><td width=10>   </td><td>marks</td><td>   </td><td>usbs</td></tr>";
$html_select .= "<tr>";
$html_select .= " <td>";
$html_select .= $html_select_books;
$html_select .= " </td>";
$html_select .= " <td width=20>   </td>";
$html_select .= " <td>";
$html_select .= $html_select_marks;
$html_select .= " </td>";
$html_select .= " <td width=20>   </td>";
$html_select .= " <td>";
$html_select .= $html_select_usbs;
$html_select .= " </td>";
$html_select .= " </tr>";
$html_select .= " </table>";
$html_select .= "<hr color=black>";
$html_select .= "<hr color=goldenrod>";
# $html_select .= "BUGS_3750<br>";
# print( "BUGS_3661 html_select=$html_select<br>");
# print( "BUGS_3662 html_select_books=$html_select_books<br>");
# print( "BUGS_3663 html_select_marks=$html_select_marks<br>");
# print( "BUGS_3664 html_select_usbs=$html_select_usbs<br>");
# print( $html );
$html_flds = "";
$html_flds .= "<table id=table_flds>";
$html_flds .= "<tr><td></td><td><input type=\"hidden\" id=\"books\" value=\"$books\" ></input></td></tr>";
$html_flds .= "<tr><td></td><td><input type=\"hidden\" id=\"marks\" value=\"$marks\" ></input></td></tr>";
$html_flds .= "<tr><td></td><td><input type=\"hidden\" id=\"usbs\" value=\"$usbs\" ></input></td></tr>";
$html_flds .= "<tr><td>fname</td><td><input type=\"text\" id=\"bmu_fname\"></input></td></tr>";
$html_flds .= "<tr><td>lname</td><td><input type=\"text\" id=\"bmu_lname\"></input></td></tr>";
$html_flds .= "<tr><td>addr</td><td><input type=\"text\" id=\"bmu_addr\"></input></td></tr>";
$html_flds .= "<tr><td>city</td><td><input type=\"text\" id=\"bmu_city\"></input></td></tr>";
$html_flds .= "<tr><td>zip</td><td><input type=\"text\" id=\"bmu_zip\"></input></td></tr>";
$html_flds .= "<tr><td>country</td><td><input type=\"text\" id=\"bmu_country\"></input></td></tr>";
$html_flds .= "<tr><td>notes</td><td><input type=\"text\" id=\"bmu_notes\"></input></td></tr>";
$html_flds .= "<tr><td>tel</td><td><input type=\"tel\" id=\"bmu_phn\"></input></td></tr>";
$html_flds .= "<tr><td>email</td><td><input type=\"email\" id=\"bmu_email\"></input></td></tr>";
$html_flds .= "<tr><td>url</td><td><input type=\"url\" id=\"bmu_url\"></input></td></tr>";
$html_flds .= "<tr><td>file</td><td><input type=\"text\" id=\"bmu_file\"></input></td></tr>";
$html_flds .= "<tr><td>checkbox</td><td><input type=\"text\" id=\"bmu_checkbox\"></input></td></tr>";
$html_flds .= "<tr><td>date</td><td><input type=\"text\" id=\"bmu_date\"></input></td></tr>";
$html_flds .= "<tr><td>radio</td><td><input type=\"text\" id=\"bmu_radio\"></input></td></tr>";
$html_flds .= "<tr><td>number</td><td><input type=\"text\" id=\"bmu_number\"></input></td></tr>";
$html_flds .= "<tr><td>image</td><td><input type=\"text\" id=\"bmu_image\"></input></td></tr>";
$html_flds .= "<tr><td>date</td><td><input type=\"text\" id=\"bmu_date\"></input></td></tr>";
$html_flds .= "<tr><td>month</td><td><input type=\"text\" id=\"bmu_month\"></input></td></tr>";
$html_flds .= "<tr><td>week</td><td><input type=\"text\" id=\"bmu_week\"></input></td></tr>";
$html_flds .= "<tr><td>submit</td><td><input type=\"submit\" id=\"bmu_submit\"></input></td></tr>";
$html_flds .= " </table>";
$html_flds .= "<hr color=black>";
# print( "BUGS_710 html_flds=$html_flds" );
$html_kludge="";
$html_kludge .= "<hr color=blue>";
$html_kludge .= "<hr color=white>";
$html_kludge .= "<hr color=red>";
$html_kludge .= "<h1>form</h1>";
$html_kludge .= "<form method=\"post\" id=\"form_bookmarkusb\" action=\"ko.php?id=bookmarkusb_form\">";
$html_kludge .= " <hr color=white>";
$html_kludge .= $html_select;
$html_kludge .= " <hr color=black>";
$html_kludge .= $html_flds;
$html_kludge .= " <hr color=white>";
$html_kludge .= " </form>";
$html_kludge .= "<hr color=red>";
$html_kludge .= "<hr color=white>";
$html_kludge .= "<hr color=blue>";
$html_kludge .= "<h1>BUGS_END</h1>";
$html_kludge .= "</body>";
$html_kludge .= "</html>";
# print( "BUGS_730 html_kludge=$html_kludge" );
$html = "";
$html .= "<html>";
$html .= "<head>";
$html .= " <title>ko.php 20211024_2000</title>";
$html .= " </head>";
$html .= "<body bgcolor=linen>";
$html .= "<form method=\"post\" id=\"form_bookmarkusb\" action=\"ko.php?id=bookmarkusb_form\">";
$html .= $html_select;
$html .= $html_flds;
$html .= " </form>";
$html .= " </body>";
$html .= " </html>";
print($html);
# print( $html_select );
# print( $html_flds );
return($html);
}
function bookmarkusb_list() {
$db3file="ko.db3";
$htmout=""; $j=0;$k=0;
print( "<h1>BOOKMARKUSB_LIST $db3file</h1>" );
$html_books="";
$html_marks="";
$html_usbs="";
$books="";
$marks="";
$usbs="";
if( isset($_REQUEST['books'])) { $books=$_REQUEST['books']; }
if( isset($_REQUEST['marks'])) { $marks=$_REQUEST['marks']; }
if( isset($_REQUEST['usbs'])) { $usbs=$_REQUEST['usbs']; }
# print( "BUGS_300 books=$books<br>");
# print( "BUGS_300 marks=$marks<br>");
# print( "BUGS_300 usbs=$usbs<br>");
$types="books marks usbs";
foreach( explode(" ", $types) as $type ) {
if( preg_match("/books/", $type, $matches )) { $tblname=$type; $lists=$books; }
if( preg_match("/marks/", $type, $matches )) { $tblname=$type; $lists=$marks; }
if( preg_match("/usbs/", $type, $matches )) { $tblname=$type; $lists=$usbs; }
# jjjjjjjjjjjjjjjjjjjjjjj
# $sql="select * from $tblname where fbid='$select'";
$sql="select * from $tblname";
# print( "BUGS_300 type=$type sql=$sql<br>" );
$fbid="";
$grp="";
$media="";
$tn="";
$link="";
$credit="";
$caption="";
$desc="";
$html = "";
$html .= "<table id=table_$type>";
$html .= "<tr>";
$html .= "<td width=200>img</td>";
$html .= "<td>   </td>";
$html .= "<td>id</td>";
$html .= "<td>   </td>";
$html .= "<td>grp</td>";
$html .= "<td>   </td>";
$html .= "<td>type</td>";
$html .= "<td>   </td>";
$html .= "<td>amt</td>";
$html .= "<td>   </td>";
$html .= "<td>caption</td>";
$html .= "<td>   </td>";
$html .= "<td>text</td>";
$html .= "<td>   </td>";
$html .= "<td>desc</td>";
$html .= "</tr>";
# print( "BUGS_301 html=$html" );
$pdo = newpdo($db3file);
foreach( $pdo->query($sql) as $row ) {
$j=$j+1;
$fbid=$row['fbid'];
$grp=$row['grp'];
$media=$row['media'];
$tn=$row['tn'];
$link=$row['link'];
$credit=$row['credit'];
$caption=$row['caption'];
$text=$row['text'];
$desc=$row['desc'];
$html .= "<tr>";
$html .= "<td width=200>";
$html .= "<a href=".$media." target=_blank>";
$html .= " <img src=".$tn." height=50 >";
$html .= " </a>";
$html .= " </td>";
$html .= "<td>     </td>";
$html .= "<td>$fbid</td>";
$html .= "<td>     </td>";
$html .= "<td>$grp</td>";
$html .= "<td>     </td>";
$html .= "<td>$type</td>";
$html .= "<td>     </td>";
$html .= "<td>\$$credit</td>";
$html .= "<td>     </td>";
$html .= "<td>$caption</td>";
$html .= "<td>     </td>";
$html .= "<td>$text</td>";
$html .= "<td>     </td>";
$html .= "<td>$desc</td>";
$html .= "</tr>";
}
$html .= " </table>";
print( "BUGS_3603 type=$type html=$html" );
# kkkkkkkkkkkkkkkkkkkkkkk
if( preg_match("/books/", $type, $matches )) { $html_books=$html; }
if( preg_match("/marks/", $type, $matches )) { $html_marks=$html; }
if( preg_match("/usbs/", $type, $matches )) { $html_usbs=$html; }
}
$html .= "<h1>bookmarkusb</h2>";
$html .= "<h2>books</h2>";
$html .= $html_books;
$html .= "<h2>marks</h2>";
$html .= $html_marks;
$html .= "<h2>usbs</h2>";
$html .= $html_usbs;
return($htmout);
}
function bookmarkusb() {
# $select_books=array();
# $select_marks=array();
# $select_usbs=array();
$select_books="x2,b_1";
$select_marks="m2,m_1";
$select_usbs="u2,u_1";
$books="";
$marks="";
$usbs="";
# print( "BUGS_100 bookmarkusb <br>" );
# print( "BUGS_111 select_books=$select_books[0]<br>" );
# print( "BUGS_112 select_marks=$select_marks[0]<br>" );
# print( "BUGS_113 select_usbs=$select_usbs[0]<br>" );
# print( "BUGS_121 books=$books<br>" );
# print( "BUGS_122 marks=$marks<br>" );
# print( "BUGS_123 usbs=$usbs<br>" );
$htmout="";
$htmout.="<html>";
$htmout.="<body bgcolor=linen>";
$books="";
$marks="";
$usbs="";
$select_books = array();
$select_marks = array();
$select_usbs = array();;
# print_r($_REQUEST);
# print_r($_REQUEST['select_books']);
# print_r($_REQUEST['select_marks']);
# print_r($_REQUEST['select_usbs']);
if( isset($_REQUEST['select_books'])) {
$select_books=$_REQUEST['select_books'];
# if(empty($select_books)) {
# print( "BUGS_11 EMPTY select_books=$select_books");
# }
# else {
# print( "BUGS_12 REQUEST select_books=$select_books");
# }
}
if( isset($_REQUEST['select_marks'])) {
$select_marks=$_REQUEST['select_marks'];
# if(empty($select_marks)) {
# print( "BUGS_21 EMPTY select_marks select_marks=$select_marks");
# }
# else {
# print( "BUGS_22 REQUEST REQUEST select_marks=$select_marks");
# }
}
if( isset($_REQUEST['select_usbs'])) {
$select_usbs=$_REQUEST['select_usbs'];
# if(empty($select_usbs)) {
# print( "BUGS_31 EMPTY select_usbs=$select_usbs");
# }
# else {
# print( "BUGS_32 REQUEST select_usbs=$select_usbs");
# }
}
if( isset($_REQUEST['select_books'])) {
print( "select_books=".$_REQUEST['select_books']."<br>" );
}
if( isset($_REQUEST['select_marks'])) {
print( "select_marks=".$_REQUEST['select_marks']."<br>" );
}
if( isset($_REQUEST['select_usbs'])) {
print( "select_usbs=".$_REQUEST['select_usbs']."<br>" );
}
if( isset($_REQUEST['books'])) {
# print( "select_books=".$_REQUEST['books']."<br>" );
}
if( isset($_REQUEST['marks'])) {
# print( "select_marks=".$_REQUEST['marks']."<br>" );
}
if( isset($_REQUEST['usbs'])) {
# print( "select_usbs=".$_REQUEST['usbs']."<br>" );
}
#print( "BUGS_31=".$_REQUEST['select_books'][0] );
# print( "BUGS_32=".$_REQUEST['select_marks'][0] );
# print( "BUGS_33=".$_REQUEST['select_usbs'][0] );
# $books=array();
# $marks=array();
# $usbs=array();
if( isset($_REQUEST['select_books'])) {
$books=$_REQUEST['select_books'];
}
if( isset($_REQUEST['select_marks'])) {
$marks=$_REQUEST['select_marks'];
}
if( isset($_REQUEST['select_usbs'])) {
$usbs=$_REQUEST['select_usbs'];
}
if( isset($_REQUEST['books'])) {
$books=$_REQUEST['books'];
# print( "BUGS_41 ISSET books=$books<br>");
# print( "BUGS_42 ISSET request_books="+$_REQUEST['books']+"<br>");
# print_r($_REQUEST['books']);
}
if( isset($_REQUEST['marks'])) {
$marks=$_REQUEST['marks'];
# print( "BUGS_51 ISSET marks=$marks<br>");
# print( "BUGS_52 ISSET request_marks="+$_REQUEST['marks']+"<br>" );
# print_r($_REQUEST['marks']);
}
if( isset($_REQUEST['usbs'])) {
$usbs=$_REQUEST['usbs'];
# print( "BUGS_61 ISSET usbs=$usbs<br>");
# print( "BUGS_62 ISSET request_usbs="+$_REQUEST['usbs']+"<br>" );
# print_r($_REQUEST['usbs']);
}
$email="email";
$phn="phn";
$fname="fname";
$lname="lname";
$addr="addr";
$city="city";
$zip="zip";
$note="note";
if( isset($_REQUEST['email'])) { $email=$_REQUEST['email']; }
if( isset($_REQUEST['phn'])) { $phn=$_REQUEST['phn']; }
if( isset($_REQUEST['fname'])) { $fname=$_REQUEST['fname']; }
if( isset($_REQUEST['lname'])) { $lname=$_REQUEST['lname']; }
if( isset($_REQUEST['address'])) { $eessmail=$_REQUEST['eessmail']; }
if( isset($_REQUEST['city'])) { $city=$_REQUEST['city']; }
if( isset($_REQUEST['zip'])) { $zip=$_REQUEST['zip']; }
if( isset($_REQUEST['notes'])) { $notes=$_REQUEST['notes']; }
# $htmout .="<hr color=goldenrod>";
# $htmout .= "<h1>books</h1>";
# $htmout.="books=$books";
# $htmout .="<hr color=goldenrod>";
# $htmout .= "<h1>marks</h1>";
# $htmout.="marks=$marks";
# $htmout .="<hr color=goldenrod>";
# $htmout .= "<h1>usbs</h1>";
# $htmout.="usbs=$usbs";
$bigline="";
$progid="ko";
$dttm=date('y,m,d_H:i:s');
$remote_addr=$_SERVER['REMOTE_ADDR'];
$lines = $books;
# print( "BUGS_3900 lines=$lines<br>" );
$lines = explode("\n", $bigline );
for( $j=0; $j < count($lines); $j++ ) {
$line=$lines[$j];
# printf( "$progid $dttm MSG:_300: $j line=[$line] [$remote_addr]<br>\n" );
}
$htmout .="<hr color=goldenrod>";
$htmout .= "email=$email<br>";
$htmout .= "phn=$phn<br>";
$htmout .= "fname=$fname<br>";
$htmout .= "fname=$fname<br>";
$htmout .= "addr=$addr<br>";
$htmout .= "city=$city<br>";
$htmout .= "zip=$zip<br>";
$htmout .= "note=$note<br>";
$htmout.=" </body>";
$htmout.=" </html>";
# foreach ( $post_data as $key => $value) {
# $post_items[] = $key . '=' . $value;
# }
# $post_string = implode ('&', $post_items)
print("$htmout");
# phpinfo();
$htmout=bmu_sql("");
# print( "BUGS_300 htmout=$htmout" );
exit;
}
function bmu_sql($options) {
$id="b_0";
$db3file="ko.db3";
$tblname="bmu";
$fbid=$id;
$tblname="books";
$html_books="";
$html_marks="";
$html_usbs="";
$found_marks="";
$found_usbs="";
$found_book="";
$types="books marks usbs";
$select_books=array();
$select_marks=array();
$select_usbs=array();
$selects=array();
$html_books="";
$html_marks="";
$htm_usbs="";
foreach( explode(" ",$types) as $type ) {
# print( "BUGS_3840 type=$type<br>" );
if( $type == "books" ) {
$tblname="books";
$selects=$select_books;
}
if( $type == "marks" ) {
$tblname="marks";
$selects=$select_marks;
}
if( $type == "usbs" ) {
$tblname="usbs";
$selects=$select_usbs;
}
$sql = "select * from $tblname where fbid == '$fbid'";
$sql = "select * from $tblname";
# printf( "BUGS_320: sql=[$sql] [$db3file]<br>\n" );
$html="";
$html .= "<br>";
$html .= "<hr color=goldenrod>";
$html .= "<h1>$tblname</h1>";
$html .= "<table id=table_".$tblname." >";
$html .= "<tr>";
$html .= "<td>grp</td>";
$html .= "<td>media</td>";
$html .= "<td>tn</td>";
$html .= "<td>link</td>";
$html .= "<td>credit</td>";
$html .= "<td>caption</td>";
$html .= "<td>text</td>";
$html .= "<td>desc</td>";
$html .= "</tr>\n";
$j=0;
$remote_addr="";
$remote_port="";
$referer="";
$query_string="";
$user_agent="";
# phpinfo();
if( isset($_SERVER['REMOTE_ADDR'])) {
$remote_addr=$_SERVER['REMOTE_ADDR'];
str_replace(".","-",$remote_addr);
}
if( isset($_SERVER['REMOTE_PORT'])) { $remote_port=$_SERVER['REMOTE_PORT']; }
if( isset($_SERVER['REFERER'])) { $referer=$_SERVER['REFERER']; }
if( isset($_SERVER['QUERY_STRING'])) {
$query_string=$_SERVER['QUERY_STRING'];
str_replace("%27","",$query_string);
}
if( isset($_SERVER['HTTP_USER_AGENT'])) {
$user_agent=$_SERVER['HTTP_USER_AGENT'];
str_replace(" ","_",$user_agent );
str_replace(".","",$user_agent );
str_replace(";","",$user_agent );
str_replace(":","",$user_agent );
str_replace("/","",$user_agent );
str_replace("(","",$user_agent );
str_replace(")","",$user_agent );
}
$pdo = newpdo($db3file);
$sqls="";
foreach( $pdo->query($sql) as $row ) {
$j=$j+1;
# printf( "BUGS__3228: row=$row['fbid']<br>\n" );
$fbid=$row['fbid'];
$grp=$row['grp'];
$media=$row['media'];
$tn=$row['tn'];
$link=$row['link'];
$credit=$row['credit'];
$caption=$row['caption'];
$text=$row['text'];
$desc=$row['desc'];
$sql = "";
$tblname="orders";
$sql .= "insert or replace into $tblname ( ";
$sql .= "'remote_addr','remote_port', 'referer', 'query_string','user_agent',";
$sql .= "'fbid', 'grp', 'media', 'tn', 'link', 'credit', 'caption', 'text', 'desc'";
$sql .= ") values ( ";
$sql .= "'$remote_addr','$remote_port', '$referer', '$query_string','$user_agent',";
$sql .= "'$fbid', '$grp', '$media', '$tn', '$link', '$credit', '$caption', '$text', '$desc'";
$sql .= " );";
# print( "BUGS_3940 j=$j sql=$sql<br>\n" );
if( isset($_REQUEST['select_books'] )) { $select_books=$_REQUEST['select_books']; }
if( isset($_REQUEST['select_marks'] )) { $select_marks=$_REQUEST['select_marks']; }
if( isset($_REQUEST['select_usbs'] )) { $select_usbs=$_REQUEST['select_usbs']; }
# foreach( explode("\n",$select_books) as $select_book ) {
# if( $select_book == "$fbid" ) { $pdo->exec($sql); }
# }
# foreach( explode(" ",$select_marks) as $select_mark ) {
# if( $select_mark == "$fbid" ) { $pdo->exec($sql); }
# }
# foreach( $select_usbs as $select_usb ) {
# if( $select_usb == "$fbid" ) { $pdo->exec($sql); }
# }
# print( "BUGS_440 fbid=$fbid books=$select_books marks=$select_marks usbs=$select_usbs<br>");
if( $select_books == "$fbid" ) {
$found_book.="<a href=$media target=_blank class=\"popover\">";
$found_book.="<img src=$tn height=50>";
# $found_book.="<span><img src=$tn height=200></span>";
$found_book.=" </a><br>";
printf( "$found_book" );
# print( "MSG_441 FOUND_BOOK fbid=$fbid books=$select_books marks=$select_marks usbs=$select_usbs<br>");
$pdo->exec( $sql ); }
if( $select_marks == "$fbid" ) {
$found_marks.="<a href=$media target=_blank class=\"popover\">";
$found_marks.="<img src=$tn height=50>";
# $found_marks.="<span><img src=$tn height=200></span>";
$found_marks.=" </a><br>";
printf( "$found_marks" );
# print( "MSG_402: FOUND_MARK fbid=$fbid books=$select_books marks=$select_marks usbs=$select_usbs<br>");
$pdo->exec( $sql ); }
$selects=array('books','marks','usbs');
if( $type == "books" ) { $selects=array($select_books); }
if( $type == "marks" ) { $selects=array($select_marks); }
if( $type == "usbs" ) { $selects=array($select_usbs); }
$selects_books=array();
$selects_marks=array();
$selects_usbs=array();
if( isset($_REQUEST['selects_books'])) {
$selects_books=$_REQUEST['selects_books'];
}
if( isset($_REQUEST['selects_marks'])) {
$selects_marks=$_REQUEST['selects_marks'];
}
if( isset($_REQUEST['selects_usbs'])) {
$selects_usbs=$_REQUEST['selects_usbs'];
}
# phpinfo();
# print_r($selects_books);
# print_r($selects_marks);
# print_r($selects_usbs);
# print( "BUGS_481 selects_books=$selects_books<br>" );
# print( "BUGS_482 selects_marks=$selects_marks<br>" );
# print( "BUGS_483 selects_usbs=$selects_usbs<br>" );
# foreach( $selects as $select ) {
# foreach( array('books','marks','usbs') as $select ) {
# print( "BUGS_500 type=$type select=$select<br>\n");
# }
if( $select_usbs == "$fbid" ) {
$found_usbs.="<a href=$media target=_blank class=\"popover\">";
$found_usbs.="<img src=$tn height=50>";
# $found_usbs.="<span><img src=$tn height=200></span>";
$found_usbs.=" </a><br>";
printf( "$found_usbs" );
# print( "MSG_403: FOUND_USB fbid=$fbid books=$select_books marks=$select_marks usbs=$select_usbs<br>");
$pdo->exec( $sql ); }
# print ( "BUGS_370 db3file=$db3file tblname=$tblname sql=$sql<br>" );
# print ( "BUGS_380 db3file=$db3file tblname=$tblname sql=$sql<br>" );
$fbid="";
$select_books="";
$select_marks="";
$select_usbs="";
$select_book="";
$select_mark="";
$select_usb="";
if( isset($_REQUEST['fbid'])) {$fbid=$_REQUEST['fbid'];}
if( isset($_REQUEST['select_books'])) {$select_books=$_REQUEST['select_books'];}
if( isset($_REQUEST['select_marks'])) {$select_marks=$_REQUEST['select_marks'];}
if( isset($_REQUEST['select_usbs'])) {$select_usbs=$_REQUEST['select_usbs'];}
if( $select_books == $fbid ) {
$html_books.="<a href=$media target=_blank ><img src=$tn height=50></a><br>";
}
if( $select_marks == $fbid ) {
$html_marks.="<a href=$media target=_blank ><img src=$tn height=50></a><br>";
}
if( $select_usbs == $fbid ) {
$html_usbs.="<a href=$media target=_blank ><img src=$tn height=50></a><br>";
}
$html .= "<tr>";
$html .= "<td>$grp</td>";
$html .= "<td><a href=$media class=\"popover\" target=_blank> <img src=$tn height=50>";
# $html .= "<span><img src=$tn height=200></span><a></td>";
$html .= "<td>tn</td>";
$html .= "<td>$link</td>";
$html .= "<td>$credit</td>";
$html .= "<td>$caption</td>";
$html .= "<td>$text</td>";
$html .= "<td>$desc</td>";
$html .= "</tr>\n";
}
$html .= "</table>\n";
$html .= "</div>\n";
}
$html_temp=$html;
$html = "";
$html .= "<br>";
$html .= "<hr color=goldenrod>";
$html .= "<div id=div_selects>";
$html .= " <h1>div_selects</h1>";
$html .= " <h2>books</h2>";
$html .= $select_book;
$html .= $html_books;
$html .= " <h2>marks</h2>";
$html .= $select_book;
$html .= $html_marks;
$html .= " <h2>usbs</h2>";
$html .= $select_book;
$html .= $html_usbs;
$html .= "<hr color=goldenrod>";
$html .= "<br>";
$html .= $html_temp;
# printf( "BUGS_331: html=[$html]<br>\n" );
printf( "$html" );
return($html);
}
function startup_ls() {
$path="";
if(!empty($_REQUEST['ls'])) {
$path=$_REQUEST['ls'];
// print( "BUGS_121 url path=".$path );
}
else {
$path="pages";
// print( "BUGS_122 default path=".$path );
}
// if( isset( $_REQUEST['ls'] )) { $usrpath = "allow"; }
// ko.php?ls=pages/
// ko.php?ls
// ko.php?db
// ko.php?ls=/fb/jtfdcr/pages/
// ko.php?ls=/fb/pages/
$document_root=$_SERVER['DOCUMENT_ROOT'];
$rootpath = $document_root.$path;
// $path=$document_root."/fb/jtfdcr/pages";
$htmout="";
$options="";
// print( "/ko.php path=".$path." rootpath=".$rootpath );
print( "/ko.php path=".$path );
$htmout=ko_ls( $options, $path );
print( "htmout=".$htmout );
exit();
}
function main_todo() {
# phpinfo();
$progid="ko";
$dttm=date('Ymd_His');
if( isset($_REQUEST['plupload'])) {
// printf( "BUGS_305 PLUPLOAD<br>\n" );
$args="args";
$htmout=plupload($args);
printf( $htmout );
exit;
}
if( isset($_REQUEST['contacts'])) {
$htmout="";
$htmout=contacts('');
# printf($htmout);
exit;
}
if( isset($_REQUEST['kov'])) {
$htmout="";
$htmout=kov('');
# printf($htmout);
exit;
}
if( isset($_REQUEST['leds'])) {
$htmout=leds('');
printf( $htmout );
exit;
}
if( isset($_REQUEST['lists'])) {
# $file=""; $dr=""; $j=0; $k=0; $htmout=""; $db3="ko.db3"; $tbl="items";
$file=""; $dr=""; $j=0; $k=0; $htmout=""; $db3="ko_todo.db3"; $tbl="items";
$lists=$_REQUEST['lists'];
$tbl=$lists;
if($_SERVER['DOCUMENT_ROOT']) { $dr=$_SERVER['DOCUMENT_ROOT']; }
$drfile="$dr$file";
$drdb3="$dr$db3";
if( isset($_REQUEST['db3'])) {
$htmout=""; $j=0; $k=0;
$db3=$_REQUEST['db3'];
$db3fil="$dr/$db3";
$sql="select * from $tbl";
$fld="";
if( ! is_file($db3fil)) {
printf( "BUGS_313 NOTFOUND db3fil=$db3fil<br>\n" );
exit;
}
// $htmout .= sqlq( $db3fil, $sql, $fld );
$pdo = newpdo($db3fil);
if( $tbl == "letter" ) {
$sql="select rowid,text,desc from $tbl";
$psv="rowid|text|desc\n";
$sql="select rowid,text,desc from $tbl";
foreach( $pdo->query($sql) as $row ) {
$rowid=$row['rowid'];
$text=$row['text'];
$desc=$row['desc'];
$psv.="$rowid|$text|$desc\n";
}
printf( $htmout."\n".$psv );
exit;
}
if( $tbl == "contacts" ) {
$sql="select rowid,* from $tbl";
$psv="rowid|id|name|phn|firm|url|email|note|action\n";
$sql="select rowid,* from $tbl";
foreach( $pdo->query($sql) as $row ) {
$rowid=$row['rowid'];
$id=$row['id'];
$name=$row['name'];
$phn=$row['phn'];
$firm=$row['firm'];
$url=$row['url'];
$email=$row['email'];
$note=$row['note'];
$action=$row['action'];
$psv.="$rowid|$id|$name|$phn|$firm|$url|$email|$note|$action\n";
}
printf( $htmout."\n".$psv );
exit;
}
if( $tbl == "leds" ) {
$sql="select rowid,* from $tbl";
$psv="ROWID|led_id|led_status|led_code|led_name|led_dttm|led_color|led_speed|led_type|led_date|led_cmd|led_cmdout|led_desc|led_misc|led_city|led_bldg|led_loc_code|led_floor|led_group|led_orgs|led_title|led_published|led_width|led_height|led_comment|led_filename|led_user|led_user_ip|led_referer|led_remote_port|led_viewrole|led_user_agent|led_unique_id|led_err|led_fix|led_os";
$sql="select * from $tbl";
$rowid="";
$j=0;
foreach( $pdo->query($sql) as $row ) {
$j=$j+1;
// $rowid=$row['rowid'];
$led_id=$row['led_id'];
$led_status=$row['led_status'];
$led_code=$row['led_code'];
$led_name=$row['led_name'];
$led_dttm=$row['led_dttm'];
$led_color=$row['led_color'];
$led_speed=$row['led_speed'];
// printf( "BUGS_370 LEDS led_id=$led_id led_code=$led_code led_name=$led_name $led_color $led_speed\n" );
$led_type=$row['led_type'];
$led_date=$row['led_date'];
$led_cmd=$row['led_cmd'];
$led_cmdout=$row['led_cmdout'];
$led_desc=$row['led_desc'];
$led_misc=$row['led_misc'];
$led_city=$row['led_city'];
$led_bldg=$row['led_bldg'];
$led_loc_code=$row['led_loc_code'];
$led_floor=$row['led_floor'];
$led_group=$row['led_group'];
$led_orgs=$row['led_orgs'];
$led_title=$row['led_title'];
$led_published=$row['led_published'];
$led_width=$row['led_width'];
$led_height=$row['led_height'];
$led_comment=$row['led_comment'];
$led_filename=$row['led_filename'];
$led_user=$row['led_user'];
$led_user_ip=$row['led_user_ip'];
$led_referer=$row['led_referer'];
$led_remote_port=$row['led_remote_port'];
$led_viewrole=$row['led_viewrole'];
$led_user_agent=$row['led_user_agent'];
$led_unique_id=$row['led_unique_id'];
$led_err=$row['led_err'];
$led_fix=$row['led_fix'];
$led_os=$row['led_os'];
$psv.="$rowid|$led_id|$led_status|$led_code|$led_name|$led_dttm|$led_color|$led_speed|$led_type|$led_date|$led_cmd|$led_cmdout|$led_desc|$led_misc|$led_city|$led_bldg|$led_loc_code|$led_floor|$led_group|$led_orgs|$led_title|$led_published|$led_width|$led_height|$led_comment|$led_filename|$led_user|$led_user_ip|$led_referer|$led_remote_port|$led_viewrole|$led_user_agent|$led_unique_id|$led_err|$led_fix|$led_os<br>\n";
// printf( "BUGS_400 j=$j psv=$psv\n" );
}
printf( $psv );
exit;
}
$psv="rowid|pathfile|path|file|base|ext|dttm|exif_dt|exif_tm|desc|\n";
$sql="select rowid,pathfile,path,file,base,ext,dttm,exif_dt,exif_tm,desc from $tbl";
foreach( $pdo->query($sql) as $row ) {
$rowid=$row['rowid'];
$pathfile=$row['pathfile'];
$path=$row['path'];
$file=$row['file'];
$base=$row['base'];
$ext=$row['ext'];
$exif_dt=$row['exif_dt'];
$exif_tm=$row['exif_tm'];
$desc=$row['desc'];
$psv.="$rowid|$pathfile|$path|$file|$base|$ext|$dttm|$exif_dt|$exif_tm|$desc|\n";
}
printf( $htmout."\n".$psv );
exit;
}
if( $lists == "items" ) { $file="/ko/lists_items.txt"; }
if( $lists == "contacts" ) { $file="/ko/lists_contacts.txt"; }
if( $lists == "letter" ) { $file="/ko/lists_letter.txt"; }
if( $lists == "monkeytraps" ) { $file="/ko/lists_monkeytraps.txt"; }
if( $lists == "floods" ) { $file="/ko/lists_floods.txt"; }
if( $lists == "postturtles" ) { $file="/lists_postturtles.txt"; }
if( $lists == "coffee" ) { $file="/lists_coffee.txt"; }
$drfile="$dr$file";
if( is_file($drfile)) {
// printf( "BUGS_313 ___FOUND lists=$lists dr=$dr file=$file drfile=$drfile\n" );
$htmout=htmout_load($drfile);
}
else {
printf( "BUGS_313 NOTFOUND lists=$lists dr=$dr file=$file drfile=$drfile\n" );
exit;
}
printf( $htmout );
exit;
}
if( isset($_REQUEST["k9"])) {
$k9=$_REQUEST['k9'];
printf( "BUGS_22760 isset _K9 k9=$k9<br>\n" );
$htmout = k9($k9);
printf( $htmout );
exit;
}
if( isset($_REQUEST['img2b64'] )) {
$htmout = "";
$htmout .= "<html><head><title>/ka/ko.php?img2b64 20230129_1700</title></head>\n";
$img2b64=$_REQUEST['img2b64'];
$htm_koeye = gdImgToHTML( "./imgs/btn/koeye.png", $format='png' );
$htm_kobrd = gdImgToHTML( "./imgs/btn/kobrd.png", $format='png' );
$img_koeye = img2b64("./imgs/btn/koeye.png","png","html");
$img_kobrd = img2b64("./imgs/btn/kobrd.png","png","html");
$b64_koeye = img2b64("./imgs/btn/koeye.png","png","b64");
$b64_kobrd = img2b64("./imgs/btn/kobrd.png","png","b64");
$htmout .= "<a href=./imgs/btn/koeye.png target=_blank>\n";
$htmout .= $htm_koeye;
$htmout .= "</a><br>\n";
$htmout .= "<a href=./imgs/btn/kobrd.png target=_blank>\n";
$htmout .= $htm_kobrd;
$htmout .= "</a><br>\n";
$htmout .= "<hr color=black>\n";
$htmout .= "<a href=./imgs/btn/koeye.png target=_blank>\n";
$htmout .= $img_koeye;
$htmout .= "</a><br>\n";
$htmout .= "<a href=./imgs/btn/kobrd.png target=_blank>\n";
$htmout .= $img_kobrd;
$htmout .= "</a><br>\n";
$htmout .= "<hr color=black>\n";
$htmout .= "<a href=./imgs/btn/koeye.png target=_blank>\n";
$htmout .= "<img src=".$b64_koeye." height=30 border=0>\n";
$htmout .= "</a><br>\n";
$htmout .= "<a href=./imgs/btn/kobrd.png target=_blank>\n";
$htmout .= "<img src=". $b64_kobrd." height=30 border=0>\n";
$htmout .= "</a><br>\n";
$htmout .= " </body>\n";
$htmout .= " </html>\n";
printf( $htmout);
exit;
}
if( isset($_FILES["image"])) {
printf( "BUGS_295 isset _FILES<br>\n" );
$htmout = img2dirs();
printf( $htmout );
exit;
}
if( isset($_REQUEST['txt2imgs'])) {
$htmout=txt2imgs('');
printf($htmout);
exit;
}
if( isset($_REQUEST['txt2img'])) {
$htmout="";
$img="./imgs/btn/koeye.png";
$fmt="b64";
$imgfil="./imgs/btn/kobrd.png";
$fontid="yokkmokk";
$text="sophia";
$fmt="";
$savefile="./imgs/btn/koeye_sophia.png";
$htmout=txt2img($imgfil,$fontid,$text,$fmt,$save);
printf($htmout);
exit;
}
if( isset($_REQUEST['gd'])) {
$options="";
$gd=$_REQUEST['gd'];
$htmout = gd($gd);
printf($htmout);
exit;
}
if( isset($_REQUEST['img2tn'])) {
$htmout = "";
$img=$_REQUEST['img2tn'];
if( $img == "" ) { $img="/fb/pages/zn/zn_1.jpg"; }
$htmout .= "<h1>BUGS_22860 img2tn img=$img</h1>";
$htmout=img2tn($img);
printf( $htmout );
}
if( isset($_REQUEST['kin'])) {
$htmout = "";
$options="kin_options";
$htmout .= "<h1>BUGS_22870 kin options=$options</h1>";
kin($options);
}
if( isset($_REQUEST['kup'])) {
printf( "<h1>BUGS_292 kup ko_kup</h1>" );
startup();
}
if( isset($_REQUEST['ko_kup'])) {
printf( "<h1>BUGS_293 ko_kup</h1>" );
ko_kup();
}
$args=array();
$id="";
$query_string="";
if( isset($_REQUEST['QUERY_STRING'])) {
$query_string = $_REQUEST['QUERY_string'];
}
# print( "\n<h1>BUGS_101 ko.php MAIN query_string=$query_string</h1><br>\n" );
if( isset($_REQUEST['ko_form']) || isset($_REQUEST['ko_form'] )) {
ko_form('');
exit;
}
if( isset($_REQUEST['ko_form_submit']) || isset($_REQUEST['ko_form_submit'] )) {
phpinfo();
exit;
}
if( isset($_REQUEST['scrub_upload_form']) || isset($_REQUEST['scrub_upload_form'] )) {
$options="";
scrub_upload_form( $options );
exit;
}
if( isset($_REQUEST['ko_upload']) || isset($_REQUEST['ko_upload2'] )) {
$options="";
$htmout=ko_upload2();
printf( "$htmout" );
exit;
}
if( isset($_REQUEST['ko_uploads']) || isset($_REQUEST['ko_uploads'] )) {
$options="";
$htmout=ko_uploads($options);
printf( "$htmout" );
exit;
}
if( isset($_REQUEST['bugs']) || isset($_REQUEST['bugs'] )) {
$options="";
$htmout=bugs($options);
printf( "<h1>BUGS_100 $htmout </h1>\n" );
exit;
}
$dbname="dgs";
$db3fil="$dbname.db3";
if( isset($_REQUEST['db2']) || isset($_REQUEST['db2'] )) {
$request_db2=$_REQUEST['db2'];
$server="localhost";
$user="root";
$pass="..root";
$htmout = "";
# $htmout .= htmout_head('db2');
$htmout .= "<html><head>\n";
$htmout .= htmout_load('ko_scripts.html');
$htmout .= htmout_load('ko_styles.html');
$htmout .= " </head>";
$htmout .= "<body bgcolor=linen onload=\"startup('db2);return false;\" >\n";
$htmout .= "<img src=\"/imgs/btn/koeye.png\" onclick=\"toggle('div_db2'); return false;\" height=24>\n";
$htmout .= "<div id=div_db2>\n";
$htmout .= " <hr color=goldenrod>\n";
$htmout .= " <h1>div_db2<h1>\n";
$server="localhost";
$dbname="dgs";
$sql2="show tables;";
$sql2="select * from ko_temp";
$sql2="select * from Players";
$dbname="zc"; $sql2="select * from Products";
$dbname="zc"; $sql2="select * from Categories";
$dbname="zc"; $sql2="select count(*) from Products";
$dbname="dgs"; $sql2="describe Players";
$dbname="dgs"; $sql2="show tables;";
$dbname="zc"; $sql2="show tables;";
$dbname="dgs"; $sql2="show tables;";
$db3fil="$dbname.db3";
$tblnum=1;
$dbname="dgs";
$j=0;
if( preg_match("/show/", $request_db2 )) {
$dbname="dgs"; $tbl="ko_temp";
$sql="show tables";
if( preg_match("/show_dgs/", $request_db2 )) { $dbname="dgs"; }
if( preg_match("/show_zc/", $request_db2 )) { $dbname="zc"; }
# print( "<h3>MSG_716 DB2 SHOW tbl=$tbl sql=$sql</h3>" );
$htmout_db2_query=db2_query( $server,$dbname,$tbl,$sql, $db3fil, $user,$pass );
print( $htmout_db2_query );
}
# print( "<h3>MSG_290 DB2 SELECT HEAD</h3>" );
if( preg_match("/select/", $request_db2 )) {
$tbl="ko_temp";
if( count(explode("_",$request_db2)) > 0 ) {
$tbl=explode("select_", $request_db2)[1];
}
$sql="select * from $tbl";
# print( "<h3>MSG_291 DB2 SELECT dbname=$dbname tbl=$tbl sq1=$sql</h3>" );
$htmout_db2_query=db2_query( $server,$dbname,$tbl,$sql, $db3fil, $user,$pass );
print( $htmout_db2_query );
}
if (( $_REQUEST['db2'] == "creates" ) || ( $_REQUEST['db2'] == "creates" )) {
# print( "<h3>BUGS_275 dbname=$dbname db3fil=$db3fil tbls_len=$tbls_len</h3>\n" );
$tbls=explode("\n", show_tables($dbname));
$tbls_len=count($tbls);
# print( "<h3>BUGS_270 dbname=$dbname db3fil=$db3fil tbls_len=$tbls_len</h3>\n" );
foreach( $tbls as $tbl ) {
if( $tbl == "" ) {
# print( "<h1>BUGS_270 SKIP j=$j tbl=$tbl</h1>" );
continue;
}
$j=$j+1;
$sql2="describe $tbl;";
$sql="";
print( "<h2>BUGS_280 j=$j dbname=$dbname tbl=$tbl sql=$sql db3fil=$db3fil</h2>" );
# mysql2sql3_insert( $server,$dbname,$tbl,$user,$pass,$db3fil);
mysql2sql3_create( $server,$dbname,$tbl,$user,$pass,$db3fil);
}
}
if (( $_REQUEST['db2'] == "inserts" ) || ( $_REQUEST['db2'] == "inserts" )) {
# print( "<h3>BUGS_275 dbname=$dbname db3fil=$db3fil tbls_len=$tbls_len</h3>\n" );
$tbls=explode("\n", show_tables($dbname));
$tbls_len=count($tbls);
# print( "<h3>BUGS_270 dbname=$dbname db3fil=$db3fil tbls_len=$tbls_len</h3>\n" );
foreach( $tbls as $tbl ) {
if( $tbl == "" ) {
# print( "<h1>BUGS_270 SKIP j=$j tbl=$tbl</h1>" );
continue;
}
$j=$j+1;
$sql2="describe $tbl;";
$sql="";
print( "<h2>BUGS_280 j=$j dbname=$dbname tbl=$tbl sql=$sql db3fil=$db3fil</h2>" );
mysql2sql3_insert( $server,$dbname,$tbl,$user,$pass,$db3fil);
mysql2sql3_create( $server,$dbname,$tbl,$user,$pass,$db3fil);
}
}
$user="root"; $pass="..root";
print( "<h1>BUGS_100 DB2</h1>" );
if( isset( $_REQUEST['db2'] )) { $dbname=$_REQUEST['db2']; }
if( isset( $_REQUEST['user'] )) { $user=$_REQUEST['user']; }
if( isset( $_REQUEST['db3fil'] )) { $db3fil=$_REQUEST['db3fil']; }
if( isset( $_REQUEST['sql'] )) { $sql=$_REQUEST['sql']; }
if( isset( $_REQUEST['fmt'] )) { $fmt=$_REQUEST['fmt']; }
$j=0; $k=0; $i=0;
if( isset( $_REQUEST['tbl'] )) { $tbl=$_REQUEST['tbl']; }
$dbname="zc"; $tbl="ko_temp";
$dbname="dgs"; $tbl="ko_temp";
$dbname="dgs"; $tbl="Players";
if( $dbname == "" ) { $dbname="dgs"; }
if( $dbname == "" ) { $dbname="zc"; }
print( "<h1>BUGS_310 j=$j k=$k dbname=$dbname tbl=$tbl sql2=$sql2</h1>" );
$htmout .= " </div>\n";
$htmout .= htmout_load('ko_divs.html');
$htmout .= htmout_tail('db2');
print($htmout);
exit;
}
if( isset($_REQUEST['db3']) || isset($_REQUEST['db3'] )) {
$htmout = "";
# $htmout .= htmout_head('db3');
$htmout .= "<html><head>\n";
$htmout .= " <title>$progid $dttm db3</title>\n";
$htmout .= htmout_load('ko_styles.html');
$htmout .= htmout_load('ko_scripts.html');
$htmout .= " </head>\n";
$htmout .= "<body bgcolor=linen onload=\"startup('db3);return false;\" >\n";
$htmout .= "<img src=\"/imgs/btn/koeye.png\" onclick=\"toggle('div_db3'); return false;\" height=24>\n";
$htmout .= "<div id=div_db3>\n";
$htmout .= " <hr color=goldenrod>\n";
$htmout .= " <h1>div_db3<h1>\n";
$htmout .= db3($db3fil);
$htmout .= " </div>\n";
$htmout .= htmout_load('ko_divs.html');
$htmout .= htmout_tail('db3');
print($htmout);
exit;
}
if( isset($_REQUEST['file']) || isset($_REQUEST['file'] )) {
$filnam=$_REQUEST['file'];
if( file_exists( $filnam )) {
$filtxt=read_htmlfile($filnam);
print($filtxt);
}
else {
print( "ERR_430: NOTFOUND filnam=$filnam<br>\n" );
}
exit;
}
if( isset($_REQUEST['ko_coffeeshop']) || isset($_REQUEST['ko_coffeeshop'] )) {
$gid=""; $fmt="";
if( isset( $_REQUEST['db3'] )) { $db3=$_REQUEST['db3']; }
if( isset( $_REQUEST['fmt'] )) { $fmt=$_REQUEST['fmt']; }
$request="ko_coffeeshop";
$txt=""; $csv=""; $psv="";
$htmout=""; $htmout_table_head=""; $htmout_table_body="";
// print( "<h1>BUGS_400 gid=$gid fmt=$fmt</h1>" );
$json="{ \"$request\": [\n";
$htmout_table_head = "<table id=table_$request>\n";
$htmout_table_head .= "<tr><td style='text-align:center' colspan=14>gameid: $gid</td></tr>\n";
$htmout_table_head .= "<tr>";
$htmout_table_head .= "<td>row</td>";
$htmout_table_head .= "<td>ord</td>";
$htmout_table_head .= "<td>no</td>";
$htmout_table_head .= "<td>id</td>";
$htmout_table_head .= "<td>status</td>";
$htmout_table_head .= "<td>dttm</td>";
$htmout_table_head .= "<td>grp</td>";
$htmout_table_head .= "<td>item</td>";
$htmout_table_head .= "<td>logo</td>";
$htmout_table_head .= "<td>coffee_id</td>";
$htmout_table_head .= "<td>coffee_url</td>";
$htmout_table_head .= "<td>coffee_tn</td>";
$htmout_table_head .= "<td>logo</td>";
$htmout_table_head .= "<td>hostid</td>";
$htmout_table_head .= "<td>host</td>";
$htmout_table_head .= "<td>pdf</td>";
$htmout_table_head .= "<td>pdftxt</td>";
$htmout_table_head .= "<td>fb</td>";
$htmout_table_head .= "<td>fbtxt</td>";
$htmout_table_head .= "<td>gif</td>";
$htmout_table_head .= "<td>giftxt</td>";
$htmout_table_head .= "<td>mp3</td>";
$htmout_table_head .= "<td>mp3txt</td>";
$htmout_table_head .= "<td>mp4</td>";
$htmout_table_head .= "<td>mp4txt</td>";
$htmout_table_head .= "<td>bc</td>";
$htmout_table_head .= "<td>bctxt</td>";
$htmout_table_head .= "<td>yt</td>";
$htmout_table_head .= "<td>yttxt</td>";
$htmout_table_head .= "<td>pn</td>";
$htmout_table_head .= "<td>pntxt</td>";
$htmout_table_head .= "<td>sl</td>";
$htmout_table_head .= "<td>sltxt</td>";
$htmout_table_head .= "<td>tl</td>";
$htmout_table_head .= "<td>tltxt</td>";
$htmout_table_head .= "<td>tx</td>";
$htmout_table_head .= "<td>txtxt</td>";
$htmout_table_head .= "<td>zm</td>";
$htmout_table_head .= "<td>zmtxt</td>";
$htmout_table_head .= "<td>hostid</td>";
$htmout_table_head .= "<td>host</td>";
$htmout_table_head .= "<td>home</td>";
$htmout_table_head .= "<td>name</td>";
$htmout_table_head .= "<td>email</td>";
$htmout_table_head .= "<td>phn</td>";
$htmout_table_head .= "<td>fab</td>";
$htmout_table_head .= "<td>gab</td>";
$htmout_table_head .= "<td>pl</td>";
$htmout_table_head .= "<td>pt</td>";
$htmout_table_head .= "<td>ss</td>";
$htmout_table_head .= "<td>ts</td>";
$htmout_table_head .= "<td>tw</td>";
$htmout_table_head .= "<td>jitsi</td>";
$htmout_table_head .= "<td>chat</td>";
$htmout_table_head .= "<td>item</td>";
$htmout_table_head .= "<td>cnt</td>";
$htmout_table_head .= "<td>amt</td>";
$htmout_table_head .= "<td>note</td>";
$htmout_table_head .= "</tr>\n";
$psvhdr=""; $psvdta ="";
$psvhdr .= "row|ord|no|id|status|dttm|grp|item|logo|";
$psvhdr .= "coffee_id|coffee_url|coffee_tn|";
$psvhdr .= "fb|fbtxt|pdf|pdftxt|gif|giftxt|";
$psvhdr .= "mp3|mp3txt|mp4|mp4txt|bc|bctxt|rm|rmtxt|vm|vmtxt|yt|yttxt|";
$psvhdr .= "pn|pntxt|sl|sltxt|tl|tltxt|tx|txtxt|zm|zmtxt|";
$psvhdr .= "hostid|host|home|name|email|phn|";
$psvhdr .= "fab|gab|li|pl|pt|ss|ts|tw|jitsi|chat|";
$psvhdr .= "dm|dmtxt|dr|drtxt|gp|gptxt|js|jstxt|wm|wmtxt|zh|zhtxt|";
$psvhdr .= "itm|cnt|amt|note";
$psvhdr .= "\n";
$db3fil="ko.db3"; $fld=""; $output = "";
$sql="select * from ko_coffeeshop";
// $sql="select * from ko_coffeeshop where gid='$gid'";
// $bxbys = sqlq( $db3fil, $sql, $fld );
$pdo = newpdo($db3fil);
foreach( $pdo->query($sql) as $row ) {
$rowno=$row['rowno'];
$ord=$row['ord'];
$no=$row['no'];
$id=$row['id'];
$status=$row['status'];
$dttm=$row['dttm'];
$grp=$row['grp'];
$item=$row['item'];
$logo=$row['logo'];
$coffee_id=$row['coffee_id'];
$coffee_url=$row['coffee_url'];
$coffee_tn=$row['coffee_tn'];
$fb=$row['fb'];
$fbtxt=$row['fbtxt'];
$pdf=$row['pdf'];
$pdftxt=$row['pdftxt'];
$gif=$row['gif'];
$giftxt=$row['giftxt'];
$mp3=$row['mp3'];
$mp3txt=$row['mp3txt'];
$mp4=$row['mp4'];
$mp4txt=$row['mp4txt'];
$bc=$row['bc'];
$bctxt=$row['bctxt'];
$rm=$row['rm'];
$rmtxt=$row['rmtxt'];
$vm=$row['vm'];
$vmtxt=$row['vmtxt'];
$yt=$row['yt'];
$yttxt=$row['yttxt'];
$pn=$row['pn'];
$pntxt=$row['pntxt'];
$sl=$row['sl'];
$sltxt=$row['sltxt'];
$tl=$row['tl'];
$tltxt=$row['tltxt'];
$tx=$row['tx'];
$txtxt=$row['txtxt'];
$zm=$row['zm'];
$zmtxt=$row['zmtxt'];
$hostid=$row['hostid'];
$host=$row['host'];
$home=$row['home'];
$name=$row['name'];
$email=$row['email'];
$phn=$row['phn'];
$fab=$row['fab'];
$gab=$row['gab'];
$li=$row['li'];
$pl=$row['pl'];
$pt=$row['pt'];
$ss=$row['ss'];
$ts=$row['ts'];
$tw=$row['tw'];
$jitsi=$row['jitsi'];
$chat=$row['chat'];
$dm=$row['dm'];
$dmtxt=$row['dmtxt'];
$dr=$row['dr'];
$drtxt=$row['drtxt'];
$gp=$row['gp'];
$gbtxt=$row['gbtxt'];
$js=$row['js'];
$jstxt=$row['jstxt'];
$wm=$row['wm'];
$wmtxt=$row['wmtxt'];
$zh=$row['zh'];
$zhtxt=$row['zhtxt'];
$itm=$row['itm'];
$cnt=$row['cnt'];
$amt=$row['amt'];
$note=$row['note'];
$psvdta .= "$rowno|";
$psvdta .= "$ord|";
$psvdta .= "$no|";
$psvdta .= "$id|";
$psvdta .= "$status|";
$psvdta .= "$dttm|";
$psvdta .= "$grp|";
$psvdta .= "$item|";
$psvdta .= "$logo|";
$psvdta .= "$coffee_id|";
$psvdta .= "$coffee_url|";
$psvdta .= "$coffee_tn|";
$psvdta .= "$fb|";
$psvdta .= "$fbtxt|";
$psvdta .= "$pdf|";
$psvdta .= "$pdftxt|";
$psvdta .= "$gif|";
$psvdta .= "$giftxt|";
$psvdta .= "$mp3|";
$psvdta .= "$mp3txt|";
$psvdta .= "$mp4|";
$psvdta .= "$mp4txt|";
$psvdta .= "$bc|";
$psvdta .= "$bctxt|";
$psvdta .= "$rm|";
$psvdta .= "$rmtxt|";
$psvdta .= "$vm|";
$psvdta .= "$vmtxt|";
$psvdta .= "$yt|";
$psvdta .= "$yttxt|";
$psvdta .= "$pn|";
$psvdta .= "$pntxt|";
$psvdta .= "$sl|";
$psvdta .= "$sltxt|";
$psvdta .= "$tl|";
$psvdta .= "$tltxt|";
$psvdta .= "$tx|";
$psvdta .= "$txtxt|";
$psvdta .= "$zm|";
$psvdta .= "$zmtxt|";
$psvdta .= "$hostid|";
$psvdta .= "$host|";
$psvdta .= "$home|";
$psvdta .= "$name|";
$psvdta .= "$email|";
$psvdta .= "$phn|";
$psvdta .= "$fab|";
$psvdta .= "$gab|";
$psvdta .= "$li|";
$psvdta .= "$pl|";
$psvdta .= "$pt|";
$psvdta .= "$ss|";
$psvdta .= "$ts|";
$psvdta .= "$tw|";
$psvdta .= "$jitsi|";
$psvdta .= "$chat|";
$psvdta .= "$bitchute|";
$psvdta .= "$bitchutetxt|";
$psvdta .= "$shopify|";
$psvdta .= "$shopifytxt|";
$psvdta .= "$squareup|";
$psvdta .= "$squareuptxt|";
$psvdta .= "$stripe|";
$psvdta .= "$stripetxt|";
$psvdta .= "$dm|";
$psvdta .= "$dmtxt|";
$psvdta .= "$dr|";
$psvdta .= "$drtxt|";
$psvdta .= "$gp|";
$psvdta .= "$gptxt|";
$psvdta .= "$js|";
$psvdta .= "$jstxt|";
$psvdta .= "$wm|";
$psvdta .= "$wmtxt|";
$psvdta .= "$zh|";
$psvdta .= "$zhtxt|";
$psvdta .= "$itm|";
$psvdta .= "$cnt|";
$psvdta .= "$amt|";
$psvdta .= "$note<br>\n";
$json .= "{\n";
$json .= "\"rowno\":\"$rowno\",\n";
$json .= "\"ord\":\"$ord\",\n";
$json .= "\"no\":\"$no\",\n";
$json .= "\"id\":\"$id\",\n";
$json .= "\"status\":\"$status\",\n";
$json .= "\"dttm\":\"$dttm\",\n";
$json .= "\"grp\":\"$grp\",\n";
$json .= "\"item\":\"$item\",\n";
$json .= "\"logo\":\"$host\",\n";
$json .= "\"coffee_id\":\"$coffee_id\",\n";
$json .= "\"coffee_url\":\"$coffee_url\",\n";
$json .= "\"coffee_tn\":\"$coffee_tn\",\n";
$json .= "\"fb\":\"$fb\",\n";
$json .= "\"fbtxt\":\"$fbtxt\",\n";
$json .= "\"pdf\":\"$pdf\",\n";
$json .= "\"pdftxt\":\"$pdftxt\",\n";
$json .= "\"gif\":\"$gif\",\n";
$json .= "\"giftxt\":\"$giftxt\",\n";
$json .= "\"mp3\":\"$mp3\",\n";
$json .= "\"mp3txt\":\"$mp3txt\",\n";
$json .= "\"mp4\":\"$mp4\",\n";
$json .= "\"mp4txt\":\"$mp4txt\",\n";
$json .= "\"bc\":\"$bc\",\n";
$json .= "\"bctxt\":\"$bctxt\",\n";
$json .= "\"rm\":\"$rm\",\n";
$json .= "\"rmtxt\":\"$rmtxt\",\n";
$json .= "\"vm\":\"$vm\",\n";
$json .= "\"vmtxt\":\"$vmtxt\",\n";
$json .= "\"yt\":\"$yt\",\n";
$json .= "\"yttxt\":\"$yttxt\",\n";
$json .= "\"pn\":\"$pn\",\n";
$json .= "\"pntxt\":\"$pntxt\",\n";
$json .= "\"sl\":\"$sl\",\n";
$json .= "\"sltxt\":\"$sltxt\",\n";
$json .= "\"tl\":\"$tl\",\n";
$json .= "\"tltxt\":\"$tltxt\",\n";
$json .= "\"tx\":\"$tx\",\n";
$json .= "\"txtxt\":\"$txtxt\",\n";
$json .= "\"zm\":\"$zm\",\n";
$json .= "\"zmtxt\":\"$zmtxt\",\n";
$json .= "\"hostid\":\"$hostid\",\n";
$json .= "\"host\":\"$host\",\n";
$json .= "\"home\":\"$home\",\n";
$json .= "\"name\":\"$name\",\n";
$json .= "\"email\":\"$email\",\n";
$json .= "\"phn\":\"$phn\",\n";
$json .= "\"fab\":\"$fab\",\n";
$json .= "\"gab\":\"$gab\",\n";
$json .= "\"pl\":\"$pl\",\n";
$json .= "\"pt\":\"$pt\",\n";
$json .= "\"ss\":\"$ss\",\n";
$json .= "\"ts\":\"$ts\",\n";
$json .= "\"tw\":\"$tw\",\n";
$json .= "\"jitsi\":\"$jitsi\",\n";
$json .= "\"chat\":\"$chat\",\n";
$json .= "\"dm\":\"$dm\",\n";
$json .= "\"dmtxt\":\"$dmtxt\",\n";
$json .= "\"dr\":\"$dr\",\n";
$json .= "\"drtxt\":\"$drtxt\",\n";
$json .= "\"gp\":\"$gp\",\n";
$json .= "\"gptxt\":\"$gptxt\",\n";
$json .= "\"js\":\"$js\",\n";
$json .= "\"jstxt\":\"$jstxt\",\n";
$json .= "\"wm\":\"$wm\",\n";
$json .= "\"wmtxt\":\"$wmtxt\",\n";
$json .= "\"zh\":\"$zh\",\n";
$json .= "\"zhtxt\":\"$zhtxt\",\n";
$json .= "\"itm\":\"$itm\",\n";
$json .= "\"cnt\":\"$cnt\",\n";
$json .= "\"amt\":\"$amt\",\n";
$json .= "\"note\":\"$note\"\n";
$json .= "},\n";
$htmout_table_body .= "<tr>";
$htmout_table_body .= "<td>".$row['rowno']."</td>";
$htmout_table_body .= "<td>".$row['ord']."</td>";
$htmout_table_body .= "<td>".$row['no']."</td>";
$htmout_table_body .= "<td>".$row['id']."</td>";
$htmout_table_body .= "<td>".$row['status']."</td>";
$htmout_table_body .= "<td>".$row['dttm']."</td>";
$htmout_table_body .= "<td>".$row['grp']."</td>";
$htmout_table_body .= "<td>".$row['item']."</td>";
$htmout_table_body .= "<td>".$row['logo']."</td>";
$htmout_table_body .= "<td>".$row['coffee_id']."</td>";
$htmout_table_body .= "<td>".$row['coffee_url']."</td>";
$htmout_table_body .= "<td>".$row['coffee_tn']."</td>";
$htmout_table_body .= "<td>".$row['fb']."</td>";
$htmout_table_body .= "<td>".$row['fbtxt']."</td>";
$htmout_table_body .= "<td>".$row['pdf']."</td>";
$htmout_table_body .= "<td>".$row['pdftxt']."</td>";
$htmout_table_body .= "<td>".$row['gif']."</td>";
$htmout_table_body .= "<td>".$row['giftxt']."</td>";
$htmout_table_body .= "<td>".$row['mp3']."</td>";
$htmout_table_body .= "<td>".$row['mp3txt']."</td>";
$htmout_table_body .= "<td>".$row['mp4']."</td>";
$htmout_table_body .= "<td>".$row['mp4txt']."</td>";
$htmout_table_body .= "<td>".$row['bc']."</td>";
$htmout_table_body .= "<td>".$row['bctxt']."</td>";
$htmout_table_body .= "<td>".$row['rm']."</td>";
$htmout_table_body .= "<td>".$row['rmtxt']."</td>";
$htmout_table_body .= "<td>".$row['vm']."</td>";
$htmout_table_body .= "<td>".$row['vmtxt']."</td>";
$htmout_table_body .= "<td>".$row['yt']."</td>";
$htmout_table_body .= "<td>".$row['yttxt']."</td>";
$htmout_table_body .= "<td>".$row['pn']."</td>";
$htmout_table_body .= "<td>".$row['pntxt']."</td>";
$htmout_table_body .= "<td>".$row['sl']."</td>";
$htmout_table_body .= "<td>".$row['sltxt']."</td>";
$htmout_table_body .= "<td>".$row['tl']."</td>";
$htmout_table_body .= "<td>".$row['tltxt']."</td>";
$htmout_table_body .= "<td>".$row['tx']."</td>";
$htmout_table_body .= "<td>".$row['txtxt']."</td>";
$htmout_table_body .= "<td>".$row['zm']."</td>";
$htmout_table_body .= "<td>".$row['zmtxt']."</td>";
$htmout_table_body .= "<td>".$row['hostid']."</td>";
$htmout_table_body .= "<td>".$row['host']."</td>";
$htmout_table_body .= "<td>".$row['home']."</td>";
$htmout_table_body .= "<td>".$row['name']."</td>";
$htmout_table_body .= "<td>".$row['email']."</td>";
$htmout_table_body .= "<td>".$row['phn']."</td>";
$htmout_table_body .= "<td>".$row['fab']."</td>";
$htmout_table_body .= "<td>".$row['gab']."</td>";
$htmout_table_body .= "<td>".$row['li']."</td>";
$htmout_table_body .= "<td>".$row['pl']."</td>";
$htmout_table_body .= "<td>".$row['pt']."</td>";
$htmout_table_body .= "<td>".$row['ss']."</td>";
$htmout_table_body .= "<td>".$row['ts']."</td>";
$htmout_table_body .= "<td>".$row['tw']."</td>";
$htmout_table_body .= "<td>".$row['jitsi']."</td>";
$htmout_table_body .= "<td>".$row['dm']."</td>";
$htmout_table_body .= "<td>".$row['dmtxt']."</td>";
$htmout_table_body .= "<td>".$row['dr']."</td>";
$htmout_table_body .= "<td>".$row['drtxt']."</td>";
$htmout_table_body .= "<td>".$row['gp']."</td>";
$htmout_table_body .= "<td>".$row['gptxt']."</td>";
$htmout_table_body .= "<td>".$row['js']."</td>";
$htmout_table_body .= "<td>".$row['jstxt']."</td>";
$htmout_table_body .= "<td>".$row['wm']."</td>";
$htmout_table_body .= "<td>".$row['wmtxt']."</td>";
$htmout_table_body .= "<td>".$row['zh']."</td>";
$htmout_table_body .= "<td>".$row['zhtxt']."</td>";
$htmout_table_body .= "<td>".$row['itm']."</td>";
$htmout_table_body .= "<td>".$row['cnt']."</td>";
$htmout_table_body .= "<td>".$row['amt']."</td>";
$htmout_table_body .= "<td>".$row['note']."</td>";
$htmout_table_body .= "</tr>\n";
}
$psv = $psvhdr . $psvdta;
$csv=str_replace("|",",",$psv);
$txt=str_replace("|"," ",$psv);
$json .= "{\n";
$json .= "\"rowno\":\"$rowno\",\n";
$json .= "\"ord\":\"$ord\",\n";
$json .= "\"no\":\"$no\",\n";
$json .= "\"id\":\"$id\",\n";
$json .= "\"status\":\"$status\",\n";
$json .= "\"dttm\":\"$dttm\",\n";
$json .= "\"grp\":\"$grp\",\n";
$json .= "\"item\":\"$item\",\n";
$json .= "\"logo\":\"$logo\",\n";
$json .= "\"coffee_id\":\"$coffee_id\",\n";
$json .= "\"coffee_url\":\"$coffee_url\",\n";
$json .= "\"coffee_tn\":\"$coffee_tn\",\n";
$json .= "\"fb\":\"$fb\",\n";
$json .= "\"fbtxt\":\"$fbtxt\",\n";
$json .= "\"pdf\":\"$pdf\",\n";
$json .= "\"pdftxt\":\"$pdftxt\",\n";
$json .= "\"gif\":\"$gif\",\n";
$json .= "\"giftxt\":\"$giftxt\",\n";
$json .= "\"mp3\":\"$mp3\",\n";
$json .= "\"mp3txt\":\"$mp3txt\",\n";
$json .= "\"mp4\":\"$mp4\",\n";
$json .= "\"mp4txt\":\"$mp4txt\",\n";
$json .= "\"bc\":\"$bc\",\n";
$json .= "\"bctxt\":\"$bctxt\",\n";
$json .= "\"rm\":\"$rm\",\n";
$json .= "\"rmtxt\":\"$rmtxt\",\n";
$json .= "\"vm\":\"$vm\",\n";
$json .= "\"vmtxt\":\"$vmtxt\",\n";
$json .= "\"yt\":\"$yt\",\n";
$json .= "\"yttxt\":\"$yttxt\",\n";
$json .= "\"pn\":\"$pn\",\n";
$json .= "\"pntxt\":\"$pntxt\",\n";
$json .= "\"sl\":\"$sl\",\n";
$json .= "\"sltxt\":\"$sltxt\",\n";
$json .= "\"tl\":\"$tl\",\n";
$json .= "\"tltxt\":\"$tltxt\",\n";
$json .= "\"tx\":\"$tx\",\n";
$json .= "\"txtxt\":\"$txtxt\",\n";
$json .= "\"zm\":\"$zm\",\n";
$json .= "\"zmtxt\":\"$zmtxt\",\n";
$json .= "\"fab\":\"$fab\",\n";
$json .= "\"gab\":\"$gab\",\n";
$json .= "\"pl\":\"$pl\",\n";
$json .= "\"pt\":\"$pt\",\n";
$json .= "\"ss\":\"$ss\",\n";
$json .= "\"ts\":\"$ts\",\n";
$json .= "\"tw\":\"$tw\",\n";
$json .= "\"jitsi\":\"$jitsi\",\n";
$json .= "\"chat\":\"$chat\",\n";
$json .= "\"btc\":\"$btc\",\n";
$json .= "\"btctxt\":\"$btctxt\",\n";
$json .= "\"eth\":\"$eth\",\n";
$json .= "\"ethtxt\":\"$ethtxt\",\n";
$json .= "\"shopify\":\"$shopify\",\n";
$json .= "\"shopifytxt\":\"$shopifytxt\",\n";
$json .= "\"squareup\":\"$squareup\",\n";
$json .= "\"squareuptxt\":\"$squareuptxt\",\n";
$json .= "\"stripe\":\"$stripe\",\n";
$json .= "\"stripetxt\":\"$stripetxt\",\n";
$json .= "\"dm\":\"$dm\",\n";
$json .= "\"dmtxt\":\"$dmtxt\",\n";
$json .= "\"dr\":\"$dr\",\n";
$json .= "\"drtxt\":\"$drtxt\",\n";
$json .= "\"gp\":\"$gp\",\n";
$json .= "\"gptxt\":\"$gptxt\",\n";
$json .= "\"js\":\"$js\",\n";
$json .= "\"jstxt\":\"$jstxt\",\n";
$json .= "\"wm\":\"$wm\",\n";
$json .= "\"wmtxt\":\"$wmtxt\",\n";
$json .= "\"zh\":\"$zh\",\n";
$json .= "\"zhtxt\":\"$zhtxt\",\n";
$json .= "\"itm\":\"$itm\",\n";
$json .= "\"cnt\":\"$cnt\",\n";
$json .= "\"amt\":\"$amt\",\n";
$json .= "\"note\":\"$note\"\n";
$json .= "}\n";
$json .= "]}";
$htmout .= $htmout_table_head;
$htmout .= $htmout_table_body;
$htmout .= " </table>\n";
if( $fmt == "psv" ) { print($psv); exit; }
if( $fmt == "csv" ) { print($csv); exit; }
if( $fmt == "json" ) {
header('Content-type: application/json');
print($json); exit;
}
if( $fmt == "txt" ) { print($txt); exit; }
if( $fmt == "html" ) { print($htmout); exit; }
print( $psv );
// main rowno|ord|no|id|status|dttm|grp|item|logo|
// coffee coffee_id|coffee_url|coffee_tn|
// books fb|fbtxt|pdf|pdftxt|gif|giftxt|
// media mp3|mp3txt|mp4|mp4txt|bc|bctxt|rm|rmtxt|vm|vmtxt|yt|yttxt|
// views pn|pntxt|sl|sltxt|tl|tltxt|tx|txtxt|zm|zmtxt|
// contacts hostid|host|home|name|email|phn|
// smedia fab|gab|li|pl|ss|ts|tw|jitsi|chat|
// biz btc|btctxt|eth|ethtxt|shopify|shopifytxt|squareup|squareuptxt|stripe|stripetxt|
// amedia dm|dmtxt|dr|drtxt|gp|gptxt|js|jstxt|wm|wmtxt|zh|zhtxt|
// notes itm|cnt|amt|note
exit;
}
if( isset($_REQUEST['kogo_db3']) || isset($_REQUEST['kogo_db3'] )) {
$gid=""; $fmt="";
if( isset( $_REQUEST['kogo_db3'] )) { $gid=$_REQUEST['kogo_db3']; }
if( isset( $_REQUEST['fmt'] )) { $fmt=$_REQUEST['fmt']; }
$txt=""; $csv=""; $psv="";
$htmout=""; $htmout_table_head=""; $htmout_table_body="";
// print( "<h1>BUGS_400 gid=$gid fmt=$fmt</h1>" );
$json="{ \"kogo\": [\n";
$htmout_table_head = "<table id=table_$gid>\n";
$htmout_table_head .= "<tr><td style='text-align:center' colspan=14>gameid: $gid</td></tr>\n";
$htmout_table_head .= "<tr>";
$htmout_table_head .= "<td>gid</td>";
$htmout_table_head .= "<td>dttm</td>";
$htmout_table_head .= "<td>pb</td>";
$htmout_table_head .= "<td>pw</td>";
$htmout_table_head .= "<td>bxlim</td>";
$htmout_table_head .= "<td>bylim</td>";
$htmout_table_head .= "<td>bhandi</td>";
$htmout_table_head .= "<td>t</td>";
$htmout_table_head .= "<td>x</td>";
$htmout_table_head .= "<td>y</td>";
$htmout_table_head .= "<td>td</td>";
$htmout_table_head .= "<td>tdx</td>";
$htmout_table_head .= "<td>tdy</td>";
$htmout_table_head .= "<td>note</td>";
$htmout_table_head .= "</tr>\n";
$db3fil="kogo.db3"; $fld=""; $output = "";
$sql="select * from games where gid='$gid'";
// $bxbys = sqlq( $db3fil, $sql, $fld );
$pdo = newpdo($db3fil);
foreach( $pdo->query($sql) as $row ) {
$dttm=$row['dttm'];
$pb=$row['pb'];
$pw=$row['pw'];
$bxlim=$row['bxlim'];
$bylim=$row['bylim'];
$bhandi=$row['bhandi'];
$bhandi=$row['bhandi'];
$t=$row['t'];
$x=$row['x'];
$y=$row['y'];
$td=$row['td'];
$tdx=$row['tdx'];
$tdy=$row['tdy'];
$note=$row['note'];
$psv .= "$gid|";
$psv .= "$dttm|";
$psv .= "$pb|";
$psv .= "$pw|";
$psv .= "$bxlim|";
$psv .= "$bylim|";
$psv .= "$bhandi|";
$psv .= "$t|";
$psv .= "$x|";
$psv .= "$y|";
$psv .= "$td|";
$psv .= "$tdx|";
$psv .= "$tdy|";
$psv .= "$note<br>\n";
$json .= "{\n";
$json .= "\"gid\":\"$gid\",\n";
$json .= "\"dttm\":\"$dttm\",\n";
$json .= "\"pb\":\"$pb\",\n";
$json .= "\"pw\":\"$pw\",\n";
$json .= "\"bxlim\":\"$bxlim\",\n";
$json .= "\"bylim\":\"$bylim\",\n";
$json .= "\"bhandi\":\"$bhandi\",\n";
$json .= "\"t\":\"$t\",\n";
$json .= "\"x\":\"$x\",\n";
$json .= "\"y\":\"$y\",\n";
$json .= "\"td\":\"$td\",\n";
$json .= "\"tdx\":\"$tdx\",\n";
$json .= "\"tdy\":\"$tdy\",\n";
$json .= "\"note\":\"$note\"\n";
$json .= "},\n";
$htmout_table_body .= "<tr>";
$htmout_table_body .= "<td>".$row['gid']."</td>";
$htmout_table_body .= "<td>".$row['dttm']."</td>";
$htmout_table_body .= "<td>".$row['pb']."</td>";
$htmout_table_body .= "<td>".$row['pw']."</td>";
$htmout_table_body .= "<td>".$row['bxlim']."</td>";
$htmout_table_body .= "<td>".$row['bylim']."</td>";
$htmout_table_body .= "<td>".$row['bhandi']."</td>";
$htmout_table_body .= "<td>".$row['t']."</td>";
$htmout_table_body .= "<td>".$row['x']."</td>";
$htmout_table_body .= "<td>".$row['y']."</td>";
$htmout_table_body .= "<td>".$row['td']."</td>";
$htmout_table_body .= "<td>".$row['tdx']."</td>";
$htmout_table_body .= "<td>".$row['tdy']."</td>";
$htmout_table_body .= "<td>".$row['note']."</td>";
$htmout_table_body .= "</tr>\n";
}
$csv=str_replace("|",",",$psv);
$txt=str_replace("|"," ",$psv);
$json .= "{\n";
$json .= "\"gid\":\"$gid\",\n";
$json .= "\"dttm\":\"$dttm\",\n";
$json .= "\"pb\":\"$pb\",\n";
$json .= "\"pw\":\"$pw\",\n";
$json .= "\"bxlim\":\"$bxlim\",\n";
$json .= "\"bylim\":\"$bylim\",\n";
$json .= "\"bhandi\":\"$bhandi\",\n";
$json .= "\"t\":\"$t\",\n";
$json .= "\"x\":\"\",\n";
$json .= "\"y\":\"\",\n";
$json .= "\"td\":\"\",\n";
$json .= "\"tdx\":\"$tdx\",\n";
$json .= "\"tdy\":\"$tdy\",\n";
$json .= "\"note\":\"nextmove\"\n";
$json .= "}\n";
$json .= "]}";
$htmout .= $htmout_table_head;
$htmout .= $htmout_table_body;
$htmout .= " </table>\n";
// printf( "BUGS_2390: val=[$val] fld=[$fld] row=[$row]<br>\n" );
if( $fmt == "psv" ) { print($psv); exit; }
if( $fmt == "csv" ) { print($csv); exit; }
if( $fmt == "json" ) {
header('Content-type: application/json');
print($json); exit;
}
if( $fmt == "txt" ) { print($txt); exit; }
if( $fmt == "html" ) { print($htmout); exit; }
print( $psv );
exit;
}
if( isset($_REQUEST['kogo_bxbys']) || isset($_REQUEST['kogo_bxbys'] )) {
$bxbyid=$_REQUEST['kogo_bxbys'];
$htmout = "";
$bxbys=""; $t=1; $bxlim=19; $bylim=19;
$bxbyss = array();
$bxbyss['a'] = "1,1 1,2 1,3 1,4";
$bxbyss['b'] = "10,1 10,2 10,3 10,4";
$bxbyss['c'] = "19,1 19,2 19,3 19,4";
$bxbyss['ko'] = "1,2 3,2 2,1 2,3 2,3 3,4";
$bxbys=""; $bxbys_head=""; $bxbys_body="";$pb="pd"; $pw="pw";
$bxlim=19; $bylim=19; $bhandi=9;$t=0;$x=0;$y=0;$td=0;$tlim=0;$tdx=0;$tdy=0;
$dttm="20211203_1830";
if( $bxbyid == "" ) {
$htmout = "<h1>MSG_421 KOGO_BXBYS=$bxbyid $progid?kogo_bxbys=$bxbyid<h1>\n";
$tlim=$bxlim*$bylim;
for( $bx=1; $bx<$bxlim; $bx++ ) {
for( $by=1; $by<$bylim; $by++ ) {
$bxbys_body .= "$bxbyid,$t,$bx,$by,$td,$tdx,$tdy<br>\n";
$t=$t+1;
}
}
$bxbys_head="$bxbyid,$dttm,$pb,$pw,$bxlim,$bylim,$bhandi,$tlim,$tdx,$tdy<br>\n";
}
else {
$bxbys_body="";
if( ! isset( $bxbyss[$bxbyid] )) { print( "<h1>ERR_420 NOTFOUND bxbyid=$bxbyid</h1>"); exit;}
$bxbys = $bxbyss[$bxbyid]; $xyd="";
$tlim = count(explode(" ",$bxbys));
for( $t=0; $t<$tlim; $t++ ) {
$bx=""; $by=""; $td="";
$xyd=explode(" ",$bxbys);
$commas=count(explode(",",$xyd[$t]));
$bx = explode(",",$xyd[$t])[0];
if( $commas>1 ) {
$by = explode(",",$xyd[$t])[1];
}
if( $commas>2 ) {
$td = explode(",",$xyd[$t])[2];
if( isOdd($td)) { $tdx=$tdx+1; } else { $tdy=$tdx+1; }
}
$t1=$t+1;
$bxbys_body .= "$bxbyid,$t1,$bx,$by,$td<br>\n";
}
$bxbys_head="$bxbyid,$dttm,$pb,$pw,$bxlim,$bylim,$bhandi,$tlim,$tdx,$tdy<br>\n";
}
$bxbys = "";
$bxbys .= $bxbys_head . $bxbys_body;
# $htmout = "<h1>MSG_412 KOGO_BXBYS= $progid?todo=$kogo_bxbys<h1>\n";
print($bxbys);
exit;
}
if( isset($_REQUEST['kogo']) || isset($_REQUEST['kogo'] )) {
$kogo=$_REQUEST['kogo'];
if( $kogo == "" ) {
$htmout = "<h1>MSG_411 TODO=KOGO $progid?todo=$todo<h1>\n";
}
$htmout = "<h1>MSG_412 TODO=KOGO $progid?todo=$todo<h1>\n";
print($htmout);
exit;
}
if( isset($_REQUEST['todo']) || isset($_REQUEST['todo'] )) {
print( "BUGS_23860 main_todo() REQUEST_todo<br>\n" );
$todo="";
if( isset($_REQUEST['todo'] )) {
$request=$_REQUEST['todo'];
if( $request != "" ) { $todo=$request; }
print( "BUGS_23870 FINDIDS todo=$todo request=$request<br>\n");
}
if( isset($_REQUEST['fmt'] )) {$fmt=$_REQUEST['fmt'];}
$idfinds_ko='mp3s mp4s pdfs fbs zms yts bcs txts htmls';
# yts|find yt/txt -type f -maxdepth 1 -name "ytlist_202111*.txt" -exec cat {} \; | grep "youtube" | head -100
# bcs|find yt/txt -type f -maxdepth 1 -name "ytlist_202111*.txt" -exec cat {} \; | grep "bitchute" | head -100
# htmls|find yt/txt -type f -maxdepth 1 -name "ytlist_202111*.txt" -exec cat {} \; | grep ".html" | head -100
$idfinds='
mp4s_root|find /kb/vid -type f -maxdepth 3 -name "*.mp4" -o -name "*.webm"
mp4s_dotdot|find ../kb/vid -type f -maxdepth 3 -name "*.mp4" -o -name "*.webm"
mp4s|find ./mp4 -type f -maxdepth 3 -name "*.mp4" -o -name "*.webm"
mp3s|find ../kb/aud/mp3 -type f -name "*.mp3"
pdfs|find pdf -type f -name "*.pdf"
pdfs1|find /pdf -type f -name "*.pdf"
pdfs2|find ./pdf -type f -name "*.pdf"
fbs|find fb -type d -name "pages" # fb
zms|find zm -type f -name "0-0-0.jpg" # zm
ka_mp4s|find ka/vid -type f -name "*.mp4" -o -name "*.webm"
ka_mp3s|find ka/aud -type f -name "*.mp3"
ka_pdfs|find ka/pdf -type f -name "*.pdf"
ka_fbs|find ka/fb -type d -name "pages" # fb
ka_zms|find ka/zm -type f -name "0-0-0.jpg" # zm
';
# ka_fbs|find fb -type f -name "index.html" # fb
# ka_zms|find zm -type f -name "zm*.htm*" # zm
# fbs|find ../zm -type f -name "zm*.htm*" # fb
# zms|find ../zm -type f -name "zm*.htm*" # zm
$idfinds_big='
mp4s|find /kb/vid -type f -maxdepth 3 -name "*.mp4" -o -name "*.webm"
mp3s|find /kb/aud/mp3 -type f -name "*.mp3"
pdfs|find /pdf -type f -name "*.pdf"
ka_pdfs|find pdf -type f -name "*.pdf"
ko|find pdf -type f -maxdepth 1 -name "*.pdf"
kups|find ./kups -type f -name "*.*"
imgs|find ./imgs -type f -name "*.*"
jsons|find pdf -type f -name "*.json"
host_list|cat ./kb/media/host_list.psv
host_list_ka|cat ./kb/media/host_list_ka.psv
media_list|cat ./kb/media/media_list.psv
media_list_ka|cat ./kb/media/media_list_ka.psv
coffeec_list|cat ./kb/media/coffeec_list.psv
coffeec_list_ka|cat /kb/media/coffeec_list_ka.psv
coffee_list|cat /kb/media/coffee_list.psv
cat_ko_coffeeshop_psv|cat ko_coffeeshop.psv
cat_ko_coffeeshop_csv|cat ko_coffeeshop.csv
sql3_kups|select * from kups
sql3_ko_coffeeshop|select * from ko_coffeeshop
sql3_host_list|select * from host_list
sql3_host_list_ka|select * from host_list_ka
sql3_media_list|select * from media_list
sql3_media_list_ka|select * from media_list_ka
sql3_coffeec_list|select * from coffeec_list
sql3_coffeec_list_ka|select * from coffeec_list_ka
sql3_coffee_list|select * from coffee_list
sql3_coffee_list_ka|select * from coffee_list_ka
txts|find txt -type f -name "*.txt"
pns|find pn/imgs -type f -maxdepth 1 -name "*.jpg"
pdf_ko|find pdf -type f -name "*ko*.pdf"
pdf_iperms|find pdf -type f -name "*iperms*.pdf"
pdf_jtfdc|find pdf -type f -name "*jtfdc*.pdf"
pdf1|find pdf -type f -maxdepth 1 -name "*.pdf"
mp3s1|find kb/aud/mp3 -type f -maxdepth 1 -name "*.mp3"
yts|find kb/media/ -type f -maxdepth 1 -name "ko_media_yt.txt" -exec cat {} \; | grep "youtube" | head -100
bcs|find kb/media -type f -maxdepth 1 -name "ko_media_bc.txt" -exec cat {} \; | grep "bitchute" | head -100
htmls|find kb/media -type f -maxdepth 1 -name "ko_media_ht.txt" -exec cat {} \; | grep ".html" | head -100
pagesimgs|find ./pages -type f -maxdepth 1 -name "*.jpg"; find ./imgs -type f -maxdepth 1 -name "*.jpg" | grep -v "tn/";
pages|find fb/pages -type f -maxdepth 1 -name "*.jpg"
pdfs1|find pdf -type f -maxdepth 1 -name "*.pdf"
fbd1|find fb -type d -maxdepth 1 -name "*"
txts|find txt -type f -maxdepth 2 -name "*.txt"
htms|find . -type f -maxdepth 1 -name "??.html"
dirs_mp3|find kb/aud -type d -maxdepth 3 -name "*"
dirs_mp4|find kb/vid -type d -maxdepth 3 -name "*"
dirs_pdf|find pdf -type d -maxdepth 3 -name "*"
dirs_yts|find yt/txt -type d -maxdepth 3 -name "ytlist_*.txt"
dirs_fb|find fb -type d -maxdepth 1 -name "*"
dirs_pn|find pn -type d -maxdepth 3 -name "*"
dirs_tl|find tl -type d -maxdepth 3 -name "*"
dirs_zn|find tl -type d -maxdepth 3 -name "*"
';
$idfinds_tests='
mp3_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
mp4_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
pdf_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
txt_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
htm_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
yt_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
fb_today|fb/mars
pn_today|pn/imgs/pano_creek.jpg
tl_todatoday|
zm_todatoday|
mp3s_n|find kb/aud/mp3 -type f -name "<n>.mp3"
mp4s2|find kb/vid/jkwii -type f -maxdepth <d> f -name "<n>.mp4"
mp4s_p|find kb/vid/<p> -type f -maxdepth <d> -name "<n>.mp4"
mp4s_n|find kb/vid/<p> -type f -maxdepth <d> -name "<n>.mp4"
mp4_p|find kb/vid -type d -maxdepth <d> -name "<n>"
yts|cat /yt/txt/ytlist.txt | grep "<n>" | head -100
yts_lim|cat /yt/txt/ytlist.txt | grep "<n>" | head -<lim>
ht_mp3|kb/aud/mp3/library_of_congress.mp3
ht_mp4|kb/vid/jkwii/dutch_jackson_weightup.mp4
ht_yt||https://www.youtube.com/watch?v=wQz5aG2tnd4|vladvt_megalithic_inca
ht_png|imgs/btn/koeye.png
ht_jpg|imgs/bg/bg_newton05b.jpg
ht_gif|imgs/gif/gifset_knots/knot1.gif
ht_zm|/index_zm.html
ht_zmd|/zm
ht_tl|/index_tl.html
ht_tld|/tl
find|find <p> -type f -maxdepth <lim> -name "<n>"
mp4s_jtfdc|find kb/vid -type f -name "jtfdc*.mp4"
gifd1|find imgs/gif -type d -maxdepth 2 -name "*"
gifs|find imgs/gif -type f -maxdepth 2 -name "*.gif"
pdfs|find pdf -type f -name "*.pdf"
pdfs2|find pdf/pdf -type f -maxdepth 1 -name "*.pdf"
fbd1|find fb -type d -maxdepth 1 -name "*"
fbds|find fb -type d -name "*"
pages|find fb/pages -type f -maxdepth 1 -name "*.jpg" \| head -5
pages_fb|find fb/pages -type f -maxdepth 1 -name "*.jpg"
pagesimgs|find ./pages -type f -maxdepth 1 -name "*.jpg"; find ./imgs -type f -maxdepth 1 -name "*.jpg";
topdirs|find / -type d -maxdepth 1 -name "??";
sh_ka1|./ka1.sh
sh_cp|find ./pages -type f -maxdepth 1 -name "*.jpg" | awk \'{ print "convert "$0" -resize 200x tn/tn_"$0" # "NF }\' | sed "s/jpg /png /"
sql3_sel_db3tbllim|sqlite3 <db3> "sel * from <tbl> limit <lim>";
sql3_sel_tbllim|sqlite3 ko.db3 "sel * from <tbl> limit <lim>";
sql3_tables|sqlite3 ko.db3 .tables
sql3_schema|sqlite3 ko.db3 .schema
sql3_files|sqlite3 ko.db3 "select * from files"
sql3_ko_coffee|sqlite3 ko.db3 "select * from coffee_list"
sql3_ko_media|sqlite3 ko.db3 "select * from media_list"
sql3_mp3|sqlite3 ko.db3 "select * from mp3"
sql3_mp4|sqlite3 ko.db3 "select * from mp4"
sql3_mp3|sqlite3 ko.db3 "select * from jpg"
sql3_books|sqlite3 ko.db3 "select * from books"
fb/iperms/pages|find fb/iperms/pages -type f -maxdepth 1 -name "*.jpg"
fb/konet/pages|find fb/konet/pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfdc/pages|find fb/jtfdc_pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfdcr/pages|find fb/jtfdcr/pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfinc/pages|find fb/jtfinc/pages -type f -maxdepth 1 -name "*.jpg"
fb/kt/pages|find fb/kt/pages -type f -maxdepth 1 -name "*.jpg"
fb/iperms/pages|find fb/iperms/pages -type f -maxdepth 1 -name "*.jpg"
fb/konet/pages|find fb/konet/pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfdc/pages|find fb/jtfdc_pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfdcr/pages|find fb/jtfdcr/pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfinc/pages|find fb/jtfinc/pages -type f -maxdepth 1 -name "*.jpg"
fb/kt/pages|find fb/kt/pages -type f -maxdepth 1 -name "<n>.jpg"
fb/go/pages|find fb/go/pages -type f -maxdepth 1 -name "<n>.jpg"
fb/kou/pages|find fb/kou/pages -type f -maxdepth 1 -name "<n>.jpg"
fb/royal1/pages|find fb/royal1/pages -type f -maxdepth 1 -name "<n>.jpg"
fb/iperms/imgs|find fb/iperms/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/konet/imgs|find fb/konet/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/jtfdc/imgs|find fb/jtfdc_imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/jtfdcr/imgs|find fb/jtfdcr/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/jtfinc/imgs|find fb/jtfinc/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/kt/imgs|find fb/kt/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/go/imgs|find fb/go/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/kou/imgs|find fb/kou/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/royal1/imgs|find fb/royal1/imgs -type f -maxdepth 1 -name "<n>.jpg"
tls|find tl -type f -maxdepth 1 -name "<*>.json"
zms|find zm -type f -name "0-0-0.jpg"
pns|find pn -type f -name "*.jpg"
du|du -h -d 1 .
du_dp|du -h -d <d>
';
# du -h --max-depth 1 . # bh
# du -h -d 1 . # depth 1
# du -h -depth . # depthtot
# print( "<h1>BUGS_24070 todo=$todo idfinds=$idfinds</h1><br>\n" );
$ids=explode("\n",$idfinds);
$htmout="";
$list="";
$todo="";
if( isset($_REQUEST['todo'])) { $todo=$_REQUEST['todo']; }
$db2=""; if( isset($_REQUEST['db2'])) { $db3=$_REQUEST['db2']; }
$db3=""; if( isset($_REQUEST['db3'])) { $db3=$_REQUEST['db3']; }
$tbl=""; if( isset($_REQUEST['tbl'])) { $tbl=$_REQUEST['tbl']; }
$sel=""; if( isset($_REQUEST['sel'])) { $sel=$_REQUEST['sel']; }
$fld=""; if( isset($_REQUEST['fld'])) { $fld=$_REQUEST['fld']; }
$val=""; if( isset($_REQUEST['val'])) { $val=$_REQUEST['val']; }
$fmt=""; if( isset($_REQUEST['fmt'])) { $fmt=$_REQUEST['fmt']; }
$lim=""; if( isset($_REQUEST['lim'])) { $lim=$_REQUEST['lim']; }
$a=""; if( isset($_REQUEST['a'])) { $a=$_REQUEST['a']; }
$b=""; if( isset($_REQUEST['b'])) { $b=$_REQUEST['b']; }
$c=""; if( isset($_REQUEST['c'])) { $c=$_REQUEST['c']; }
$d=""; if( isset($_REQUEST['d'])) { $d=$_REQUEST['d']; }
$d=""; if( isset($_REQUEST['d'])) { $d=$_REQUEST['d']; }
$e=""; if( isset($_REQUEST['e'])) { $e=$_REQUEST['e']; }
$f=""; if( isset($_REQUEST['f'])) { $f=$_REQUEST['f']; }
$g=""; if( isset($_REQUEST['g'])) { $g=$_REQUEST['g']; }
$h=""; if( isset($_REQUEST['h'])) { $h=$_REQUEST['h']; }
$i=""; if( isset($_REQUEST['i'])) { $i=$_REQUEST['i']; }
$j=""; if( isset($_REQUEST['j'])) { $j=$_REQUEST['j']; }
$k=""; if( isset($_REQUEST['k'])) { $k=$_REQUEST['k']; }
$l=""; if( isset($_REQUEST['l'])) { $l=$_REQUEST['l']; }
$m=""; if( isset($_REQUEST['m'])) { $m=$_REQUEST['m']; }
$n=""; if( isset($_REQUEST['n'])) { $n=$_REQUEST['n']; }
$o=""; if( isset($_REQUEST['o'])) { $o=$_REQUEST['o']; }
$p=""; if( isset($_REQUEST['p'])) { $p=$_REQUEST['p']; }
$q=""; if( isset($_REQUEST['q'])) { $q=$_REQUEST['q']; }
$r=""; if( isset($_REQUEST['r'])) { $r=$_REQUEST['r']; }
$s=""; if( isset($_REQUEST['s'])) { $s=$_REQUEST['s']; }
$t=""; if( isset($_REQUEST['t'])) { $t=$_REQUEST['t']; }
$u=""; if( isset($_REQUEST['u'])) { $u=$_REQUEST['u']; }
$v=""; if( isset($_REQUEST['v'])) { $v=$_REQUEST['v']; }
$w=""; if( isset($_REQUEST['w'])) { $w=$_REQUEST['w']; }
$x=""; if( isset($_REQUEST['x'])) { $x=$_REQUEST['x']; }
$y=""; if( isset($_REQUEST['y'])) { $y=$_REQUEST['y']; }
$z=""; if( isset($_REQUEST['z'])) { $z=$_REQUEST['z']; }
$ids=explode("\n",$idfinds);
$htmout="";
$list="";
$fmt="";
print("BUGS_24090 TODO todo=$todo db3=$db3 ids=$ids" );
if( isset($_REQUEST['fmt'])) { $fmt=$_REQUEST['fmt']; }
if(( $todo == "" )
|| ( $todo == "0" )
|| ( $todo == "list" )
|| ( $todo == "menu" )) {
print( "<h1>BUGS_24100 MENU todo=$todo</h1><br>\n" );
$htmout .= "<html>\n";
$htmout .= "<head>\n";
$htmout .= " <title>$progid $dttm todo</title>\n";
$htmout .= " </head>\n";
$htmout .= "<body bgcolor=linen>\n";
# $htmout .= "<h1>todo</h1>\n";
$htmout .= "<a href=/index.html target=_blank>";
$htmout .= "<img src=ko.png height=20>";
$htmout .= "</a>\n";
$htmout .= "       ";
$htmout .= "$progid $dttm";
$htmout .= "<hr color=goldenrod>\n";
$htmout .= "<table id=table_todo>";
$htmout .= "<tr><td>j</td><td width=100 >url</td><td width=125>id</td><td width=400>find</td></tr>\n";
for( $j=0; $j<count($ids); $j++ ) {
$line=$ids[$j];
$list .= $line;
if( $line === "" ) { continue; }
if( preg_match("/^#/", $line, $matches )) { continue; }
if( preg_match("/^</", $line, $matches)) {
# $list .= $line;
# $htmout .= $line;
# print( "<h2>MSG_385 HTMFMT line=$line</h2><br>\n" );
continue;
}
$id=explode("|",$line)[0];
if( $id === "" ) { continue; }
$find=""; $findtype="";
if( count(explode("|", $line)) > 1 ) {
$idpipe=$id."|";
$find=str_replace($idpipe,"",$line);
}
else {
$find=explode("|",$line)[1];
}
$matches2="";
// print( "<h1>BUGS_680 todo=$todo j=$j id=$id line=$line</h1><br>\n" );
// if( str_contains( $find, "# fb" )) { $findtype="fb"; }
// if( str_contains( $find, "# zm" )) { $findtype="zm"; }
$find=str_replace('<fmt>',$fmt, $find, $matches2);
$find=str_replace('<lim>',$lim, $find, $matches2);
$find=str_replace('<db3>',$db3, $find, $matches2);
$find=str_replace('<tbl>',$tbl, $find, $matches2);
$find=str_replace('<sel>',$sel, $find, $matches2);
$find=str_replace('<fld>',$fld, $find, $matches2);
$find=str_replace('<a>',$a, $find, $matches2);
$find=str_replace('<b>',$b, $find, $matches2);
$find=str_replace('<c>',$c, $find, $matches2);
$find=str_replace('<d>',$d, $find, $matches2);
$find=str_replace('<e>',$e, $find, $matches2);
$find=str_replace('<f>',$f, $find, $matches2);
$find=str_replace('<g>',$g, $find, $matches2);
$find=str_replace('<h>',$h, $find, $matches2);
$find=str_replace('<i>',$i, $find, $matches2);
$find=str_replace('<j>',$j, $find, $matches2);
$find=str_replace('<k>',$k, $find, $matches2);
$find=str_replace('<l>',$l, $find, $matches2);
$find=str_replace('<m>',$m, $find, $matches2);
$find=str_replace('<n>',$n, $find, $matches2);
$find=str_replace('<o>',$o, $find, $matches2);
$find=str_replace('<p>',$p, $find, $matches2);
$find=str_replace('<q>',$q, $find, $matches2);
$find=str_replace('<r>',$r, $find, $matches2);
$find=str_replace('<s>',$s, $find, $matches2);
$find=str_replace('<t>',$t, $find, $matches2);
$find=str_replace('<u>',$u, $find, $matches2);
$find=str_replace('<v>',$v, $find, $matches2);
$find=str_replace('<w>',$w, $find, $matches2);
$find=str_replace('<x>',$x, $find, $matches2);
$find=str_replace('<y>',$y, $find, $matches2);
$find=str_replace('<x>',$z, $find, $matches2);
# print( "<h3>BUGS_460 j=$j id=$id p=$p find=$find</h3>\n") ;
$k=$j+1;
$htmout .= "<tr>";
$htmout .= "<td>$k</td>";
$htmout .= "<td width=100>";
# $htmout .= "<a href=/ko.php?todo=$id target=_blank>\n";
$htmout .= "<a href=./ko_center.php?todo=$id target=_blank>\n";
$htmout .= "<img src=/imgs/btn/koeye.png height=25>";
$htmout .= "</a>";
$htmout .= "</td>\n";
$htmout .= "<td width=125><b>$id</b></td>";
$htmout .= "<td width=470>$find</td>";
$htmout .= "</tr>";
}
$htmout .= " </table>";
$htmout .= "<hr color=goldenrod>\n";
$htmout .= " </body>\n";
$htmout .= " </html>\n";
if( $fmt == "list" ) { print( $list ); }
else { print( $htmout ); }
exit;
}
if( isset( $_REQUEST['todo'] )) {
$todo=$_REQUEST['todo'];
}
if( $todo == "ko_media_psv" ) {
$psvfil="ko_media.psv";
$fmt="psv";
$options=array($psvfil,$fmt);
if( file_exists( $psvfil )) {
$psv=psv_ko_media($options);
}
else {
$psv="ERR_2021 NOTFOUND psvfil=$psvfil fmt=$fmt";
}
print($psv);
exit;
}
if( $todo == "ko_coffeeshop_sql3" ) {
$db3fil="ko.db3";
$fmt="html";
$options=array($db3fil,$fmt);
$sqlout=sql3_ko_coffeeshop($options);
print_r($sqlout);
exit;
}
if( $todo == "sql3_ko_media" ) {
$db3fil="ko.db3";
$fmt="html";
$options=array($db3fil,$fmt);
$sqlout=sql3_ko_media($options);
print($sqlout);
exit;
}
$min=1; $max=3;
if( $todo == "ko" ) {
$id=$todo;
$min=0;$max=0;
$min=1; $max=count(explode(" ",$idfinds_ko))-1;
$random=random_int($min,$max);
$todo=explode(" ",$idfinds_ko)[$random];
}
for( $j=0; $j<count($ids); $j++) {
$line=$ids[$j];
$id=explode("|",$line)[0];
# print( "<h1>BUGS_871 j=$j id=$id line=$line todo=$todo</h1><br>\n" );
if( $id === "" ) { continue; }
if( $id != $todo ) {continue; }
# print( "<h1>BUGS_873 MATCH j=$j id=$id= todo=$todo= line=$line todo=$todo</h1><br>\n" );
# $find=explode("|",$line)[1];
$find=str_replace("$id|","", $line);
# print( "<h1>BUGS_675 id=$id find=$find line=$line</h1>" );
$list="";
$url=$find;
$url = urlcheck($url);
# print( "<h1>MSG_661 query_string=$query_string name=name id=$id find=$find</h1><br>\n" );
$find=str_replace_all($find);
# $find=str_replace("<n>", "$name", $find );
# print( "<h1>MSG_900 j=$j k=$k todo=$todo id=$id find=$find</h1><br>\n" );
$out = "";
# print( "<h1>BUGS_2056 find=$find</h1>" );
# pqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpq
exec( $find, $out, $err );
# bdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbd
$outcnt=count($out);
$script_filename=$_SERVER['SCRIPT_FILENAME']; # /Volumes/ka1tbr2/ht/ka/ko.php
$request_uri=$_SERVER['REQUEST_URI']; # /ka/ko.php?todo=ka_zms
$php_self=$_SERVER['PHP_SELF']; # /ka/ko.php
$query_string=$_SERVER['QUERY_STRING']; # todo=ka_zms
# if( $outcnt == 0 ) {
# $htmout = "";
# $htmout .= "<html><head><title>$request_uri NOTFOUND</title></head>\n";
# $htmout .= "<body bgcolor=wheat>\n";
# $htmout .= "<a href=$php_self target=_blank>";
# $htmout .= "<img src=/imgs/btn/ko.png height=50 border=0>$php_self</a>\n";
# $htmout .= "<h2>ERR_2080 NOTFOUND find=$find</h2>\n";
# $htmout .= "<h3>request_uri=$request_uri</h3>\n";
# $htmout .= "</body></html>\n";
# print( $htmout );
# phpinfo();
# $errtxt="<h2>ERR_2070 NOTFOUND find=$find</h2>\n";
# return($errtxt);
# }
# print( "<h1>BUGS_2060 outcnt=$outcnt fmt=$fmt out=".$out[2]."</h1>" );
$psv="";
$csv="";
$txt="";
$json="";
$json.="{\"todo\": [\n";
$dttm=date('Ymd_His');
$htmout = "";
$htmout .= "<html>\n";
$htmout .= "<head>\n";
$htmout .= " <title>todo=$todo $dttm</title>\n";
$icon="./favicon_ko64.ico";
# $htmout .= "<link rel=\"icon\" href=\"$icon\" type=\"image/icon\">\n";
$icon_png="koeye.png";
$icon_png="ko.png";
$icon_gif="koeye_handhither.gif";
# $htmout .= "<link rel=\"icon\" href=\"$icon_png\" type=\"image/png\">\n";
$htmout .= "<link rel=\"icon\" href=\"$icon_gif\" type=\"image/gif\">\n";
$htmout .= " </head>\n";
$htmout .= "<body bgcolor=linen>\n";
$htmout .= " <div id=div_todo_$todo>\n";
$htmout .= " <h1>div_todo_$todo</h1>\n";
$htmout .= " <hr color=goldenrod>\n";
for( $j=0; $j< count($out); $j++ ) {
$line= $out[$j];
$txt .= $line."\n";
$psv .= $line."|\n";
$csv .= $line.",";
$json .= "{ \"j\":\"".$j."\", \"line\":\"".$line."\" },\n";
}
$psv .= preg_replace("/|$/", "", $psv );
$csv .= preg_replace("/|/", ",", $psv );
// $json .= preg_replace("/},$/", "}", $json );
// $json .= str_lreplace( ",$", "", $json );
$j=""; $line="";
$json .= "{ \"j\":\"".$j."\", \"line\":\"".$line."\" }\n";
// $json .= str_replace_last( ",", "" , $json );
$json .="]}\n\n";
$fmt="";
if( isset( $_REQUEST['fmt'] )) {$fmt=$_REQUEST['fmt']; }
// print( "<h1>BUGS_925 fmt=$fmt</h1>\n" );
if( $fmt == "txt" ) {
header('Content-type: text/plain');
print($txt); exit();
}
if( $fmt == "list" ) { print($txt);exit(); }
if( $fmt == "psv" ) { print($psv); exit(); }
if( $fmt == "csv" ) {
header('Content-type: text/csv');
print($csv); exit();
}
if( $fmt == "json" ) {
header('Content-type: application/json');
print( $json );
exit();
}
$k=1;
# if(! isset( $out[$k] )) {
# print( "<h1>MSG_2100 k=$k NOTFOUND \$out</h1>\n" );
# $url="./index.html?err=out";
# header('Location: '.$url);
# die();
# print( "<h1>MSG_2100 k=$k NOTFOUND \$out</h1>\n" );
# return($k);
# exit();
# }
$line="";
$out = [];
if( count($out) > 0 ) { $line=$out[$k]; }
# print( "<h1>MSG_2110 k=$k line=$line</h1>" );
# print( "<h1>MSG_2111 k=$k id=$id find=$find outcnt=$outcnt out0=".$out[0]." </h1><br>\n" );
# print( "<h2>MSG_704 out4=".$out[4]."</h2>" );
# print( "<h2>MSG_705 out5=".$out[5]."</h2>" );
# print( "<h2>MSG_706 out6=".$out[6]."</h2>" );
# print( "<h2>MSG_707 out7=".$out[7]."</h2>" );
$htmout_table = "";
$htmout_table .= "<table id=table_media>\n";
$htmout_table .= "<tr>";
$htmout_table .= "<td>j</td>";
$htmout_table .= "<td>k</td>";
$htmout_table .= "<td>tot</td>";
$htmout_table .= "<td>link</td>";
$htmout_table .= "<td>group</td>";
$htmout_table .= "<td width=400>base bugs_24480</td>";
$htmout_table .= "</tr>";
# $htmout_table .= "</table>";
$txt = "";
$psv = "";
$csv = "";
$sql = "";
$sql .= "insert into table files (\n";
$json = "";
$json .= "{\n";
# print( "<h1>BUGS_710 skiplist $htmout_table</table></h1>" );
$out_skiplist = skiplist($out);
$out=$out_skiplist;
$j=0; $k=0;
for( $j=0; $j<count($out); $j++ ) {
$k=$j+1;
$line = $out[$j]."\n";
$list .= $line."\n";
$pathfile = $line;
# print( "<h1>BUGS_950 j=$j k=$k line=$line</h1>" );
# $extension = pathinfo($pathfile, PATHINFO_EXTENSION);
$dirname=dirname($pathfile);
$group = str_replace("/","_", $dirname );
$temp= explode('.',$pathfile);
$ext = end($temp);
$base=basename($pathfile,".$ext");
$link = htmout_link($pathfile,'',$find);
# $url=$pathfile;
# $tn="/imgs/btn/koeye.png";
$txt .= "$line\n";
$psv .= "$j|$k|$outcnt|$pathfile|$link|$group|$base\n";
$csv .= "$j,$k,$outcnt,$pathfile,$link,$group,$base\n";
$sql .= "( 'j','k','outcnt',pathfile,'link','group','base' ),";
$json .= "{\n";
$json .= "'j':'$k', ";
$json .= " 'k':'$k', ";
$json .= "'outcnt':'$outcnt', ";
$json .= "'pathfile':'$pathfile', ";
$json .= "'link':'$link', ";
$json .= "'group':'$group', ";
$json .= "'base':'$base' ";
$json .= "},\n";
$htmout_table .= "<tr>";
$htmout_table .= "<td>$j</td>";
$htmout_table .= "<td>$k</td>";
$htmout_table .= "<td>$outcnt</td>";
$htmout_table .= "<td>".htmout_link($pathfile,'',$find)."</td>";
# $htmout_table .= "<td><img src=/imgs/btn/koeye_handhither.gif height=100></td>";
$htmout_table .= "<td>$group</td>";
$htmout_table .= "<td>$base</td>";
$htmout_table .= "</tr>\n";
# print( "<h3>BUGS_740 j=$j k=$k outcnt=$outcnt group=$group base=$base ext=$ext </h3>" );
$htmout_link=htmout_link($pathfile,'',$find);
# print( "<h3>BUGS_2020 j=$j k=$k pathfile=<$pathfile></h3>" );
# print( "<h3>BUGS_2021 j=$j k=$k htmout_link=<$htmout_link> find=$find</h3>" );
}
$json .= " }\n";
$matches = "";
$json = preg_replace( "/,}$/", "}", $matches );
$sql = preg_replace( "/,\)$/", ")", $matches );
$psv = preg_replace( "/|$/", "", $matches );
$csv = preg_replace( "/,$/", "", $matches );
$htmout_table .= " </table>";
$htmout .= "<hr color=goldenrod>";
$htmout .= $htmout_table;
$htmout .= "<hr color=goldenrod>";
$htmout .= " </body>\n";
$htmout .= " </html>\n";
$fmt="";
if( isset($_REQUEST['fmt'])) { $fmt=$_REQUEST['fmt']; }
# print( "<h1>BUGS_1000 find=$find fmt=$fmt</h1>" );
if( $fmt == "txt" ) { print( $txt ); exit; }
if( $fmt == "psv" ) { print( $psv ); exit; }
if( $fmt == "csv" ) { print( $csv ); exit; }
if( $fmt == "sql" ) { print( $sql ); exit; }
if( $fmt == "json" ) {
header('Content-type: application/json');
print( $json );
exit;
}
if( $fmt == "html" ) { print( $htmout ); exit; }
print($htmout); exit;
print( "<h3>BUGS_1021 j=$j k=$k outcnt=$outcnt group=$group base=$base ext=$ext </h3>" );
}
# if( count($out) < 1 ) { print( "<h2>ERR_2160 NOTFOUND find=$find</h2>\n" ); }
$outcnt="";
$group="";
$base="";
$ext="";
# print( "<h3>BUGS_1022 j=$j k=$k outcnt=$outcnt group=$group base=$base ext=$ext </h3>" );
return($htmout);
exit;
}
if( isset($_REQUEST['ls-lat']) || isset($_REQUEST['ls'] )) {
if( isset($_REQUEST['ls-lat'])) {
$request_path=$_REQUEST['ls-lat'];
}
else {
$request_path=$_REQUEST['ls'];
}
# print( "<h1>BUGS_183 request_path=$request_path</h1><br>\n" );
if( $request_path === "" ) { exit; }
$pathparts = pathinfo($request_path);
$dirname=$pathparts['dirname'];
$basename=$pathparts['basename'];
$ext="";
if( isset($pathparts['extension'])) {
$ext=$pathparts['extension'];
}
$path=$dirname;
if( ! is_dir($path)) {
print( "\n<h1>ERR_122 LSLAT NOTFOUND path=$path</h1><br>\n");
exit;
}
$lscmd="ls $request_path";
if( isset($_SERVER['ls-lat'])) {
$lscmd="ls -lat $request_path";
}
# print( "\n<h1>MSG_199 LSLAT lscmd=$lscmd</h1><br>\n");
$htmout = "";
exec( $lscmd, $out, $err );
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
print( $htmout );
exit;
}
if( isset($_REQUEST['find'])) {
# 1 ?find=/fb/zc/pages/*.jpg
# 4 ?find=find $path -name $names
# 6 ?find=find $path -type d -name $names
# 6 ?find=find $path -maxdepth 2 -name $names
# 8 ?find=find $path -type d -maxdepth 2 -name $names
# 4 ?find=find $path -type d
# 6 ?find=find $path -type d -maxdepth $maxdepth
$request_find=""; $findargs=""; $findargs_len=0;
$request_find=$_REQUEST['find'];
$findargs = explode( " ", $request_find );
$findargs_len=count($findargs);
for( $j=0; $j<count($findargs); $j++ ) {
$findargs[$j]=str_replace("\"","",$findargs[$j]);
$findargs[$j]=str_replace("'","",$findargs[$j]);
}
# print( "<h1>BUGS_140 findargs_len=$findargs_len request_find=$request_find</h1><br>\n" );
$path="";
if( count($findargs) === 1 ) {
// print( "<h1>BUGS_141 findargs_len=$findargs_len request_find=$request_find</h1><br>\n" );
// $pathparts = pathinfo($request_find);
// $dirname=$pathparts['dirname'];
// $basename=$pathparts['basename'];
// $ext="";
// if( isset($pathparts['extension'])) {
// $ext=$pathparts['extension'];
// }
// print( "<h1>BUGS_161 dirname=$dirname basename=$basename request_find=$request_find</h1><br>\n" );
// $path=$dirname;
// $name=$basename;
$path="fb";
$type="d";
$maxdepth="1";
$name="??";
if( ! is_dir($path)) {
print( "<h1>ERR_163 NOTFOUND path=$path</h1><br>\n" );
exit;
}
$find="find $path -type $type -maxdepth $maxdepth -name \"$name\"";
// print( "<h1>MSG_164 FOUND path=$path name=$name</h1><br>\n" );
print( "<h1>MSG_2340 FOUND find=$find </h1><br>\n" );
exec( $find, $out, $err );
$htmout="";
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
// print( "<h1>MSG_161 find=$find htmout=$htmout</h1><br>\n" );
print( $htmout );
exit;
}
# print( "<h1>BUGS_150 path=$path request_find=$request_find</h1><br>\n" );
$path="";
$maxdepth="";
$type="";
$names="";
$query_string="";
if( isset( $_SERVER['QUERY_STRING'])) {
$query_string=$_SERVER['QUERY_STRING'];
}
# print( "<h1>BUGS_300 findargs_len=$findargs_len request_find=$request_find query_string=$query_string</h1><br>\n" );
if( $findargs_len === 2 ) {
print( "<h1>BUGS_142 findargs_len=$findargs_len request_find=$request_find</h1><br>\n" );
$path=$findargs[1];
$path=str_replace("\"","",$path );
if( ! is_dir($path)) {
print( "<h1>ERR_143 NOTFOUND path=$path=- request_find=$request_find</h1><br>\n" );
exit;
}
$path="fb"; $type="d"; $maxdepth="1"; $names="??";
$find="find $path -type $type -maxdepth $maxdepth -name \"$names\"";
exec($find,$out,$err);
print( "<h1>BUGS_2380 find=$find</h1><br>\n" );
$htmout="";
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
print( $htmout );
// phpinfo();
// $request_find=str_replace("%20"," ",$request_find);
exit;
}
if( $findargs_len === 3 ) {
print( "<h1>BUGS_303 findargs_len=$findargs_len $request_find=$request_find query_string=$query_string</h1><br>\n" );
exit;
}
// if( $findargs_len === 4 ) {
// print( "<h1>BUGS_304 findargs_len=$findargs_len $request_find=$request_find query_string=$query_string</h1><br>\n" );
// }
if( $findargs_len === 1 ) {
$path="fb";
$type="d";
$maxdepth="1";
$names="??";
$find="find $path -type $type -maxdepth $maxdepth -name \"$names\"";
exec( $find, $out, $err );
print( "BUGS_311 find=$find<br>\n" );
$htmout="";
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
print( $htmout );
// print_r($out);
exit;
}
// if( $findargs_len === 2 ) { exit; }
// if( $findargs_len === 3 ) { exit; }
// if( $findargs_len === 5 ) { exit; }
// if( $findargs_len === 7 ) { exit; }
if( $findargs_len > 8 ) { exit; }
// print( "<h1>BUGS_350 findargs_len=$findargs_len query_string=$query_string</h1>\n" );
if( $findargs_len === 1 ) {
# if( is_file($request_find)) {
# print( "<h1>BUGS_101 is_file FOUND request_find=$request_find</h1>");
# }
# else {
# print( "<h1>BUGS_102 is_file NOTFOUND request_find=$request_find</h1>");
# }
if( $request_find != "" ) {
$pathparts = pathinfo($request_find);
$dirname=$pathparts['dirname'];
$basename=$pathparts['basename'];
$ext="";
if( isset($pathparts['extension'])) {
$ext=$pathparts['extension'];
}
$path=$dirname;
$names=$basename;
$type="f";
if( $ext === "" ) {
$path=$request_find;
$type="";
$names="";
}
# print( "BUGS_150 dirname=$dirname names=$names ext=$ext<br>\n" );
# if( $basename === "" ) { $names=""; }
}
}
# ?find=find $path -name $names
# ?find=find $path -type $type
if( $findargs_len === 4 ) {
$path = $findargs[1];
if ($findargs[2] === "-type" ) { $type=$findargs[3]; }
if ($findargs[2] === "-maxdepth" ) { $maxdepth=$findargs[3]; }
if ($findargs[2] === "-name" ) { $names=$findargs[3]; }
# print( "<h1>BUGS_240 findargs3=".$findargs[3]." request_find=$request_find</h1><br>\n") ;
if( ! is_dir($path)) {
print( "<h1>BUGS_241 NOTFOUND path=$path request_find=$request_find</h1><br>\n") ;
exit;
}
# print( "<h1>BUGS_242 FOUND path=$path request_find=$request_find</h1><br>\n") ;
$find="find $path";
if( $type != "" ) { $find .= " -type $type"; }
if( $maxdepth != "" ) { $find .= " -maxdepth $maxdepth"; }
if( $names != "" ) { $find .= " -name \"$names\""; }
# print( "<h1>BUGS_243 type=$type find=$find request_find=$request_find</h1><br>\n") ;
$htmout="";
exec($find, $out, $err );
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
# print( "<h1>BUGS_249 find=$find htmout=$htmout</h1><br>\n") ;
print( $htmout );
exit;
}
# ?find=find $path -type f -name $names
# ?find=find $path -maxdepth $maxdepth -name $names
# ?find=find $path -type d -maxdepth 1
if( $findargs_len === 6 ) {
# print( "<h1>BUGS_601 request_find=$request_find</h1><br>\n" );
$path="";
$type="";
$maxdepth="";
$names="";
$path = $findargs[1];
if( $findargs[2] === "-type" ) { $type=$findargs[3]; }
if( $findargs[2] === "-maxdepth" ) { $maxdepth=$findargs[3]; }
if( $findargs[2] === "-name" ) { $names=$findargs[3]; }
if( $findargs[4] === "-type" ) { $type=$findargs[5]; }
if( $findargs[4] === "-maxdepth" ) { $maxdepth=$findargs[5]; }
if( $findargs[4] === "-name" ) { $names=$findargs[5]; }
$find="find $path";
if( $type != "" ) { $find .= " -type $type"; }
if( $maxdepth != "" ) { $find .= " -maxdepth $maxdepth"; }
if( $names != "" ) { $find .= " -name \"$names\""; }
$htmout="";
exec( $find, $out, $err );
for($j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
print( $htmout );
exit;
}
# ?find=find $path -type f -maxdepth $maxdepth -name $names
if( $findargs_len === 8 ) {
$path = $findargs[1];
if( ! is_dir($path)) { print( "<h1>NOTFOUND path=$path</h1><br>\n" ); exit; }
$find = "find $path";
if( $findargs[2] === "-type" ) { $type=$findargs[3]; }
if( $findargs[2] === "-maxdepth" ) { $maxdepth=$findargs[3]; }
if( $findargs[2] === "-name" ) { $names=$findargs[3]; }
if( $findargs[4] === "-type" ) { $type=$findargs[5]; }
if( $findargs[4] === "-maxdepth" ) { $maxdepth=$findargs[5]; }
if( $findargs[4] === "-name" ) { $names=$findargs[5]; }
if( $findargs[6] === "-type" ) { $type=$findargs[7]; }
if( $findargs[6] === "-maxdepth" ) { $maxdepth=$findargs[7]; }
if( $findargs[6] === "-name" ) { $names=$findargs[7]; }
if( $type != "" ) { $find .= " -type $type"; }
if( $maxdepth != "" ) { $find .= " -maxdepth $maxdepth"; }
if( $names != "" ) { $find .= " -name \"$names\""; }
$htmout="";
# print( "<h1>BUGS_800 find=$find request_find=$request_find</h1><br>\n" );
exec( $find, $out, $err );
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
print( $htmout );
exit;
}
$find="find $path";
if( $type != "" ) { $find .= " -type $type"; }
if( $maxdepth != "" ) { $find .= " -maxdepth $maxdepth"; }
if( $names != "" ) {
$names=str_replace("\"","",$names);
$names=str_replace("'","",$names);
$find .= " -name \"$names\"";
}
// $find="find $path -type $type -maxdepth $maxdepth -name \"$names\"";
// if( $names === "" ) {
// $find="find $path -type $type -maxdepth $maxdepth";
// }
# print( "<h1>BUGS_101 find=$find</h1>\n");
$htmout="";
$types="http html htm php mp4 mp3 jps png gif";
$l=0;
foreach( $types as $types ) {
if( preg_match( "/$type/", $find, $matches )) {
print( "MSG_680 l=$l type=$type find=$find<br>\n");
window.location($find);
exit;
}
$l++;
}
$url=$find;
# print( "MSG_681 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.http/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_682 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.html/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_683 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.htm/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_684 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.php/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_685 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.mp4/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_686 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.mp3/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_687 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.gif/", $url, $matches )) { window.open($url); exit; }
if( preg_match( "/.jpg/", $url, $matches )) { window.open($url); exit; }
if( preg_match( "/.png/", $url, $matches )) { window.open($url); exit; }
#// $path="fb";
#// $find="find $path -type f -maxdepth 1 -name \"*.*\"";
# if( is_dir($path)) {
#// print( "<h1>MSG_271 find=$find</h1>\n" );
# exec( $find, $out, $err );
#
#// print( "<h1>MSG_272 OUT find=$find</h1>\n" );
# $query_string="";
# if( isset($_SERVER['QUERY_STRING'] )) {
# $query_string=$_SERVER['QUERY_STRING'];
# }
#// print( "<h1>MSG_273 OUT query_string=$query_string</h1>\n" );
#// print_r($out);
# print_r($err);
# $outlen=count($out);
# $htmout="";
# $htmout .= "<hr color=goldenrod>\n";
# $list="";
# for( $j=0; $j<$outlen; $j++ ) {
# $htmout .= $out[$j]."<br>\n";
# $list .= $out[$j]."\n";
# }
# $htmout .= "<hr color=goldenrod>\n";
## print( "<h1>MSG_104 ERR</h1>\n" );
## print_r($err);
# $process = proc_open( $cmd, $descriptorspec, $pipes, $cwd_process );
# print( "<h1>MSG_250 LS DONE find=$find outlen=$outlen</h1>" );
# }
# else {
# print( "<h1>ERR_500 NOTFOUND path=$path request_find=$request_find query_string=$query_string</h1>\n" );
# exit();
# }
print( "<h1>MSG_900 LS DONE find=$find</h1>\n" );
if( $fmt == "list" ) { print ( $list ); return($list); }
if( $fmt == "list" ) { print ( $list ); return($list); }
print( $list );
return( $list );
# exit;
# }
// $path="fb";
// $find="find $path -type f -maxdepth 1 -name \"*.*\"";
if( is_dir($path)) {
// print( "<h1>MSG_271 find=$find</h1>\n" );
exec( $find, $out, $err );
// print( "<h1>MSG_272 OUT find=$find</h1>\n" );
$query_string="";
if( isset($_SERVER['QUERY_STRING'] )) {
$query_string=$_SERVER['QUERY_STRING'];
}
// print( "<h1>MSG_273 OUT query_string=$query_string</h1>\n" );
// print_r($out);
print_r($err);
$outlen=count($out);
$htmout="";
$htmout .= "<hr color=goldenrod>\n";
$list="";
for( $j=0; $j<$outlen; $j++ ) {
$htmout .= $out[$j]."<br>\n";
$list .= $out[$j]."\n";
}
$htmout .= "<hr color=goldenrod>\n";
# print( "<h1>MSG_104 ERR</h1>\n" );
# print_r($err);
# $process = proc_open( $cmd, $descriptorspec, $pipes, $cwd_process );
print( "<h1>MSG_250 LS DONE find=$find outlen=$outlen</h1>" );
}
else {
print( "<h1>ERR_500 NOTFOUND path=$path request_find=$request_find query_string=$query_string</h1>\n" );
exit();
}
# print( "<h1>MSG_109 LS DONE find=$find</h1>\n" );
# print( $htmout );
print( $list );
exit;
}
if( isset($_REQUEST['kolog'])) {
$db3file="ko.db3"; $tblname="kologs";
$todo=$_REQUEST['kolog'];
if( $todo == "" ) {$htmout=kolog($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "new" ) {$htmout=kolog_new($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "add" ) {$htmout=kolog_add($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "del" ) {$htmout=kolog_del($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "upd" ) {$htmout=kolog_upd($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "sel" ) {$htmout=kolog_sel($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "create" ) {$htmout=kolog_create($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "form" ) {$htmout=kolog_form($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "submit" ) {$htmout=kolog_submit($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "list" ) {$htmout=kolog_list($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "bugs" ) {$htmout=kolog_bugs($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "logs" ) {$htmout=kologs($db3file, $tblname, $args); print( $htmout ); exit; }
exit;
}
if( isset($_REQUEST['id'])) {
$id=$_REQUEST['id'];
if( $id == "bookmarkusb" ) {
$htmout=bookmarkusb();
# $htmout=bookmarkusb_form();
exit;
}
if( $id == "bookmarkusb_list" ) {
$htmout=bookmarkusb_list();
exit;
}
if( $id == "bookmarkusb_select" ) {
$htmout=bookmarkusb_select();
exit;
}
if( $id == "bookmarkusb_form" ) {
$htmout=bookmarkusb_form();
exit;
}
# print( "<h1>BUGS_100c REQUEST_id id=$id REQ=".$_REQUEST['id']."</h1><br>" );
}
# startup_ls();
# main_ka1();
# main_tl();
$htmlfile="index.html";
$htmout=read_htmlfile($htmlfile);
print( $htmout );
exit;
startup();
exit;
}
function startup_todo() {
# phpinfo();
$progid="ko";
$dttm=date('Ymd_His');
# $img="/fb/pages/zn/zn_1.jpg";
# $img="/fb/byrdbellvjk/pages/zn/zn_1.jpg";
# $dr=$_SERVER['DOCUMENT_ROOT'];
# $drimg = $dr.$img;
# $htmout="";
# $w=100; $h=150;
# $tn=img2tn($drimg,$w,$h);
# $htmout .= "img=$img<br>\n";
# $htmout .= "drimg=$drimg<br>\n";
# $htmout .= "<a href=$img target=_blank>";
# $htmout .= " <img src=$img height=$h border=0>";
# $htmout .= " </a>\n";
# print( $htmout );
# exit;
# if( isset($_REQUEST['kups'])) {
# $kups=$_REQUEST['kups'];
# $htmout = kups($kups);
# printf( $htmout );
# exit;
# }
if( isset($_REQUEST['plupload'])) {
// printf( "BUGS_305 PLUPLOAD<br>\n" );
$args="args";
$htmout=plupload($args);
printf( $htmout );
exit;
}
if( isset($_REQUEST['contacts'])) {
$htmout="";
$htmout=contacts('');
# printf($htmout);
exit;
}
if( isset($_REQUEST['kov'])) {
$htmout="";
$htmout=kov('');
# printf($htmout);
exit;
}
if( isset($_REQUEST['leds'])) {
$htmout=leds('');
printf( $htmout );
exit;
}
if( isset($_REQUEST['lists'])) {
# $file=""; $dr=""; $j=0; $k=0; $htmout=""; $db3="ko.db3"; $tbl="items";
$file=""; $dr=""; $j=0; $k=0; $htmout=""; $db3="ko_todo.db3"; $tbl="items";
$lists=$_REQUEST['lists'];
$tbl=$lists;
if($_SERVER['DOCUMENT_ROOT']) { $dr=$_SERVER['DOCUMENT_ROOT']; }
$drfile="$dr$file";
$drdb3="$dr$db3";
if( isset($_REQUEST['db3'])) {
$htmout=""; $j=0; $k=0;
$db3=$_REQUEST['db3'];
$db3fil="$dr/$db3";
$sql="select * from $tbl";
$fld="";
if( ! is_file($db3fil)) {
printf( "BUGS_313 NOTFOUND db3fil=$db3fil<br>\n" );
exit;
}
// $htmout .= sqlq( $db3fil, $sql, $fld );
$pdo = newpdo($db3fil);
if( $tbl == "letter" ) {
$sql="select rowid,text,desc from $tbl";
$psv="rowid|text|desc\n";
$sql="select rowid,text,desc from $tbl";
foreach( $pdo->query($sql) as $row ) {
$rowid=$row['rowid'];
$text=$row['text'];
$desc=$row['desc'];
$psv.="$rowid|$text|$desc\n";
}
printf( $htmout."\n".$psv );
exit;
}
if( $tbl == "contacts" ) {
$sql="select rowid,* from $tbl";
$psv="rowid|id|name|phn|firm|url|email|note|action\n";
$sql="select rowid,* from $tbl";
foreach( $pdo->query($sql) as $row ) {
$rowid=$row['rowid'];
$id=$row['id'];
$name=$row['name'];
$phn=$row['phn'];
$firm=$row['firm'];
$url=$row['url'];
$email=$row['email'];
$note=$row['note'];
$action=$row['action'];
$psv.="$rowid|$id|$name|$phn|$firm|$url|$email|$note|$action\n";
}
printf( $htmout."\n".$psv );
exit;
}
if( $tbl == "leds" ) {
$sql="select rowid,* from $tbl";
$psv="ROWID|led_id|led_status|led_code|led_name|led_dttm|led_color|led_speed|led_type|led_date|led_cmd|led_cmdout|led_desc|led_misc|led_city|led_bldg|led_loc_code|led_floor|led_group|led_orgs|led_title|led_published|led_width|led_height|led_comment|led_filename|led_user|led_user_ip|led_referer|led_remote_port|led_viewrole|led_user_agent|led_unique_id|led_err|led_fix|led_os";
$sql="select * from $tbl";
$rowid="";
$j=0;
foreach( $pdo->query($sql) as $row ) {
$j=$j+1;
// $rowid=$row['rowid'];
$led_id=$row['led_id'];
$led_status=$row['led_status'];
$led_code=$row['led_code'];
$led_name=$row['led_name'];
$led_dttm=$row['led_dttm'];
$led_color=$row['led_color'];
$led_speed=$row['led_speed'];
// printf( "BUGS_370 LEDS led_id=$led_id led_code=$led_code led_name=$led_name $led_color $led_speed\n" );
$led_type=$row['led_type'];
$led_date=$row['led_date'];
$led_cmd=$row['led_cmd'];
$led_cmdout=$row['led_cmdout'];
$led_desc=$row['led_desc'];
$led_misc=$row['led_misc'];
$led_city=$row['led_city'];
$led_bldg=$row['led_bldg'];
$led_loc_code=$row['led_loc_code'];
$led_floor=$row['led_floor'];
$led_group=$row['led_group'];
$led_orgs=$row['led_orgs'];
$led_title=$row['led_title'];
$led_published=$row['led_published'];
$led_width=$row['led_width'];
$led_height=$row['led_height'];
$led_comment=$row['led_comment'];
$led_filename=$row['led_filename'];
$led_user=$row['led_user'];
$led_user_ip=$row['led_user_ip'];
$led_referer=$row['led_referer'];
$led_remote_port=$row['led_remote_port'];
$led_viewrole=$row['led_viewrole'];
$led_user_agent=$row['led_user_agent'];
$led_unique_id=$row['led_unique_id'];
$led_err=$row['led_err'];
$led_fix=$row['led_fix'];
$led_os=$row['led_os'];
$psv.="$rowid|$led_id|$led_status|$led_code|$led_name|$led_dttm|$led_color|$led_speed|$led_type|$led_date|$led_cmd|$led_cmdout|$led_desc|$led_misc|$led_city|$led_bldg|$led_loc_code|$led_floor|$led_group|$led_orgs|$led_title|$led_published|$led_width|$led_height|$led_comment|$led_filename|$led_user|$led_user_ip|$led_referer|$led_remote_port|$led_viewrole|$led_user_agent|$led_unique_id|$led_err|$led_fix|$led_os<br>\n";
// printf( "BUGS_400 j=$j psv=$psv\n" );
}
printf( $psv );
exit;
}
$psv="rowid|pathfile|path|file|base|ext|dttm|exif_dt|exif_tm|desc|\n";
$sql="select rowid,pathfile,path,file,base,ext,dttm,exif_dt,exif_tm,desc from $tbl";
foreach( $pdo->query($sql) as $row ) {
$rowid=$row['rowid'];
$pathfile=$row['pathfile'];
$path=$row['path'];
$file=$row['file'];
$base=$row['base'];
$ext=$row['ext'];
$exif_dt=$row['exif_dt'];
$exif_tm=$row['exif_tm'];
$desc=$row['desc'];
$psv.="$rowid|$pathfile|$path|$file|$base|$ext|$dttm|$exif_dt|$exif_tm|$desc|\n";
}
printf( $htmout."\n".$psv );
exit;
}
if( $lists == "items" ) { $file="/ko/lists_items.txt"; }
if( $lists == "contacts" ) { $file="/ko/lists_contacts.txt"; }
if( $lists == "letter" ) { $file="/ko/lists_letter.txt"; }
if( $lists == "monkeytraps" ) { $file="/ko/lists_monkeytraps.txt"; }
if( $lists == "floods" ) { $file="/ko/lists_floods.txt"; }
if( $lists == "postturtles" ) { $file="/lists_postturtles.txt"; }
if( $lists == "coffee" ) { $file="/lists_coffee.txt"; }
$drfile="$dr$file";
if( is_file($drfile)) {
// printf( "BUGS_313 ___FOUND lists=$lists dr=$dr file=$file drfile=$drfile\n" );
$htmout=htmout_load($drfile);
}
else {
printf( "BUGS_313 NOTFOUND lists=$lists dr=$dr file=$file drfile=$drfile\n" );
exit;
}
printf( $htmout );
exit;
}
if( isset($_REQUEST['kups'])) {
$kups=$_REQUEST['kups'];
if( $kups == "" ) {
$htmout = kups('');
}
if( $kups == "review" ) {
$htmout = kups_review('');
}
# printf( "BUGS_295 isset _FILES<br>\n" );
if( $kups == "go" ) {
$htmout = img2dirs();
}
printf( $htmout );
exit;
}
if( isset($_FILES["kups"])) {
printf( "BUGS_295 isset _FILES<br>\n" );
$htmout = img2dirs();
printf( $htmout );
exit;
}
if( isset($_REQUEST["k9"])) {
$k9=$_REQUEST['k9'];
printf( "BUGS_295 isset _K9 k9=$k9<br>\n" );
$htmout = k9($k9);
printf( $htmout );
exit;
}
if( isset($_REQUEST['img2b64'] )) {
# img2b64( $imgfil, $fmt );
# img2b64("./imgs/btn/kobrd.png","png","b64" );
# img2b64("./imgs/bg/ko_colorado_white.jpg","jpg","b64" );
# img2b64("./imgs/btn/kobrd.png","png","html" );
# img2b64("./imgs/btn/kobrd.png","png","" );
$htmout = "";
$htmout .= "<html><head><title>/ko1/ko_todo.php?img2b64 20230129_1700</title></head>\n";
$img2b64=$_REQUEST['img2b64'];
$htm_koeye = gdImgToHTML( "./imgs/btn/koeye.png", $format='png' );
$htm_kobrd = gdImgToHTML( "./imgs/btn/kobrd.png", $format='png' );
$img_koeye = img2b64("./imgs/btn/koeye.png","png","html");
$img_kobrd = img2b64("./imgs/btn/kobrd.png","png","html");
$b64_koeye = img2b64("./imgs/btn/koeye.png","png","b64");
$b64_kobrd = img2b64("./imgs/btn/kobrd.png","png","b64");
$htmout .= "<a href=./imgs/btn/koeye.png target=_blank>\n";
$htmout .= $htm_koeye;
$htmout .= "</a><br>\n";
$htmout .= "<a href=./imgs/btn/kobrd.png target=_blank>\n";
$htmout .= $htm_kobrd;
$htmout .= "</a><br>\n";
$htmout .= "<hr color=black>\n";
$htmout .= "<a href=./imgs/btn/koeye.png target=_blank>\n";
$htmout .= $img_koeye;
$htmout .= "</a><br>\n";
$htmout .= "<a href=./imgs/btn/kobrd.png target=_blank>\n";
$htmout .= $img_kobrd;
$htmout .= "</a><br>\n";
$htmout .= "<hr color=black>\n";
$htmout .= "<a href=./imgs/btn/koeye.png target=_blank>\n";
$htmout .= "<img src=".$b64_koeye." height=30 border=0>\n";
$htmout .= "</a><br>\n";
$htmout .= "<a href=./imgs/btn/kobrd.png target=_blank>\n";
$htmout .= "<img src=". $b64_kobrd." height=30 border=0>\n";
$htmout .= "</a><br>\n";
$htmout .= " </body>\n";
$htmout .= " </html>\n";
printf( $htmout);
exit;
}
if( isset($_FILES["image"])) {
printf( "BUGS_295 isset _FILES<br>\n" );
$htmout = img2dirs();
printf( $htmout );
exit;
}
if( isset($_REQUEST['txt2imgs'])) {
$htmout=txt2imgs('');
printf($htmout);
exit;
}
if( isset($_REQUEST['txt2img'])) {
$htmout="";
$img="./imgs/btn/koeye.png";
$fmt="b64";
$imgfil="./imgs/btn/kobrd.png";
$fontid="yokkmokk";
$text="sophia";
$fmt="";
$savefile="./imgs/btn/koeye_sophia.png";
$htmout=txt2img($imgfil,$fontid,$text,$fmt,$save);
printf($htmout);
exit;
}
if( isset($_REQUEST['gd'])) {
$options="";
$gd=$_REQUEST['gd'];
$htmout = gd($gd);
printf($htmout);
exit;
}
if( isset($_REQUEST['img2tn'])) {
$htmout = "";
$img=$_REQUEST['img2tn'];
if( $img == "" ) { $img="/fb/pages/zn/zn_1.jpg"; }
$htmout .= "<h1>BUGS_290 img2tn img=$img</h1>";
$htmout=img2tn($img);
printf( $htmout );
}
if( isset($_REQUEST['kin'])) {
$htmout = "";
$options="kin_options";
$htmout .= "<h1>BUGS_291 kin options=$options</h1>";
kin($options);
}
if( isset($_REQUEST['kup'])) {
printf( "<h1>BUGS_292 kup ko_kup</h1>" );
startup();
}
if( isset($_REQUEST['ko_kup'])) {
printf( "<h1>BUGS_293 ko_kup</h1>" );
ko_kup();
}
$args=array();
$id="";
$query_string="";
if( isset($_REQUEST['QUERY_STRING'])) {
$query_string = $_REQUEST['QUERY_string'];
}
# print( "\n<h1>BUGS_101 ko.php MAIN query_string=$query_string</h1><br>\n" );
if( isset($_REQUEST['ko_form']) || isset($_REQUEST['ko_form'] )) {
ko_form('');
exit;
}
if( isset($_REQUEST['ko_form_submit']) || isset($_REQUEST['ko_form_submit'] )) {
phpinfo();
exit;
}
if( isset($_REQUEST['scrub_upload_form']) || isset($_REQUEST['scrub_upload_form'] )) {
$options="";
scrub_upload_form( $options );
exit;
}
if( isset($_REQUEST['ko_upload']) || isset($_REQUEST['ko_upload2'] )) {
$options="";
$htmout=ko_upload2();
printf( "$htmout" );
exit;
}
if( isset($_REQUEST['ko_uploads']) || isset($_REQUEST['ko_uploads'] )) {
$options="";
$htmout=ko_uploads($options);
printf( "$htmout" );
exit;
}
if( isset($_REQUEST['bugs']) || isset($_REQUEST['bugs'] )) {
$options="";
$htmout=bugs($options);
printf( "<h1>BUGS_100 $htmout </h1>\n" );
exit;
}
$dbname="dgs";
$db3fil="$dbname.db3";
if( isset($_REQUEST['db2']) || isset($_REQUEST['db2'] )) {
$request_db2=$_REQUEST['db2'];
$server="localhost";
$user="root";
$pass="..root";
$htmout = "";
# $htmout .= htmout_head('db2');
$htmout .= "<html><head>\n";
$htmout .= htmout_load('ko_scripts.html');
$htmout .= htmout_load('ko_styles.html');
$htmout .= " </head>";
$htmout .= "<body bgcolor=linen onload=\"startup('db2);return false;\" >\n";
$htmout .= "<img src=\"/imgs/btn/koeye.png\" onclick=\"toggle('div_db2'); return false;\" height=24>\n";
$htmout .= "<div id=div_db2>\n";
$htmout .= " <hr color=goldenrod>\n";
$htmout .= " <h1>div_db2<h1>\n";
$server="localhost";
$dbname="dgs";
$sql2="show tables;";
$sql2="select * from ko_temp";
$sql2="select * from Players";
$dbname="zc"; $sql2="select * from Products";
$dbname="zc"; $sql2="select * from Categories";
$dbname="zc"; $sql2="select count(*) from Products";
$dbname="dgs"; $sql2="describe Players";
$dbname="dgs"; $sql2="show tables;";
$dbname="zc"; $sql2="show tables;";
$dbname="dgs"; $sql2="show tables;";
$db3fil="$dbname.db3";
$tblnum=1;
$dbname="dgs";
$j=0;
if( preg_match("/show/", $request_db2 )) {
$dbname="dgs"; $tbl="ko_temp";
$sql="show tables";
if( preg_match("/show_dgs/", $request_db2 )) { $dbname="dgs"; }
if( preg_match("/show_zc/", $request_db2 )) { $dbname="zc"; }
# print( "<h3>MSG_716 DB2 SHOW tbl=$tbl sql=$sql</h3>" );
$htmout_db2_query=db2_query( $server,$dbname,$tbl,$sql, $db3fil, $user,$pass );
print( $htmout_db2_query );
}
# print( "<h3>MSG_290 DB2 SELECT HEAD</h3>" );
if( preg_match("/select/", $request_db2 )) {
$tbl="ko_temp";
if( count(explode("_",$request_db2)) > 0 ) {
$tbl=explode("select_", $request_db2)[1];
}
$sql="select * from $tbl";
# print( "<h3>MSG_291 DB2 SELECT dbname=$dbname tbl=$tbl sq1=$sql</h3>" );
$htmout_db2_query=db2_query( $server,$dbname,$tbl,$sql, $db3fil, $user,$pass );
print( $htmout_db2_query );
}
if (( $_REQUEST['db2'] == "creates" ) || ( $_REQUEST['db2'] == "creates" )) {
# print( "<h3>BUGS_275 dbname=$dbname db3fil=$db3fil tbls_len=$tbls_len</h3>\n" );
$tbls=explode("\n", show_tables($dbname));
$tbls_len=count($tbls);
# print( "<h3>BUGS_270 dbname=$dbname db3fil=$db3fil tbls_len=$tbls_len</h3>\n" );
foreach( $tbls as $tbl ) {
if( $tbl == "" ) {
# print( "<h1>BUGS_270 SKIP j=$j tbl=$tbl</h1>" );
continue;
}
$j=$j+1;
$sql2="describe $tbl;";
$sql="";
print( "<h2>BUGS_280 j=$j dbname=$dbname tbl=$tbl sql=$sql db3fil=$db3fil</h2>" );
# mysql2sql3_insert( $server,$dbname,$tbl,$user,$pass,$db3fil);
mysql2sql3_create( $server,$dbname,$tbl,$user,$pass,$db3fil);
}
}
if (( $_REQUEST['db2'] == "inserts" ) || ( $_REQUEST['db2'] == "inserts" )) {
# print( "<h3>BUGS_275 dbname=$dbname db3fil=$db3fil tbls_len=$tbls_len</h3>\n" );
$tbls=explode("\n", show_tables($dbname));
$tbls_len=count($tbls);
# print( "<h3>BUGS_270 dbname=$dbname db3fil=$db3fil tbls_len=$tbls_len</h3>\n" );
foreach( $tbls as $tbl ) {
if( $tbl == "" ) {
# print( "<h1>BUGS_270 SKIP j=$j tbl=$tbl</h1>" );
continue;
}
$j=$j+1;
$sql2="describe $tbl;";
$sql="";
print( "<h2>BUGS_280 j=$j dbname=$dbname tbl=$tbl sql=$sql db3fil=$db3fil</h2>" );
mysql2sql3_insert( $server,$dbname,$tbl,$user,$pass,$db3fil);
mysql2sql3_create( $server,$dbname,$tbl,$user,$pass,$db3fil);
}
}
$user="root"; $pass="..root";
print( "<h1>BUGS_100 DB2</h1>" );
if( isset( $_REQUEST['db2'] )) { $dbname=$_REQUEST['db2']; }
if( isset( $_REQUEST['user'] )) { $user=$_REQUEST['user']; }
if( isset( $_REQUEST['db3fil'] )) { $db3fil=$_REQUEST['db3fil']; }
if( isset( $_REQUEST['sql'] )) { $sql=$_REQUEST['sql']; }
if( isset( $_REQUEST['fmt'] )) { $fmt=$_REQUEST['fmt']; }
$j=0; $k=0; $i=0;
if( isset( $_REQUEST['tbl'] )) { $tbl=$_REQUEST['tbl']; }
$dbname="zc"; $tbl="ko_temp";
$dbname="dgs"; $tbl="ko_temp";
$dbname="dgs"; $tbl="Players";
if( $dbname == "" ) { $dbname="dgs"; }
if( $dbname == "" ) { $dbname="zc"; }
# $db2=db2_connect($server,$dbname,$user,$pass);
# $htmout_db2_query = db2_query($db2,$dbname,$sql2 );
# $htmout_db2_exec = db2_exec($db2,$dbname,$sql2 );
print( "<h1>BUGS_310 j=$j k=$k dbname=$dbname tbl=$tbl sql2=$sql2</h1>" );
$htmout .= " </div>\n";
$htmout .= htmout_load('ko_divs.html');
$htmout .= htmout_tail('db2');
print($htmout);
exit;
}
if( isset($_REQUEST['db3']) || isset($_REQUEST['db3'] )) {
$htmout = "";
# $htmout .= htmout_head('db3');
$htmout .= "<html><head>\n";
$htmout .= " <title>$progid $dttm db3</title>\n";
$htmout .= htmout_load('ko_styles.html');
$htmout .= htmout_load('ko_scripts.html');
$htmout .= " </head>\n";
$htmout .= "<body bgcolor=linen onload=\"startup('db3);return false;\" >\n";
$htmout .= "<img src=\"/imgs/btn/koeye.png\" onclick=\"toggle('div_db3'); return false;\" height=24>\n";
$htmout .= "<div id=div_db3>\n";
$htmout .= " <hr color=goldenrod>\n";
$htmout .= " <h1>div_db3<h1>\n";
$htmout .= db3($db3fil);
$htmout .= " </div>\n";
$htmout .= htmout_load('ko_divs.html');
$htmout .= htmout_tail('db3');
print($htmout);
exit;
}
if( isset($_REQUEST['file']) || isset($_REQUEST['file'] )) {
$filnam=$_REQUEST['file'];
if( file_exists( $filnam )) {
$filtxt=read_htmlfile($filnam);
print($filtxt);
}
else {
print( "ERR_430: NOTFOUND filnam=$filnam<br>\n" );
}
exit;
}
if( isset($_REQUEST['ko_coffeeshop']) || isset($_REQUEST['ko_coffeeshop'] )) {
$gid=""; $fmt="";
if( isset( $_REQUEST['db3'] )) { $db3=$_REQUEST['db3']; }
if( isset( $_REQUEST['fmt'] )) { $fmt=$_REQUEST['fmt']; }
$request="ko_coffeeshop";
$txt=""; $csv=""; $psv="";
$htmout=""; $htmout_table_head=""; $htmout_table_body="";
// print( "<h1>BUGS_400 gid=$gid fmt=$fmt</h1>" );
$json="{ \"$request\": [\n";
$htmout_table_head = "<table id=table_$request>\n";
$htmout_table_head .= "<tr><td style='text-align:center' colspan=14>gameid: $gid</td></tr>\n";
$htmout_table_head .= "<tr>";
$htmout_table_head .= "<td>row</td>";
$htmout_table_head .= "<td>ord</td>";
$htmout_table_head .= "<td>no</td>";
$htmout_table_head .= "<td>id</td>";
$htmout_table_head .= "<td>status</td>";
$htmout_table_head .= "<td>dttm</td>";
$htmout_table_head .= "<td>grp</td>";
$htmout_table_head .= "<td>item</td>";
$htmout_table_head .= "<td>logo</td>";
$htmout_table_head .= "<td>coffee_id</td>";
$htmout_table_head .= "<td>coffee_url</td>";
$htmout_table_head .= "<td>coffee_tn</td>";
$htmout_table_head .= "<td>logo</td>";
$htmout_table_head .= "<td>hostid</td>";
$htmout_table_head .= "<td>host</td>";
$htmout_table_head .= "<td>pdf</td>";
$htmout_table_head .= "<td>pdftxt</td>";
$htmout_table_head .= "<td>fb</td>";
$htmout_table_head .= "<td>fbtxt</td>";
$htmout_table_head .= "<td>gif</td>";
$htmout_table_head .= "<td>giftxt</td>";
$htmout_table_head .= "<td>mp3</td>";
$htmout_table_head .= "<td>mp3txt</td>";
$htmout_table_head .= "<td>mp4</td>";
$htmout_table_head .= "<td>mp4txt</td>";
$htmout_table_head .= "<td>bc</td>";
$htmout_table_head .= "<td>bctxt</td>";
$htmout_table_head .= "<td>yt</td>";
$htmout_table_head .= "<td>yttxt</td>";
$htmout_table_head .= "<td>pn</td>";
$htmout_table_head .= "<td>pntxt</td>";
$htmout_table_head .= "<td>sl</td>";
$htmout_table_head .= "<td>sltxt</td>";
$htmout_table_head .= "<td>tl</td>";
$htmout_table_head .= "<td>tltxt</td>";
$htmout_table_head .= "<td>tx</td>";
$htmout_table_head .= "<td>txtxt</td>";
$htmout_table_head .= "<td>zm</td>";
$htmout_table_head .= "<td>zmtxt</td>";
$htmout_table_head .= "<td>hostid</td>";
$htmout_table_head .= "<td>host</td>";
$htmout_table_head .= "<td>home</td>";
$htmout_table_head .= "<td>name</td>";
$htmout_table_head .= "<td>email</td>";
$htmout_table_head .= "<td>phn</td>";
$htmout_table_head .= "<td>fab</td>";
$htmout_table_head .= "<td>gab</td>";
$htmout_table_head .= "<td>pl</td>";
$htmout_table_head .= "<td>pt</td>";
$htmout_table_head .= "<td>ss</td>";
$htmout_table_head .= "<td>ts</td>";
$htmout_table_head .= "<td>tw</td>";
$htmout_table_head .= "<td>jitsi</td>";
$htmout_table_head .= "<td>chat</td>";
$htmout_table_head .= "<td>item</td>";
$htmout_table_head .= "<td>cnt</td>";
$htmout_table_head .= "<td>amt</td>";
$htmout_table_head .= "<td>note</td>";
$htmout_table_head .= "</tr>\n";
$psvhdr=""; $psvdta ="";
$psvhdr .= "row|ord|no|id|status|dttm|grp|item|logo|";
$psvhdr .= "coffee_id|coffee_url|coffee_tn|";
$psvhdr .= "fb|fbtxt|pdf|pdftxt|gif|giftxt|";
$psvhdr .= "mp3|mp3txt|mp4|mp4txt|bc|bctxt|rm|rmtxt|vm|vmtxt|yt|yttxt|";
$psvhdr .= "pn|pntxt|sl|sltxt|tl|tltxt|tx|txtxt|zm|zmtxt|";
$psvhdr .= "hostid|host|home|name|email|phn|";
$psvhdr .= "fab|gab|li|pl|pt|ss|ts|tw|jitsi|chat|";
$psvhdr .= "dm|dmtxt|dr|drtxt|gp|gptxt|js|jstxt|wm|wmtxt|zh|zhtxt|";
$psvhdr .= "itm|cnt|amt|note";
$psvhdr .= "\n";
$db3fil="ko.db3"; $fld=""; $output = "";
$sql="select * from ko_coffeeshop";
// $sql="select * from ko_coffeeshop where gid='$gid'";
// $bxbys = sqlq( $db3fil, $sql, $fld );
$pdo = newpdo($db3fil);
foreach( $pdo->query($sql) as $row ) {
$rowno=$row['rowno'];
$ord=$row['ord'];
$no=$row['no'];
$id=$row['id'];
$status=$row['status'];
$dttm=$row['dttm'];
$grp=$row['grp'];
$item=$row['item'];
$logo=$row['logo'];
$coffee_id=$row['coffee_id'];
$coffee_url=$row['coffee_url'];
$coffee_tn=$row['coffee_tn'];
$fb=$row['fb'];
$fbtxt=$row['fbtxt'];
$pdf=$row['pdf'];
$pdftxt=$row['pdftxt'];
$gif=$row['gif'];
$giftxt=$row['giftxt'];
$mp3=$row['mp3'];
$mp3txt=$row['mp3txt'];
$mp4=$row['mp4'];
$mp4txt=$row['mp4txt'];
$bc=$row['bc'];
$bctxt=$row['bctxt'];
$rm=$row['rm'];
$rmtxt=$row['rmtxt'];
$vm=$row['vm'];
$vmtxt=$row['vmtxt'];
$yt=$row['yt'];
$yttxt=$row['yttxt'];
$pn=$row['pn'];
$pntxt=$row['pntxt'];
$sl=$row['sl'];
$sltxt=$row['sltxt'];
$tl=$row['tl'];
$tltxt=$row['tltxt'];
$tx=$row['tx'];
$txtxt=$row['txtxt'];
$zm=$row['zm'];
$zmtxt=$row['zmtxt'];
$hostid=$row['hostid'];
$host=$row['host'];
$home=$row['home'];
$name=$row['name'];
$email=$row['email'];
$phn=$row['phn'];
$fab=$row['fab'];
$gab=$row['gab'];
$li=$row['li'];
$pl=$row['pl'];
$pt=$row['pt'];
$ss=$row['ss'];
$ts=$row['ts'];
$tw=$row['tw'];
$jitsi=$row['jitsi'];
$chat=$row['chat'];
$dm=$row['dm'];
$dmtxt=$row['dmtxt'];
$dr=$row['dr'];
$drtxt=$row['drtxt'];
$gp=$row['gp'];
$gbtxt=$row['gbtxt'];
$js=$row['js'];
$jstxt=$row['jstxt'];
$wm=$row['wm'];
$wmtxt=$row['wmtxt'];
$zh=$row['zh'];
$zhtxt=$row['zhtxt'];
$itm=$row['itm'];
$cnt=$row['cnt'];
$amt=$row['amt'];
$note=$row['note'];
$psvdta .= "$rowno|";
$psvdta .= "$ord|";
$psvdta .= "$no|";
$psvdta .= "$id|";
$psvdta .= "$status|";
$psvdta .= "$dttm|";
$psvdta .= "$grp|";
$psvdta .= "$item|";
$psvdta .= "$logo|";
$psvdta .= "$coffee_id|";
$psvdta .= "$coffee_url|";
$psvdta .= "$coffee_tn|";
$psvdta .= "$fb|";
$psvdta .= "$fbtxt|";
$psvdta .= "$pdf|";
$psvdta .= "$pdftxt|";
$psvdta .= "$gif|";
$psvdta .= "$giftxt|";
$psvdta .= "$mp3|";
$psvdta .= "$mp3txt|";
$psvdta .= "$mp4|";
$psvdta .= "$mp4txt|";
$psvdta .= "$bc|";
$psvdta .= "$bctxt|";
$psvdta .= "$rm|";
$psvdta .= "$rmtxt|";
$psvdta .= "$vm|";
$psvdta .= "$vmtxt|";
$psvdta .= "$yt|";
$psvdta .= "$yttxt|";
$psvdta .= "$pn|";
$psvdta .= "$pntxt|";
$psvdta .= "$sl|";
$psvdta .= "$sltxt|";
$psvdta .= "$tl|";
$psvdta .= "$tltxt|";
$psvdta .= "$tx|";
$psvdta .= "$txtxt|";
$psvdta .= "$zm|";
$psvdta .= "$zmtxt|";
$psvdta .= "$hostid|";
$psvdta .= "$host|";
$psvdta .= "$home|";
$psvdta .= "$name|";
$psvdta .= "$email|";
$psvdta .= "$phn|";
$psvdta .= "$fab|";
$psvdta .= "$gab|";
$psvdta .= "$li|";
$psvdta .= "$pl|";
$psvdta .= "$pt|";
$psvdta .= "$ss|";
$psvdta .= "$ts|";
$psvdta .= "$tw|";
$psvdta .= "$jitsi|";
$psvdta .= "$chat|";
$psvdta .= "$bitchute|";
$psvdta .= "$bitchutetxt|";
$psvdta .= "$shopify|";
$psvdta .= "$shopifytxt|";
$psvdta .= "$squareup|";
$psvdta .= "$squareuptxt|";
$psvdta .= "$stripe|";
$psvdta .= "$stripetxt|";
$psvdta .= "$dm|";
$psvdta .= "$dmtxt|";
$psvdta .= "$dr|";
$psvdta .= "$drtxt|";
$psvdta .= "$gp|";
$psvdta .= "$gptxt|";
$psvdta .= "$js|";
$psvdta .= "$jstxt|";
$psvdta .= "$wm|";
$psvdta .= "$wmtxt|";
$psvdta .= "$zh|";
$psvdta .= "$zhtxt|";
$psvdta .= "$itm|";
$psvdta .= "$cnt|";
$psvdta .= "$amt|";
$psvdta .= "$note<br>\n";
$json .= "{\n";
$json .= "\"rowno\":\"$rowno\",\n";
$json .= "\"ord\":\"$ord\",\n";
$json .= "\"no\":\"$no\",\n";
$json .= "\"id\":\"$id\",\n";
$json .= "\"status\":\"$status\",\n";
$json .= "\"dttm\":\"$dttm\",\n";
$json .= "\"grp\":\"$grp\",\n";
$json .= "\"item\":\"$item\",\n";
$json .= "\"logo\":\"$host\",\n";
$json .= "\"coffee_id\":\"$coffee_id\",\n";
$json .= "\"coffee_url\":\"$coffee_url\",\n";
$json .= "\"coffee_tn\":\"$coffee_tn\",\n";
$json .= "\"fb\":\"$fb\",\n";
$json .= "\"fbtxt\":\"$fbtxt\",\n";
$json .= "\"pdf\":\"$pdf\",\n";
$json .= "\"pdftxt\":\"$pdftxt\",\n";
$json .= "\"gif\":\"$gif\",\n";
$json .= "\"giftxt\":\"$giftxt\",\n";
$json .= "\"mp3\":\"$mp3\",\n";
$json .= "\"mp3txt\":\"$mp3txt\",\n";
$json .= "\"mp4\":\"$mp4\",\n";
$json .= "\"mp4txt\":\"$mp4txt\",\n";
$json .= "\"bc\":\"$bc\",\n";
$json .= "\"bctxt\":\"$bctxt\",\n";
$json .= "\"rm\":\"$rm\",\n";
$json .= "\"rmtxt\":\"$rmtxt\",\n";
$json .= "\"vm\":\"$vm\",\n";
$json .= "\"vmtxt\":\"$vmtxt\",\n";
$json .= "\"yt\":\"$yt\",\n";
$json .= "\"yttxt\":\"$yttxt\",\n";
$json .= "\"pn\":\"$pn\",\n";
$json .= "\"pntxt\":\"$pntxt\",\n";
$json .= "\"sl\":\"$sl\",\n";
$json .= "\"sltxt\":\"$sltxt\",\n";
$json .= "\"tl\":\"$tl\",\n";
$json .= "\"tltxt\":\"$tltxt\",\n";
$json .= "\"tx\":\"$tx\",\n";
$json .= "\"txtxt\":\"$txtxt\",\n";
$json .= "\"zm\":\"$zm\",\n";
$json .= "\"zmtxt\":\"$zmtxt\",\n";
$json .= "\"hostid\":\"$hostid\",\n";
$json .= "\"host\":\"$host\",\n";
$json .= "\"home\":\"$home\",\n";
$json .= "\"name\":\"$name\",\n";
$json .= "\"email\":\"$email\",\n";
$json .= "\"phn\":\"$phn\",\n";
$json .= "\"fab\":\"$fab\",\n";
$json .= "\"gab\":\"$gab\",\n";
$json .= "\"pl\":\"$pl\",\n";
$json .= "\"pt\":\"$pt\",\n";
$json .= "\"ss\":\"$ss\",\n";
$json .= "\"ts\":\"$ts\",\n";
$json .= "\"tw\":\"$tw\",\n";
$json .= "\"jitsi\":\"$jitsi\",\n";
$json .= "\"chat\":\"$chat\",\n";
$json .= "\"dm\":\"$dm\",\n";
$json .= "\"dmtxt\":\"$dmtxt\",\n";
$json .= "\"dr\":\"$dr\",\n";
$json .= "\"drtxt\":\"$drtxt\",\n";
$json .= "\"gp\":\"$gp\",\n";
$json .= "\"gptxt\":\"$gptxt\",\n";
$json .= "\"js\":\"$js\",\n";
$json .= "\"jstxt\":\"$jstxt\",\n";
$json .= "\"wm\":\"$wm\",\n";
$json .= "\"wmtxt\":\"$wmtxt\",\n";
$json .= "\"zh\":\"$zh\",\n";
$json .= "\"zhtxt\":\"$zhtxt\",\n";
$json .= "\"itm\":\"$itm\",\n";
$json .= "\"cnt\":\"$cnt\",\n";
$json .= "\"amt\":\"$amt\",\n";
$json .= "\"note\":\"$note\"\n";
$json .= "},\n";
$htmout_table_body .= "<tr>";
$htmout_table_body .= "<td>".$row['rowno']."</td>";
$htmout_table_body .= "<td>".$row['ord']."</td>";
$htmout_table_body .= "<td>".$row['no']."</td>";
$htmout_table_body .= "<td>".$row['id']."</td>";
$htmout_table_body .= "<td>".$row['status']."</td>";
$htmout_table_body .= "<td>".$row['dttm']."</td>";
$htmout_table_body .= "<td>".$row['grp']."</td>";
$htmout_table_body .= "<td>".$row['item']."</td>";
$htmout_table_body .= "<td>".$row['logo']."</td>";
$htmout_table_body .= "<td>".$row['coffee_id']."</td>";
$htmout_table_body .= "<td>".$row['coffee_url']."</td>";
$htmout_table_body .= "<td>".$row['coffee_tn']."</td>";
$htmout_table_body .= "<td>".$row['fb']."</td>";
$htmout_table_body .= "<td>".$row['fbtxt']."</td>";
$htmout_table_body .= "<td>".$row['pdf']."</td>";
$htmout_table_body .= "<td>".$row['pdftxt']."</td>";
$htmout_table_body .= "<td>".$row['gif']."</td>";
$htmout_table_body .= "<td>".$row['giftxt']."</td>";
$htmout_table_body .= "<td>".$row['mp3']."</td>";
$htmout_table_body .= "<td>".$row['mp3txt']."</td>";
$htmout_table_body .= "<td>".$row['mp4']."</td>";
$htmout_table_body .= "<td>".$row['mp4txt']."</td>";
$htmout_table_body .= "<td>".$row['bc']."</td>";
$htmout_table_body .= "<td>".$row['bctxt']."</td>";
$htmout_table_body .= "<td>".$row['rm']."</td>";
$htmout_table_body .= "<td>".$row['rmtxt']."</td>";
$htmout_table_body .= "<td>".$row['vm']."</td>";
$htmout_table_body .= "<td>".$row['vmtxt']."</td>";
$htmout_table_body .= "<td>".$row['yt']."</td>";
$htmout_table_body .= "<td>".$row['yttxt']."</td>";
$htmout_table_body .= "<td>".$row['pn']."</td>";
$htmout_table_body .= "<td>".$row['pntxt']."</td>";
$htmout_table_body .= "<td>".$row['sl']."</td>";
$htmout_table_body .= "<td>".$row['sltxt']."</td>";
$htmout_table_body .= "<td>".$row['tl']."</td>";
$htmout_table_body .= "<td>".$row['tltxt']."</td>";
$htmout_table_body .= "<td>".$row['tx']."</td>";
$htmout_table_body .= "<td>".$row['txtxt']."</td>";
$htmout_table_body .= "<td>".$row['zm']."</td>";
$htmout_table_body .= "<td>".$row['zmtxt']."</td>";
$htmout_table_body .= "<td>".$row['hostid']."</td>";
$htmout_table_body .= "<td>".$row['host']."</td>";
$htmout_table_body .= "<td>".$row['home']."</td>";
$htmout_table_body .= "<td>".$row['name']."</td>";
$htmout_table_body .= "<td>".$row['email']."</td>";
$htmout_table_body .= "<td>".$row['phn']."</td>";
$htmout_table_body .= "<td>".$row['fab']."</td>";
$htmout_table_body .= "<td>".$row['gab']."</td>";
$htmout_table_body .= "<td>".$row['li']."</td>";
$htmout_table_body .= "<td>".$row['pl']."</td>";
$htmout_table_body .= "<td>".$row['pt']."</td>";
$htmout_table_body .= "<td>".$row['ss']."</td>";
$htmout_table_body .= "<td>".$row['ts']."</td>";
$htmout_table_body .= "<td>".$row['tw']."</td>";
$htmout_table_body .= "<td>".$row['jitsi']."</td>";
$htmout_table_body .= "<td>".$row['dm']."</td>";
$htmout_table_body .= "<td>".$row['dmtxt']."</td>";
$htmout_table_body .= "<td>".$row['dr']."</td>";
$htmout_table_body .= "<td>".$row['drtxt']."</td>";
$htmout_table_body .= "<td>".$row['gp']."</td>";
$htmout_table_body .= "<td>".$row['gptxt']."</td>";
$htmout_table_body .= "<td>".$row['js']."</td>";
$htmout_table_body .= "<td>".$row['jstxt']."</td>";
$htmout_table_body .= "<td>".$row['wm']."</td>";
$htmout_table_body .= "<td>".$row['wmtxt']."</td>";
$htmout_table_body .= "<td>".$row['zh']."</td>";
$htmout_table_body .= "<td>".$row['zhtxt']."</td>";
$htmout_table_body .= "<td>".$row['itm']."</td>";
$htmout_table_body .= "<td>".$row['cnt']."</td>";
$htmout_table_body .= "<td>".$row['amt']."</td>";
$htmout_table_body .= "<td>".$row['note']."</td>";
$htmout_table_body .= "</tr>\n";
}
$psv = $psvhdr . $psvdta;
$csv=str_replace("|",",",$psv);
$txt=str_replace("|"," ",$psv);
$json .= "{\n";
$json .= "\"rowno\":\"$rowno\",\n";
$json .= "\"ord\":\"$ord\",\n";
$json .= "\"no\":\"$no\",\n";
$json .= "\"id\":\"$id\",\n";
$json .= "\"status\":\"$status\",\n";
$json .= "\"dttm\":\"$dttm\",\n";
$json .= "\"grp\":\"$grp\",\n";
$json .= "\"item\":\"$item\",\n";
$json .= "\"logo\":\"$logo\",\n";
$json .= "\"coffee_id\":\"$coffee_id\",\n";
$json .= "\"coffee_url\":\"$coffee_url\",\n";
$json .= "\"coffee_tn\":\"$coffee_tn\",\n";
$json .= "\"fb\":\"$fb\",\n";
$json .= "\"fbtxt\":\"$fbtxt\",\n";
$json .= "\"pdf\":\"$pdf\",\n";
$json .= "\"pdftxt\":\"$pdftxt\",\n";
$json .= "\"gif\":\"$gif\",\n";
$json .= "\"giftxt\":\"$giftxt\",\n";
$json .= "\"mp3\":\"$mp3\",\n";
$json .= "\"mp3txt\":\"$mp3txt\",\n";
$json .= "\"mp4\":\"$mp4\",\n";
$json .= "\"mp4txt\":\"$mp4txt\",\n";
$json .= "\"bc\":\"$bc\",\n";
$json .= "\"bctxt\":\"$bctxt\",\n";
$json .= "\"rm\":\"$rm\",\n";
$json .= "\"rmtxt\":\"$rmtxt\",\n";
$json .= "\"vm\":\"$vm\",\n";
$json .= "\"vmtxt\":\"$vmtxt\",\n";
$json .= "\"yt\":\"$yt\",\n";
$json .= "\"yttxt\":\"$yttxt\",\n";
$json .= "\"pn\":\"$pn\",\n";
$json .= "\"pntxt\":\"$pntxt\",\n";
$json .= "\"sl\":\"$sl\",\n";
$json .= "\"sltxt\":\"$sltxt\",\n";
$json .= "\"tl\":\"$tl\",\n";
$json .= "\"tltxt\":\"$tltxt\",\n";
$json .= "\"tx\":\"$tx\",\n";
$json .= "\"txtxt\":\"$txtxt\",\n";
$json .= "\"zm\":\"$zm\",\n";
$json .= "\"zmtxt\":\"$zmtxt\",\n";
$json .= "\"fab\":\"$fab\",\n";
$json .= "\"gab\":\"$gab\",\n";
$json .= "\"pl\":\"$pl\",\n";
$json .= "\"pt\":\"$pt\",\n";
$json .= "\"ss\":\"$ss\",\n";
$json .= "\"ts\":\"$ts\",\n";
$json .= "\"tw\":\"$tw\",\n";
$json .= "\"jitsi\":\"$jitsi\",\n";
$json .= "\"chat\":\"$chat\",\n";
$json .= "\"btc\":\"$btc\",\n";
$json .= "\"btctxt\":\"$btctxt\",\n";
$json .= "\"eth\":\"$eth\",\n";
$json .= "\"ethtxt\":\"$ethtxt\",\n";
$json .= "\"shopify\":\"$shopify\",\n";
$json .= "\"shopifytxt\":\"$shopifytxt\",\n";
$json .= "\"squareup\":\"$squareup\",\n";
$json .= "\"squareuptxt\":\"$squareuptxt\",\n";
$json .= "\"stripe\":\"$stripe\",\n";
$json .= "\"stripetxt\":\"$stripetxt\",\n";
$json .= "\"dm\":\"$dm\",\n";
$json .= "\"dmtxt\":\"$dmtxt\",\n";
$json .= "\"dr\":\"$dr\",\n";
$json .= "\"drtxt\":\"$drtxt\",\n";
$json .= "\"gp\":\"$gp\",\n";
$json .= "\"gptxt\":\"$gptxt\",\n";
$json .= "\"js\":\"$js\",\n";
$json .= "\"jstxt\":\"$jstxt\",\n";
$json .= "\"wm\":\"$wm\",\n";
$json .= "\"wmtxt\":\"$wmtxt\",\n";
$json .= "\"zh\":\"$zh\",\n";
$json .= "\"zhtxt\":\"$zhtxt\",\n";
$json .= "\"itm\":\"$itm\",\n";
$json .= "\"cnt\":\"$cnt\",\n";
$json .= "\"amt\":\"$amt\",\n";
$json .= "\"note\":\"$note\"\n";
$json .= "}\n";
$json .= "]}";
$htmout .= $htmout_table_head;
$htmout .= $htmout_table_body;
$htmout .= " </table>\n";
// printf( "BUGS_2390: val=[$val] fld=[$fld] row=[$row]<br>\n" );
if( $fmt == "psv" ) { print($psv); exit; }
if( $fmt == "csv" ) { print($csv); exit; }
if( $fmt == "json" ) {
header('Content-type: application/json');
print($json); exit;
}
if( $fmt == "txt" ) { print($txt); exit; }
if( $fmt == "html" ) { print($htmout); exit; }
print( $psv );
// main rowno|ord|no|id|status|dttm|grp|item|logo|
// coffee coffee_id|coffee_url|coffee_tn|
// books fb|fbtxt|pdf|pdftxt|gif|giftxt|
// media mp3|mp3txt|mp4|mp4txt|bc|bctxt|rm|rmtxt|vm|vmtxt|yt|yttxt|
// views pn|pntxt|sl|sltxt|tl|tltxt|tx|txtxt|zm|zmtxt|
// contacts hostid|host|home|name|email|phn|
// smedia fab|gab|li|pl|ss|ts|tw|jitsi|chat|
// biz btc|btctxt|eth|ethtxt|shopify|shopifytxt|squareup|squareuptxt|stripe|stripetxt|
// amedia dm|dmtxt|dr|drtxt|gp|gptxt|js|jstxt|wm|wmtxt|zh|zhtxt|
// notes itm|cnt|amt|note
exit;
}
if( isset($_REQUEST['kogo_db3']) || isset($_REQUEST['kogo_db3'] )) {
$gid=""; $fmt="";
if( isset( $_REQUEST['kogo_db3'] )) { $gid=$_REQUEST['kogo_db3']; }
if( isset( $_REQUEST['fmt'] )) { $fmt=$_REQUEST['fmt']; }
$txt=""; $csv=""; $psv="";
$htmout=""; $htmout_table_head=""; $htmout_table_body="";
// print( "<h1>BUGS_400 gid=$gid fmt=$fmt</h1>" );
$json="{ \"kogo\": [\n";
$htmout_table_head = "<table id=table_$gid>\n";
$htmout_table_head .= "<tr><td style='text-align:center' colspan=14>gameid: $gid</td></tr>\n";
$htmout_table_head .= "<tr>";
$htmout_table_head .= "<td>gid</td>";
$htmout_table_head .= "<td>dttm</td>";
$htmout_table_head .= "<td>pb</td>";
$htmout_table_head .= "<td>pw</td>";
$htmout_table_head .= "<td>bxlim</td>";
$htmout_table_head .= "<td>bylim</td>";
$htmout_table_head .= "<td>bhandi</td>";
$htmout_table_head .= "<td>t</td>";
$htmout_table_head .= "<td>x</td>";
$htmout_table_head .= "<td>y</td>";
$htmout_table_head .= "<td>td</td>";
$htmout_table_head .= "<td>tdx</td>";
$htmout_table_head .= "<td>tdy</td>";
$htmout_table_head .= "<td>note</td>";
$htmout_table_head .= "</tr>\n";
$db3fil="kogo.db3"; $fld=""; $output = "";
$sql="select * from games where gid='$gid'";
// $bxbys = sqlq( $db3fil, $sql, $fld );
$pdo = newpdo($db3fil);
foreach( $pdo->query($sql) as $row ) {
$dttm=$row['dttm'];
$pb=$row['pb'];
$pw=$row['pw'];
$bxlim=$row['bxlim'];
$bylim=$row['bylim'];
$bhandi=$row['bhandi'];
$bhandi=$row['bhandi'];
$t=$row['t'];
$x=$row['x'];
$y=$row['y'];
$td=$row['td'];
$tdx=$row['tdx'];
$tdy=$row['tdy'];
$note=$row['note'];
$psv .= "$gid|";
$psv .= "$dttm|";
$psv .= "$pb|";
$psv .= "$pw|";
$psv .= "$bxlim|";
$psv .= "$bylim|";
$psv .= "$bhandi|";
$psv .= "$t|";
$psv .= "$x|";
$psv .= "$y|";
$psv .= "$td|";
$psv .= "$tdx|";
$psv .= "$tdy|";
$psv .= "$note<br>\n";
$json .= "{\n";
$json .= "\"gid\":\"$gid\",\n";
$json .= "\"dttm\":\"$dttm\",\n";
$json .= "\"pb\":\"$pb\",\n";
$json .= "\"pw\":\"$pw\",\n";
$json .= "\"bxlim\":\"$bxlim\",\n";
$json .= "\"bylim\":\"$bylim\",\n";
$json .= "\"bhandi\":\"$bhandi\",\n";
$json .= "\"t\":\"$t\",\n";
$json .= "\"x\":\"$x\",\n";
$json .= "\"y\":\"$y\",\n";
$json .= "\"td\":\"$td\",\n";
$json .= "\"tdx\":\"$tdx\",\n";
$json .= "\"tdy\":\"$tdy\",\n";
$json .= "\"note\":\"$note\"\n";
$json .= "},\n";
$htmout_table_body .= "<tr>";
$htmout_table_body .= "<td>".$row['gid']."</td>";
$htmout_table_body .= "<td>".$row['dttm']."</td>";
$htmout_table_body .= "<td>".$row['pb']."</td>";
$htmout_table_body .= "<td>".$row['pw']."</td>";
$htmout_table_body .= "<td>".$row['bxlim']."</td>";
$htmout_table_body .= "<td>".$row['bylim']."</td>";
$htmout_table_body .= "<td>".$row['bhandi']."</td>";
$htmout_table_body .= "<td>".$row['t']."</td>";
$htmout_table_body .= "<td>".$row['x']."</td>";
$htmout_table_body .= "<td>".$row['y']."</td>";
$htmout_table_body .= "<td>".$row['td']."</td>";
$htmout_table_body .= "<td>".$row['tdx']."</td>";
$htmout_table_body .= "<td>".$row['tdy']."</td>";
$htmout_table_body .= "<td>".$row['note']."</td>";
$htmout_table_body .= "</tr>\n";
}
$csv=str_replace("|",",",$psv);
$txt=str_replace("|"," ",$psv);
$json .= "{\n";
$json .= "\"gid\":\"$gid\",\n";
$json .= "\"dttm\":\"$dttm\",\n";
$json .= "\"pb\":\"$pb\",\n";
$json .= "\"pw\":\"$pw\",\n";
$json .= "\"bxlim\":\"$bxlim\",\n";
$json .= "\"bylim\":\"$bylim\",\n";
$json .= "\"bhandi\":\"$bhandi\",\n";
$json .= "\"t\":\"$t\",\n";
$json .= "\"x\":\"\",\n";
$json .= "\"y\":\"\",\n";
$json .= "\"td\":\"\",\n";
$json .= "\"tdx\":\"$tdx\",\n";
$json .= "\"tdy\":\"$tdy\",\n";
$json .= "\"note\":\"nextmove\"\n";
$json .= "}\n";
$json .= "]}";
$htmout .= $htmout_table_head;
$htmout .= $htmout_table_body;
$htmout .= " </table>\n";
// printf( "BUGS_2390: val=[$val] fld=[$fld] row=[$row]<br>\n" );
if( $fmt == "psv" ) { print($psv); exit; }
if( $fmt == "csv" ) { print($csv); exit; }
if( $fmt == "json" ) {
header('Content-type: application/json');
print($json); exit;
}
if( $fmt == "txt" ) { print($txt); exit; }
if( $fmt == "html" ) { print($htmout); exit; }
print( $psv );
exit;
}
if( isset($_REQUEST['kogo_bxbys']) || isset($_REQUEST['kogo_bxbys'] )) {
$bxbyid=$_REQUEST['kogo_bxbys'];
$htmout = "";
$bxbys=""; $t=1; $bxlim=19; $bylim=19;
$bxbyss = array();
$bxbyss['a'] = "1,1 1,2 1,3 1,4";
$bxbyss['b'] = "10,1 10,2 10,3 10,4";
$bxbyss['c'] = "19,1 19,2 19,3 19,4";
$bxbyss['ko'] = "1,2 3,2 2,1 2,3 2,3 3,4";
$bxbys=""; $bxbys_head=""; $bxbys_body="";$pb="pd"; $pw="pw";
$bxlim=19; $bylim=19; $bhandi=9;$t=0;$x=0;$y=0;$td=0;$tlim=0;$tdx=0;$tdy=0;
$dttm="20211203_1830";
if( $bxbyid == "" ) {
$htmout = "<h1>MSG_421 KOGO_BXBYS=$bxbyid $progid?kogo_bxbys=$bxbyid<h1>\n";
$tlim=$bxlim*$bylim;
for( $bx=1; $bx<$bxlim; $bx++ ) {
for( $by=1; $by<$bylim; $by++ ) {
$bxbys_body .= "$bxbyid,$t,$bx,$by,$td,$tdx,$tdy<br>\n";
$t=$t+1;
}
}
$bxbys_head="$bxbyid,$dttm,$pb,$pw,$bxlim,$bylim,$bhandi,$tlim,$tdx,$tdy<br>\n";
}
else {
$bxbys_body="";
if( ! isset( $bxbyss[$bxbyid] )) { print( "<h1>ERR_420 NOTFOUND bxbyid=$bxbyid</h1>"); exit;}
$bxbys = $bxbyss[$bxbyid]; $xyd="";
$tlim = count(explode(" ",$bxbys));
for( $t=0; $t<$tlim; $t++ ) {
$bx=""; $by=""; $td="";
$xyd=explode(" ",$bxbys);
$commas=count(explode(",",$xyd[$t]));
$bx = explode(",",$xyd[$t])[0];
if( $commas>1 ) {
$by = explode(",",$xyd[$t])[1];
}
if( $commas>2 ) {
$td = explode(",",$xyd[$t])[2];
if( isOdd($td)) { $tdx=$tdx+1; } else { $tdy=$tdx+1; }
}
$t1=$t+1;
$bxbys_body .= "$bxbyid,$t1,$bx,$by,$td<br>\n";
}
$bxbys_head="$bxbyid,$dttm,$pb,$pw,$bxlim,$bylim,$bhandi,$tlim,$tdx,$tdy<br>\n";
}
$bxbys = "";
$bxbys .= $bxbys_head . $bxbys_body;
# $htmout = "<h1>MSG_412 KOGO_BXBYS= $progid?todo=$kogo_bxbys<h1>\n";
print($bxbys);
exit;
}
if( isset($_REQUEST['kogo']) || isset($_REQUEST['kogo'] )) {
$kogo=$_REQUEST['kogo'];
if( $kogo == "" ) {
$htmout = "<h1>MSG_411 TODO=KOGO $progid?todo=$todo<h1>\n";
}
$htmout = "<h1>MSG_412 TODO=KOGO $progid?todo=$todo<h1>\n";
print($htmout);
exit;
}
if( isset($_REQUEST['todo']) || isset($_REQUEST['todo'] )) {
$todo="";
# if( isset($_REQUEST['todo'] )) {
# $request=$_REQUEST['todo'];
# if( $request != "" ) { $todo=$request; }
# print( "\n<h1>MSG_130 FINDIDS todo=$todo request=$request</h1><br>\n");
# }
if( isset($_REQUEST['fmt'] )) {$fmt=$_REQUEST['fmt'];}
$idfinds_ko='mp3s mp4s pdfs fbs zms yts bcs txts htmls';
# yts|find yt/txt -type f -maxdepth 1 -name "ytlist_202111*.txt" -exec cat {} \; | grep "youtube" | head -100
# bcs|find yt/txt -type f -maxdepth 1 -name "ytlist_202111*.txt" -exec cat {} \; | grep "bitchute" | head -100
# htmls|find yt/txt -type f -maxdepth 1 -name "ytlist_202111*.txt" -exec cat {} \; | grep ".html" | head -100
$idfinds='
mp4s_root|find /kb/vid -type f -maxdepth 3 -name "*.mp4" -o -name "*.webm"
mp4s_dotdot|find ../kb/vid -type f -maxdepth 3 -name "*.mp4" -o -name "*.webm"
mp4s|find ./mp4 -type f -maxdepth 3 -name "*.mp4" -o -name "*.webm"
mp3s|find ../kb/aud/mp3 -type f -name "*.mp3"
pdfs|find pdf -type f -name "*.pdf"
fbs|find fb -type d -name "pages" # fb
zms|find zm -type f -name "0-0-0.jpg" # zm
ka_mp4s|find ka/vid -type f -name "*.mp4" -o -name "*.webm"
ka_mp3s|find ka/aud -type f -name "*.mp3"
ka_pdfs|find ka/pdf -type f -name "*.pdf"
ka_fbs|find ka/fb -type d -name "pages" # fb
ka_zms|find ka/zm -type f -name "0-0-0.jpg" # zm
';
# ka_fbs|find fb -type f -name "index.html" # fb
# ka_zms|find zm -type f -name "zm*.htm*" # zm
# fbs|find ../zm -type f -name "zm*.htm*" # fb
# zms|find ../zm -type f -name "zm*.htm*" # zm
$idfinds_big='
mp4s|find /kb/vid -type f -maxdepth 3 -name "*.mp4" -o -name "*.webm"
mp3s|find /kb/aud/mp3 -type f -name "*.mp3"
pdfs|find /pdf -type f -name "*.pdf"
ka_pdfs|find pdf -type f -name "*.pdf"
ko|find pdf -type f -maxdepth 1 -name "*.pdf"
kups|find ./kups -type f -name "*.*"
imgs|find ./imgs -type f -name "*.*"
jsons|find pdf -type f -name "*.json"
host_list|cat ./kb/media/host_list.psv
host_list_ka|cat ./kb/media/host_list_ka.psv
media_list|cat ./kb/media/media_list.psv
media_list_ka|cat ./kb/media/media_list_ka.psv
coffeec_list|cat ./kb/media/coffeec_list.psv
coffeec_list_ka|cat /kb/media/coffeec_list_ka.psv
coffee_list|cat /kb/media/coffee_list.psv
cat_ko_coffeeshop_psv|cat ko_coffeeshop.psv
cat_ko_coffeeshop_csv|cat ko_coffeeshop.csv
sql3_kups|select * from kups
sql3_ko_coffeeshop|select * from ko_coffeeshop
sql3_host_list|select * from host_list
sql3_host_list_ka|select * from host_list_ka
sql3_media_list|select * from media_list
sql3_media_list_ka|select * from media_list_ka
sql3_coffeec_list|select * from coffeec_list
sql3_coffeec_list_ka|select * from coffeec_list_ka
sql3_coffee_list|select * from coffee_list
sql3_coffee_list_ka|select * from coffee_list_ka
txts|find txt -type f -name "*.txt"
pns|find pn/imgs -type f -maxdepth 1 -name "*.jpg"
pdf_ko|find pdf -type f -name "*ko*.pdf"
pdf_iperms|find pdf -type f -name "*iperms*.pdf"
pdf_jtfdc|find pdf -type f -name "*jtfdc*.pdf"
pdf1|find pdf -type f -maxdepth 1 -name "*.pdf"
mp3s1|find kb/aud/mp3 -type f -maxdepth 1 -name "*.mp3"
yts|find kb/media/ -type f -maxdepth 1 -name "ko_media_yt.txt" -exec cat {} \; | grep "youtube" | head -100
bcs|find kb/media -type f -maxdepth 1 -name "ko_media_bc.txt" -exec cat {} \; | grep "bitchute" | head -100
htmls|find kb/media -type f -maxdepth 1 -name "ko_media_ht.txt" -exec cat {} \; | grep ".html" | head -100
pagesimgs|find ./pages -type f -maxdepth 1 -name "*.jpg"; find ./imgs -type f -maxdepth 1 -name "*.jpg" | grep -v "tn/";
pages|find fb/pages -type f -maxdepth 1 -name "*.jpg"
pdfs1|find pdf -type f -maxdepth 1 -name "*.pdf"
fbd1|find fb -type d -maxdepth 1 -name "*"
txts|find txt -type f -maxdepth 2 -name "*.txt"
htms|find . -type f -maxdepth 1 -name "??.html"
dirs_mp3|find kb/aud -type d -maxdepth 3 -name "*"
dirs_mp4|find kb/vid -type d -maxdepth 3 -name "*"
dirs_pdf|find pdf -type d -maxdepth 3 -name "*"
dirs_yts|find yt/txt -type d -maxdepth 3 -name "ytlist_*.txt"
dirs_fb|find fb -type d -maxdepth 1 -name "*"
dirs_pn|find pn -type d -maxdepth 3 -name "*"
dirs_tl|find tl -type d -maxdepth 3 -name "*"
dirs_zn|find tl -type d -maxdepth 3 -name "*"
';
$idfinds_tests='
mp3_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
mp4_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
pdf_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
txt_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
htm_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
yt_today|find kb/aud/mp3 -type f -name "library_of_congress.mp3"
fb_today|fb/mars
pn_today|pn/imgs/pano_creek.jpg
tl_todatoday|
zm_todatoday|
mp3s_n|find kb/aud/mp3 -type f -name "<n>.mp3"
mp4s2|find kb/vid/jkwii -type f -maxdepth <d> f -name "<n>.mp4"
mp4s_p|find kb/vid/<p> -type f -maxdepth <d> -name "<n>.mp4"
mp4s_n|find kb/vid/<p> -type f -maxdepth <d> -name "<n>.mp4"
mp4_p|find kb/vid -type d -maxdepth <d> -name "<n>"
yts|cat /yt/txt/ytlist.txt | grep "<n>" | head -100
yts_lim|cat /yt/txt/ytlist.txt | grep "<n>" | head -<lim>
ht_mp3|kb/aud/mp3/library_of_congress.mp3
ht_mp4|kb/vid/jkwii/dutch_jackson_weightup.mp4
ht_yt||https://www.youtube.com/watch?v=wQz5aG2tnd4|vladvt_megalithic_inca
ht_png|imgs/btn/koeye.png
ht_jpg|imgs/bg/bg_newton05b.jpg
ht_gif|imgs/gif/gifset_knots/knot1.gif
ht_zm|/index_zm.html
ht_zmd|/zm
ht_tl|/index_tl.html
ht_tld|/tl
find|find <p> -type f -maxdepth <lim> -name "<n>"
mp4s_jtfdc|find kb/vid -type f -name "jtfdc*.mp4"
gifd1|find imgs/gif -type d -maxdepth 2 -name "*"
gifs|find imgs/gif -type f -maxdepth 2 -name "*.gif"
pdfs|find pdf -type f -name "*.pdf"
pdfs2|find pdf/pdf -type f -maxdepth 1 -name "*.pdf"
fbd1|find fb -type d -maxdepth 1 -name "*"
fbds|find fb -type d -name "*"
pages|find fb/pages -type f -maxdepth 1 -name "*.jpg" \| head -5
pages_fb|find fb/pages -type f -maxdepth 1 -name "*.jpg"
pagesimgs|find ./pages -type f -maxdepth 1 -name "*.jpg"; find ./imgs -type f -maxdepth 1 -name "*.jpg";
topdirs|find / -type d -maxdepth 1 -name "??";
sh_ka1|./ka1.sh
sh_cp|find ./pages -type f -maxdepth 1 -name "*.jpg" | awk \'{ print "convert "$0" -resize 200x tn/tn_"$0" # "NF }\' | sed "s/jpg /png /"
sql3_sel_db3tbllim|sqlite3 <db3> "sel * from <tbl> limit <lim>";
sql3_sel_tbllim|sqlite3 ko.db3 "sel * from <tbl> limit <lim>";
sql3_tables|sqlite3 ko.db3 .tables
sql3_schema|sqlite3 ko.db3 .schema
sql3_files|sqlite3 ko.db3 "select * from files"
sql3_ko_coffee|sqlite3 ko.db3 "select * from coffee_list"
sql3_ko_media|sqlite3 ko.db3 "select * from media_list"
sql3_mp3|sqlite3 ko.db3 "select * from mp3"
sql3_mp4|sqlite3 ko.db3 "select * from mp4"
sql3_mp3|sqlite3 ko.db3 "select * from jpg"
sql3_books|sqlite3 ko.db3 "select * from books"
fb/iperms/pages|find fb/iperms/pages -type f -maxdepth 1 -name "*.jpg"
fb/konet/pages|find fb/konet/pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfdc/pages|find fb/jtfdc_pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfdcr/pages|find fb/jtfdcr/pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfinc/pages|find fb/jtfinc/pages -type f -maxdepth 1 -name "*.jpg"
fb/kt/pages|find fb/kt/pages -type f -maxdepth 1 -name "*.jpg"
fb/iperms/pages|find fb/iperms/pages -type f -maxdepth 1 -name "*.jpg"
fb/konet/pages|find fb/konet/pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfdc/pages|find fb/jtfdc_pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfdcr/pages|find fb/jtfdcr/pages -type f -maxdepth 1 -name "*.jpg"
fb/jtfinc/pages|find fb/jtfinc/pages -type f -maxdepth 1 -name "*.jpg"
fb/kt/pages|find fb/kt/pages -type f -maxdepth 1 -name "<n>.jpg"
fb/go/pages|find fb/go/pages -type f -maxdepth 1 -name "<n>.jpg"
fb/kou/pages|find fb/kou/pages -type f -maxdepth 1 -name "<n>.jpg"
fb/royal1/pages|find fb/royal1/pages -type f -maxdepth 1 -name "<n>.jpg"
fb/iperms/imgs|find fb/iperms/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/konet/imgs|find fb/konet/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/jtfdc/imgs|find fb/jtfdc_imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/jtfdcr/imgs|find fb/jtfdcr/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/jtfinc/imgs|find fb/jtfinc/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/kt/imgs|find fb/kt/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/go/imgs|find fb/go/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/kou/imgs|find fb/kou/imgs -type f -maxdepth 1 -name "<n>.jpg"
fb/royal1/imgs|find fb/royal1/imgs -type f -maxdepth 1 -name "<n>.jpg"
tls|find tl -type f -maxdepth 1 -name "<*>.json"
zms|find zm -type f -name "0-0-0.jpg"
pns|find pn -type f -name "*.jpg"
du|du -h -d 1 .
du_dp|du -h -d <d>
';
# du -h --max-depth 1 . # bh
# du -h -d 1 . # depth 1
# du -h -depth . # depthtot
# print( "BUGS_26500 todo=$todo idfinds=$idfinds<br>\n" );
$ids=explode("\n",$idfinds);
$htmout="";
$list="";
$todo="";
if( isset($_REQUEST['todo'])) { $todo=$_REQUEST['todo']; }
$db2=""; if( isset($_REQUEST['db2'])) { $db3=$_REQUEST['db2']; }
$db3=""; if( isset($_REQUEST['db3'])) { $db3=$_REQUEST['db3']; }
$tbl=""; if( isset($_REQUEST['tbl'])) { $tbl=$_REQUEST['tbl']; }
$sel=""; if( isset($_REQUEST['sel'])) { $sel=$_REQUEST['sel']; }
$fld=""; if( isset($_REQUEST['fld'])) { $fld=$_REQUEST['fld']; }
$val=""; if( isset($_REQUEST['val'])) { $val=$_REQUEST['val']; }
$fmt=""; if( isset($_REQUEST['fmt'])) { $fmt=$_REQUEST['fmt']; }
$lim=""; if( isset($_REQUEST['lim'])) { $lim=$_REQUEST['lim']; }
$a=""; if( isset($_REQUEST['a'])) { $a=$_REQUEST['a']; }
$b=""; if( isset($_REQUEST['b'])) { $b=$_REQUEST['b']; }
$c=""; if( isset($_REQUEST['c'])) { $c=$_REQUEST['c']; }
$d=""; if( isset($_REQUEST['d'])) { $d=$_REQUEST['d']; }
$d=""; if( isset($_REQUEST['d'])) { $d=$_REQUEST['d']; }
$e=""; if( isset($_REQUEST['e'])) { $e=$_REQUEST['e']; }
$f=""; if( isset($_REQUEST['f'])) { $f=$_REQUEST['f']; }
$g=""; if( isset($_REQUEST['g'])) { $g=$_REQUEST['g']; }
$h=""; if( isset($_REQUEST['h'])) { $h=$_REQUEST['h']; }
$i=""; if( isset($_REQUEST['i'])) { $i=$_REQUEST['i']; }
$j=""; if( isset($_REQUEST['j'])) { $j=$_REQUEST['j']; }
$k=""; if( isset($_REQUEST['k'])) { $k=$_REQUEST['k']; }
$l=""; if( isset($_REQUEST['l'])) { $l=$_REQUEST['l']; }
$m=""; if( isset($_REQUEST['m'])) { $m=$_REQUEST['m']; }
$n=""; if( isset($_REQUEST['n'])) { $n=$_REQUEST['n']; }
$o=""; if( isset($_REQUEST['o'])) { $o=$_REQUEST['o']; }
$p=""; if( isset($_REQUEST['p'])) { $p=$_REQUEST['p']; }
$q=""; if( isset($_REQUEST['q'])) { $q=$_REQUEST['q']; }
$r=""; if( isset($_REQUEST['r'])) { $r=$_REQUEST['r']; }
$s=""; if( isset($_REQUEST['s'])) { $s=$_REQUEST['s']; }
$t=""; if( isset($_REQUEST['t'])) { $t=$_REQUEST['t']; }
$u=""; if( isset($_REQUEST['u'])) { $u=$_REQUEST['u']; }
$v=""; if( isset($_REQUEST['v'])) { $v=$_REQUEST['v']; }
$w=""; if( isset($_REQUEST['w'])) { $w=$_REQUEST['w']; }
$x=""; if( isset($_REQUEST['x'])) { $x=$_REQUEST['x']; }
$y=""; if( isset($_REQUEST['y'])) { $y=$_REQUEST['y']; }
$z=""; if( isset($_REQUEST['z'])) { $z=$_REQUEST['z']; }
$ids=explode("\n",$idfinds);
$htmout="";
$list="";
$fmt="";
# if( $todo == "" ) { print("<h1>BUGS_811 TODO=BLANK todo=$todo</h1>" ); }
# if( $todo == 0 ) { print("<h1>BUGS_812 TODO=NUM0 todo=$todo</h1>" ); }
# if( $todo == "0" ) { print("<h1>BUGS_813 TODO=NUMCHR todo=$todo</h1>" ); }
# if( $todo == "menu" ) { print("<h1>BUGS_814 TODO=MENU todo=$todo</h1>" ); }
# print("<h1>BUGS_1840 TODO todo=$todo</h1>" );
if( isset($_REQUEST['fmt'])) { $fmt=$_REQUEST['fmt']; }
if(( $todo == "" )
|| ( $todo == "0" )
|| ( $todo == "list" )
|| ( $todo == "menu" )) {
print( "<h1>BUGS_815 MENU todo=$todo</h1><br>\n" );
$htmout .= "<html>\n";
$htmout .= "<head>\n";
$htmout .= " <title>$progid $dttm todo</title>\n";
$htmout .= " </head>\n";
$htmout .= "<body bgcolor=linen>\n";
# $htmout .= "<h1>todo</h1>\n";
$htmout .= "<a href=/index.html target=_blank>";
$htmout .= "<img src=ko.png height=20>";
$htmout .= "</a>\n";
$htmout .= "       ";
$htmout .= "$progid $dttm";
$htmout .= "<hr color=goldenrod>\n";
$htmout .= "<table id=table_todo>";
$htmout .= "<tr><td>j</td><td width=100 >url</td><td width=125>id</td><td width=400>find</td></tr>\n";
for( $j=0; $j<count($ids); $j++ ) {
$line=$ids[$j];
$list .= $line;
if( $line === "" ) { continue; }
if( preg_match("/^#/", $line, $matches )) { continue; }
if( preg_match("/^</", $line, $matches)) {
# $list .= $line;
# $htmout .= $line;
# print( "<h2>MSG_385 HTMFMT line=$line</h2><br>\n" );
continue;
}
$id=explode("|",$line)[0];
if( $id === "" ) { continue; }
$find=""; $findtype="";
if( count(explode("|", $line)) > 1 ) {
$idpipe=$id."|";
$find=str_replace($idpipe,"",$line);
}
else {
$find=explode("|",$line)[1];
}
$matches2="";
// print( "<h1>BUGS_680 todo=$todo j=$j id=$id line=$line</h1><br>\n" );
// if( str_contains( $find, "# fb" )) { $findtype="fb"; }
// if( str_contains( $find, "# zm" )) { $findtype="zm"; }
$find=str_replace('<fmt>',$fmt, $find, $matches2);
$find=str_replace('<lim>',$lim, $find, $matches2);
$find=str_replace('<db3>',$db3, $find, $matches2);
$find=str_replace('<tbl>',$tbl, $find, $matches2);
$find=str_replace('<sel>',$sel, $find, $matches2);
$find=str_replace('<fld>',$fld, $find, $matches2);
$find=str_replace('<a>',$a, $find, $matches2);
$find=str_replace('<b>',$b, $find, $matches2);
$find=str_replace('<c>',$c, $find, $matches2);
$find=str_replace('<d>',$d, $find, $matches2);
$find=str_replace('<e>',$e, $find, $matches2);
$find=str_replace('<f>',$f, $find, $matches2);
$find=str_replace('<g>',$g, $find, $matches2);
$find=str_replace('<h>',$h, $find, $matches2);
$find=str_replace('<i>',$i, $find, $matches2);
$find=str_replace('<j>',$j, $find, $matches2);
$find=str_replace('<k>',$k, $find, $matches2);
$find=str_replace('<l>',$l, $find, $matches2);
$find=str_replace('<m>',$m, $find, $matches2);
$find=str_replace('<n>',$n, $find, $matches2);
$find=str_replace('<o>',$o, $find, $matches2);
$find=str_replace('<p>',$p, $find, $matches2);
$find=str_replace('<q>',$q, $find, $matches2);
$find=str_replace('<r>',$r, $find, $matches2);
$find=str_replace('<s>',$s, $find, $matches2);
$find=str_replace('<t>',$t, $find, $matches2);
$find=str_replace('<u>',$u, $find, $matches2);
$find=str_replace('<v>',$v, $find, $matches2);
$find=str_replace('<w>',$w, $find, $matches2);
$find=str_replace('<x>',$x, $find, $matches2);
$find=str_replace('<y>',$y, $find, $matches2);
$find=str_replace('<x>',$z, $find, $matches2);
# print( "<h3>BUGS_460 j=$j id=$id p=$p find=$find</h3>\n") ;
$k=$j+1;
$htmout .= "<tr>";
$htmout .= "<td>$k</td>";
$htmout .= "<td width=100>";
# $htmout .= "<a href=/ko.php?todo=$id target=_blank>\n";
$htmout .= "<a href=./ko_todo.php?todo=$id target=_blank>\n";
$htmout .= "<img src=/imgs/btn/koeye.png height=25>";
$htmout .= "</a>";
$htmout .= "</td>\n";
$htmout .= "<td width=125><b>$id</b></td>";
$htmout .= "<td width=470>$find</td>";
$htmout .= "</tr>";
}
$htmout .= " </table>";
$htmout .= "<hr color=goldenrod>\n";
$htmout .= " </body>\n";
$htmout .= " </html>\n";
if( $fmt == "list" ) { print( $list ); }
else { print( $htmout ); }
exit;
}
if( isset( $_REQUEST['todo'] )) {
$todo=$_REQUEST['todo'];
}
if( $todo == "ko_coffeeshop" ) {
$output=ko_coffeeshop('');
header('Content-type: text/plain');
print( $output );
}
if( $todo == "ko_coffeeshop_psv" ) {
$psvfil="ko_coffeeshop.psv";
$fmt="psv";
$options=array($psvfil,$fmt);
if( file_exists( $psvfil )) {
$psv=psv_ko_coffeeshop($options);
}
else {
$psv="ERR_2011 NOTFOUND psvfil=$psvfil fmt=$fmt";
}
print($psv);
exit;
}
if( $todo == "ko_coffeeshop_csv" ) {
$csvfil="ko_coffeeshop.csv";
$fmt="csv";
$options=array($csvfil,$fmt);
if( file_exists( $csvfil )) {
$csv=csv_ko_coffeeshop($options);
}
else {
$psv="ERR_2011 NOTFOUND csvfil=$csvfil fmt=$fmt";
}
print($psv);
exit;
}
if( $todo == "ko_media_psv" ) {
$psvfil="ko_media.psv";
$fmt="psv";
$options=array($psvfil,$fmt);
if( file_exists( $psvfil )) {
$psv=psv_ko_media($options);
}
else {
$psv="ERR_2021 NOTFOUND psvfil=$psvfil fmt=$fmt";
}
print($psv);
exit;
}
if( $todo == "ko_coffeeshop_sql3" ) {
$db3fil="ko.db3";
$fmt="html";
$options=array($db3fil,$fmt);
$sqlout=sql3_ko_coffeeshop($options);
print_r($sqlout);
exit;
}
if( $todo == "sql3_ko_media" ) {
$db3fil="ko.db3";
$fmt="html";
$options=array($db3fil,$fmt);
$sqlout=sql3_ko_media($options);
print($sqlout);
exit;
}
$min=1; $max=3;
if( $todo == "ko" ) {
$id=$todo;
$min=0;$max=0;
$min=1; $max=count(explode(" ",$idfinds_ko))-1;
$random=random_int($min,$max);
$todo=explode(" ",$idfinds_ko)[$random];
}
for( $j=0; $j<count($ids); $j++) {
$line=$ids[$j];
$id=explode("|",$line)[0];
# print( "<h1>BUGS_871 j=$j id=$id line=$line todo=$todo</h1><br>\n" );
if( $id === "" ) { continue; }
if( $id != $todo ) {continue; }
# print( "<h1>BUGS_873 MATCH j=$j id=$id= todo=$todo= line=$line todo=$todo</h1><br>\n" );
# $find=explode("|",$line)[1];
$find=str_replace("$id|","", $line);
# print( "<h1>BUGS_675 id=$id find=$find line=$line</h1>" );
$list="";
$url=$find;
$url = urlcheck($url);
# print( "<h1>MSG_661 query_string=$query_string name=name id=$id find=$find</h1><br>\n" );
$find=str_replace_all($find);
# $find=str_replace("<n>", "$name", $find );
# print( "<h1>MSG_900 j=$j k=$k todo=$todo id=$id find=$find</h1><br>\n" );
# $out = "";
# print( "BUGS_26775 find=$find<br>\n" );
# pqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpqpq
# $out=array(); $err=array();
exec( $find, $out, $err );
# bdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbd
$outcnt=count($out);
# printf( "BUGS_26781 find=$find outcnt=$outcnt<br>\n" );
for( $j=0; $j<$outcnt; $j++) {
# print( "BUGS_2079 find=$find outcnt=$outcnt out=[$j]".$out[$j]."<br>\n" );
}
$script_filename=$_SERVER['SCRIPT_FILENAME']; # /Volumes/ka1tbr2/ht/ka/ko.php
$request_uri=$_SERVER['REQUEST_URI']; # /ka/ko.php?todo=ka_zms
$php_self=$_SERVER['PHP_SELF']; # /ka/ko.php
$query_string=$_SERVER['QUERY_STRING']; # todo=ka_zms
# if( $outcnt == 0 ) {
# $htmout = "";
# $htmout .= "<html><head><title>$request_uri NOTFOUND</title></head>\n";
# $htmout .= "<body bgcolor=wheat>\n";
# $htmout .= "<a href=$php_self target=_blank>";
# $htmout .= "<img src=/imgs/btn/ko.png height=50 border=0>$php_self</a>\n";
# $htmout .= "<h2>ERR_2080 NOTFOUND find=$find</h2>\n";
# $htmout .= "<h3>request_uri=$request_uri</h3>\n";
# $htmout .= "</body></html>\n";
# print( $htmout );
# phpinfo();
# $errtxt="<h2>ERR_2070 NOTFOUND find=$find</h2>\n";
# return($errtxt);
# }
# print( "<h1>BUGS_2100 outcnt=$outcnt fmt=$fmt out=".$out[0]."</h1>" );
$psv="";
$csv="";
$txt="";
$json="";
$json.="{\"todo\": [\n";
$dttm=date('Ymd_His');
$htmout = "";
$htmout .= "<html>\n";
$htmout .= "<head>\n";
$htmout .= " <title>todo=$todo $dttm</title>\n";
$icon="./favicon_ko64.ico";
# $htmout .= "<link rel=\"icon\" href=\"$icon\" type=\"image/icon\">\n";
$icon_png="koeye.png";
$icon_png="ko.png";
$icon_gif="koeye_handhither.gif";
# $htmout .= "<link rel=\"icon\" href=\"$icon_png\" type=\"image/png\">\n";
$htmout .= "<link rel=\"icon\" href=\"$icon_gif\" type=\"image/gif\">\n";
$htmout .= " </head>\n";
$htmout .= "<body bgcolor=linen>\n";
$htmout .= " <div id=div_todo_$todo>\n";
$htmout .= " <h1>div_todo_$todo</h1>\n";
$htmout .= " <hr color=goldenrod>\n";
for( $j=0; $j< count($out); $j++ ) {
$line= $out[$j];
$txt .= $line."\n";
$psv .= $line."|\n";
$csv .= $line.",";
$json .= "{ \"j\":\"".$j."\", \"line\":\"".$line."\" },\n";
}
$psv .= preg_replace("/|$/", "", $psv );
$csv .= preg_replace("/|/", ",", $psv );
// $json .= preg_replace("/},$/", "}", $json );
// $json .= str_lreplace( ",$", "", $json );
$j=""; $line="";
$json .= "{ \"j\":\"".$j."\", \"line\":\"".$line."\" }\n";
// $json .= str_replace_last( ",", "" , $json );
$json .="]}\n\n";
$fmt="";
if( isset( $_REQUEST['fmt'] )) {$fmt=$_REQUEST['fmt']; }
// print( "<h1>BUGS_925 fmt=$fmt</h1>\n" );
if( $fmt == "txt" ) {
header('Content-type: text/plain');
print($txt); exit();
}
if( $fmt == "list" ) { print($txt);exit(); }
if( $fmt == "psv" ) { print($psv); exit(); }
if( $fmt == "csv" ) {
header('Content-type: text/csv');
print($csv); exit();
}
if( $fmt == "json" ) {
header('Content-type: application/json');
print( $json );
exit();
}
$k=1;
# if(! isset( $out[$k] )) {
# print( "<h1>MSG_2100 k=$k NOTFOUND \$out</h1>\n" );
# $url="./index.html?err=out";
# header('Location: '.$url);
# die();
# print( "<h1>MSG_2100 k=$k NOTFOUND \$out</h1>\n" );
# return($k);
# exit();
# }
$line="";
# $out = [];
if( count($out) > 0 ) { $line=$out[$k]; }
# print( "<h1>MSG_2110 k=$k line=$line</h1>" );
# print( "<h1>MSG_2111 k=$k id=$id find=$find outcnt=$outcnt out0=".$out[0]." </h1><br>\n" );
# print( "<h2>MSG_704 out4=".$out[4]."</h2>" );
# print( "<h2>MSG_705 out5=".$out[5]."</h2>" );
# print( "<h2>MSG_706 out6=".$out[6]."</h2>" );
# print( "<h2>MSG_707 out7=".$out[7]."</h2>" );
$htmout_table = "";
$htmout_table .= "<table id=table_media>\n";
$htmout_table .= "<tr>";
$htmout_table .= "<td>j</td>";
$htmout_table .= "<td>k</td>";
$htmout_table .= "<td>tot</td>";
$htmout_table .= "<td>link</td>";
$htmout_table .= "<td>group</td>";
$htmout_table .= "<td width=400>base bugs_700</td>";
$htmout_table .= "</tr>";
# $htmout_table .= "</table>";
$txt = "";
$psv = "";
$csv = "";
$sql = "";
$sql .= "insert into table files (\n";
$json = "";
$json .= "{\n";
# print( "<h1>BUGS_710 skiplist $htmout_table</table></h1>" );
# $out_skiplist = skiplist($out);
# $out=$out_skiplist;
$cntout=count($out);
# print_r($out);
# print( "BUGS_26920 count(out)=".count($out)."<br>\n" );
$j=0; $k=0;
for( $j=0; $j<count($out); $j++ ) {
# for( $j=0; $j<$cntout; $j++ ) {
$k=$j+1;
$line = $out[$j]."\n";
$list .= $line."\n";
$pathfile = $line;
# print( "BUGS_27930 j=$j k=$k line=$line<br>\n" );
# $extension = pathinfo($pathfile, PATHINFO_EXTENSION);
$dirname=dirname($pathfile);
$group = str_replace("/","_", $dirname );
$temp= explode('.',$pathfile);
$ext = end($temp);
$base=basename($pathfile,".$ext");
$link = htmout_link($pathfile,'',$find);
# $url=$pathfile;
# $tn="/imgs/btn/koeye.png";
# print( "BUGS_26940 j=$j k=$k link=$link line=$line<br>\n" );
$txt .= "$line\n";
$psv .= "$j|$k|$outcnt|$pathfile|$link|$group|$base\n";
$csv .= "$j,$k,$outcnt,$pathfile,$link,$group,$base\n";
$sql .= "( 'j','k','outcnt',pathfile,'link','group','base' ),";
$json .= "{\n";
$json .= "'j':'$k', ";
$json .= " 'k':'$k', ";
$json .= "'outcnt':'$outcnt', ";
$json .= "'pathfile':'$pathfile', ";
$json .= "'link':'$link', ";
$json .= "'group':'$group', ";
$json .= "'base':'$base' ";
$json .= "},\n";
$htmout_table .= "<tr>";
$htmout_table .= "<td>$j</td>";
$htmout_table .= "<td>$k</td>";
$htmout_table .= "<td>$outcnt</td>";
$htmout_table .= "<td>".htmout_link($pathfile,'',$find)."</td>";
# $htmout_table .= "<td><img src=/imgs/btn/koeye_handhither.gif height=100></td>";
$htmout_table .= "<td>$group</td>";
$htmout_table .= "<td>$base</td>";
$htmout_table .= "</tr>\n";
# print( "<h3>BUGS_740 j=$j k=$k outcnt=$outcnt group=$group base=$base ext=$ext </h3>" );
$htmout_link=htmout_link($pathfile,'',$find);
# print( "<h3>BUGS_2020 j=$j k=$k pathfile=<$pathfile></h3>" );
# print( "<h3>BUGS_2021 j=$j k=$k htmout_link=<$htmout_link> find=$find</h3>" );
}
$json .= " }\n";
$matches = "";
$json = preg_replace( "/,}$/", "}", $matches );
$sql = preg_replace( "/,\)$/", ")", $matches );
$psv = preg_replace( "/|$/", "", $matches );
$csv = preg_replace( "/,$/", "", $matches );
$htmout_table .= " </table>";
$htmout .= "<hr color=goldenrod>";
$htmout .= $htmout_table;
$htmout .= "<hr color=goldenrod>";
$htmout .= " </body>\n";
$htmout .= " </html>\n";
$fmt="";
if( isset($_REQUEST['fmt'])) { $fmt=$_REQUEST['fmt']; }
# print( "<h1>BUGS_1000 find=$find fmt=$fmt</h1>" );
if( $fmt == "txt" ) { print( $txt ); exit; }
if( $fmt == "psv" ) { print( $psv ); exit; }
if( $fmt == "csv" ) { print( $csv ); exit; }
if( $fmt == "sql" ) { print( $sql ); exit; }
if( $fmt == "json" ) {
header('Content-type: application/json');
print( $json );
exit;
}
if( $fmt == "html" ) { print( $htmout ); exit; }
print($htmout); exit;
print( "<h3>BUGS_1021 j=$j k=$k outcnt=$outcnt group=$group base=$base ext=$ext </h3>" );
}
# if( count($out) < 1 ) { print( "<h2>ERR_2160 NOTFOUND find=$find</h2>\n" ); }
$outcnt="";
$group="";
$base="";
$ext="";
# print( "<h3>BUGS_1022 j=$j k=$k outcnt=$outcnt group=$group base=$base ext=$ext </h3>" );
return($htmout);
exit;
}
if( isset($_REQUEST['ls-lat']) || isset($_REQUEST['ls'] )) {
if( isset($_REQUEST['ls-lat'])) {
$request_path=$_REQUEST['ls-lat'];
}
else {
$request_path=$_REQUEST['ls'];
}
# print( "<h1>BUGS_183 request_path=$request_path</h1><br>\n" );
if( $request_path === "" ) { exit; }
$pathparts = pathinfo($request_path);
$dirname=$pathparts['dirname'];
$basename=$pathparts['basename'];
$ext="";
if( isset($pathparts['extension'])) {
$ext=$pathparts['extension'];
}
$path=$dirname;
if( ! is_dir($path)) {
print( "\n<h1>ERR_122 LSLAT NOTFOUND path=$path</h1><br>\n");
exit;
}
$lscmd="ls $request_path";
if( isset($_SERVER['ls-lat'])) {
$lscmd="ls -lat $request_path";
}
# print( "\n<h1>MSG_199 LSLAT lscmd=$lscmd</h1><br>\n");
$htmout = "";
exec( $lscmd, $out, $err );
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
print( $htmout );
exit;
}
if( isset($_REQUEST['find'])) {
# 1 ?find=/fb/zc/pages/*.jpg
# 4 ?find=find $path -name $names
# 6 ?find=find $path -type d -name $names
# 6 ?find=find $path -maxdepth 2 -name $names
# 8 ?find=find $path -type d -maxdepth 2 -name $names
# 4 ?find=find $path -type d
# 6 ?find=find $path -type d -maxdepth $maxdepth
$request_find=""; $findargs=""; $findargs_len=0;
$request_find=$_REQUEST['find'];
$findargs = explode( " ", $request_find );
$findargs_len=count($findargs);
for( $j=0; $j<count($findargs); $j++ ) {
$findargs[$j]=str_replace("\"","",$findargs[$j]);
$findargs[$j]=str_replace("'","",$findargs[$j]);
}
# print( "<h1>BUGS_140 findargs_len=$findargs_len request_find=$request_find</h1><br>\n" );
$path="";
if( count($findargs) === 1 ) {
// print( "<h1>BUGS_141 findargs_len=$findargs_len request_find=$request_find</h1><br>\n" );
// $pathparts = pathinfo($request_find);
// $dirname=$pathparts['dirname'];
// $basename=$pathparts['basename'];
// $ext="";
// if( isset($pathparts['extension'])) {
// $ext=$pathparts['extension'];
// }
// print( "<h1>BUGS_161 dirname=$dirname basename=$basename request_find=$request_find</h1><br>\n" );
// $path=$dirname;
// $name=$basename;
$path="fb";
$type="d";
$maxdepth="1";
$name="??";
if( ! is_dir($path)) {
print( "<h1>ERR_163 NOTFOUND path=$path</h1><br>\n" );
exit;
}
$find="find $path -type $type -maxdepth $maxdepth -name \"$name\"";
// print( "<h1>MSG_164 FOUND path=$path name=$name</h1><br>\n" );
print( "<h1>MSG_2340 FOUND find=$find </h1><br>\n" );
exec( $find, $out, $err );
$htmout="";
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
// print( "<h1>MSG_161 find=$find htmout=$htmout</h1><br>\n" );
print( $htmout );
exit;
}
# print( "<h1>BUGS_150 path=$path request_find=$request_find</h1><br>\n" );
$path="";
$maxdepth="";
$type="";
$names="";
$query_string="";
if( isset( $_SERVER['QUERY_STRING'])) {
$query_string=$_SERVER['QUERY_STRING'];
}
# print( "<h1>BUGS_300 findargs_len=$findargs_len request_find=$request_find query_string=$query_string</h1><br>\n" );
if( $findargs_len === 2 ) {
print( "<h1>BUGS_142 findargs_len=$findargs_len request_find=$request_find</h1><br>\n" );
$path=$findargs[1];
$path=str_replace("\"","",$path );
if( ! is_dir($path)) {
print( "<h1>ERR_143 NOTFOUND path=$path=- request_find=$request_find</h1><br>\n" );
exit;
}
$path="fb"; $type="d"; $maxdepth="1"; $names="??";
$find="find $path -type $type -maxdepth $maxdepth -name \"$names\"";
exec($find,$out,$err);
print( "<h1>BUGS_2380 find=$find</h1><br>\n" );
$htmout="";
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
print( $htmout );
// phpinfo();
// $request_find=str_replace("%20"," ",$request_find);
exit;
}
if( $findargs_len === 3 ) {
print( "<h1>BUGS_303 findargs_len=$findargs_len $request_find=$request_find query_string=$query_string</h1><br>\n" );
exit;
}
// if( $findargs_len === 4 ) {
// print( "<h1>BUGS_304 findargs_len=$findargs_len $request_find=$request_find query_string=$query_string</h1><br>\n" );
// }
if( $findargs_len === 1 ) {
$path="fb";
$type="d";
$maxdepth="1";
$names="??";
$find="find $path -type $type -maxdepth $maxdepth -name \"$names\"";
exec( $find, $out, $err );
print( "BUGS_311 find=$find<br>\n" );
$htmout="";
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
print( $htmout );
// print_r($out);
exit;
}
// if( $findargs_len === 2 ) { exit; }
// if( $findargs_len === 3 ) { exit; }
// if( $findargs_len === 5 ) { exit; }
// if( $findargs_len === 7 ) { exit; }
if( $findargs_len > 8 ) { exit; }
// print( "<h1>BUGS_350 findargs_len=$findargs_len query_string=$query_string</h1>\n" );
if( $findargs_len === 1 ) {
# if( is_file($request_find)) {
# print( "<h1>BUGS_101 is_file FOUND request_find=$request_find</h1>");
# }
# else {
# print( "<h1>BUGS_102 is_file NOTFOUND request_find=$request_find</h1>");
# }
if( $request_find != "" ) {
$pathparts = pathinfo($request_find);
$dirname=$pathparts['dirname'];
$basename=$pathparts['basename'];
$ext="";
if( isset($pathparts['extension'])) {
$ext=$pathparts['extension'];
}
$path=$dirname;
$names=$basename;
$type="f";
if( $ext === "" ) {
$path=$request_find;
$type="";
$names="";
}
# print( "BUGS_150 dirname=$dirname names=$names ext=$ext<br>\n" );
# if( $basename === "" ) { $names=""; }
}
}
# ?find=find $path -name $names
# ?find=find $path -type $type
if( $findargs_len === 4 ) {
$path = $findargs[1];
if ($findargs[2] === "-type" ) { $type=$findargs[3]; }
if ($findargs[2] === "-maxdepth" ) { $maxdepth=$findargs[3]; }
if ($findargs[2] === "-name" ) { $names=$findargs[3]; }
# print( "<h1>BUGS_240 findargs3=".$findargs[3]." request_find=$request_find</h1><br>\n") ;
if( ! is_dir($path)) {
print( "<h1>BUGS_241 NOTFOUND path=$path request_find=$request_find</h1><br>\n") ;
exit;
}
# print( "<h1>BUGS_242 FOUND path=$path request_find=$request_find</h1><br>\n") ;
$find="find $path";
if( $type != "" ) { $find .= " -type $type"; }
if( $maxdepth != "" ) { $find .= " -maxdepth $maxdepth"; }
if( $names != "" ) { $find .= " -name \"$names\""; }
# print( "<h1>BUGS_243 type=$type find=$find request_find=$request_find</h1><br>\n") ;
$htmout="";
exec($find, $out, $err );
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
# print( "<h1>BUGS_249 find=$find htmout=$htmout</h1><br>\n") ;
print( $htmout );
exit;
}
# ?find=find $path -type f -name $names
# ?find=find $path -maxdepth $maxdepth -name $names
# ?find=find $path -type d -maxdepth 1
if( $findargs_len === 6 ) {
# print( "<h1>BUGS_601 request_find=$request_find</h1><br>\n" );
$path="";
$type="";
$maxdepth="";
$names="";
$path = $findargs[1];
if( $findargs[2] === "-type" ) { $type=$findargs[3]; }
if( $findargs[2] === "-maxdepth" ) { $maxdepth=$findargs[3]; }
if( $findargs[2] === "-name" ) { $names=$findargs[3]; }
if( $findargs[4] === "-type" ) { $type=$findargs[5]; }
if( $findargs[4] === "-maxdepth" ) { $maxdepth=$findargs[5]; }
if( $findargs[4] === "-name" ) { $names=$findargs[5]; }
$find="find $path";
if( $type != "" ) { $find .= " -type $type"; }
if( $maxdepth != "" ) { $find .= " -maxdepth $maxdepth"; }
if( $names != "" ) { $find .= " -name \"$names\""; }
$htmout="";
exec( $find, $out, $err );
for($j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
print( $htmout );
exit;
}
# ?find=find $path -type f -maxdepth $maxdepth -name $names
if( $findargs_len === 8 ) {
$path = $findargs[1];
if( ! is_dir($path)) { print( "<h1>NOTFOUND path=$path</h1><br>\n" ); exit; }
$find = "find $path";
if( $findargs[2] === "-type" ) { $type=$findargs[3]; }
if( $findargs[2] === "-maxdepth" ) { $maxdepth=$findargs[3]; }
if( $findargs[2] === "-name" ) { $names=$findargs[3]; }
if( $findargs[4] === "-type" ) { $type=$findargs[5]; }
if( $findargs[4] === "-maxdepth" ) { $maxdepth=$findargs[5]; }
if( $findargs[4] === "-name" ) { $names=$findargs[5]; }
if( $findargs[6] === "-type" ) { $type=$findargs[7]; }
if( $findargs[6] === "-maxdepth" ) { $maxdepth=$findargs[7]; }
if( $findargs[6] === "-name" ) { $names=$findargs[7]; }
if( $type != "" ) { $find .= " -type $type"; }
if( $maxdepth != "" ) { $find .= " -maxdepth $maxdepth"; }
if( $names != "" ) { $find .= " -name \"$names\""; }
$htmout="";
# print( "<h1>BUGS_800 find=$find request_find=$request_find</h1><br>\n" );
exec( $find, $out, $err );
for( $j=0; $j<count($out); $j++ ) {
$htmout .= $out[$j]."\n";
}
print( $htmout );
exit;
}
$find="find $path";
if( $type != "" ) { $find .= " -type $type"; }
if( $maxdepth != "" ) { $find .= " -maxdepth $maxdepth"; }
if( $names != "" ) {
$names=str_replace("\"","",$names);
$names=str_replace("'","",$names);
$find .= " -name \"$names\"";
}
// $find="find $path -type $type -maxdepth $maxdepth -name \"$names\"";
// if( $names === "" ) {
// $find="find $path -type $type -maxdepth $maxdepth";
// }
# print( "<h1>BUGS_101 find=$find</h1>\n");
$htmout="";
$types="http html htm php mp4 mp3 jps png gif";
$l=0;
foreach( $types as $types ) {
if( preg_match( "/$type/", $find, $matches )) {
print( "MSG_680 l=$l type=$type find=$find<br>\n");
window.location($find);
exit;
}
$l++;
}
$url=$find;
# print( "MSG_681 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.http/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_682 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.html/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_683 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.htm/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_684 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.php/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_685 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.mp4/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_686 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.mp3/", $url, $matches )) { window.open($url); exit; }
# print( "MSG_687 l=$l type=$type url=$url<br>\n");
if( preg_match( "/.gif/", $url, $matches )) { window.open($url); exit; }
if( preg_match( "/.jpg/", $url, $matches )) { window.open($url); exit; }
if( preg_match( "/.png/", $url, $matches )) { window.open($url); exit; }
#// $path="fb";
#// $find="find $path -type f -maxdepth 1 -name \"*.*\"";
# if( is_dir($path)) {
#// print( "<h1>MSG_271 find=$find</h1>\n" );
# exec( $find, $out, $err );
#
#// print( "<h1>MSG_272 OUT find=$find</h1>\n" );
# $query_string="";
# if( isset($_SERVER['QUERY_STRING'] )) {
# $query_string=$_SERVER['QUERY_STRING'];
# }
#// print( "<h1>MSG_273 OUT query_string=$query_string</h1>\n" );
#// print_r($out);
# print_r($err);
# $outlen=count($out);
# $htmout="";
# $htmout .= "<hr color=goldenrod>\n";
# $list="";
# for( $j=0; $j<$outlen; $j++ ) {
# $htmout .= $out[$j]."<br>\n";
# $list .= $out[$j]."\n";
# }
# $htmout .= "<hr color=goldenrod>\n";
## print( "<h1>MSG_104 ERR</h1>\n" );
## print_r($err);
# $process = proc_open( $cmd, $descriptorspec, $pipes, $cwd_process );
# print( "<h1>MSG_250 LS DONE find=$find outlen=$outlen</h1>" );
# }
# else {
# print( "<h1>ERR_500 NOTFOUND path=$path request_find=$request_find query_string=$query_string</h1>\n" );
# exit();
# }
print( "<h1>MSG_900 LS DONE find=$find</h1>\n" );
if( $fmt == "list" ) { print ( $list ); return($list); }
if( $fmt == "list" ) { print ( $list ); return($list); }
print( $list );
return( $list );
# exit;
# }
// $path="fb";
// $find="find $path -type f -maxdepth 1 -name \"*.*\"";
if( is_dir($path)) {
// print( "<h1>MSG_271 find=$find</h1>\n" );
exec( $find, $out, $err );
// print( "<h1>MSG_272 OUT find=$find</h1>\n" );
$query_string="";
if( isset($_SERVER['QUERY_STRING'] )) {
$query_string=$_SERVER['QUERY_STRING'];
}
// print( "<h1>MSG_273 OUT query_string=$query_string</h1>\n" );
// print_r($out);
print_r($err);
$outlen=count($out);
$htmout="";
$htmout .= "<hr color=goldenrod>\n";
$list="";
for( $j=0; $j<$outlen; $j++ ) {
$htmout .= $out[$j]."<br>\n";
$list .= $out[$j]."\n";
}
$htmout .= "<hr color=goldenrod>\n";
# print( "<h1>MSG_104 ERR</h1>\n" );
# print_r($err);
# $process = proc_open( $cmd, $descriptorspec, $pipes, $cwd_process );
print( "<h1>MSG_250 LS DONE find=$find outlen=$outlen</h1>" );
}
else {
print( "<h1>ERR_500 NOTFOUND path=$path request_find=$request_find query_string=$query_string</h1>\n" );
exit();
}
# print( "<h1>MSG_109 LS DONE find=$find</h1>\n" );
# print( $htmout );
print( $list );
exit;
}
if( isset($_REQUEST['kolog'])) {
$db3file="ko.db3"; $tblname="kologs";
$todo=$_REQUEST['kolog'];
if( $todo == "" ) {$htmout=kolog($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "new" ) {$htmout=kolog_new($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "add" ) {$htmout=kolog_add($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "del" ) {$htmout=kolog_del($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "upd" ) {$htmout=kolog_upd($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "sel" ) {$htmout=kolog_sel($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "create" ) {$htmout=kolog_create($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "form" ) {$htmout=kolog_form($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "submit" ) {$htmout=kolog_submit($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "list" ) {$htmout=kolog_list($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "bugs" ) {$htmout=kolog_bugs($db3file, $tblname, $args); print( $htmout ); exit; }
if( $todo == "logs" ) {$htmout=kologs($db3file, $tblname, $args); print( $htmout ); exit; }
exit;
}
if( isset($_REQUEST['id'])) {
$id=$_REQUEST['id'];
if( $id == "bookmarkusb" ) {
$htmout=bookmarkusb();
# $htmout=bookmarkusb_form();
exit;
}
if( $id == "bookmarkusb_list" ) {
$htmout=bookmarkusb_list();
exit;
}
if( $id == "bookmarkusb_select" ) {
$htmout=bookmarkusb_select();
exit;
}
if( $id == "bookmarkusb_form" ) {
$htmout=bookmarkusb_form();
exit;
}
# print( "<h1>BUGS_100c REQUEST_id id=$id REQ=".$_REQUEST['id']."</h1><br>" );
}
# startup_ls();
# main_ka1();
# main_tl();
$htmlfile="index.html";
$htmout=read_htmlfile($htmlfile);
print( $htmout );
exit;
startup();
exit;
}
// ------------------------------------------------------------------
// html_style_leds_context — CSS for the context buttons
// ------------------------------------------------------------------
function html_style_leds_context() {
$htmout = "";
$htmout .= " <style type=\"text/css\">\n";
$htmout .= " .leds_context {\n";
$htmout .= " -moz-box-shadow:inset 0px 1px 0px 0px #fcf8f2;\n";
$htmout .= " -webkit-box-shadow:inset 0px 1px 0px 0px #fcf8f2;\n";
$htmout .= " box-shadow:inset 0px 1px 0px 0px #fcf8f2;\n";
$htmout .= " background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #fae4bd), color-stop(1, #eac380) );\n";
$htmout .= " background:-moz-linear-gradient( center top, #fae4bd 5%, #eac380 100% );\n";
$htmout .= " filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fae4bd', endColorstr='#eac380');\n";
$htmout .= " background-color:#fae4bd;\n";
$htmout .= " -webkit-border-top-left-radius:0px;\n";
$htmout .= " -moz-border-radius-topleft:0px;\n";
$htmout .= " border-top-left-radius:0px;\n";
$htmout .= " -webkit-border-top-right-radius:0px;\n";
$htmout .= " -moz-border-radius-topright:0px;\n";
$htmout .= " border-top-right-radius:0px;\n";
$htmout .= " -webkit-border-bottom-right-radius:0px;\n";
$htmout .= " -moz-border-radius-bottomright:0px;\n";
$htmout .= " border-bottom-right-radius:0px;\n";
$htmout .= " -webkit-border-bottom-left-radius:0px;\n";
$htmout .= " -moz-border-radius-bottomleft:0px;\n";
$htmout .= " border-bottom-left-radius:0px;\n";
$htmout .= " text-indent:0;\n";
$htmout .= " border:1px solid #eeb44f;\n";
$htmout .= " display:inline-block;\n";
$htmout .= " color:#ffffff;\n";
$htmout .= " font-family:Arial;\n";
$htmout .= " font-size:15px;\n";
$htmout .= " font-weight:bold;\n";
$htmout .= " font-style:normal;\n";
$htmout .= " height:40px;\n";
$htmout .= " line-height:40px;\n";
$htmout .= " width:100px;\n";
$htmout .= " text-decoration:none;\n";
$htmout .= " text-align:center;\n";
$htmout .= " text-shadow:1px -21px 0px #cc9f52;\n";
$htmout .= " }\n";
$htmout .= " .leds_context:hover {\n";
$htmout .= " background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #eac380), color-stop(1, #fae4bd) );\n";
$htmout .= " background:-moz-linear-gradient( center top, #eac380 5%, #fae4bd 100% );\n";
$htmout .= " filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eac380', endColorstr='#fae4bd');\n";
$htmout .= " background-color:#eac380;\n";
$htmout .= " }\n";
$htmout .= " .leds_context:active {\n";
$htmout .= " position:relative;\n";
$htmout .= " top:1px;\n";
$htmout .= " }\n";
$htmout .= " .leds_context_img {\n";
$htmout .= " border:0;\n";
$htmout .= " cursor:pointer;\n";
$htmout .= " }\n";
$htmout .= " </style>\n";
return( $htmout );
}
// ------------------------------------------------------------------
// html_leds_context — four clickable images in div_leds_context
// ------------------------------------------------------------------
function html_leds_context() {
$htmout = "";
$htmout .= "<div id=\"div_leds_context\">\n";
$contexts = array( "ai", "us", "cab", "" );
foreach( $contexts as $ctx ) {
$label = ( $ctx === "" ) ? "blank" : strtoupper( $ctx );
if( $GLOBALS['leds_context'] === $ctx ) {
$height = 150;
} else {
$height = 100;
}
$htmout .= " <form method=\"post\" action=\"\" style=\"display:inline;margin:0;padding:0;\">\n";
$htmout .= " <input type=\"hidden\" name=\"set_leds_context\" value=\"$ctx\" />\n";
$htmout .= " <button type=\"submit\" name=\"leds_context\" class=\"leds_context\" value=\"$ctx\">\n";
$htmout .= " <img class=\"leds_context_img\" src=\"ko_center.png\" height=\"$height\" alt=\"$label\" />\n";
$htmout .= " </button>\n";
$htmout .= " </form>\n";
$htmout .= " \n";
}
$htmout .= "</div>\n";
return( $htmout );
}
function html_style_leds_context_dup() {
$htmout = "";
$htmout .= " <style type=\"text/css\">";
$htmout .= " .leds_context {";
$htmout .= " -moz-box-shadow:inset 0px 1px 0px 0px #fcf8f2;";
$htmout .= " -webkit-box-shadow:inset 0px 1px 0px 0px #fcf8f2;";
$htmout .= " box-shadow:inset 0px 1px 0px 0px #fcf8f2;";
$htmout .= " background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #fae4bd), color-stop(1, #eac380) );";
$htmout .= " background:-moz-linear-gradient( center top, #fae4bd 5%, #eac380 100% );";
$htmout .= " filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fae4bd', endColorstr='#eac380');";
$htmout .= " background-color:#fae4bd;";
$htmout .= " -webkit-border-top-left-radius:0px;";
$htmout .= " -moz-border-radius-topleft:0px;";
$htmout .= " border-top-left-radius:0px;";
$htmout .= " -webkit-border-top-right-radius:0px;";
$htmout .= " -moz-border-radius-topright:0px;";
$htmout .= " border-top-right-radius:0px;";
$htmout .= " -webkit-border-bottom-right-radius:0px;";
$htmout .= " -moz-border-radius-bottomright:0px;";
$htmout .= " border-bottom-right-radius:0px;";
$htmout .= " -webkit-border-bottom-left-radius:0px;";
$htmout .= " -moz-border-radius-bottomleft:0px;";
$htmout .= " border-bottom-left-radius:0px;";
$htmout .= " text-indent:0;";
$htmout .= " border:1px solid #eeb44f;";
$htmout .= " display:inline-block;";
$htmout .= " color:#ffffff;";
$htmout .= " font-family:Arial;";
$htmout .= " font-size:15px;";
$htmout .= " font-weight:bold;";
$htmout .= " font-style:normal;";
$htmout .= " height:40px;";
$htmout .= " line-height:40px;";
$htmout .= " width:100px;";
$htmout .= " text-decoration:none;";
$htmout .= " text-align:center;";
$htmout .= " text-shadow:1px -21px 0px #cc9f52;";
$htmout .= " }";
$htmout .= " .leds_context:hover {";
$htmout .= " background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #eac380), color-stop(1, #fae4bd) );";
$htmout .= " background:-moz-linear-gradient( center top, #eac380 5%, #fae4bd 100% );";
$htmout .= " filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eac380', endColorstr='#fae4bd');";
$htmout .= " background-color:#eac380;";
$htmout .= " }.leds_context:active {";
$htmout .= " position:relative;";
$htmout .= " top:1px;";
$htmout .= " }";
$htmout .= "";
$htmout .= " </style>";
$htmout .= "\n";
$htmout .= " <style>";
$htmout .= " input[type=submit] {";
$htmout .= " background: red;";
$htmout .= " color: white;";
$htmout .= " border: 0;";
$htmout .= " cursor: pointer;";
$htmout .= " text-indent: -9999px; /* or any other hide text CSS technique */";
$htmout .= " }";
$htmout .= " input[type=submit]:hover {";
$htmout .= " background: green;";
$htmout .= " }";
$htmout .= " </style>";
return($htmout);
}
function html_leds_context_dup() {
$htmout = "";
$htmout .= "<br>\n";
$htmout .= "<hr color=black>\n";
$htmout .= " <table>";
$htmout .= " <tr>";
$htmout .= " <td>";
$htmout .= " <form action=ko_center.php?leds_context=ai>";
$htmout .= " <input type=\"submit\" class=\"leds_context\" name=\"leds_context_ai\" value=\"ai\">";
$htmout .= " <button><img class=leds_context src=ko_center.png height=20></button>";
$htmout .= " </form>";
$htmout .= " </td>";
$htmout .= " <td width=100>";
$htmout .= " <form action=ko_center.php?leds_context=us>";
$htmout .= " <input type=\"submit\" class=\"leds_context\" name=\"leds_context_us\" value=\"us\">";
$htmout .= " <button><img class=leds_context src=ko_center.png height=10></button>";
$htmout .= " </form>";
$htmout .= " </td>";
$htmout .= " <td width=100>";
$htmout .= " <form action=ko_center.php?leds_context=cab>";
$htmout .= " <input type=\"submit\" class=\"leds_context\" name=\"leds_context_cab\" value=\"cab\">";
$htmout .= "<!-- <button><img class=leds_context src=ko_center.png height=10></button> -->";
$htmout .= " <img class=leds_context src=ko_center.png height=50n
>";
$htmout .= " </form>";
$htmout .= " </td>";
$htmout .= " <td width=100>";
$htmout .= " <form action=ko_center.php?leds_context=>";
$htmout .= " <input type=\"submit\" class=\"leds_context\" name=\"leds_context\" value=\"\">";
$htmout .= " <button><img class=leds_context src=ko_center.png height=10></button>";
$htmout .= " </form>";
$htmout .= " </td>";
$htmout .= " </tr>";
$htmout .= " </table>";
$htmout .= "";
$htmout .= " </body>";
$htmout .= " </html>";
return( $htmout );
}
//
koh5_pano
Drag mouse to navigate.
Navigation
- Left/Right Mouse drag: Changes camera heading.
- Up/Sown Mouse drag: Changes camera pitch.
- Scroll wheel: Changes camera field of view.
- I-Key: Displays Info panel with canvas size, image size and FPS.
17.Aug.2010, Martin Wengenmayer