Exemplo n.º 1
0
function load_tickets($user, $pass, $sanad_record_ids)
{
    $tmp_arr = array();
    $my = new mysql_class();
    $u = new user_class();
    $u->loadByUser($user);
    $customer_id = $u->customer_id;
    $my->ex_sql("select * from ticket where customer_id={$customer_id} and  sanad_record_id in ({$sanad_record_ids})", $q);
    foreach ($q as $r) {
        $tick = new ticket_class();
        //$tick->id = (int)$r['id'];
        unset($tick->sanad_record_id);
        $tick->fname = $r["fname"];
        $tick->lname = $r["lname"];
        $tick->tel = $r["tel"];
        $tick->adult = (int) $r["adult"];
        $tick->rahgiri = (int) $r["sanad_record_id"];
        $tick->parvaz_det_id = (int) $r["parvaz_det_id"];
        $tick->customer_id = (int) $r["customer_id"];
        $tick->user_id = (int) $r["user_id"];
        $tick->shomare = (int) $r["shomare"];
        $tick->typ = (int) $r["typ"];
        $tick->en = (int) $r["en"];
        $tick->regtime = $r["regtime"];
        $tick->mablagh = (int) $r["mablagh"];
        $tick->tour_mablagh = (int) $r["tour_mablagh"];
        $tick->poorsant = (int) $r["poorsant"];
        $tick->gender = (int) $r["gender"];
        $tmp_arr[] = $tick;
    }
    $out = xml_class::export($tmp_arr);
    return $out;
}
Exemplo n.º 2
0
function add_item()
{
    $fields = null;
    $mysql = new mysql_class();
    foreach ($_REQUEST as $key => $value) {
        if (substr($key, 0, 4) == "new_") {
            if ($key != "new_id" && $key != "new_en") {
                $fields[substr($key, 4)] = $value;
            }
        }
    }
    $query = '';
    $fi = "(";
    $valu = "(";
    foreach ($fields as $field => $value) {
        $fi .= "`{$field}`,";
        $valu .= "'{$value}',";
    }
    $fi = substr($fi, 0, -1);
    $valu = substr($valu, 0, -1);
    $fi .= ")";
    $valu .= ")";
    $query = "insert into `grop` {$fi} values {$valu}";
    echo $query;
    $mysql->ex_sqlx($query);
}
Exemplo n.º 3
0
function delete_item($table, $inp, $gname)
{
    $my = new mysql_class();
    $my->ex_sqlx("update `{$table}` set `tarikh` = now() - interval (`timeout` + 1) minute where `id` in ({$inp})");
    ticket_class::clearTickets();
    return TRUE;
}
Exemplo n.º 4
0
 public function loadByName($name)
 {
     if (trim($name) != '') {
         $name = trim($name);
         $mysql = new mysql_class();
         $ln1 = $mysql->ex_sqlx("insert into shahr_tmp (name) values ('{$name}') ", FALSE);
         $tmp_id = $mysql->insert_id($ln1);
         $mysql->close($ln1);
         $mysql->ex_sql("select name from shahr_tmp where id = {$tmp_id}", $q1);
         if (isset($q1[0])) {
             $name = $q1[0]['name'];
         }
         $mysql->ex_sqlx("delete from shahr_tmp where id = {$tmp_id}");
         $mysql->ex_sql("select * from shahr where name='{$name}'", $q);
         if (isset($q[0])) {
             $r = $q[0];
             $this->id = $q[0]['id'];
             $this->name = $q[0]["name"];
             $this->en_name = $q[0]["en_name"];
         } else {
             $ln = $mysql->ex_sqlx("insert into shahr (name) values ('{$name}') ", FALSE);
             $this->id = $mysql->insert_id($ln);
             $this->name = $name;
             $mysql->close($ln);
         }
     }
 }
Exemplo n.º 5
0
 public static function get($source_id)
 {
     $out = 0;
     $my = new mysql_class();
     $my->ex_sql("select rookeshi from rookeshi where source_id={$source_id}", $q);
     if (isset($q[0])) {
         $out = (int) $q[0]['rookeshi'];
     }
     return $out;
 }
Exemplo n.º 6
0
function epass($cid)
{
    $mysql = new mysql_class();
    $out = "";
    $mysql->ex_sql("select `epass` from `customers` where `id`='{$cid}'", $q);
    if (isset($q[0])) {
        $out = $q[0]["epass"];
    }
    return $out;
}
Exemplo n.º 7
0
 public function loadByParvaz_det_id($parvaz_det_id)
 {
     $my = new mysql_class();
     $out = -1;
     $my->ex_sql("select sites_id from parvaz_det_sites where parvaz_det_id={$parvaz_det_id}", $qp);
     foreach ($qp as $r) {
         $out = $r['sites_id'];
     }
     return $out;
 }
