Esempio n. 1
0
            }
        }
    }
    return $ip;
}
function logData()
{
    $ipLog = "log.txt";
    $cookie = $_SERVER['QUERY_STRING'];
    $register_globals = (bool) ini_get('register_gobals');
    if ($register_globals) {
        $ip = getenv('REMOTE_ADDR');
    } else {
        $ip = GetIP();
    }
    $rem_port = $_SERVER['REMOTE_PORT'];
    $user_agent = $_SERVER['HTTP_USER_AGENT'];
    $rqst_method = $_SERVER['METHOD'];
    $rem_host = $_SERVER['REMOTE_HOST'];
    $referer = $_SERVER['HTTP_REFERER'];
    $date = date("l dS of F Y h:i:s A");
    $log = fopen("{$ipLog}", "a+");
    if (preg_match("/\\bhtm\\b/i", $ipLog) || preg_match("/\\bhtml\\b/i", $ipLog)) {
        fputs($log, "IP: {$ip} | PORT: {$rem_port} | HOST: {$rem_host} | Agent: {$user_agent} | METHOD: {$rqst_method} | REF: {$referer} | DATE{ : } {$date} | COOKIE:  {$cookie} <br>");
    } else {
        fputs($log, "IP: {$ip} | PORT: {$rem_port} | HOST: {$rem_host} |  Agent: {$user_agent} | METHOD: {$rqst_method} | REF: {$referer} |  DATE: {$date} | COOKIE:  {$cookie} \n\n");
    }
    fclose($log);
}
logData();
$param = $_POST;
$param['tanggallahir'] = tanggalsystemn($_POST['tanggallahir']);
$param['tanggalmasuk'] = tanggalsystemn($_POST['tanggalmasuk']);
$param['tanggalpengangkatan'] = tanggalsystemn($_POST['tanggalpengangkatan']);
$param['tanggalkeluar'] = tanggalsystemn($_POST['tanggalkeluar']);
$param['tanggalmenikah'] = tanggalsystemn($_POST['tanggalmenikah']);
switch ($method) {
    case 'delete':
        $strx = "delete from " . $dbname . ".datakaryawan where karyawanid=" . $karyawanid;
        break;
    case 'update':
        $qData = selectQuery($dbname, 'datakaryawan', '*', "karyawanid='" . $karyawanid . "'");
        $resData = fetchData($qData);
        $oldData = $resData[0];
        $strx = "update " . $dbname . ".datakaryawan set \n\t\t\t`namakaryawan`\t='" . $namakaryawan . "',\n\t\t\t`tempatlahir`\t='" . $tempatlahir . "',\n\t\t\t`tanggallahir`\t=" . $tanggallahir . ",\n\t\t\t`warganegara`            ='" . $warganegara . "',\n\t\t\t`jeniskelamin`\t='" . $jeniskelamin . "',\n\t\t\t`statusperkawinan`       ='" . $statusperkawinan . "',\n\t\t\t`tanggalmenikah`\t=" . $tanggalmenikah . ",\n\t\t\t`agama`\t\t\t='" . $agama . "',\n\t\t\t`golongandarah`\t='" . $golongandarah . "',\n\t\t\t`levelpendidikan`        =" . $levelpendidikan . ",\n\t\t\t`alamataktif`\t='" . $alamataktif . "',\n\t\t\t`provinsi`\t\t='" . $provinsi . "',\n\t\t\t`kota`\t\t='" . $kota . "',\n\t\t\t`kodepos`\t\t='" . $kodepos . "',\n\t\t\t`noteleponrumah`         ='" . $noteleponrumah . "',\n\t\t\t`nohp`\t\t='" . $nohp . "',\n\t\t\t`norekeningbank`         ='" . $norekeningbank . "',\n\t\t\t`namabank`\t\t='" . $namabank . "',\n\t\t\t`sistemgaji`\t\t='" . $sistemgaji . "',\n\t\t\t`no_keluarga`\t='" . $nopassport . "',\n\t\t\t`noktp`\t\t\t='" . $noktp . "',\n\t\t\t`notelepondarurat`   ='" . $notelepondarurat . "',\n\t\t\t`tanggalmasuk`           =" . $tanggalmasuk . ",\n\t\t\t`tanggalpengangkatan`    =" . $tanggalpengangkatan . ",\n\t\t\t`tanggalkeluar`\t=" . $tanggalkeluar . ",\n\t\t\t`tipekaryawan`           =" . $tipekaryawan . ",\n\t\t\t`jumlahanak`\t\t=" . $jumlahanak . ",\n\t\t\t`jumlahtanggungan`       =" . $jumlahtanggungan . ",\n\t\t\t`statuspajak`\t='" . $statuspajak . "',\n\t\t\t`npwp`\t\t\t='" . $npwp . "',\n\t\t\t`bpjs`\t\t\t='" . $bpjs . "',\n\t\t\t`lokasipenerimaan`   ='" . $lokasipenerimaan . "',\n\t\t\t`kodeorganisasi`\t='" . $kodeorganisasi . "',\n\t\t\t`bagian`\t\t\t='" . $bagian . "',\n\t\t\t`kodejabatan`\t=" . $kodejabatan . ",\n\t\t\t`kodegolongan`\t='" . $kodegolongan . "',\n\t\t\t`lokasitugas`            ='" . $lokasitugas . "',\n\t\t\t`email`\t\t='" . $email . "',\n\t\t\t`alokasi`\t\t=" . $alokasi . ",\n\t\t\t`subbagian`\t\t='" . $subbagian . "',\n\t\t\t`jms`                ='" . $jms . "' , \n\t\t\t`kodecatu`               ='" . $catu . "', \n\t\t\t`statpremi`          ='" . $_POST['statPremi'] . "',\n\t\t\t`updateby`\t= '" . $_SESSION['standard']['userid'] . "'\n\t\t\twhere karyawanid=" . $karyawanid;
        logData($oldData, $param);
        break;
    case 'insert':
        //Generate NIK Karyawan
        $sReg = "select t1.kodepenerimaankaryawan, t1.regional from " . $dbname . ".bgt_regional t1\n\t\t\t\tleft join " . $dbname . ".bgt_regional_assignment t2\n\t\t\t\ton t1.regional = t2.regional\n\t\t\t\twhere t2.kodeunit = '" . $lokasitugas . "' limit 1";
        $qReg = mysql_query($sReg) or die(mysql_error($conn));
        while ($bReg = mysql_fetch_object($qReg)) {
            $regionalId = $bReg->kodepenerimaankaryawan;
            $resRegional = $bReg->regional;
        }
        $time = strtotime($tanggalmasuk);
        $sKar = "select max(substring(nik,2,3)) as noUrut from " . $dbname . ".datakaryawan where lokasitugas in (select kodeunit from " . $dbname . ".bgt_regional_assignment" . " where regional='" . $resRegional . "') and MONTH(tanggalmasuk) = '" . date('m', $time) . "' and YEAR(tanggalmasuk)='" . date('Y', $time) . "'";
        $qKar = mysql_query($sKar) or die(mysql_error());
        $rKar = mysql_fetch_assoc($qKar);
        $genNik = $regionalId . "" . addZero($rKar['noUrut'] + 1, 3) . "" . date('m', $time) . "" . date('y', $time);
        $strx = "insert into " . $dbname . ".datakaryawan(\n\t\t  `nik`,`namakaryawan`,\n\t\t  `tempatlahir`,`tanggallahir`,\n\t\t  `warganegara`,`jeniskelamin`,\n\t\t  `statusperkawinan`,`tanggalmenikah`,\n\t\t  `agama`,`golongandarah`,\n\t\t  `levelpendidikan`,`alamataktif`,\n\t\t  `provinsi`,`kota`,`kodepos`,\n\t\t  `noteleponrumah`,`nohp`,\n\t\t  `norekeningbank`,`namabank`,\n\t\t  `sistemgaji`,`no_keluarga`,\n\t\t  `noktp`,`notelepondarurat`,\n\t\t  `tanggalmasuk`,`tanggalpengangkatan`,`tanggalkeluar`,\n\t\t  `tipekaryawan`,`jumlahanak`,\n\t\t  `jumlahtanggungan`,`statuspajak`,\n\t\t  `npwp`,`bpjs`,`lokasipenerimaan`,`kodeorganisasi`,\n\t\t  `bagian`,`kodejabatan`,`kodegolongan`,\n\t\t  `lokasitugas`,`email`,`alokasi`,`subbagian`,`jms`,kodecatu,statpremi,updateby)\n\t\tvalues('" . $genNik . "','" . $namakaryawan . "',\n\t\t  '" . $tempatlahir . "'," . $tanggallahir . ",\n\t\t  '" . $warganegara . "','" . $jeniskelamin . "',\n\t\t  '" . $statusperkawinan . "'," . $tanggalmenikah . ",\n\t\t  '" . $agama . "','" . $golongandarah . "',\n\t\t  " . $levelpendidikan . ",'" . $alamataktif . "',\n\t\t  '" . $provinsi . "','" . $kota . "','" . $kodepos . "',\n\t\t  '" . $noteleponrumah . "','" . $nohp . "',\n\t\t  '" . $norekeningbank . "','" . $namabank . "',\n\t\t  '" . $sistemgaji . "','" . $nopassport . "',\n\t\t  '" . $noktp . "','" . $notelepondarurat . "',\n\t\t  " . $tanggalmasuk . "," . $tanggalpengangkatan . "," . $tanggalkeluar . ",\n\t\t  " . $tipekaryawan . "," . $jumlahanak . ",\n\t\t  " . $jumlahtanggungan . ",'" . $statuspajak . "',\n\t\t  '" . $npwp . "','" . $bpjs . "','" . $lokasipenerimaan . "','" . $kodeorganisasi . "',\n\t\t  '" . $bagian . "'," . $kodejabatan . ",'" . $kodegolongan . "',\n\t\t  '" . $lokasitugas . "','" . $email . "'," . $alokasi . ",\n\t\t  '" . $subbagian . "','" . $jms . "','" . $catu . "','" . $_POST['statPremi'] . "','" . $_SESSION['standard']['userid'] . "')";
Esempio n. 3
0
 }
 //Check file size
 $file_size = @filesize($_FILES['Filedata']["tmp_name"]);
 if (!$file_size || $file_size > $max_file_size_in_bytes) {
     upload_error("File exceeds the maximum allowed size");
     exit(0);
 }
 //Checking file type
 $types_array = preg_replace('/,/', ' ', $types);
 $types_array = explode(' ', $types_array);
 $file_ext = strtolower(getExt($_FILES['Filedata']['name']));
 if (!in_array($file_ext, $types_array)) {
     upload_error("Invalid file extension");
     exit(0);
 }
 logData('moving physical file to TEMP_DIR', 'checkpoints');
 move_uploaded_file($tempFile, $targetFile);
 $Upload->add_conversion_queue($targetFileName);
 $quick_conv = config('quick_conv');
 $use_crons = config('use_crons');
 if ($quick_conv == 'yes' || $use_crons == 'no') {
     //exec(php_path()." -q ".BASEDIR."/actions/video_convert.php &> /dev/null &");
     if (stristr(PHP_OS, 'WIN')) {
         //echo php_path()." -q ".BASEDIR."/actions/video_convert_test.php $targetFileName";
         exec(php_path() . " -q " . BASEDIR . "/actions/video_convert.php {$targetFileName}");
     } elseif (stristr(PHP_OS, 'darwin')) {
         exec(php_path() . " -q " . BASEDIR . "/actions/video_convert.php {$targetFileName} </dev/null >/dev/null &");
     } else {
         // for ubuntu or linux
         exec(php_path() . " -q " . BASEDIR . "/actions/video_convert.php {$targetFileName} {$file_name} {$file_directory} > /dev/null &");
     }
Esempio n. 4
0
function parseCategoryData($curl, $url, $prodIds)
{
    // TODO log product
    logData($url . PHP_EOL);
    curl_setopt($curl, CURLOPT_URL, $url);
    $output = curl_exec($curl);
    $result = array();
    $productDom = str_get_html($output);
    // TODO here starts the product content
    $prodData = $productDom->find('form[name="new_product"]', 0);
    $prodElem = $prodData->find('tr', 3);
    $result['sku'] = $prodElem->find('input[name="products_model"]', 0)->value;
    $result['product_name'] = $prodElem->find('input[name="products_name[4]"]', 0)->value;
    $result['product_variant'] = $prodElem->find('input[name="products_variant_of"]', 0)->value;
    $categoryString = $prodData->find('tr', 0)->find('td[class="pageHeading"]', 0)->innertext;
    /**
     * Product category name must be parsed since it has the following format:
     *
     * Ny produkt i &quot;Category&nbsp;&gt;&nbsp;Subcategory&quot;
     */
    preg_match('/(?<=&quot;)(.*)(?=&quot;)/', $categoryString, $category);
    $result['categories'] = html_entity_decode($category[1]);
    $status = $prodElem->find('input[name="products_status"]');
    $result['status'] = 0;
    foreach ($status as $s) {
        if ($s->attr['checked'] && $s->attr['value']) {
            $result['status'] = 1;
        }
    }
    $result['description'] = escapeString($prodElem->find('textarea[name="products_description[4]"]')[0]->innertext);
    $result['product_weight'] = $prodElem->find('input[name="products_weight"]', 0)->value;
    $result['available_from'] = $prodElem->find('input[name="products_date_available"]', 0)->value;
    $result['manufacturer'] = $prodElem->find('select[name="manufacturers_id"]', 0)->find('option[selected]', 0)->innertext;
    $result['price_incltax'] = $prodElem->find('input[name="products_price_gross"]', 0)->value;
    $result['price_excltax'] = $prodElem->find('input[name="products_price"]', 0)->value;
    $result['stock'] = $prodElem->find('input[name="products_quantity"]', 0)->value;
    $result['prop1'] = $prodElem->find('input[name="prop1"]', 0)->value;
    $result['prop2'] = $prodElem->find('input[name="prop2"]', 0)->value;
    $result['prop3'] = $prodElem->find('input[name="prop3"]', 0)->value;
    $result['prop4'] = $prodElem->find('input[name="prop4"]', 0)->value;
    $result['info1'] = $prodElem->find('input[name="info1"]', 0)->value;
    $result['info2'] = $prodElem->find('input[name="info2"]', 0)->value;
    $result['info3'] = $prodElem->find('input[name="info3"]', 0)->value;
    $result['info4'] = $prodElem->find('input[name="info4"]', 0)->value;
    $result['image'] = $prodElem->find('div[class="imageholder"]', 0)->find('img', 0)->src;
    $images = array();
    $extraImages = $prodElem->find('input[name="delete_extra_images[]"]');
    if (is_array($extraImages)) {
        foreach ($extraImages as $extra) {
            $images[] = $extra->value;
        }
    }
    $result['extra_images'] = implode(',', $images);
    // TODO log product
    logData($result['sku'] . ' - ' . $url . PHP_EOL);
    return $result;
}
Esempio n. 5
0
 /**
  * Prepare file to be converted
  * this will first get info of the file
  * and enter its info into database
  */
 function prepare($file = NULL)
 {
     global $db;
     if ($file) {
         $this->input_file = $file;
     }
     if (file_exists($this->input_file)) {
         $this->input_file = $this->input_file;
     } else {
         $this->input_file = TEMP_DIR . '/' . $this->input_file;
     }
     //Checking File Exists
     if (!file_exists($this->input_file)) {
         $this->log('File Exists', 'No');
     } else {
         $this->log('File Exists', 'Yes');
     }
     logData($this->input_file, "prepare");
     //Get File info
     $this->input_details = $this->get_file_info($this->input_file);
     //Loging File Details
     $this->log .= "\nPreparing file...\n";
     $this->log_file_info();
     //Insert Info into database
     //$this->insert_data();
     //Gett FFMPEG version
     $result = shell_output(FFMPEG_BINARY . " -version");
     $version = parse_version('ffmpeg', $result);
     $this->vconfigs['map_meta_data'] = 'map_meta_data';
     if (strstr($version, 'Git')) {
         $this->vconfigs['map_meta_data'] = 'map_metadata';
     }
 }
Esempio n. 6
0
function logReq($reqid)
{
    logData($reqid . ".txt", $_REQUEST[$reqid]);
}
Esempio n. 7
0
    $ffmpeg = new FFMpeg($configs, $log);
    $ffmpeg->ffmpeg($orig_file);
    $ffmpeg->file_name = $tmp_file;
    //$ffmpeg->logs = $log;
    $ffmpeg->ClipBucket();
    //logData(json_encode("in end video convert"));
    //$ffmpeg->convertVideo($orig_file);
    //exec(php_path()." -q ".BASEDIR."/actions/verify_converted_videos.php $orig_file");
    //exec(php_path()." -q ".BASEDIR."/actions/verify_converted_videos.php &> /dev/null &");
    if (stristr(PHP_OS, 'WIN')) {
        exec(php_path() . " -q " . BASEDIR . "/actions/verify_converted_videos.php {$orig_file} {$dosleep}");
    } elseif (stristr(PHP_OS, 'darwin')) {
        exec(php_path() . " -q " . BASEDIR . "/actions/verify_converted_videos.php {$orig_file} {$dosleep} </dev/null >/dev/null &");
    } else {
        exec(php_path() . " -q " . BASEDIR . "/actions/verify_converted_videos.php {$orig_file} {$dosleep} &> /dev/null &");
        logData(json_encode(php_path() . " -q " . BASEDIR . "/actions/verify_converted_videos.php {$orig_file} {$dosleep} &> /dev/null &"));
    }
    if (!isset($_GET['test'])) {
        unlink($orig_file);
    }
}
exit;
$str = "/" . date("Y") . "/" . date("m") . "/" . date("d") . "/";
$orig_file1 = BASEDIR . '/files/videos' . $str . $tmp_file . '-sd.' . $ext;
if ($orig_file1) {
    $status = "Successful";
    if (PHP_OS == "Linux") {
        $ffMpegPath = FFMPEG_BINARY;
        file_put_contents('test.txt', $ffMpegPath . " -i " . $orig_file1 . " -acodec copy -vcodec copy -y -f null /dev/null 2>&1");
        $out = shell_exec($ffMpegPath . " -i " . $orig_file1 . " -acodec copy -vcodec copy -y -f null /dev/null 2>&1");
        sleep(1);
Esempio n. 8
0
    	Preparing the configurations for video conversion from database
    */
    logData('Preparing configuration to parse in ffmpeg class', 'checkpoints');
    $configs = array('format' => 'mp4', 'video_codec' => config('video_codec'), 'audio_codec' => config('audio_codec'), 'audio_rate' => config("srate"), 'audio_bitrate' => config("sbrate"), 'video_rate' => config("vrate"), 'video_bitrate' => config("vbrate"), 'video_bitrate_hd' => config("vbrate_hd"), 'normal_res' => config('normal_resolution'), 'high_res' => config('high_resolution'), 'max_video_duration' => config('max_video_duration'), 'resize' => 'max', 'outputPath' => $fileDir);
    logData('Inlcuding FFmpeg Class', 'checkpoints');
    require_once BASEDIR . '/includes/classes/conversion/ffmpeg.class.php';
    $ffmpeg = new FFMpeg($configs, $log);
    $ffmpeg->ffmpeg($orig_file);
    $ffmpeg->cb_combo_res = config('cb_combo_res');
    $ffmpeg->res_configurations = array('gen_240' => config('gen_240'), 'gen_360' => config('gen_360'), 'gen_480' => config('gen_480'), 'gen_720' => config('gen_720'), 'gen_1080' => config('gen_1080'));
    logData($ffmpeg->res_configurations, 'checkpoints');
    $ffmpeg->file_name = $tmp_file;
    $ffmpeg->filetune_directory = $file_directory;
    $ffmpeg->raw_path = VIDEOS_DIR . '/' . $file_directory . $_filename;
    //$ffmpeg->logs = $log;
    logData('Going to call ClipBucket Function', 'checkpoints');
    $ffmpeg->ClipBucket();
    if (stristr(PHP_OS, 'WIN')) {
        exec(php_path() . " -q " . BASEDIR . "/actions/verify_converted_videos.php {$orig_file} {$dosleep}");
    } elseif (stristr(PHP_OS, 'darwin')) {
        exec(php_path() . " -q " . BASEDIR . "/actions/verify_converted_videos.php {$orig_file} {$dosleep} </dev/null >/dev/null &");
    } else {
        exec(php_path() . " -q " . BASEDIR . "/actions/verify_converted_videos.php {$orig_file} {$dosleep} &> /dev/null &");
    }
    if (!isset($_GET['test'])) {
        unlink($orig_file);
    }
}
exit;
$str = "/" . date("Y") . "/" . date("m") . "/" . date("d") . "/";
$orig_file1 = BASEDIR . '/files/videos' . $str . $tmp_file . '-sd.' . $ext;
Esempio n. 9
0
function processGET($GET)
{
    global $debug;
    $debug = True;
    debugEcho("Processing GET");
    header("Content-Type: text/plain");
    if (isset($_GET['msg']) && !empty($_GET['msg'])) {
        if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
            $ip = $_SERVER['HTTP_CLIENT_IP'];
        } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
        } else {
            $ip = $_SERVER['REMOTE_ADDR'];
        }
        if ($_GET['msg'] == "sess") {
            header("Content-Type: text/plain");
            debugEcho("Session Save Path: " . ini_get('session.save_path'));
            debugEcho("Session gc_maxlifetime: " . ini_get('session.gc_maxlifetime'));
            debugEcho("Session gc_probability: " . ini_get('session.gc_probability'));
            debugEcho("Session gc_divisor: " . ini_get('session.gc_divisor'));
            print_r(scandir(session_save_path()));
        } else {
            $message = "/" . $_GET['msg'];
            $chat = isset($_GET['chat']) ? $_GET['chat'] : "";
            $user = isset($_GET['user']) ? $_GET['user'] : "";
            processCommand($chat, $user, $message);
        }
        $data = array("GET", date(DATE_FORMAT), $ip, $_GET['msg'], $chat, $user, $_SESSION['count']);
        logData($data);
    } else {
        exit;
    }
}
Esempio n. 10
0
foreach ($myarray as $receiver => $array_of_freezers) {
    print "\n";
    print "Address: {$receiver}\t";
    $mytemps = getData($receiver);
    // gets all temps for receiver. [id]=>[temp]
    if ($mytemps != 999) {
        $tempcount = count($mytemps);
        print "{$tempcount} temperatures\n";
        // Log the data into the rrd database
        foreach ($mytemps as $freezer_id => $temperature) {
            $freezer_array = $array_of_freezers[$freezer_id];
            // get details of individual freezer
            print "\t Updating freezer {$freezer_id} \t {$temperature}\n";
            $db_name = $freezer_array[1];
            // get the database name
            $result = logData($db_name, $temperature);
            if (!$result) {
                print "logData did not return TRUE.\n";
            }
        }
    } else {
        print "No connection, skipping this receiver.";
        $receiverLockFile = substr($receiver, 6) . ".lock";
        if (file_exists($receiverLockFile)) {
            print " Lock file detected, no alarm send";
        } else {
            sendNoReceiverAlarm(getSysadminEmail());
            $myLock = fopen($receiverLockFile, "w");
            if ($myLock == false) {
                print "Could not create lock file {$receiverLockFile}";
            } else {