/* Decoded by unphp.net */ ?> '' ); } function __autoload($class) { if (file_exists("../utilities/{$class}.php")) include_once("../utilities/{$class}.php"); } $obj = new database; $table = isset($_REQUEST['txtTable']) ? filter_var($_REQUEST['txtTable'], FILTER_SANITIZE_STRING) : NULL; $delimit = isset($_REQUEST['txtLimit']) ? filter_var($_REQUEST['txtLimit'], FILTER_SANITIZE_STRING) : NULL; $fileCsv = isset($_REQUEST['txtFile']) ? filter_var($_REQUEST['txtFile'], FILTER_SANITIZE_STRING) : NULL; $nbLigne = isset($_REQUEST['txtLigne']) ? filter_var($_REQUEST['txtLigne'], FILTER_SANITIZE_NUMBER_INT) : NULL; for ( $i = 0 ; $i < $nbLigne ; $i++ ) : $tcsv = "txtcsv" . $i; $scsv = "valcsv" . $i; $ttbl = "txttbl" . $i; $stbl = "valtbl" . $i; $txtcsv[] = isset($_REQUEST[$tcsv]) ? filter_var($_REQUEST[$tcsv], FILTER_SANITIZE_STRING) : NULL; $valcsv[] = isset($_REQUEST[$scsv]) ? filter_var($_REQUEST[$scsv], FILTER_SANITIZE_STRING) : NULL; $txttbl[] = isset($_REQUEST[$ttbl]) ? filter_var($_REQUEST[$ttbl], FILTER_SANITIZE_STRING) : NULL; $valtbl[] = isset($_REQUEST[$stbl]) ? filter_var($_REQUEST[$stbl], FILTER_SANITIZE_STRING) : NULL; endfor; // for ( $i = 0 ; $i < $nbLigne ; $i++ ) : $numCol = array_filter($valcsv, "vide"); $arrCol = array_values( array_filter($txttbl, "aucun") ) ; $arrCol = array("numsalarie","periode","Semaine","Credit"); if ( $nbLigne > 0 ) : $row = 0; if ( ($handle = fopen($fileCsv, "r") ) !== FALSE ) : $keys = array(); $out = array(); $line = 1; $taille = filesize($fileCsv) + 1; while ( ($data = fgetcsv($handle, $taille, ",") ) !== FALSE ) : foreach ($data as $key => $value) : if ( $line !== 1 ) $out[$line] = utf8_encode($value); endforeach; $line++; endwhile; // while ( ($data = fgetcsv($handle, $taille, ",") ) !== FALSE ) fclose($handle); if ( !empty($out) ) : $nbDatas = count($out); $nbDatas += 2; if ( $nbDatas > 0) : for ($j = 2 ; $j < $nbDatas ; $j++ ) : if ( !empty($out[$j]) ) { $terms = array(); $arrRows = explode($delimit, $out[$j]); foreach ($numCol as $key ) : $terms[] = $arrRows[$key]; endforeach; $insert = array_combine($arrCol, $terms); $insert['Credit'] = toReqs($insert['Credit'],$obj); //var_dump($insert); $obj->executeQuery($table, $insert); } endfor; // for ($j = 2 ; $j < $nbDatas ; $j++ ) endif; // if ( $nbDatas > 0) endif; // if ( !empty($out) ) endif; // if ( ($handle = fopen($fileCsv, "r") ) !== FALSE ) unlink($fileCsv); endif; // if ( $nbLigne > 0 ) function toReqs($texte,$obj){ $tab = explode(":", $texte); $h = $tab[0]; $m = $tab[1]; $s = $tab[2]; $req = "select dbo.heuretodate({$h},{$m},{$s}) as dts"; //echo $req; $result = $obj->getData($req); extract($result); return ToDateTime($dts); } function Totime($s){ return substr($s, 0,8); } function ToDateTime($s){ $dates = substr($s, 8,2). "/" . substr($s, 5,2). "/" . substr($s, 0,4); $hr = substr($s, 11,8); return $dates . " " . $hr; } function ToDate($s){ $dates = substr($s, 8,2). "/" . substr($s, 5,2). "/" . substr($s, 0,4); return $dates ; } ?>