Пример #1
0
 function submit_tao_du_an_buoc_3()
 {
     try {
         if (isset($_POST['duan_id']) == false) {
             die('ERROR_SYSTEM');
         }
         $duan_id = $_POST['duan_id'];
         $this->duan->id = $duan_id;
         $this->duan->where(' and active=-1');
         $data = $this->duan->search('id,tenduan,alias');
         if (empty($data)) {
             die('ERROR_SYSTEM');
         }
         $tenduan = $data['duan']['tenduan'];
         $alias = $data['duan']['alias'];
         $email = $_POST['duan_email'];
         $sodienthoai = $_POST['duan_sodienthoai'];
         $thongtinchitiet = $_POST['duan_thongtinchitiet'];
         $file_id = $_POST['duan_filedinhkem'];
         $validate = new Validate();
         if ($validate->check_submit(1, array('duan_email', 'duan_sodienthoai')) == false) {
             die('ERROR_SYSTEM');
         }
         if ($validate->check_null(array($email, $sodienthoai)) == false) {
             die('ERROR_SYSTEM');
         }
         if (!$validate->check_email($email)) {
             die('ERROR_SYSTEM');
         }
         $account_id = null;
         $flagSendmail = 1;
         global $cache;
         include ROOT . DS . 'library' . DS . 'sendmail.php';
         $priSenders = $cache->get('priSenders');
         $sender = $priSenders[mt_rand(0, count($priSenders) - 1)];
         if (isset($_SESSION['account'])) {
             $account_id = $_SESSION['account']['id'];
             if ($email != $_SESSION['account']['username']) {
                 //Post du an dum nguoi khac
                 $flagSendmail = 2;
             }
         } else {
             $this->setModel('account');
             $strWhere = "AND username='******'";
             $this->account->where($strWhere);
             $data2 = $this->account->search('id');
             if (!empty($data2)) {
                 die('ERROR_EXIST');
             }
             $this->account->id = null;
             $this->account->username = $email;
             $this->account->timeonline = 0;
             $this->account->role = 2;
             $this->account->active = 0;
             $account_id = $this->account->insert(true);
             $this->account->id = $account_id;
             $data2 = $this->account->search();
             $_SESSION['account'] = $data2['account'];
             $active_code = genString();
             $this->setModel('activecode');
             $this->activecode->id = null;
             $this->activecode->account_id = $account_id;
             $this->activecode->active_code = $active_code;
             $this->activecode->insert();
             //Send active code
             $linkactive = BASE_PATH . "/webmaster/doActive/true&account_id={$account_id}&active_code={$active_code}";
             $linkactive = "<a href='{$linkactive}'>{$linkactive}</a>";
             $content = $cache->get('mail_verify');
             $search = array('#LINKACTIVE#', '#ACTIVECODE#', '#USERNAME#');
             $replace = array($linkactive, $active_code, $email);
             $content = str_replace($search, $replace, $content);
             $mail = new sendmail();
             $mail->send($email, 'JobBid.vn - Mail Xác Nhận Đăng Ký Tài Khoản!', $content, $sender);
         }
         $this->setModel('data');
         $sIndex = "{$tenduan} " . strip_tags($thongtinchitiet);
         $sIndex = strtolower(remove_accents($sIndex));
         $this->data->id = null;
         $this->data->data = $sIndex;
         $data_id = $this->data->insert(true);
         $this->setModel('duan');
         $this->duan->id = $duan_id;
         $this->duan->duan_email = $email;
         $this->duan->duan_sodienthoai = $sodienthoai;
         $this->duan->thongtinchitiet = $thongtinchitiet;
         if ($file_id != 0) {
             $this->duan->file_id = $file_id;
         }
         $this->duan->account_id = $account_id;
         $this->duan->prior = '0';
         $currentDate = GetDateSQL();
         $this->duan->timeupdate = $currentDate;
         $this->duan->views = '0';
         $this->duan->bidcount = '0';
         $this->duan->averagecost = '0';
         $this->duan->isnew = 1;
         $this->duan->data_id = $data_id;
         $this->duan->approve = '0';
         $editcode = genString(20);
         $this->duan->editcode = $editcode;
         if (isset($_SESSION['account']) && $_SESSION['account']['active'] == 1) {
             if ($flagSendmail == 1) {
                 $this->duan->active = 1;
             } else {
                 $this->duan->active = '0';
             }
         }
         $this->duan->update();
         if ($flagSendmail == 2) {
             //Send approve email to employer
             $linkview = BASE_PATH . "/duan/view/{$duan_id}/{$alias}&editcode={$editcode}";
             $linkview = "<a href='{$linkview}'>{$tenduan}</a>";
             $linkdongy = BASE_PATH . "/duan/permission/{$duan_id}/{$editcode}/1";
             $linkdongy = "<a href='{$linkdongy}'><font color='green'>ĐỒNG Ý</font></a>";
             $linkodongy = BASE_PATH . "/duan/permission/{$duan_id}/{$editcode}/0";
             $linkodongy = "<a href='{$linkodongy}'><font color='red'>KHÔNG ĐỒNG Ý</font></a>";
             $content = $cache->get('mail_permission');
             $search = array('#LINKDUAN#', '#DONGY#', '#KHONGDONGY#');
             $replace = array($linkview, $linkdongy, $linkodongy);
             $content = str_replace($search, $replace, $content);
             $subject = "[EMAIL XIN PHÉP] Đăng công việc [{$tenduan}] lên JobBid.vn!!!";
             $mail = new sendmail();
             $mail->send($email, $subject, $content, $sender);
         } else {
             //Send approve email to admin
             $linkview = BASE_PATH . "/duan/view/{$duan_id}/{$alias}";
             $linkview = "<a href='{$linkview}'>{$linkview}</a>";
             $linkdongy = BASE_PATH . "/duan/approve/{$duan_id}/{$editcode}/1";
             $linkdongy = "<a href='{$linkdongy}'><font color='green'>ĐỒNG Ý</font></a>";
             $linkodongy = BASE_PATH . "/duan/approve/{$duan_id}/{$editcode}/0";
             $linkodongy = "<a href='{$linkodongy}'><font color='red'>KHÔNG ĐỒNG Ý</font></a>";
             $content = $cache->get('mail_approve');
             $search = array('#TENDUAN#', '#EMAIL1#', '#EMAIL#', '#SDT#', '#THONGTINCHITIET#', '#LINK#', '#DONGY#', '#KHONGDONGY#');
             $replace = array($tenduan, $email, $email, $sodienthoai, $thongtinchitiet, $linkview, $linkdongy, $linkodongy);
             $content = str_replace($search, $replace, $content);
             $mail = new sendmail();
             $mail->send(GLOBAL_EMAIL, 'Hệ Thống - Email Approve Dự Án Mới!', $content, $sender);
         }
         $myprojects = array();
         if (isset($_SESSION['myprojects'])) {
             $myprojects = $_SESSION['myprojects'];
         }
         array_push($myprojects, $duan_id);
         $_SESSION['myprojects'] = $myprojects;
         if (isset($_SESSION['account'])) {
             if ($_SESSION['account']['active'] == 1) {
                 echo 'OK';
             } else {
                 echo 'NOT_ACTIVE';
             }
         } else {
             echo 'NOT_ACTIVE';
         }
     } catch (Exception $e) {
         echo 'ERROR_SYSTEM';
     }
 }
		<td><select name="dbName" onchange=submit();>';