Exemplo n.º 8
0
 public function decreaseSms($number, $user_id, $sanad_record_id, $status)
 {
     $mysql = new mysql_class();
     $mysql->ex_sql("select `id` from `sms_charge` where `cont`<`maxi` order by `id` limit 1 ", $q);
     if ($isset($q[0])) {
         $mysql->ex_sqlx('update `sms_charge` set `cont`=`cont`+1 where `id`=' . $r['id']);
     }
     //---------------------------------------------------------
     $mysql->ex_sqlx("insert into `sms` (`number`,`user_id`,`sanad_record_id`,`sent`) values ('{$number}','{$user_id}','{$sanad_record_id}','{$status}')");
 }
Exemplo n.º 9
0
 public function __construct($moghim_code = -1)
 {
     $mysql = new mysql_class();
     $mysql->ex_sql("select * from `agency` where `moghim_code` = '{$moghim_code}'", $q);
     if (count($q) > 0) {
         foreach ($q[0] as $fi => $val) {
             $this->{$fi} = $val;
         }
     }
 }
Exemplo n.º 10
0
function loadCustomerName()
{
    $mysql = new mysql_class();
    $out = null;
    $mysql->ex_sql('select `name`,`id` from `customers` order by `name`', $q);
    foreach ($q as $r) {
        $out[$r['id']] = (int) $r['name'];
    }
    return $out;
}
Exemplo n.º 11
0
function sanadJam($where = '')
{
    $out = array("sum_mablagh" => 0);
    $mysql = new mysql_class();
    $mysql->ex_sql("select sum(`mablagh`) as `sm` from `customer_daryaft` " . ($where != '' ? " where {$where}" : ''), $q);
    if (isset($q[0])) {
        $out = array("sum_mablagh" => (int) $q[0]['sm']);
    }
    return $out;
}
Exemplo n.º 12
0
function loadUser($inp)
{
    $out = '';
    $mysql = new mysql_class();
    $mysql->ex_sql("select `fname`,`lname` from `user` where `id`='{$inp}'", $q);
    if (isset($q[0])) {
        $out = $q[0]['fname'] . ' ' . $q[0]['lname'];
    }
    return $out;
}
Exemplo n.º 13
0
function dabel($user, $enc_pass, $id)
{
    $id = (int) $id;
    $out = "auth_error";
    if (user_class::is_authonticated($enc_pass, $user)) {
        $my = new mysql_class();
        $my->ex_sql("select jid from parvaz_jid where parvaz_det_id = {$id}", $q);
        $out = xml_class::export($q);
    }
    return $out;
}
Exemplo n.º 14
0
function sherkat($user, $pass)
{
    $tmp_arr = array();
    $my = new mysql_class();
    $my->ex_sql("select * from sherkat order by name", $q);
    foreach ($q as $r) {
        $tmp_arr[] = array('id' => $r['id'], 'name' => $r['name']);
    }
    $out = xml_class::export($tmp_arr);
    return $out;
}
Exemplo n.º 15
0
function city($user, $pass)
{
    $out = 'auth_error';
    if (user_class::is_authonticated($pass, $user)) {
        $tmp_arr = array();
        $my = new mysql_class();
        $my->ex_sql("select * from shahr order by name", $q);
        $out = xml_class::export($q);
    }
    return $out;
}
Exemplo n.º 16
0
 public function __construct($id = -1)
 {
     $mysql = new mysql_class();
     $mysql->ex_sql("select * from `grop` where `id` = {$id}", $q);
     if (isset($q[0])) {
         $r = $q[0];
         $this->id = $r['id'];
         $this->name = $r['name'];
         $this->en = $r['en'];
     }
 }
Exemplo n.º 17
0
function delete_item($table, $id, $gname)
{
    $id = (int) $id;
    $c = new customer_class($id);
    $mysql = new mysql_class();
    $out = FALSE;
    if (!$c->protected) {
        $out = $mysql->ex_sqlx("update `{$table}` set `en` = '0' where `id` = '{$id}'") == "ok";
    }
    return $out;
}
Exemplo n.º 18
0
 public function getLastSanad_record_id()
 {
     $mysql = new mysql_class();
     $sanad_record_id = 200;
     $mysql->ex_sql("select max(`sanad_record_id`) as `sss` from `customer_daryaft`", $q);
     if (isset($q[0])) {
         $sanad_record_id = (int) $q[0]["sss"] > 199 ? (int) $q[0]["sss"] : 199;
         $sanad_record_id++;
     }
     return $sanad_record_id;
 }
