test

Php code posted by huylo
created at 02 Mar 10:43, updated at 09 Mar 10:48

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  function init () {
    global $REMOTE_ADDR, $site_own, $eng, $DEBUG, $HTTP_X_FORWARDED_FOR, $HTTP_COOKIE_VARS ;
    $this->id = null ;
    $this->data = null ;
    $this->stamp = null ;
    $this->errors = array();
    if(isset($HTTP_COOKIE_VARS[$site_own."-users"])) {
      $this->stamp = $HTTP_COOKIE_VARS[$site_own."-users"];
      $sql = " select * from {$site_own}.users_stamp where stamp = '{$this->stamp}' ";
      if(DEBUG) error_log($sql);
      $user_id_data = array();
      $n_user_id_data = eng_query($sql,$user_id_data);
      if($n_user_id_data == 1) {
        $this->id = $user_id_data["ID"][0];
        $options = array ( NO_DATE_DEPTH => true, OBJECTS => "USERS" , WHERE => sprintf ( "id=%d", $this->id ), ORDER => "status" ) ;
        $dummy = 0 ;
        $n_user_data = get_obj_simple_list ( $options, $this->data, $dummy ) ;
        if ($n_user_data == 1) {
          $ok = true;
          $this->set_attrs () ;
          return true;
        }
        else {
          $this->id = 0;
          return false;
        }
      }
      else {
        $this->id = 0;
        return false;
      }
    }
    else {
      $this->id = 0;
      return false;
    }
  }
1.08 KB in 11 ms with coderay