foreach ($dbList as $dbName) {
    if ($_POST[dbName] == $dbName) {
        $pick = 'selected';
    } else {
        $pick = '';
    }
    $qContent .= '<option value="' . $dbName . '" ' . $db_sel[$dbName] . ' ' . $pick . '>' . $dbName . '</option>';
}
$qContent .= '</select> Table ' . $tableList . '
	</td>
	</tr><tr>
		<td>Query </td><td><textarea name="sql" rows=' . $rows . ' cols=' . $cols . '>' . stripslashes($_POST['sql']) . '</textarea></td>
	</tr><tr>
		<td></td><td><input type="submit" name="subQuery" value="Submit Query"> 
			<a href="./query.php?h=' . genString(8) . '" target=_blank><input type=button value="Open New Session"></a>
			<a href="./query.php?h=' . $_GET['h'] . '&reset=1"><input type=button value="Reset Query History"></a>
		</td>
	</tr><tr>
		<td>Query History</td>
		<td><select name="previous_queries" onChange="copyQuery(this.value)">
			<option value="">---Query History----</option>' . $history_opt . '</select>
		</td>
	</tr>
	</table>
	</td><td>
	<table border=0 height=100%>
	<tr valign=top>
		<td>
		<input type="radio" name="ck_csv" value="" checked> Not Delimited<br>
		<input type="radio" name="ck_csv" value="," ' . $ck_csv[','] . '> Comma Delimited<br>
