console.log("$_SESSION[\'currentpage\'] = '.$_SESSION['currentpage'].'")'; exit; } if ($_GET['log'] == 'out') { session_destroy(); header("location: /"); } $root = '/home/frontlin/domains/flnr.nl/private_html/'; require_once $root.'lib/class.flnr.php'; require_once $root.'lib/fbsdk/src/facebook.php'; require_once $root.'lib/fbsdk/src/ffb_frontliner_global.php'; $flnr = new flnr('localhost', 'frontlin_a', 'BDnd9121', 'frontlin_flnr', $root); $mobile = $flnr->checkMobile(); $js = new js($root); $css = new css($root); $smartmenu = new smartmenu($flnr, $mobile, 'pages/'); $links = new links($flnr); $forms = new forms($flnr, $links); $post = new post($flnr); if (!$_SESSION['tableinformation']) { $_SESSION['tableinformation'] = $forms->tblIdentification(); } if ($_GET['export'] == 'csv') { $forms->exportCsv($_GET['table']); exit; } if ($_GET['export'] == 'csvtemplate') { $forms->exportCsv($_GET['table'], true); exit; } if ($_FILES['csv_file']) { $table = $_POST['csv_table']; $scheme = $flnr->getSqlSchemeTable($table); $tinfo = $forms->tblIdentification($table); $csvfile = $_FILES['csv_file']['tmp_name']; $handle = fopen($csvfile, "r"); $r = 0; $startrow = 1; $col = 0; $datacolc = 0; foreach ($scheme as $colv) { $colArr[$col] = $colv['COLUMN_COMMENT']; $colArrDf[$col] = $colv['COLUMN_DEFAULT']; $col++; } while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) { if ($r >= $startrow) { $dstr = 'NULL,'; $datacolc = 0; foreach ($data as $v) { $c_comment = $colArr[($datacolc+1)]; $c_default = $colArrDf[($datacolc+1)]; $e = explode(":", str_replace("!", "", str_replace(".", "", $c_comment))); $c = ($e[0]) ? $e[0] : 'txt'; $sfld = $e[1]; if ($c == 'sf' || $c == 'lsf' || $c == 'ac') { $tinfoSf = $forms->tblIdentification($sfld); $srcSqlStr = "SELECT * FROM `".$sfld."` WHERE `".$tinfoSf[4]."` = '".$v."'"; $sfxsql = $flnr->getSql($srcSqlStr); $id = $sfxsql['array'][0][$tinfoSf[0]]; $code = $sfxsql['array'][0][$tinfoSf[4]]; $saveValue = ($c == 'ac') ? $code : $id; } else { $finddate = explode("-", $v); $mktime = mktime(0, 0, 0, $finddate[1], $finddate[0], $finddate[2]); $saveValue = ($mktime) ? $mktime : $forms->csvSafeName($v); } $saveValue = ($saveValue != '') ? $saveValue : $colArrDf[$col]; $dstr .= "'".addslashes($saveValue)."',"; $datacolc++; } $sqlstr="INSERT INTO ".$table." VALUES (".substr($dstr, 0, -1).")"; //echo $sqlstr.'
'; $flnr->qSql($sqlstr); } $r++; } fclose($handle); //echo $result; //echo '
'.print_r($tinfo, true).'
'; //exit; $_SESSION['postsuccess'] = 'CSV import completed.'; header("location: /"); } if ($_POST) { if (!$_POST['nothing']) { $a = explode("_", $_POST['action']); $action = $a[0]; $table = str_replace($action."_", "", $_POST['action']); //echo '
'.print_r($_POST, true).'
'; //echo '
'.print_r($_FILES, true).'
'; //exit; $editSql = $post->postToMysql($table, $_POST, $_FILES, $action, $root.'files/'); } } if ($_GET['dialog']) { $html = '
'; switch ($_GET['dialog']) { case 'csvimport': $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= '
'; break; default: $table = $_GET['table']; $table_id_field = $forms->getPrimairyKeyFieldFrom($table); $sql = $flnr->getSql("SELECT * FROM `".$table."` WHERE `".$table_id_field."` = '".$_GET['id']."'"); $edittable = $forms->createAETable($table, 'dialog_edit'.$table, 'default', $sql['array'][0], '500px', true, 500, true); $html = $edittable; //$html .= '
'.print_r($sql,true).'
'.$table_id_field; break; } $html .= '
'; echo $html; exit; } // start html $html = ''."\n"; $html .= ''."\n"; $html .= ''."\n"; $html .= $css->htmlHeadCssSrc(); $html .= $js->htmlHeadJsSrc(); $html .= ''; $html .= ''."\n"; $html .= ''."\n"; $html .= ($_GET['table'] != 'flnr_links') ? '' : ''; $html .= ''."\n"; $html .= ''; $html .= ''; $html .= ''; $scale = '0.7'; $html .= ''; //$html .= ''; $html .= 'ADMIN V2'."\n"; $htmlpace = ' '; $html .= ''."\n"; $html .= (!$mobile) ? ''."\n\n" : ''; $html .= '
'; $html .= ''; if ($_SESSION['is_log']) { $mwclss = ($_GET['table'] != 'flnr_links') ? 'main_blurred' : ''; $html .= '
' .$smartmenu->createSmartMenu('sm-clean', 'pages/') .'
' .'
'; echo $html; $sessionurl = strtok($_SESSION['currentpage'], '?'); if ($_GET['page']) { include_once 'pages/'.$_GET['page']; } elseif ($sessionurl) { //echo $_SESSION['currentpage']; include_once $sessionurl; /*$jsloadauto = '';*/ //include_once 'pages/'.$_SESSION['currentpage']; } else { include_once 'pages/p.links.php'; } //$loadinghtml = '

Welcome

'.$sessionurl.' - '.$_SESSION['currenttable']; $html = $loadinghtml.$jsloadauto; if ($_SESSION['logarr']['wal_level'] >= 98) { //$html .= '

'; //$html .= 'Current Page (from session: '.$_SESSION['currentpage'].') | '; //$html .= '
'; } $html .= '
' .'
' ."\n"; $html .= ""; } else { $html .= '
' .'

Login

' .'
' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'
' .'' .'' .'' .'
' .'' .'' .'' .'' .'
' .'
' .'
'; } $html .= ' '; $html .= "\n\n\n"; $html .= ''; echo $html; ?>