function common_var($var_name, $default = NULL)
{
    /*
    return 
        (isset($_POST[$var_name]) 
        ? $_POST[$var_name] 
        :   (isset($_GET[$var_name]) 
            ? $_GET[$var_name] 
            : $default)
        );
    */
    $var = post_var($var_name);
    return !is_null($var) ? $var : get_var($var_name, $default);
}
ini_set('session.use_cookies', 1);
ini_set('session.use_only_cookies', 1);
session_start();
/* Required files */
include_once '../cores/definition.php';
include_once '../cores/db.php';
include_once 'gammu-cores.php';
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE);
$nama_modem = post_var('nama_modem');
$nama_port = strtolower(post_var('nama_port'));
$mode = post_var('mode');
$baudrate = post_var('baudrate');
$path = post_var('path');
$smsc = post_var('smsc');
$php = post_var('php');
$uselog = post_var('use_log') == 'true';
$service_name = GAMMU_SERVICE_NAME;
$str = '';
$str .= empty($nama_port) ? 'Nama Port kosong.<br>' : '';
$str .= empty($mode) ? 'Mode Koneksi kosong.<br>' : '';
$str .= empty($baudrate) ? 'Baudrate kosong.<br>' : '';
$str .= empty($path) ? 'Path Gammu.exe kosong.<br>' : '';
$str .= empty($smsc) ? 'Nomor SMSC kosong.<br>' : '';
$gammu = $path . (substr($path, strlen($path) - 1) == "\\" ? "Gammu.exe" : "\\Gammu.exe");
$path = dirname($gammu);
$str .= !file_exists($gammu) ? 'Direktori Gammu.exe tidak valid.<br>' : '';
$ph = $php . (substr($php, strlen($php) - 1) == "\\" ? "php.exe" : "\\php.exe");
$php = dirname($ph);
$str .= !file_exists($ph) ? 'Direktori Php.exe tidak valid.<br>' : '';
/*
echo 
include_once 'gammu-cores.php';
require_once 'gammu-hex.php';
$no_tujuan = stripslashes(post_var('notujuan'));
$pno = '+62';
if (substr($no_tujuan, 0, 3) != '+62' && substr($no_tujuan, 0, 2) != '08') {
    die('ERNomor tidak valid.<br>Nomor harus diawali dengan +628xx... atau 08xx...');
}
if (substr($no_tujuan, 0, 2) == '08') {
    $no_tujuan = $pno . substr($no_tujuan, 1);
}
$pesan = substr($_mysqli->real_escape_string(stripslashes(post_var('pesan'))), 0, 400);
// $pesan     = post_var('pesan');
// $tipe      = strlen($pesan)>160 ? 'EMS' : 'TEXT';
$tipe = 'TEXT';
$param = strlen($pesan) > 160 ? ' -len 400' : '';
$use = strtoupper(post_var('use'));
$data = 'ERSMS Gagal Dikirim.';
$res = fetch_query('select * from modem_gateway order by id desc limit 0,1');
$modem = $res[0];
$nama_modem = $modem['nama_modem'];
// $nama_modem = '';
unset($res);
if ($use == 'CMD') {
    $command = str_replace('\\', '/', $modem['gammu_path']) . '/gammu-smsd-inject.exe -c "' . str_replace('\\', '/', $modem['gammu_config_file']) . '" ' . $tipe . ' "' . $no_tujuan . '"' . $param . ' -text "' . $pesan . '"';
    //  $command = 'C:/Gammu-1.32.0-Windows/bin/gammu-smsd-inject.exe -c "C:/Gammu-1.32.0-Windows/bin/gammu-config.cfg" TEXT "+6282345798006" -text "tested agaiinn..sds."';
    // die($command);
    $ret = 0;
    $res = array();
    $hasil = exec($command, $res, $ret);
    $found = false;
    // echo $command.'<br>'.$res;
         $kw_file = str_replace("\\","/", realpath('../sms-daemon-hooks')).'/'.basename($kw_file);
         unset($kw_data);                
         */
         // panassa'i / ensure / pastikan:
         $res = keyword_hook_unregister($req_kw, $req_fn);
         if ($res == ERROR_KEYWORD_NOT_REGISTERED || $res == ERROR_KEYWORD_SUCCESS) {
             echo 'OKKeyword telah dihapus';
         } else {
             echo 'ERGagal menghapus keyword';
         }
     } catch (Exception $e) {
         echo 'ERGagal menghapus keyword: ' . $e->getMessage();
     }
     break;
 case 'fetch':
     $kategori_keyword = post_var('currkat', '');
     // pre($kategori_keyword);
     $keywords = keyword_fetch_all($kategori_keyword);
     // pre($keywords);
     /*
     $fetch_kw_sql = "select * from sms_keywords ".(empty($kategori_keyword)?"":" where upper(kategori) = upper('$kategori_keyword') ")." order by id asc";
     $keywords = fetch_query($fetch_kw_sql);
     echo $fetch_kw_sql ;
     */
     $c = count($keywords);
     if ($keywords == FALSE || $c == 0) {
         echo $default_list;
     } else {
         foreach ($keywords as $i => $key) {
             ?>
             
             echo 'OKData pengembalian dengan kode <strong>' . $p_kode . '</strong> telah dihapus.';
         } else {
             $_mysqli->rollback();
             echo 'ERPenghapusan data pengembalian gagal.';
         }
         $_mysqli->autocommit(true);
     }
     break;
 case 'list':
     // show list
     $p_offset = post_var('p_offset', 0);
     $p_state = post_var('pstate', '');
     // default status peminjaman.
     $p_limit = post_var('plimit', 10);
     // default item count per page.
     $p_sort_order = post_var('psortorder', 'desc');
     // default SMS will be sorted ascending way. Only SMS timestamp supported.
     $p_count_sql = "select count(k.id)                              \n                            from inkubator_kembali k\n                            inner join inkubator_pinjam p on k.kode_pinjam = p.kode_pinjam\n                            inner join inkubator_master i on i.id = p.id_inkubator                 \n                            where (lower(p.status_pinjam) = lower('Disetujui')) " . (!empty($p_state) ? " and (lower(k.status_kembali) = lower('{$p_state}') )" : "");
     $p_count = fetch_one_value($p_count_sql);
     // pre( $p_count_sql);
     // $p_count = 0;
     if ($p_offset == -1) {
         $p_offset = $p_count - $p_limit;
         if ($p_offset < 0) {
             $p_offset = 0;
         }
     }
     $sql = "select \n                \tp.id,\n                \ti.nama as nama_inkubator,\n                \tp.kode_pinjam,\n                \tp.id_inkubator,\n                \tp.tgl_pinjam,\n                \tp.nama_bayi,\n                \tp.kembar,\n                \tp.tgl_lahir,\n                \tp.berat_lahir,\n                \tp.panjang_lahir,\n                \tp.kondisi,\n                \tp.rumah_sakit,\n                \tp.nama_dokter,\n                \tp.tgl_pulang,\n                \tp.no_kk,\n                \tp.alamat,\n                \tp.nama_ibu,\n                \tp.hp_ibu,\n                \tp.email_ibu,\n                \tp.nama_ayah,\n                \tp.hp_ayah,\n                \tp.email_ayah,\n                \tp.jumlah_pinjam,\n                \tp.status_pinjam,\n                \tp.tgl_update_status_pinjam,\n                \tp.keterangan_status_pinjam,\n                \tp.konfirmasi,\n                \tk.tgl_kembali,\n                \tk.berat_kembali,\n                \tk.panjang_kembali,\n                \tk.kondisi_kembali,\n                \tk.jumlah_kembali,\n                \tk.status_kembali,\n                \tk.tgl_update_status_kembali,\n                \tk.keterangan_status_kembali\n                \t\n                from inkubator_kembali k\n                inner join inkubator_pinjam p on k.kode_pinjam = p.kode_pinjam\n                inner join inkubator_master i on i.id = p.id_inkubator                 \n                where (lower(p.status_pinjam) = lower('Disetujui')) " . (!empty($p_state) ? " and (lower(k.status_kembali) = lower('{$p_state}') )" : "") . " order by p.tgl_pinjam {$p_sort_order}, p.id {$p_sort_order} limit {$p_offset},{$p_limit}";
     // pre($sql);
     if ($p_count == 0) {
         ?>
<?php

require_once '../cores/definition.php';
$host = post_var('host');
$user = post_var('user');
$pass = post_var('pass');
$db = post_var('db');
$use_gammu = post_var('usegammu');
$er = '';
if (empty($host)) {
    $er .= 'Host jangan kosong.<br>';
}
if (empty($user)) {
    $er .= 'Username jangan kosong.<br>';
}
if (empty($pass)) {
    $er .= 'Password jangan kosong.<br>';
}
if (empty($db)) {
    $er .= 'Database jangan kosong.<br>';
}
if (!empty($er)) {
    die($er);
}
$_my = new mysqli($host, $user, $pass, $db);
if ($_my->connect_errno) {
    die('Koneksi database gagal. Silahkan direvisi lagi...');
} else {
    $dbc = str_replace("\\", "/", realpath('..')) . '/dbconfig.php';
    // die ('ERROR.'.$dbc);
    if (file_exists($dbc)) {
예제 #7
0
function pubsubhubbub_init(&$a)
{
    // PuSH subscription must be considered "public" so just block it
    // if public access isn't enabled.
    if (get_config('system', 'block_public')) {
        http_status_exit(403);
    }
    // Subscription request from subscriber
    // https://pubsubhubbub.googlecode.com/git/pubsubhubbub-core-0.4.html#anchor4
    // Example from GNU Social:
    // [hub_mode] => subscribe
    // [hub_callback] => http://status.local/main/push/callback/1
    // [hub_verify] => sync
    // [hub_verify_token] => af11...
    // [hub_secret] => af11...
    // [hub_topic] => http://friendica.local/dfrn_poll/sazius
    if ($_SERVER['REQUEST_METHOD'] === 'POST') {
        $hub_mode = post_var('hub_mode');
        $hub_callback = post_var('hub_callback');
        $hub_verify = post_var('hub_verify');
        $hub_verify_token = post_var('hub_verify_token');
        $hub_secret = post_var('hub_secret');
        $hub_topic = post_var('hub_topic');
        // check for valid hub_mode
        if ($hub_mode === 'subscribe') {
            $subscribe = 1;
        } else {
            if ($hub_mode === 'unsubscribe') {
                $subscribe = 0;
            } else {
                logger("pubsubhubbub: invalid hub_mode={$hub_mode}, ignoring.");
                http_status_exit(404);
            }
        }
        logger("pubsubhubbub: {$hub_mode} request from " . $_SERVER['REMOTE_ADDR']);
        // get the nick name from the topic, a bit hacky but needed
        $nick = substr(strrchr($hub_topic, "/"), 1);
        if (!$nick) {
            logger('pubsubhubbub: bad hub_topic=$hub_topic, ignoring.');
            http_status_exit(404);
        }
        // fetch user from database given the nickname
        $r = q("SELECT * FROM `user` WHERE `nickname` = '%s'" . " AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1", dbesc($nick));
        if (!count($r)) {
            logger('pubsubhubbub: local account not found: ' . $nick);
            http_status_exit(404);
        }
        $owner = $r[0];
        // abort if user's wall is supposed to be private
        if ($r[0]['hidewall']) {
            logger('pubsubhubbub: local user ' . $nick . 'has chosen to hide wall, ignoring.');
            http_status_exit(403);
        }
        // get corresponding row from contact table
        $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `blocked`" . " AND NOT `pending` AND `self` LIMIT 1", intval($owner['uid']));
        if (!count($r)) {
            logger('pubsubhubbub: contact not found.');
            http_status_exit(404);
        }
        $contact = $r[0];
        // sanity check that topic URLs are the same
        if (!link_compare($hub_topic, $contact['poll'])) {
            logger('pubsubhubbub: hub topic ' . $hub_topic . ' != ' . $contact['poll']);
            http_status_exit(404);
        }
        // do subscriber verification according to the PuSH protocol
        $hub_challenge = random_string(40);
        $params = 'hub.mode=' . ($subscribe == 1 ? 'subscribe' : 'unsubscribe') . '&hub.topic=' . urlencode($hub_topic) . '&hub.challenge=' . $hub_challenge . '&hub.lease_seconds=604800' . '&hub.verify_token=' . $hub_verify_token;
        // lease time is hard coded to one week (in seconds)
        // we don't actually enforce the lease time because GNU
        // Social/StatusNet doesn't honour it (yet)
        $body = fetch_url($hub_callback . "?" . $params);
        $ret = $a->get_curl_code();
        // give up if the HTTP return code wasn't a success (2xx)
        if ($ret < 200 || $ret > 299) {
            logger("pubsubhubbub: subscriber verification at {$hub_callback} " . "returned {$ret}, ignoring.");
            http_status_exit(404);
        }
        // check that the correct hub_challenge code was echoed back
        if (trim($body) !== $hub_challenge) {
            logger("pubsubhubbub: subscriber did not echo back " . "hub.challenge, ignoring.");
            logger("\"{$hub_challenge}\" != \"" . trim($body) . "\"");
            http_status_exit(404);
        }
        // fetch the old subscription if it exists
        $r = q("SELECT * FROM `push_subscriber` WHERE `callback_url` = '%s'", dbesc($hub_callback));
        // delete old subscription if it exists
        q("DELETE FROM `push_subscriber` WHERE `callback_url` = '%s'", dbesc($hub_callback));
        if ($subscribe) {
            $last_update = datetime_convert('UTC', 'UTC', 'now', 'Y-m-d H:i:s');
            $push_flag = 0;
            // if we are just updating an old subscription, keep the
            // old values for push and last_update
            if (count($r)) {
                $last_update = $r[0]['last_update'];
                $push_flag = $r[0]['push'];
            }
            // subscribe means adding the row to the table
            q("INSERT INTO `push_subscriber` (`uid`, `callback_url`, " . "`topic`, `nickname`, `push`, `last_update`, `secret`) values " . "(%d, '%s', '%s', '%s', %d, '%s', '%s')", intval($owner['uid']), dbesc($hub_callback), dbesc($hub_topic), dbesc($nick), intval($push_flag), dbesc($last_update), dbesc($hub_secret));
            logger("pubsubhubbub: successfully subscribed [{$hub_callback}].");
        } else {
            logger("pubsubhubbub: successfully unsubscribed [{$hub_callback}].");
            // we do nothing here, since the row was already deleted
        }
        http_status_exit(202);
    }
    killme();
}
ini_set('session.use_only_cookies', 1);
session_start();
/* Required files */
include_once '../cores/definition.php';
include_once '../cores/db.php';
include_once 'gammu-cores.php';
require_once 'gammu-hex.php';
$pengirim = stripslashes(post_var('nopengirim'));
$pno = '+62';
if (substr($pengirim, 0, 3) != '+62' && substr($pengirim, 0, 2) != '08') {
    die('ERNomor tidak valid.<br>Nomor harus diawali dengan +628xx... atau 08xx...');
}
if (substr($pengirim, 0, 2) == '08') {
    $pengirim = $pno . substr($pengirim, 1);
}
$pesan = addslashes(stripslashes(post_var('pesan')));
$multipart = strlen($pesan) > 160;
$data = 'ERSMS gagal diterima.';
$res = fetch_query('select * from modem_gateway order by id desc limit 0,1');
$modem = $res[0];
$nama_modem = $modem['nama_modem'];
$smsc = $modem['smsc'];
$udh_prefix = '050003' . str_pad(dechex(rand(1, 255)), 2, '0', STR_PAD_LEFT);
unset($modem);
unset($res);
/*
echo 'OK';
echo $udh_prefix.str_pad(dechex(3), 2, '0', STR_PAD_LEFT).str_pad(dechex(1), 2, '0', STR_PAD_LEFT).'<br>';
echo $udh_prefix.str_pad(dechex(3), 2, '0', STR_PAD_LEFT).str_pad(dechex(2), 2, '0', STR_PAD_LEFT).'<br>';
echo $udh_prefix.str_pad(dechex(3), 2, '0', STR_PAD_LEFT).str_pad(dechex(3), 2, '0', STR_PAD_LEFT).'<br>';
*/
<?php

/*
** 
** Built-in session for internal ajax. Do not mix it with UI session!
*/
ini_set('session.use_cookies', 1);
ini_set('session.use_only_cookies', 1);
session_start();
/* Required files */
include_once '../cores/definition.php';
$ajax = post_var('ajax', '');
$jenis_sms = 'inbox';
// post_var('jenis_sms');
$sort_type = post_var('sort_type', '');
$fetch_count = post_var('fetch_count', '');
if (empty($ajax) || empty($sort_type) || empty($fetch_count)) {
    die('Invalid arguments.');
}
include_once '../cores/db.php';
include_once 'gammu-cores.php';
$sql = "select \n    (@lapse := timediff(CURRENT_TIMESTAMP(),sv.waktu_terima)) as time_lapse,\n    /* \n    EXTRACT(hour FROM @lapse) as h_lapse,\n    EXTRACT(minute FROM @lapse) as m_lapse,\n    EXTRACT(second FROM @lapse) as s_lapse,\n    */\n    hour(@lapse) as h_lapse,\n    minute(@lapse) as m_lapse,\n    second(@lapse) as s_lapse,\n    sv.id, sv.udh, sv.waktu_terima, sv.pengirim, sv.sms, sv.jenis, sv.diproses\n    from sms_valid sv order by id {$sort_type} limit 0,{$fetch_count}";
// echo  $sql;
$smses = fetch_query($sql);
foreach ($smses as $i => $sms) {
    ?>
    <li class="left clearfix" id="sms-<?php 
    echo $sms['id'];
    ?>
">
        <div class="clearfix">
<?php

/*
** 
** Built-in session for internal ajax. Do not mix it with UI session!
*/
ini_set('session.use_cookies', 1);
ini_set('session.use_only_cookies', 1);
session_start();
/* Required files */
include_once '../cores/definition.php';
include_once '../cores/db.php';
include_once 'gammu-cores.php';
$ajax = post_var('ajax');
$command = strtolower(post_var('command'));
$sms_processor = dirname(__FILE__) . '\\sms-processor-daemon.php';
if (!$ajax) {
    die('Error: Unspeficifed parameters.');
}
$res = fetch_query('select * from modem_gateway order by id desc limit 0,1');
$modem = $res[0];
// $php = $modem['php_path'].'\php-win.exe';
$php = $modem['php_path'] . '\\php.exe';
$php_ini_cli = dirname(__FILE__) . '\\php-cli.php';
unset($res);
$ret = 0;
$res = array();
switch ($command) {
    /**
     * Window service section:
     */
<?php

include_once 'definition.php';
include_once 'session.php';
require_once 'db.php';
require_once 'functions.php';
/* expected parameter :
** post_id: int, post id to be updated
** post_status: new post status which the post wil be update as
** return uri: redirect target to redirect to after successful update
*/
$ajax = post_var('ajax', 0);
$tipe = post_var('tipe', '');
// die('ER'.$ajax.':'.$tipe);
if ($ajax == 0 || $tipe == '') {
    die('ERInvalid Parameter.');
}
$sql = "delete from `{$tipe}` where id = '{$ajax}'";
if (exec_query($sql)) {
    echo 'OKSMS telah dihapus.';
} else {
    echo 'Gagal menghapus SMS.';
}
예제 #12
0
<?php

include "kernel/main.php";
include "_affiche_vignette.php";
//
// Variables...
//
$ERR = false;
$DEMANDE_CONNEXION = false;
// true si demande de connexion...(utile pour afficher $ERR dans le bon form...
$DEMANDE_PASSWD_OUBLIE = false;
// true si demande de passwd oublié...
post_var('compte_civilite', "Mme", "*");
# Css additionnel...
$css = "compte";
# Ancre...
$ancre = "";
# Historique...
$titre_historique = "Mon compte - connexion";
//////////////////////////////////////////////////
//
// Retour si déjà connecté...
//
if ($_COMPTE) {
    $Navig->redirect("compte.php");
}
//////////////////////////////////////////////////
//
// Tester email+password...
//
if (isset($_POST['deja_compte'])) {
<?php

/*
** 
** Built-in session for internal ajax. Do not mix it with UI session!
*/
ini_set('session.use_cookies', 1);
ini_set('session.use_only_cookies', 1);
session_start();
/* Required files */
include_once '../cores/definition.php';
include_once '../cores/db.php';
$nama = addslashes(strip_tags(post_var('nama')));
$email = addslashes(strip_tags(post_var('email')));
$url = addslashes(strip_tags(post_var('url')));
$komentar = addslashes(strip_tags(post_var('komentar')));
$postid = post_var('postid', 0);
$table = post_var('table', 0);
// die($postid.'<br>'.$table);
$data = 'ERKomentar gagal kirim';
if (!exec_query("insert into frontend_comments values (UUID_SHORT(), CURRENT_TIMESTAMP(), '{$nama}', '{$email}', '{$url}', '{$komentar}','{$table}','{$postid}')")) {
    echo $data;
} else {
    echo 'OKKomentar terkirim';
}
 if ($ajax == 'del-inkubator') {
     $id = post_var('id', 0);
     if ($id == 0) {
         echo 'ERID inkubator tidak valid.';
     } else {
         if (exec_query("delete from inkubator_master where id = '{$id}'")) {
             echo 'OKInkubator terhapus.';
         } else {
             echo 'ERInkubator gagal hapus.';
         }
     }
     die;
 } else {
     if ($ajax == 'sto-inkubator') {
         $id = post_var('id', 0);
         $jumlah = post_var('jumlah', 0);
         if ($id == 0) {
             echo 'ERID inkubator tidak valid.';
         } else {
             if ($jumlah == 0) {
                 echo 'ERJumlah tidak valid.';
             } else {
                 // die("update inkubator_master set jumlah = '$jumlah' where id = '$id'");
                 if (exec_query("update inkubator_master set jumlah = '{$jumlah}' where id = '{$id}'")) {
                     echo 'OKInkubator telah diupdate.';
                 } else {
                     echo 'ERGagal mengupdate stok inkubator.';
                 }
             }
         }
         die;
<?php

$skip_morris = true;
include_once '../cores/definition.php';
if (USE_GAMMU) {
    require_once '../gammu/gammu-cores.php';
    if (!is_gammu_ok()) {
        header('location:setup-gammu.php');
    }
}
include_once '../gammu/gammu-cores.php';
include_once '../cores/db.php';
include_once '../cores/session.php';
$ajax = post_var('ajax');
if ($ajax == 'ajax') {
    $sx = post_var('smscount');
    if (set_system_config('sms_to_process_per_minute', $sx)) {
        echo 'OK';
    } else {
        echo 'ER';
    }
    die('ER');
}
require_login();
require_admin('index.php', 'Pooling SMS Settings', 'Anda tidak memiliki hak akses ke halaman ini.', 'Dashboard');
$sms_count_per_min = get_system_config('sms_to_process_per_minute', 20);
?>

<?php 
include "_head.php";
function waktu()
예제 #16
0
파일: mod.php 프로젝트: VoDongMy/VoDongMy
 function edit()
 {
     $id = $this->uri->segment(3);
     $data['title'] = 'Cập nhật Modules';
     $data['save'] = true;
     $data['apply'] = true;
     $data['cancel'] = 'mod/ds';
     $data['rs'] = $this->mod->get_mod_by_id($id);
     $data['list'] = $this->mod->get_list_mod_by_lang($id);
     $data['xml'] = simplexml_load_file(ROOT . 'site/mod/' . $data['rs']->module . '/' . $data['rs']->module . '.xml');
     $data['position'] = simplexml_load_file(ROOT . 'site/templates/templates.xml');
     $data['css'] = $this->mod->get_css($data['rs']->params);
     // Form validation
     foreach ($this->language as $lang) {
         $this->form_validation->set_rules('vdata[title][' . $lang->lang_id . ']', 'Tiêu đề: ' . $lang->lang_name, 'required');
         $this->form_validation->set_rules('vdata[content][' . $lang->lang_id . ']', '', '');
     }
     // Form validation
     $this->form_validation->set_rules('show_title', 'Hiển thị tiêu đề', 'required');
     $this->form_validation->set_rules('vdata[position]', 'Vị trí hiển thị', 'required');
     $this->form_validation->set_rules('vdata[params]', '', '');
     if ($this->form_validation->run() === FALSE) {
         $this->pre_message = validation_errors();
     } else {
         $id = post_var('id', 'int');
         $vdata = $this->request->post['vdata'];
         $param = $this->request->post['param'];
         $idata['show_title'] = $this->request->post['show_title'];
         $idata['position'] = $vdata['position'];
         $idata['published'] = $this->request->post['published'];
         $idata['module'] = $vdata['module'];
         $idata['html'] = $vdata['html'];
         $idata['params'] = $vdata['params'];
         $html = '';
         if (is_array($param)) {
             foreach ($param as $v => $k) {
                 $html .= '&' . $v . '=' . $k;
             }
             $html .= '&test=true';
         } else {
             $html .= 'test=true';
         }
         $idata['attr'] = trim($html, '&');
         if ($this->db->update('modules', $idata, array('id' => $id))) {
             $this->db->delete('modules_des', array('id' => $id));
             foreach ($this->language as $val) {
                 $vdes['id'] = $id;
                 $vdes['lang_id'] = $val->lang_id;
                 $vdes['title'] = $vdata['title'][$val->lang_id];
                 $vdes['content'] = $vdata['content'][$val->lang_id];
                 $this->db->insert('modules_des', $vdes);
             }
             $this->session->set_flashdata('message', 'Lưu thành công');
             $option = $this->request->post['option'];
             if ($option == 'save') {
                 $url = 'mod/ds';
             } else {
                 $url = uri_string();
             }
             redirect($url);
         }
     }
     $data['message'] = $this->pre_message;
     $this->_templates['page'] = 'edit';
     $this->load->templates($this->_templates['page'], $data);
 }
<?php

/*
** 
** Built-in session for internal ajax. Do not mix it with UI session!
*/
ini_set('session.use_cookies', 1);
ini_set('session.use_only_cookies', 1);
session_start();
/* Required files */
include_once '../cores/definition.php';
include_once '../cores/db.php';
include_once 'gammu-cores.php';
$ajax = post_var('ajax');
$php_data = post_var('phpdata');
$php_tipe = strtolower(post_var('tipe'));
if (!$ajax) {
    die('ERError: Unspeficifed parameters.');
}
define('NO_SYNTAX_ERROR', 'No syntax errors');
if ($php_tipe == 'file') {
    $php_file = $php_data;
} else {
    if ($php_tipe == 'data') {
        $php_file = dirname(__FILE__) . '\\php-lint-' . md5(session_id()) . '.php';
        if (file_exists($php_file)) {
            unlink($php_file);
        }
        $f = fopen($php_file, 'w');
        fputs($f, $php_data);
        fclose($f);
$sms_inbox_keyword = urldecode(get_var('keyword', ''));
include_once '../gammu/gammu-fetch-sms.php';
error_reporting(E_ALL);
/**
 * If this page is is being loaded using Ajax call,
 * fetch the requested data and skip the rest of the page:
 */
if ($ajax) {
    $sms_offset = post_var('sms_offset', 0);
    // default offset of first item to fetch.
    $sms_limit = post_var('sms_limit', 10);
    // default item count per page.
    $sms_keyword = post_var('sms_keyword', '');
    // default SMS with this keyword to display.
    // pre($sms_keyword);
    $sms_sort_order = post_var('sms_sortorder', 'asc');
    // default SMS will be sorted ascending way. Only SMS timestamp supported.
    $sms_count = fetch_one_value("select count(id) from sms_valid" . (!empty($sms_keyword) && $sms_keyword != '*' ? " where upper(jenis) = upper('{$sms_keyword}')" : ""));
    // $sms_count = 0;
    if ($sms_offset == -1) {
        $sms_offset = $sms_count - $sms_limit;
        if ($sms_offset < 0) {
            $sms_offset = 0;
        }
    }
    // $leftover_sql   = "select max(id) from sms_valid sv order by sv.waktu_terima $sms_sort_order, sv.id $sms_sort_order limit $sms_offset,$sms_limit";
    $sql = "select sv.id, sv.udh, sv.waktu_terima, sv.pengirim, sv.sms, sv.jenis, sv.param_count, sv.diproses\n        from sms_valid sv" . (!empty($sms_keyword) && $sms_keyword != '*' ? " where upper(sv.jenis) = upper('{$sms_keyword}')" : "") . " order by sv.waktu_terima {$sms_sort_order}, sv.id {$sms_sort_order} limit {$sms_offset},{$sms_limit}";
    /*
    echo $sql;
    echo '<hr>'.$sms_count;
    */
<?php

/* Required files */
include_once 'definition.php';
include_once 'db.php';
$r = post_var('r');
$also_drop = post_var('also-drop');
if ($r == NULL) {
    die('ERInvalid parameters.');
}
$ok = true;
$ok &= clean_tables();
if ($also_drop != NULL) {
    $ok &= drop_user_tables();
}
if ($ok) {
    echo 'OKTable(s) cleaned and ready.';
} else {
    echo 'ERTable(s) cleaning failed.';
}
                     </div>
                 </td>
             </tr>
              
         <?php 
         }
         echo '</tbody> ';
         unset($p_data);
     }
     // state the data count for last page:
     echo '<input type="hidden" value="' . $p_count . '" id="ajax-data-count" />';
     // ----------------- END OF CASE 'list';
     break;
 case 'details':
     // show list detail
     $p_id = post_var('pid', 0);
     if ($p_id == 0) {
         echo 'Parameter ID Peminjaman tidak valid.';
     } else {
         $sql = "select \n                    \tp.id,\n                    \ti.nama as nama_inkubator,\n                    \tp.kode_pinjam,\n                    \tp.id_inkubator,\n                    \tp.tgl_pinjam,\n                    \tp.nama_bayi,\n                    \tp.kembar,\n                    \tp.tgl_lahir,\n                    \tp.berat_lahir,\n                    \tp.panjang_lahir,\n                    \tp.kondisi,\n                    \tp.rumah_sakit,\n                    \tp.nama_dokter,\n                    \tp.tgl_pulang,\n                    \tp.no_kk,\n                    \tp.alamat,\n                    \tp.nama_ibu,\n                    \tp.hp_ibu,\n                    \tp.email_ibu,\n                    \tp.nama_ayah,\n                    \tp.hp_ayah,\n                    \tp.email_ayah,\n                    \tp.jumlah_pinjam,\n                    \tp.status_pinjam,\n                    \tp.tgl_update_status_pinjam,\n                    \tp.keterangan_status_pinjam,\n                    \tp.konfirmasi,\n                        p.ktp_ibu,\n                        p.ktp_ayah, \n                        p.jenis_kelamin,\n                    \tk.tgl_kembali,\n                    \tk.berat_kembali,\n                    \tk.panjang_kembali,\n                    \tk.kondisi_kembali,\n                    \tk.jumlah_kembali,\n                    \tk.status_kembali,\n                    \tk.tgl_update_status_kembali,\n                    \tk.keterangan_status_kembali                    \t\n                    from inkubator_pinjam p\n                    left join inkubator_master i on i.id = p.id_inkubator\n                    left join inkubator_kembali k on k.kode_pinjam = p.kode_pinjam  \n                    where p.kode_pinjam = '{$p_id}'";
         $p_datas = fetch_query($sql);
         $data = $p_datas[0];
         unset($p_datas);
         $rclas = $data['status_pinjam'] == 'Ditunda' ? 'warning' : ($data['status_pinjam'] == 'Ditolak' ? 'danger' : 'success');
         ?>
         <div class="row"><div class="col-md-12"><label>Data Kelahiran Bayi</label></div></div>
         <div class="row">
             <div class="col-md-3 text-muted">Nama &amp; Tanggal Lahir</div><div class="col-md-9">
                 <?php 
         echo '<strong>' . $data['nama_bayi'] . '</strong>, lahir di ' . $data['rumah_sakit'] . ' pada ' . date('d/M/Y', strtotime($data['tgl_lahir']));
         ?>
예제 #21
0
                increment_var($_REQUEST['incr'], $_REQUEST['value']);
                //"http://127.0.0.1:8000/get/?incr=asd&value=1"
            } else {
                if (!empty($_REQUEST['decr']) && !empty($_REQUEST['value'])) {
                    decrement_var($_REQUEST['decr'], $_REQUEST['value']);
                    //"http://127.0.0.1:8000/get/?decr=asd&value=1"
                } else {
                    return "Usage GET http://IP/get/?val='' or GET http://IP/incr/var/value";
                }
            }
        }
        break;
        // GET http://10.0.0.2:8000/get/?val=VALUE
    // GET http://10.0.0.2:8000/get/?val=VALUE
    case 'POST':
        post_var();
        break;
        // POST curl --data "var_name=TEST&var_value='Test value'" http://10.0.0.2:8000
    // POST curl --data "var_name=TEST&var_value='Test value'" http://10.0.0.2:8000
    case 'DELETE':
        delete_var();
        break;
        //curl -X DELETE http://10.0.0.2:8000/TEST
}
function __memcache()
{
    $memcache = new Memcache();
    $memcache->connect('127.0.0.1', 11311);
    return $memcache;
}
function get_var($var)