Пример #3
0
 function query_builder()
 {
     $this->load->helper('query_builder');
     $campaign = $this->mdl_campaign->query_builder();
     $id_type = $this->mdl_individual->query_builder('id_type');
     $city = $this->mdl_individual->query_builder('city');
     $curr_brand = $this->mdl_individual->query_builder('brand');
     $sec_brand = $this->mdl_individual->query_builder('brand_');
     $source_type = $this->mdl_individual->query_builder('source_type');
     $status_verifikasi = $this->mdl_individual->query_builder('status_verifikasi');
     $data[] = genSelect('campaign_id', 'Campaign', $campaign);
     $data[] = genString('id', 'Individual ID');
     $data[] = genString('mop_id', 'MOP ID');
     $data[] = genString('firstname', 'Firstname');
     $data[] = genString('lastname', 'Lastname');
     $data[] = genString('nickname', 'Nickname');
     $data[] = genSelect('sex', 'Sex', array("M" => "MALE", "F" => "FEMALE"));
     $data[] = genDate('dob', 'Day of Birth');
     $data[] = genInteger("DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS(dob)), '%Y')", 'Age');
     $data[] = genSelect('id_type', 'ID Type', $id_type);
     $data[] = genString('id_number', 'ID Number');
     $data[] = genString('tlp', 'Telephone');
     $data[] = genString('email', 'Email');
     $data[] = genString('fb', 'Facebook');
     $data[] = genString('tw', 'Twitter');
     $data[] = genString('address', 'Address');
     $data[] = genSelect('city', 'City', $city);
     $data[] = genString('pos_code', 'Pos Code');
     $data[] = genSelect('brand', 'Current Brand', $curr_brand);
     $data[] = genSelect('brand_', 'Second Brand', $sec_brand);
     $data[] = genSelect('source_type', 'Source Type', $source_type);
     $data[] = genString('source_user', 'Source User');
     $data[] = genDate('survey_date', 'Survey Date');
     $data[] = genDate('upload_date', 'Upload Date');
     $data[] = genDate('entry_date', 'Entry Date');
     $data[] = genDate('verifikasi_date', 'Verification Date');
     $data[] = genString('referred', 'Referred by');
     $data[] = genSelect('status_verifikasi', 'Status Verification', $status_verifikasi);
     echo json_encode($data);
 }
