Announcement

Collapse
No announcement yet.

how to read data from global declaration

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to read data from global declaration

    Hi all,
    I need record , how long web opened until user click button. but i
    ==================================
    OnLoad :
    $tanggal_masukx = date("Y-m-d H:i:s");
    sc_set_global($tanggal_masukx);
    ==================================
    OnValidate :
    $nama_aplikasi ='sales_surabaya_channel_research';
    $tanggalan = $_SESSION['tanggal_masukx'];
    {tanggal_masuk} = $tanggalan;
    //{username} = $_SESSION['usr_login'];
    //{application} = $nama_aplikasi;
    //{durasi_menit} = sc_time_diff ({tanggal_keluar}, "YYYY-MM-DD HH:mm:ss", {tanggal_masuk}, "YYYY-MM-DD HH:mm:ss")
    =====================================

    but on validate, why I can't read data global sc_set_global($tanggal_masukx); declaration onload event ?

  • #2
    OnLoad:
    {$tanggal_masukx} = date("Y-m-d H:i:s");
    Make that variable global in and out going.

    Then just pick up the variable later on in OnValidate
    $tanggalan = {$tanggal_masukx};
    I guess this should work better.

    Comment


    • #3
      thanks rr for your clue

      I try setting
      onload
      {tanggal_masuk} = date("Y-m-d H:i:s");
      it's succesfully to record when user used form/report first time.

      but on onvalidate form acceptance application
      i need record, who is login and how long user used this report

      {username} = $_SESSION["usr_login"];
      {durasi_menit} = sc_time_diff ({tanggal_keluar}, "Y-m-d H:i:s", {tanggal_masuk}, "Y-m-d H:i:s")
      //tanggal_keluar is field table, record date_time, when user click button insert. automatic from field menu

      ==============
      any wrong with 2 syntax ?

      usr_login, i put from menu login (form, onvalidate)

      $slogin = sc_sql_injection({login});
      $spswd = sc_sql_injection(({pswd}));


      $sql = "SELECT
      active,
      name,
      email
      FROM dbo.master_users
      WHERE login = $slogin
      AND pswd = ".$spswd;
      sc_lookup(rs, $sql);

      if(count({rs}) == 0)
      {
      sc_log_add('login Fail', {lang_login_fail} . {login});
      sc_error_message({lang_error_login});
      sc_error_exit();
      }
      else if({rs[0][0]} == 'Y')
      {
      $usr_login = {login};
      $usr_name = {rs[0][1]};
      $usr_email = {rs[0][2]};
      sc_set_global($usr_login);
      sc_set_global($usr_name);
      sc_set_global($usr_email);

      }
      else
      {
      sc_error_message({lang_error_not_active});
      sc_error_exit();
      }

      Comment


      • #4
        ups, I forget to run login form first before get data. :-D
        after run login form, i get user .
        and for how long (minute) user read report. we succesfuly to get with
        $to_time = strtotime($tgl_keluarnya);
        $from_time = strtotime($tgl_masuknya);
        $selisih= round(abs($to_time - $from_time) / 60,2);
        {durasi_menit} = $selisih;

        Ok, Problem SOLVED.
        thanks all for your clue.

        Regards
        Iwan S

        Comment

        Working...
        X