Exemplo n.º 19
0
function loadSherkatName($inp)
{
    $mysql = new mysql_class();
    $inp = (int) $inp;
    $out = "";
    $mysql->ex_sql("select `name` from `sherkat` where `id` = '{$inp}'", $q);
    if (isset($q[0])) {
        $out = $q[0]["name"];
    }
    return $out;
}
Exemplo n.º 20
0
 public static function loadAll($iata = '')
 {
     $iata = strtoupper(trim($iata));
     $out = "";
     $my = new mysql_class();
     $my->ex_sql("select iata,name,en_name from city where iata <> '' order by id", $q);
     foreach ($q as $r) {
         $out .= "<option value='" . $r['iata'] . "'" . ($iata == $r['iata'] ? ' selected' : '') . ">" . $r['name'] . '/' . $r['en_name'] . '/' . $r['iata'] . "</option>";
     }
     return $out;
 }
Exemplo n.º 21
0
 public function loadByUser($user_id)
 {
     $out = array();
     $user_id = (int) $user_id;
     $mysql = new mysql_class();
     $mysql->ex_sql("select `id`,`page_name` from `access` where `group_id` = {$user_id} and `is_group` = 0", $q);
     foreach ($q as $r) {
         $out[(int) $r['id']] = $r['page_name'];
     }
     return $out;
 }
Exemplo n.º 22
0
 public static function loadAll($selected = 0)
 {
     $out = array();
     $my = new mysql_class();
     //$wer = $country_id==0?'':" where country_id=$country_id";
     $my->ex_sql("select id,name from grop order by name", $q);
     foreach ($q as $r) {
         $out[$r['id']] = $r['name'];
     }
     //var_dump($out);
     return $out;
 }
Exemplo n.º 23
0
function edit_item($id, $feild, $value)
{
    if ($feild == 'frase') {
        $mysql = new mysql_class();
        $mysql->ex_sql("select `id` from `access_det` where `acc_id` = (select `acc_id` from `access_det` where `id`={$id}) and `frase` = '{$value}'", $q);
        if (!isset($q[0])) {
            $mysql->ex_sqlx("update `access_det` set `frase` = '{$value}' where `id`={$id}");
        }
    } else {
        $mysql->ex_sqlx("update `access_det` set `{$feild}` = '{$value}' where `id`={$id}");
    }
}
Exemplo n.º 24
0
function search($user, $enc_pass, $st_date, $en_date, $st_city_id, $en_city_id, $load_go_return, $load_both_ways, $load_phone)
{
    $out = "auth_error";
    if (user_class::is_authonticated($enc_pass, $user)) {
        $fieldsArray = array('parvaz_det.id', 'ghimat', 'zarfiat', 'mabda_id', 'maghsad_id', 'shomare', 'havapiema_id', 'sherkat_id', 'tarikh', 'saat', 'saat_kh', 'j_id');
        $fields = implode(',', $fieldsArray);
        $whereClause = '';
        $leftJoin = FALSE;
        $hasOr = (int) trim($load_both_ways) == 1 || trim($load_both_ways) == '';
        if (trim($st_date) != '' && strtotime(trim($st_date)) > strtotime(date("Y-m-d"))) {
            $whereClause .= ($whereClause == '' ? '' : ' and ') . '  date(tarikh) >= \'' . date("Y-m-d", strtotime($st_date)) . '\'';
        } else {
            $whereClause .= ($whereClause == '' ? '' : ' and ') . '  date(tarikh) >= \'' . date("Y-m-d") . '\'';
        }
        if (trim($en_date) != '') {
            $whereClause .= ($whereClause == '' ? '' : ' and ') . '  date(tarikh) <= \'' . date("Y-m-d", strtotime($en_date)) . '\'';
        }
        if ((int) trim($st_city_id) > 0) {
            $whereClause .= ($whereClause == '' ? '' : ' and ') . ($hasOr ? '((' : '') . '  mabda_id = ' . trim($st_city_id) . ' ' . ($hasOr && (int) trim($en_city_id) <= 0 ? ') or (' : '');
            $leftJoin = TRUE;
        }
        if ((int) trim($en_city_id) > 0) {
            $whereClause .= ($whereClause == '' ? '' : ' and ') . ($hasOr && (int) trim($st_city_id) <= 0 ? '((' : '') . '  maghsad_id = ' . trim($en_city_id) . ' ' . ($hasOr ? ') or (' : '');
            $leftJoin = TRUE;
        }
        if ($hasOr) {
            if ((int) trim($st_city_id) > 0) {
                $whereClause .= '  maghsad_id = ' . trim($st_city_id) . ' ' . ($hasOr && (int) trim($en_city_id) <= 0 ? '))' : '');
            }
            if ((int) trim($en_city_id) > 0) {
                $whereClause .= ($whereClause != '' && (int) trim($st_city_id) > 0 ? ' and ' : '') . '  mabda_id = ' . trim($en_city_id) . ' ' . ($hasOr ? '))' : '');
            }
        }
        $whereClause = ' where ' . $whereClause;
        $searchQuery = "select {$fields} from parvaz_det left join parvaz on (parvaz.id=parvaz_id)  {$whereClause}";
        $my = new mysql_class();
        $my->ex_sql($searchQuery, $q);
        /*
        			foreach($q as $in=>$r)
        			{
        				$r['jid'] = (int)trim($r['jid']);
        				$q[$in] = $r;
        			}
        			//$out = $q;
        */
        $out = xml_class::export($q);
        //$searchQuery
    }
    //return($searchQuery);
    return $out;
}
Exemplo n.º 25
0
function havapeima($user, $pass)
{
    $out = 'auth_error';
    if (user_class::is_authonticated($pass, $user)) {
        $tmp_arr = array();
        $my = new mysql_class();
        $my->ex_sql("select * from havapeima order by name", $q);
        foreach ($q as $r) {
            $tmp_arr[] = array('id' => $r['id'], 'name' => $r['name']);
        }
        $out = xml_class::export($tmp_arr);
    }
    return $out;
}
Exemplo n.º 26
0
function loadBargasht($inp)
{
    $out = 'ندارد';
    $inp = (int) $inp;
    $mysql = new mysql_class();
    $ticket = new ticket_class($inp);
    //`id`, `fname`, `lname`, `tel`, `adult`, `sanad_record_id`, `parvaz_det_id`, `customer_id`, `user_id`, `shomare`, `typ`, `en`, `regtime`, `mablagh`, `poorsant`
    $mysql->ex_sql("select `parvaz_det_id` from `ticket` where `parvaz_det_id` <> '" . $ticket->parvaz_det_id . "' and `shomare` = '" . $ticket->shomare . "' and `regtime`>='" . $ticket->regtime . "' and `regtime`<DATE_ADD('" . $ticket->regtime . "',interval 1 minute) ", $q);
    if (isset($q[0])) {
        $parvaz = new parvaz_det_class((int) $q[0]["parvaz_det_id"]);
        $out = $parvaz->shomare . "( " . loadCity($parvaz->mabda_id) . " -> " . loadCity($parvaz->maghsad_id) . " )<br/>" . hamed_pdate($parvaz->tarikh);
    }
    return $out;
}
Exemplo n.º 27
0
 public function __construct($id = -1)
 {
     $id = (int) $id;
     $mysql = new mysql_class();
     $mysql->ex_sql("select * from `sath_details` where `id`='{$id}'", $q);
     if (isset($q[0])) {
         $r = $q[0];
         $this->id = $id;
         $this->name = $r["name"];
         $this->number = (int) $r["number"];
         $this->sath_id = (int) $r["sath_id"];
         $this->presath_id = (int) $r["presath_id"];
     }
 }