Пример #4
0
     $type = 1;
 }
 if (isset($_POST['runas'])) {
     $runas = 1;
 } else {
     $runas = 0;
 }
 foreach ($targets as $target) {
     if ($error != 1) {
         //Maintenace VS Scheduling - For notification messages consistency
         $category = 'maintenance';
         $target = trim($target);
         $command = trim($command);
         $arguments = trim($arguments);
         //GENERATE RANDOM KEY - USED AS PRIMARY KEY TO ASSOCIATE THIS SPECIFIC TASK WITH SPECIFIC TARGET
         $key = base64_encode(genString(10));
         $opentime = time();
         //UPDATE CB PERIOD
         if ($type == 5) {
             //ADD TASK TO QUEUE
             $opentime = time();
             DB::insert('tasks', array('type' => '5', 'id' => $target, 'command' => $command, 'arguments' => '', 'key' => $key, 'status' => '0', 'results' => '', 'opentime' => $opentime, 'closetime' => ''));
         } else {
             if ($type == 20) {
                 DB::update('parameters', array('name' => $command), '`id`=%s', $target);
             } else {
                 if ($type == 6) {
                     //ADD TASK TO QUEUE
                     $opentime = time();
                     DB::insert('tasks', array('type' => '6', 'id' => $target, 'command' => $command, 'arguments' => $arguments, 'key' => $key, 'status' => '0', 'results' => '', 'opentime' => $opentime, 'closetime' => ''));
                 } else {
$expireSeconds = $p['expires'] * 60 * 60;
if ($today <= $expiresDate + $expireSeconds) {
    $downloadLinkStatus = 'Active';
    $disExtend = 'disabled';
} else {
    $downloadLinkStatus = 'Expired';
}
//get the download link
$folder = $p['folder'];
if ($folder == '') {
    $downloadLink = '../?action=download&id=' . $s[transID];
} else {
    $downloadLink = '../' . $folder . '/?action=download&id=' . $s[transID];
}
if ($_POST[makeAccount]) {
    $dbOptions = array('tableName' => 'users', 'dbFields' => array('paypal' => $s[payerEmail], 'email' => $s[contactEmail], 'fname' => $s[firstName], 'lname' => $s[lastName], 'joinDate' => $s[purchased], 'username' => genString(8), 'password' => genString(8)));
    if (dbInsert($dbOptions)) {
        $newID = mysql_insert_id();
        $msg = 'Added affiliate account: <a href="updateProfile.php?id=' . $newID . '">click here to view account</a>';
    }
}
if ($_POST[updateNotes]) {
    $dbOptions = array('tableName' => 'sales', 'dbFields' => array('notes' => $_POST[notes]), 'cond' => 'where id="' . $_GET[id] . '"');
    if (dbUpdate($dbOptions)) {
        $msg = 'Updated notes for this sale';
    } else {
        $msg = 'Failed to update this sale';
    }
}
//members account
$selU = 'select * from users where paypal="' . $s[payerEmail] . '" || email="' . $s[payerEmail] . '"';
Пример #6
0
 function submit_dang_tin_rao_vat()
 {
     try {
         $max_raovat = isset($_SESSION['MAX_RAOVAT']) ? $_SESSION['MAX_RAOVAT'] : 0;
         if ($max_raovat >= MAX_RAOVAT) {
             die('MAX_RAOVAT');
         }
         $tieude = $_POST['raovat_tieude'];
         $alias = $_POST['raovat_alias'];
         $email = $_POST['raovat_email'];
         $sodienthoai = $_POST['raovat_sodienthoai'];
         $noidung = $_POST['raovat_noidung'];
         $validate = new Validate();
         if ($validate->check_submit(1, array('raovat_email', 'raovat_sodienthoai', 'raovat_tieude', 'raovat_alias', 'raovat_noidung')) == false) {
             die('ERROR_SYSTEM');
         }
         if ($validate->check_null(array($email, $sodienthoai, $tieude, $noidung)) == false) {
             die('ERROR_SYSTEM');
         }
         if ($validate->check_length($tieude, 101)) {
             die('ERROR_SYSTEM');
         }
         if (!$validate->check_email($email)) {
             die('ERROR_SYSTEM');
         }
         $account_id = null;
         global $cache;
         $status = 0;
         if (isset($_SESSION['account'])) {
             $account_id = $_SESSION['account']['id'];
             $status = 1;
         } else {
             $this->setModel('account');
             $strWhere = "AND username='******'";
             $this->account->where($strWhere);
             $data2 = $this->account->search('id');
             if (!empty($data2)) {
                 die('ERROR_EXIST');
             }
             $this->account->id = null;
             $this->account->username = $email;
             $this->account->timeonline = 0;
             $this->account->role = 2;
             $this->account->active = 0;
             $account_id = $this->account->insert(true);
             $this->account->id = $account_id;
             $data2 = $this->account->search();
             $_SESSION['account'] = $data2['account'];
             $active_code = genString();
             $this->setModel('activecode');
             $this->activecode->id = null;
             $this->activecode->account_id = $account_id;
             $this->activecode->active_code = $active_code;
             $this->activecode->insert();
             //Send active code
             $linkactive = BASE_PATH . "/webmaster/doActive/true&account_id={$account_id}&active_code={$active_code}";
             $linkactive = "<a href='{$linkactive}'>{$linkactive}</a>";
             $content = $cache->get('mail_verify');
             $search = array('#LINKACTIVE#', '#ACTIVECODE#', '#USERNAME#');
             $replace = array($linkactive, $active_code, $email);
             $content = str_replace($search, $replace, $content);
             $priSenders = $cache->get('priSenders');
             $sender = $priSenders[mt_rand(0, count($priSenders) - 1)];
             include ROOT . DS . 'library' . DS . 'sendmail.php';
             $mail = new sendmail();
             $mail->send($email, 'JobBid.vn - Mail Xác Nhận Đăng Ký Tài Khoản!', $content, $sender);
         }
         $this->setModel('raovat');
         $this->raovat->id = null;
         $this->raovat->raovat_email = $email;
         $this->raovat->raovat_sodienthoai = $sodienthoai;
         $this->raovat->noidung = $noidung;
         $this->raovat->tieude = $tieude;
         $this->raovat->alias = $alias;
         $currentDate = GetDateSQL();
         $this->raovat->ngaypost = $currentDate;
         $this->raovat->ngayupdate = $currentDate;
         $this->raovat->views = 0;
         $this->raovat->account_id = $account_id;
         $this->raovat->status = $status;
         $this->raovat->insert();
         $this->updatecache();
         $max_raovat++;
         $_SESSION['MAX_RAOVAT'] = $max_raovat;
         if (isset($_SESSION['account'])) {
             if ($_SESSION['account']['active'] == 1) {
                 echo 'OK';
             } else {
                 echo 'NOT_ACTIVE';
             }
         } else {
             echo 'NOT_ACTIVE';
         }
     } catch (Exception $e) {
         echo 'ERROR_SYSTEM';
     }
 }
Пример #7
0
 function resetpassword()
 {
     try {
         if (!isset($_GET['username'])) {
             die('ERROR_SYSTEM');
         }
         if (!isset($_SESSION['sendresetpass'])) {
             $_SESSION['sendresetpass'] = 0;
         }
         if ($_SESSION['sendresetpass'] >= MAX_SENDRESETPASS) {
             die('ERROR_MANYTIMES');
         }
         $username = $_GET['username'];
         if ($username == null) {
             die('ERROR_SYSTEM');
         }
         $username = mysql_real_escape_string($username);
         $this->account->where(" and active>=0 and username='******'");
         $data = $this->account->search('id');
         if (empty($data)) {
             die('ERROR_NOTEXIST');
         }
         $account_id = $data[0]['account']['id'];
         $this->setModel('resetpassword');
         $this->resetpassword->where(" and account_id={$account_id}");
         $data = $this->resetpassword->search('id,times');
         $verify = genString();
         if (!empty($data)) {
             //da gui reset password truoc day
             $times = $data[0]['resetpassword']['times'] + 1;
             if ($times > MAX_TIMESRESETPASS) {
                 die('ERROR_LOCKED');
             }
             $this->resetpassword->id = $data[0]['resetpassword']['id'];
             $this->resetpassword->times = $times;
             $this->resetpassword->verify = $verify;
             $this->resetpassword->update();
         } else {
             //gui reset password lan dau tien
             $this->resetpassword->id = null;
             $this->resetpassword->account_id = $account_id;
             $this->resetpassword->times = 1;
             $this->resetpassword->verify = $verify;
             $this->resetpassword->insert();
         }
         //Send mail url : /webmaster/changepass/resetpassword_id/resetpassword_verify
         $linkresetpass = BASE_PATH . "/webmaster/changepass/{$account_id}/{$verify}";
         $linkresetpass = "******";
         global $cache;
         $content = $cache->get('mail_resetpass');
         $search = array('#RESETPASSLINK#');
         $replace = array($linkresetpass);
         $content = str_replace($search, $replace, $content);
         $priSenders = $cache->get('priSenders');
         $sender = $priSenders[mt_rand(0, count($priSenders) - 1)];
         include ROOT . DS . 'library' . DS . 'sendmail.php';
         $mail = new sendmail();
         $mail->send($username, 'JobBid.vn - Mail Xác Nhận Khôi Phục Mật Khẩu Đăng Nhập!', $content, $sender);
         $_SESSION['sendresetpass'] = $_SESSION['sendresetpass'] + 1;
         echo 'DONE';
     } catch (Exception $e) {
         echo 'ERROR_SYSTEM';
     }
 }
 if ($sales > 0) {
     //check for expiration date
     $today = time();
     $expiresDate = strtotime($expiresDate);
     $expireSeconds = $expires * 60 * 60;
     if ($transID == 'vipuser') {
         $today = 0;
         $expiresDate = 0;
     }
     if ($today <= $expiresDate + $expireSeconds) {
         //check for existing account
         $selU = 'select * from users where email="' . $payerEmail . '" or paypal="' . $payerEmail . '"';
         $resU = mysql_query($selU, $conn) or die(mysql_error());
         if (mysql_num_rows($resU) == 0) {
             //generate random password
             $password = genString(8);
             //insert email & password into db
             $ins = 'insert into users (
             paypal,
             email,
             password,
             joinDate
             ) values (
             "' . $payerEmail . '",
             "' . $payerEmail . '",
             "' . $password . '",
             now() )';
             mysql_query($ins, $conn) or die(mysql_error());
         } else {
             $u = mysql_fetch_assoc($resU);
             $password = $u[password];