Exemple #1
0
<?php

require_once '../../../../Connections/connBayAreaCont.php';
include '../functions.php';
$Models_General = new Models_General();
$result = array();
try {
    if (empty($_REQUEST['question'])) {
        throw new Exception('empty question');
    }
    if (empty($_REQUEST['name'])) {
        throw new Exception('empty name');
    }
    if (empty($_REQUEST['email'])) {
        throw new Exception('empty email');
    }
    $data = array();
    $data['question'] = $_REQUEST['question'];
    $data['name'] = $_REQUEST['name'];
    $data['email'] = $_REQUEST['email'];
    $data['status'] = 0;
    $id = $Models_General->addDetails('askquestion', $data);
    $result = array('success' => 1, 'msg' => 'Question submitted successfully', 'id' => $id, 'data' => $data);
    mail($_REQUEST['email'], 'New Question Submitted on ' . SITEURL, "\n\nFrom Name: " . $_REQUEST['name'] . "\n\nFrom Email: " . $_REQUEST['email'] . "\n\nQuestion: " . $_REQUEST['question'], 'From:' . FROMNAME . '<' . FROMEMAIL . '>');
    mail(ADMINEMAIL, 'New Question Submitted on ' . SITEURL, "\n\nFrom Name: " . $_REQUEST['name'] . "\n\nFrom Email: " . $_REQUEST['email'] . "\n\nQuestion: " . $_REQUEST['question'] . "\n\nhttp://" . SITEURL, 'From:' . FROMNAME . '<' . FROMEMAIL . '>');
} catch (Exception $e) {
    $result = array('success' => 0, 'msg' => $e->getMessage());
}
echo json_encode($result);
 public function execute()
 {
     try {
         $request = $_GET;
         $data = array();
         $Models_General = new Models_General();
         if (empty($request['account'])) {
             throw new Exception(0);
         }
         $arr = array();
         if (!empty($request['b'])) {
             $arr['account_balance'] = $request['b'];
         }
         if (!empty($request['e'])) {
             $arr['account_equity'] = $request['e'];
         }
         if (!empty($request['f'])) {
             $arr['account_free_margin'] = $request['f'];
         }
         if (!empty($request['c'])) {
             $arr['account_company'] = $request['c'];
         }
         if (!empty($arr)) {
             $where = sprintf('account_number = %s', $Models_General->qstr($request['account']));
             $Models_General->updateDetails('forex_users', $arr, $where);
         }
         //history
         $arr = array();
         if (!empty($request['b'])) {
             $arr['account_balance'] = $request['b'];
         }
         if (!empty($request['e'])) {
             $arr['account_equity'] = $request['e'];
         }
         if (!empty($request['f'])) {
             $arr['account_free_margin'] = $request['f'];
         }
         if (!empty($arr) && !empty($request['account'])) {
             $arr['account_number'] = $request['account'];
             $Models_General->addDetails('forex_balance_history', $arr);
         }
         $cache = 1;
         if (isset($_GET['cache'])) {
             $cache = $_GET['cache'];
         }
         $params = array();
         $params['where'] = sprintf(' AND account_number = %s', $this->qstr($request['account']));
         $params['fields'] = '*';
         //'forex_user_id as id, account_number, status, open_trades, close_trades';
         $params['cacheTime'] = 3600;
         $result = $Models_General->getDetails('forex_users', $cache, $params);
         if (empty($result[0])) {
             throw new Exception(1);
         }
         foreach ($result[0] as $value) {
             echo $value . '|';
         }
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     exit;
 }
Exemple #3
0
 $Models_Googleauth = new Models_Googleauth();
 $details = $Models_Googleauth->getUser($user['id'], 0);
 if ($details['status'] != 1) {
     $error = 'User with id ' . $user['id'] . ' not active';
 } else {
     $_SESSION['user'] = $user;
     $_SESSION['user']['member_type'] = $details['member_type'];
     $_SESSION['user']['member_expires'] = $details['member_expires'];
     $_SESSION['user']['fullname'] = $details['fullname'];
     $_SESSION['user']['access_level'] = !empty($details['access_level']) ? $details['access_level'] : 'member';
     $generalMode = new Models_General();
     $params = array();
     $params['where'] = sprintf('AND uid = %s', $generalMode->qstr($user['id']));
     $settings = $generalMode->getDetails('settings', 0, $params);
     if (empty($settings)) {
         $generalMode->addDetails('settings', array('uid' => $user['id']), $user['id']);
         $settings = $generalMode->getDetails('settings', 0, $params);
     }
     $_SESSION['settings'] = $settings[0];
     //$me 			= $plus->people->get('me');
     $optParams = array('maxResults' => 100);
     //$activities 	= $plus->activities->listActivities('me', 'public',$optParams);
     // The access token may have been updated lazily.
     $_SESSION['access_token'] = $client->getAccessToken();
     $email = filter_var($user['email'], FILTER_SANITIZE_EMAIL);
     // get the USER EMAIL ADDRESS using OAuth2
     if (isset($_SESSION['redirectUrl'])) {
         $url = $_SESSION['redirectUrl'];
         unset($_SESSION['redirectUrl']);
         header("Location: " . $url);
         exit;
function postMessage($approved = 0)
{
    if (!empty($_SESSION['user']['id']) && !empty($_POST['MM_Insert']) && $_POST['MM_Insert'] === 'formMessage') {
        if (empty($_POST['to_uid'])) {
            return false;
        }
        if (empty($_POST['id'])) {
            return false;
        }
        if (empty($_POST['message'])) {
            return false;
        }
        if (empty($_POST['MM_Insert'])) {
            return false;
        }
        if (empty($_SESSION['user']['id'])) {
            return false;
        }
        $data = array();
        $data['message_id'] = guid();
        $data['uid'] = $_SESSION['user']['id'];
        $data['to_uid'] = $_POST['to_uid'];
        $data['id'] = $_POST['id'];
        $data['message'] = $_POST['message'];
        $data['message_approved'] = $approved;
        $data['message_date'] = date('Y-m-d H:i:s');
        $data['module_id'] = !empty($_POST['module_id']) ? $_POST['module_id'] : '';
        $modelGeneral = new Models_General();
        $modelGeneral->addDetails('help_messages', $data, $_SESSION['user']['id']);
        mailtoadmin('new message posted', $_POST['message']);
    }
}
Exemple #5
0
try {
    if (isset($_POST['MM_Insert'])) {
        if (empty($_FILES['beforeFile']['name'])) {
            $insertError = 'Please choose before work image';
        } else {
            if (empty($_FILES['afterFile']['name'])) {
                $insertError = 'Please choose after work image';
            }
        }
        if (empty($insertError)) {
            $arr = array();
            $arr['before_image'] = 's' . time() . '_b_' . $_FILES['beforeFile']['name'];
            $arr['after_image'] = 's' . time() . '_a_' . $_FILES['afterFile']['name'];
            move_uploaded_file($_FILES['beforeFile']['tmp_name'], '../images/' . $arr['before_image']);
            move_uploaded_file($_FILES['afterFile']['tmp_name'], '../images/' . $arr['after_image']);
            $Models_General->addDetails('works', $arr);
            $insertError = 'Record Added Successfully';
        }
    }
    if (isset($_GET['delete'])) {
        $query_rsView = 'select * FROM works WHERE work_id = ?';
        $rs = $Models_General->fetchRow($query_rsView, array($_GET['id']), 0);
        if ($rs) {
            $query_rsView = 'delete FROM works WHERE work_id = ?';
            $Models_General->deleteDetails($query_rsView, array($_GET['id']));
            if (file_exists('../images/' . $rs['before_image'])) {
                unlink('../images/' . $rs['before_image']);
            }
            if (file_exists('../images/' . $rs['after_image'])) {
                unlink('../images/' . $rs['after_image']);
            }