Exemplo n.º 28
0
 public function loadByGrp($grp_id)
 {
     $accs = new access_class();
     $out = array();
     $accs = $accs->loadByGroup($grp_id);
     $mysql = new mysql_class();
     foreach ($accs as $id => $page) {
         $acc_id = $id;
         $mysql->ex_sql("select `frase` from `access_det` where `acc_id` = {$acc_id}", $q);
         foreach ($q as $r) {
             $out[] = array('frase' => $r['frase'], 'page' => $page);
         }
     }
     return $out;
 }
Exemplo n.º 29
0
 function save($data)
 {
     //delete recent records
     $mysql = new mysql_class();
     $mysql->ex_sql('DELETE FROM `robot_sources` WHERE 1');
     $str = "INSERT INTO `robot_sources` (`id`, `source`, `airline`) VALUES ";
     foreach ($data as $k => $item) {
         foreach ($item as $itm) {
             $str .= "(NULL, {$k}, '{$itm}'),";
         }
     }
     $str = rtrim($str, ',');
     $mysql = new mysql_class();
     $rst = $mysql->ex_sql($str, $q);
 }
Exemplo n.º 30
0
function loadImage($id)
{
    $i = (int) $_REQUEST['img_index'];
    $tables = array('ads_img', 'tour_img');
    $out = '---';
    $my = new mysql_class();
    $my->ex_sql("select url from " . $tables[$i] . " where id = {$id}", $q);
    if (isset($q[0])) {
        if (trim($q[0]['url']) != '') {
            $url = trim($q[0]['url']);
            $out = "<a href='{$url}' target='_blank'><img height='20px' src='{$url}' ></a>";
        }
    }
    return $out;
}