function change_password($newPassword) { global $root; $sessionID = get_session(); //echo "SESSION ID IS: " . htmlspecialchars($sessionID) . "\n"; if (!isset($sessionID)) { echo "sessionID is not set?"; //echo htmlspecialchars($sessionID); die; } else { //$sessionID = $session->SessionID; // required parameters for /changePassword $args = array('accountNum' => API_ACCOUNT_NUM, 'session' => $sessionID, 'newPassword' => $newPassword, 'password' => $_POST['current_password']); $result = build_api_request('/changePassword', $args); // error handling for changing the password $json_result = json_decode($result); //echo "json_result-Status = " . $json_result->Status; if (!isset($json_result->Status)) { echo '<div id="bigContent">'; echo "Invalid request."; echo '</div>'; include "{$root}/footer.php"; die; } else { echo '<div id="bigContent">'; echo $json_result->Status . '<br />'; echo "Please update your config.inc.php file to reflect your changed password in order to prevent errors when accessing the fed API."; echo '</div>'; include "{$root}/footer.php"; die; } } }
/** * combine BatchOuts from Threads * * @param int order_id * @return int count of CheckOuts combined */ function JKY_combine_batchouts($the_ids) { $db = Zend_Registry::get('db'); $my_id = get_next_id('BatchOuts'); $sql = 'INSERT INTO BatchOuts ' . 'SELECT ' . $my_id . ' , ' . get_session('user_id') . ' , NOW()' . ' , status' . ' , MIN(checkout_id)' . ' , thread_id' . ' , batchin_id' . ' , req_line_id' . ' , tdyer_thread_id' . ' , order_thread_id' . ' , code' . ' , batch' . ' , AVG(unit_price)' . ' , SUM(requested_weight)' . ' , AVG(average_weight)' . ' , SUM(requested_boxes)' . ' , SUM(reserved_boxes)' . ' , SUM(checkout_boxes)' . ' , SUM(checkout_weight)' . ' FROM BatchOuts' . ' WHERE id IN (' . $the_ids . ')'; log_sql('BatchOuts', $my_id, $sql); $db->query($sql); insert_changes($db, 'BatchOuts', $my_id); $sql = 'SELECT *' . ' FROM BatchOuts' . ' WHERE id IN (' . $the_ids . ')'; log_sql('BatchOuts', $my_id, $sql); /* $sql= 'UPDATE BatchOuts ' . ' SET status = "History"' . ' FROM BatchOuts' . ' WHERE id IN (' . $the_ids . ')' ; */ $my_rows = $db->fetchAll($sql); foreach ($my_rows as $my_row) { $sql = 'UPDATE BatchOuts' . ' SET status = "History"' . ' WHERE id = ' . $my_row['id']; log_sql('BatchOuts', $my_row['id'], $sql); $db->query($sql); insert_changes($db, 'BatchOuts', $my_row['id']); } return $my_id; }
function auth_error($exception = null) { global $connection, $adminer, $token; $session_name = session_name(); $error = ""; if (!$_COOKIE[$session_name] && $_GET[$session_name] && ini_bool("session.use_only_cookies")) { $error = lang('Session support must be enabled.'); } elseif (isset($_GET["username"])) { if (($_COOKIE[$session_name] || $_GET[$session_name]) && !$token) { $error = lang('Session expired, please login again.'); } else { $password =& get_session("pwds"); if (isset($password)) { $error = h($exception ? $exception->getMessage() : (is_string($connection) ? $connection : lang('Invalid credentials.'))); $password = null; } } } page_header(lang('Login'), $error, null); echo "<form action='' method='post' onclick='eventStop(event);'>\n"; $adminer->loginForm(); echo "<div>"; hidden_fields($_POST, array("driver", "server", "username", "password", "permanent")); // expired session echo "</div>\n"; echo "</form>\n"; page_footer("auth"); }
function make_mp3() { global $config; $number = get_session("ss_captcha_key"); if ($number == "") { return; } if ($number == get_session("ss_captcha_save")) { return; } $mp3s = array(); for ($i = 0; $i < strlen($number); $i++) { $file = G5_CAPTCHA_PATH . '/mp3/' . $config['cf_captcha_mp3'] . '/' . $number[$i] . '.mp3'; $mp3s[] = $file; } $ip = sprintf("%u", ip2long($_SERVER['REMOTE_ADDR'])); $mp3_file = 'data/cache/kcaptcha-' . $ip . '_' . G5_SERVER_TIME . '.mp3'; $contents = ''; foreach ($mp3s as $mp3) { $contents .= file_get_contents($mp3); } file_put_contents(G5_PATH . '/' . $mp3_file, $contents); // 지난 캡챠 파일 삭제 if (rand(0, 99) == 0) { foreach (glob(G5_PATH . '/data/cache/kcaptcha-*.mp3') as $file) { if (filemtime($file) + 86400 < G5_SERVER_TIME) { @unlink($file); } } } set_session("ss_captcha_save", $number); return G5_URL . '/' . $mp3_file; }
/** * generate Purchase * * @param int purchase_id * @return int count of Incomings generated */ function JKY_generate_purchase($the_id) { $db = Zend_Registry::get('db'); $sql = 'SELECT *' . ' FROM Purchases' . ' WHERE id = ' . $the_id; $my_purchase = $db->fetchRow($sql); $sql = 'SELECT *' . ' FROM PurchaseLines' . ' WHERE parent_id = ' . $the_id; $my_rows = $db->fetchAll($sql); $my_count = 0; foreach ($my_rows as $my_row) { $my_incoming_id = get_next_id('Incomings'); $sql = 'INSERT Incomings' . ' SET id = ' . $my_incoming_id . ', updated_by = ' . get_session('user_id') . ', updated_at ="' . get_time() . '"' . ', incoming_number = ' . $my_incoming_id . ', supplier_id = ' . $my_purchase['supplier_id'] . ', invoice_date ="' . $my_row['expected_date'] . '"' . ', invoice_weight = ' . $my_row['expected_weight']; log_sql('Incomings', 'INSERT', $sql); $db->query($sql); insert_changes($db, 'Incomings', $my_incoming_id); $my_batchin_id = get_next_id('Batches'); $sql = 'INSERT Batches' . ' SET id = ' . $my_batchin_id . ', updated_by = ' . get_session('user_id') . ', updated_at ="' . get_time() . '"' . ', incoming_id = ' . $my_incoming_id . ', thread_id = ' . $my_row['thread_id'] . ', purchase_line_id = ' . $my_row['id']; log_sql('Batches', 'INSERT', $sql); $db->query($sql); insert_changes($db, 'Batches', $my_batchin_id); $sql = 'UPDATE PurchaseLines' . ' SET batch_id = ' . $my_batchin_id . ' WHERE id = ' . $my_row['id']; log_sql('PurchaseLines', 'UPDATE', $sql); $db->query($sql); insert_changes($db, 'PurchaseLines', $my_row['id']); $my_count++; } $sql = 'UPDATE Purchases' . ' SET status = "Active"' . ' WHERE id = ' . $the_id; log_sql('Purchases', 'UPDATE', $sql); $db->query($sql); insert_changes($db, 'Purchases', $the_id); return $my_count; }
/** * i_am_logged * * @access public * @return boolean */ function i_am_logged() { $session = get_session(); if (!$session->islogged()) { throw new LoginRequiredException(); } return true; }
/** * fungsi khusus untuk mendapatkan session user */ function get_user_session($key, $default = '') { if (has_session('user')) { $user = get_session('user'); return isset($user[$key]) ? $user[$key] : $default; } return $default; }
/** * my_page * * @access public * @return string */ function my_page() { $session = get_session(); if (!$session->logged) { return redirect('/'); } $me = $session->whoAMI(); return view_user($me[0]); }
/** * get_logged_user * * @access public * @return User */ function get_logged_user() { static $user; if (!$user) { $session = get_session(); $user = $session->get_logged_user(); } return $user; }
function is_access($try) { $access = 0; $temp = get_session('user'); $user_entry = strlen($temp) > 0 ? unserialize($temp) : null; if ($user_entry != null) { $access = $user_entry['access']; } return ($access & $try) == $try ? true : false; }
function csrf_verify($name, $token) { $hash = get_session($name); $valid = false; if ($hash === $token) { $valid = true; } unset_session($name); return $valid; }
function check_rights($code) { $is_pass = 1; if (get_session('admin_group') != 'superadmin') { $local_rights = get_session('rights'); if (!stripos(",,{$local_rights},", ",{$code},")) { $is_pass = 0; } } return $is_pass; }
/** * generate Order from OSAs * * @param int quotation_id * @return int count of Orders generated */ function JKY_generate_order($the_id) { $db = Zend_Registry::get('db'); $sql = 'SELECT *' . ' FROM OSAs' . ' WHERE id = ' . $the_id; $my_osa = $db->fetchRow($sql); $sql = 'SELECT *' . ' FROM OSA_Lines' . ' WHERE parent_id = ' . $the_id; $my_rows = $db->fetchAll($sql); $my_count = 0; foreach ($my_rows as $my_row) { $my_osa_line_id = $my_row['id']; $sql = 'SELECT *' . ' FROM OSA_Colors' . ' WHERE parent_id = ' . $my_osa_line_id; $my_colors = $db->fetchAll($sql); foreach ($my_colors as $my_color) { $my_order_id = get_next_id('Orders'); $sql = 'INSERT Orders' . ' SET id =' . $my_order_id . ', updated_by =' . get_session('user_id') . ', updated_at ="' . get_time() . '"' . ', order_number =' . $my_order_id . ', osa_line_id =' . $my_osa_line_id . ', osa_number =' . $my_osa['osa_number'] . ', ordered_at ="' . $my_osa['ordered_at'] . '"' . ', needed_at ="' . $my_osa['needed_at'] . '"' . ', quoted_units =' . $my_row['units'] . ', quoted_pieces =' . $my_color['quoted_pieces'] . ', quoted_weight =' . $my_color['quoted_weight'] . ', ordered_pieces =' . $my_color['ordered_pieces'] . ', ordered_weight =' . $my_color['ordered_weight']; if ($my_osa['customer_id']) { $sql .= ', customer_id=' . $my_osa['customer_id']; } if ($my_row['product_id']) { $sql .= ', product_id=' . $my_row['product_id']; } if ($my_color['color_id']) { $sql .= ', color_id=' . $my_color['color_id']; } if ($my_color['ftp_id']) { $sql .= ', ftp_id=' . $my_color['ftp_id']; } if ($my_color['machine_id']) { $sql .= ', machine_id=' . $my_color['machine_id']; } if ($my_color['partner_id']) { $sql .= ', partner_id=' . $my_color['partner_id']; } log_sql('Orders', 'INSERT', $sql); $db->query($sql); insert_changes($db, 'Orders', $my_order_id); /* $sql= 'UPDATE OSA_lines' . ' SET status = "Active"' . ' WHERE id = ' . $my_row['id'] ; log_sql('OSA_Lines', 'UPDATE', $sql); $db->query($sql); insert_changes($db, 'OSA_Lines', $my_row['id']); */ $my_count++; } } $sql = 'UPDATE OSAs' . ' SET status = "Active"' . ' WHERE id = ' . $the_id; log_sql('OSAs', 'UPDATE', $sql); $db->query($sql); insert_changes($db, 'OSAs', $the_id); return $my_count; }
function check_dup($uid, $cid, &$ret) { $sess = get_session($uid); if ($sess['fv'] > 100) { if ($sess['_cid'] != $cid) { $ret['s'] = 'dup'; return $ret; } } return false; }
function code_exists() { $is_admin = ''; $sendor_id = ''; $admin_id = get_session('admin_id'); if ($admin_id) { $is_admin = 1; $sendor_id = $admin_id; } else { $user_id = get_sess_userid(); if (!$user_id) { return false; exit; } $is_admin = 0; $sendor_id = $user_id; } if ($sendor_id != '' && $is_admin !== '') { global $inviteCodeValue; global $tablePreStr; global $inviteCodeLength; $t_invite_code = $tablePreStr . "invite_code"; $t_users = $tablePreStr . "users"; if ($is_admin == 0) { $user_info = api_proxy('user_self_by_uid', 'integral', $sendor_id); $intg = $user_info['integral']; if ($inviteCodeValue > $intg) { return false; } } $dbo = new dbex(); dbplugin('r'); $invite_code = randkeys($inviteCodeLength); $sql = "select id from {$t_invite_code} where code_txt='{$invite_code}'"; $is_exists = $dbo->getRow($sql); if ($is_exists['id']) { code_exists(); } else { $time = time(); $sql = "insert into {$t_invite_code} (sendor_id,code_txt,is_admin,add_time) values({$sendor_id},'{$invite_code}',0,{$time})"; $success = $dbo->exeUpdate($sql); if ($success) { if ($is_admin == 0) { $sql = "update {$t_users} set integral=integral-{$inviteCodeValue} where user_id={$sendor_id}"; $dbo->exeUpdate($sql); } return $invite_code; } else { return false; } } } }
public function update($id, array $data, $log = true) { $data['updated_at'] = get_time(); if (is_session('user_id')) { $data['updated_by'] = get_session('user_id'); } $where = $this->getAdapter()->quoteInto('id = ?', $id); parent::update($data, $where); if ($log) { log_sql($this->_name, $id, 'updated', $data); set_session('notice', 'current record saved'); } }
function is_admin() { if (session_is_live()) { $session = get_session(); if ($session['login'] == $GLOBALS['admin_username']) { return true; } else { return false; } } else { return false; } }
function antiRePost($sendStr) { global $RefreshType; global $anit_refresh; if ($sendStr == get_session('PostSendStr')) { if (isset($RefreshType) == 'ajax') { action_return(2, 'error:' . $anit_refresh, "-1"); } else { action_return(1, $anit_refresh, "-1"); } } set_session('PostSendStr', $sendStr); }
function get_user() { $cookie_user = ci_get_cookie('user'); if ($cookie_user) { $this->user = json_decode($cookie_user, true); set_session('user', $this->user); } else { $this->user = get_session('user'); } if ($this->user) { $this->uid = $this->user['uid']; $this->load->vars('user', $this->user); } }
/** * generate CheckOut from Planning Orders * * @param int order_id * @return int count of CheckOuts generated */ function JKY_generate_checkout($the_id) { $db = Zend_Registry::get('db'); $sql = 'SELECT *' . ' FROM Orders' . ' WHERE id = ' . $the_id; $my_order = $db->fetchRow($sql); $sql = 'SELECT *' . ' FROM OrdThreads' . ' WHERE parent_id = ' . $the_id; $my_rows = $db->fetchAll($sql); /* $my_needed_at = $my_order['needed_at']; if ($my_needed_at == null) { $my_needed_at = get_time(); } */ $my_checkout_id = get_next_id('CheckOuts'); $sql = 'INSERT CheckOuts' . ' SET id =' . $my_checkout_id . ', updated_by =' . get_session('user_id') . ', updated_at ="' . get_time() . '"' . ', number =' . $my_checkout_id . ', requested_at ="' . get_time() . '"' . ', requested_weight =' . $my_order['ordered_weight']; if ($my_order['machine_id']) { $sql .= ', machine_id=' . $my_order['machine_id']; } if ($my_order['partner_id']) { $sql .= ', partner_id=' . $my_order['partner_id']; } log_sql('CheckOuts', 'INSERT', $sql); $db->query($sql); insert_changes($db, 'CheckOuts', $my_checkout_id); $my_count = 0; foreach ($my_rows as $my_row) { $my_ord_thread_id = $my_row['id']; $my_batch = db_get_row('Batches', 'id=' . $my_row['batchin_id']); $my_ordered_weight = $my_row['ordered_weight']; $my_ordered_boxes = ceil((double) $my_ordered_weight / (double) $my_batch['average_weight']); $my_batchout_id = get_next_id('BatchOuts'); $sql = 'INSERT BatchOuts' . ' SET id =' . $my_batchout_id . ', updated_by =' . get_session('user_id') . ', updated_at ="' . get_time() . '"' . ', checkout_id =' . $my_checkout_id . ', thread_id =' . $my_row['thread_id'] . ', batchin_id =' . $my_row['batchin_id'] . ', order_thread_id =' . $my_ord_thread_id . ', batch ="' . $my_batch['batch'] . '"' . ', unit_price =' . $my_batch['unit_price'] . ', average_weight =' . $my_batch['average_weight'] . ', requested_weight =' . $my_ordered_weight . ', requested_boxes =' . $my_ordered_boxes; log_sql('BatchOuts', 'INSERT', $sql); $db->query($sql); insert_changes($db, 'BatchOuts', $my_batchout_id); $sql = 'UPDATE OrdThreads' . ' SET batchout_id = ' . $my_batchout_id . ' WHERE id = ' . $my_ord_thread_id; log_sql('OrdThreads', 'UPDATE', $sql); $db->query($sql); insert_changes($db, 'OrdThreads', $my_ord_thread_id); $my_count++; } $sql = 'UPDATE Orders' . ' SET status = "Active"' . ' WHERE id = ' . $the_id; log_sql('Orders', 'UPDATE', $sql); $db->query($sql); insert_changes($db, 'Orders', $the_id); return $my_count; }
/** * checkin Piece from Pieces Check In * * $.ajax({ method:'checkin', table:'Pieces', barcode:9...9, ...}; * * @return string '' */ function JKY_checkin_piece($the_data) { $db = Zend_Registry::get('db'); $my_barcode = get_data($the_data, 'barcode'); $my_checkin_weight = get_data($the_data, 'checkin_weight'); /* $my_inspected_by = get_data($the_data, 'inspected_by' ); $my_weighed_by = get_data($the_data, 'weighed_by' ); $my_qualities = get_data($the_data, 'qualities' ); $my_remarks = get_data($the_data, 'remarks' ); $my_checkin_weight = get_data($the_data, 'checkin_weight' ); $my_checkin_location= get_data($the_data, 'checkin_location'); */ $my_set = ''; // $my_set .= isset($the_data['revised_by' ]) ? ', revised_by = ' . trim($the_data['revised_by' ]) : ''; $my_set .= ', revised_by = ' . get_session('user_id'); // $my_set .= isset($the_data['weighed_by' ]) ? ', weighed_by = ' . trim($the_data['weighed_by' ]) : ''; $my_set .= ', weighed_by = ' . get_session('user_id'); $my_set .= isset($the_data['qualities']) ? ', qualities =\'' . trim($the_data['qualities']) . '\'' : ''; $my_set .= isset($the_data['remarks']) ? ', remarks =\'' . trim($the_data['remarks']) . '\'' : ''; $my_set .= isset($the_data['checkin_weight']) ? ', checkin_weight = ' . trim($the_data['checkin_weight']) : ''; $my_set .= isset($the_data['checkin_location']) ? ', checkin_location =\'' . trim($the_data['checkin_location']) . '\'' : ''; $sql = 'UPDATE Pieces' . ' SET ' . get_updated() . ', checkin_at=\'' . get_time() . '\'' . $my_set . ' WHERE id =' . $my_barcode; log_sql('Pieces', 'update', $sql); $db->query($sql); insert_changes($db, 'Pieces', $my_barcode); $my_piece = db_get_row('Pieces', 'barcode =\'' . $my_barcode . '\''); if (!is_empty($my_piece['revised_by']) && !is_empty($my_piece['weighed_by'])) { $sql = 'UPDATE Pieces' . ' SET status="Check In"' . ' WHERE id = ' . $my_barcode; log_sql('Pieces', 'update', $sql); $db->query($sql); } // $my_order_id = get_table_value('Pieces', 'order_id', $my_barcode); $my_order_id = $my_piece['order_id']; if (strtolower($my_piece['qualities']) == 'boa') { $my_set = ', produced_at=\'' . get_time() . '\'' . ', produced_pieces = produced_pieces + 1' . ', produced_weight = produced_weight + ' . $my_checkin_weight; } else { $my_set = ', rejected_pieces = rejected_pieces + 1'; } $sql = 'UPDATE Orders' . ' SET ' . get_updated() . $my_set . ' WHERE id = ' . $my_order_id; log_sql('Orders', 'update', $sql); $db->query($sql); insert_changes($db, 'Orders', $my_order_id); return ''; }
public function renderDetail($view, $title, $action, $form_action, $buttons) { $contr = get_session('contr'); $html = ''; $html .= NL . '<link type="text/css" rel="stylesheet" href="/css/' . $contr . '_detail.css?20101025" />'; // $html .= NL . ' <div class="clear"></div>'; $style = $action == 'index' ? ' style="display:none"' : ''; if ($action != 'index') { $html .= NL . ' <!-- Content header -->'; $html .= NL . ' <div id="cont_header" class="padding">'; $html .= NL . ' <div class="float_left">'; $html .= NL . ' <span class="black">' . $title . '</span>'; $html .= NL . ' </div>'; if ($action == 'show') { $html .= NL . ' <div id="cont_controls">'; $html .= NL . ' <a href=' . $view->previous . ' ><< Previous</a> | '; $html .= NL . ' <a href=' . $view->next . ' >Next >></a>'; $html .= NL . ' </div id="cont_controls">'; } $html .= NL . ' <div class="clear"></div>'; $html .= NL . ' </div id="cont_header">'; } $html .= NL . ' <div id="content_body">'; $html .= NL . ' <!-- Content details -->'; $html .= NL . ' <div id="content_details">'; $html .= NL . ' <form id="im_form" action="/' . $contr . "/" . $form_action . '" method="post" enctype="multipart/form-data"' . $style . '>'; $html .= NL . $view->render($contr . '/detail.phtml'); $html .= NL . ' <!-- Save Changes -->'; $html .= NL . ' <div id="save_changes" class="bg_gray">'; $my_buttons = explode(',', $buttons); foreach ($my_buttons as $my_button) { $html .= NL . ' <a class="all_buttons button_details" onclick="javascript:submit_form_name( \'im_form\', \'' . $my_button . '\' )"><span>' . $my_button . '</span></a>'; } if ($action != 'index') { $html .= NL . ' <div class="or_anchor_enabled">or <a class="enabled_link" onclick="javascript:submit_form_name( \'im_form\', \'Cancel\' )">Cancel</a></div>'; } $html .= NL . ' </div>'; $html .= NL . '<div>' . put_img('round_corner_gray_bottom.jpg') . '</div>'; $html .= NL . '</form id="im_form">'; $html .= NL . '</div id="content_details">'; $html .= NL . '</div id="content_body">'; return $html; }
function save_customerwork() { //cmd/save_customerwork.html $customerdata = get_session('customerdata'); //customer data if (!$customerdata) { //not login json_output('requireLogin'); return ''; } //history preg_match('#[^-]+$#', $_POST['history'], $r); //final result $history = array('customer_id' => $customerdata->id, 'company' => $_POST['company'], 'salary' => $_POST['sal'], 'save_history' => $_POST['history'], 'result' => $r[0], 'post_date' => date("Y-m-d"), 'post_time' => date('H:i:s a'), 'loan' => preg_replace('#\\.#', '', $_POST['loan']), 'note' => 'Mục đích sử dụng:' . PHP_EOL . $_POST['usedfor'] . PHP_EOL . ',Thời gian chúng tôi liên hệ:' . $_POST['contacttime']); if (isset($_POST['modify'])) { //update history do_update($history, array('id' => $_POST['modify']), 'vcn_histories'); $hid = $_POST['modify']; } else { do_insert($history, 'vcn_histories'); $hid = mysql_insert_id(); //history id } //update histories1 that save answer text $history_text = array(); //multi rows $historyt = json_decode($_POST['historyt']); //decode answers_text foreach ($historyt as $answer_id => $text) { $history_t = array('answer_id' => $answer_id, 'answer_text' => $text, 'hid' => $hid); $history_text[] = $history_t; if (isset($_POST['modify'])) { //update single answer text do_update($history_t, array('hid' => $_POST['modify']), 'vcn_histories1'); } } if (!isset($_POST['modify'])) { do_insert($history_text, 'vcn_histories1'); } json_output($hid); //return new history }
/** * return Box from Boxes Return * * $.ajax({ method:'return', table:'Boxes', barcode:9...9}; * * @return string '' */ function JKY_return_box($the_data) { $db = Zend_Registry::get('db'); $my_barcode = get_data($the_data, 'barcode'); $my_number_of_cones = get_data($the_data, 'number_of_cones'); $my_real_weight = get_data($the_data, 'real_weight'); $sql = 'UPDATE Boxes' . ' SET ' . get_updated() . ', status="Return"' . ', returned_by=' . get_session('user_id') . ', returned_at="' . get_time() . '"' . ', number_of_cones =' . $my_number_of_cones . ', real_weight =' . $my_real_weight . ' WHERE id=' . $my_barcode; log_sql('Boxes', 'update', $sql); $db->query($sql); insert_changes($db, 'Boxes', $my_barcode); $my_box = db_get_row('Boxes', 'id=' . $my_barcode); $my_average_weight = $my_box['average_weight']; $my_real_weight = $my_box['real_weight']; $my_weight = $my_real_weight == 0 ? $my_average_weight : $my_real_weight; $sql = 'UPDATE Batches' . ' SET returned_boxes = returned_boxes + 1' . ' , returned_weight = returned_weight + ' . $my_weight . ' WHERE id = ' . $my_box['batch_id']; log_sql('Batches', 'update', $sql); $db->query($sql); insert_changes($db, 'Batches', $my_box['batch_id']); return ''; }
/** * This function returns the user ID of the logged in user on your site. Technical support will not * help you with this for stand-alone installations. You must purchase the professional installation * if you are having trouble. * * Suggestion: Check out the other integration files in the functions/integrations directory for * many examples of how this can be done. The easiest way is to get the user ID through a cookie. * * @return the user ID of the logged in user */ function get_user_id() { global $db; function get_session() { foreach ($_COOKIE as $key => $val) { if (strpos($key, 'SESS') === 0) { return $val; } } return ''; } $userid = NULL; $sess_id = get_session(); if (!empty($sess_id)) { $result = $db->execute("\n\t\t\t\tSELECT uid \n\t\t\t\tFROM " . TABLE_PREFIX . "sessions \n\t\t\t\tWHERE sid = '" . $db->escape_string($sess_id) . "'\n\t\t\t"); if ($row = $db->fetch_array($result)) { $userid = $row['uid']; } } return $userid; }
$c_PayPlus->m_res_cd = "9562"; $c_PayPlus->m_res_msg = "연동 오류|tran_cd값이 설정되지 않았습니다."; } if ($res_cd != '0000') { $res_msg = iconv("euc-kr", "utf-8", $res_msg); /* echo "<script> var openwin = window.open( './kcp/proc_win.php', 'proc_win', '' ); openwin.close(); </script>"; */ if (isset($_POST['pp_id']) && $_POST['pp_id']) { $page_return_url = G5_SHOP_URL . '/personalpayform.php?pp_id=' . get_session('ss_personalpay_id'); } else { $page_return_url = G5_SHOP_URL . '/orderform.php'; if (get_session('ss_direct')) { $page_return_url .= '?sw_direct=1'; } } alert("{$res_cd} : {$res_msg}", $page_return_url); exit; } /* = -------------------------------------------------------------------------- = */ /* = 04. 실행 END = */ /* ============================================================================== */ /* ============================================================================== */ /* = 05. 승인 결과 값 추출 = */ /* = -------------------------------------------------------------------------- = */ if ($req_tx == "pay") { if ($res_cd == "0000") { $tno = $c_PayPlus->mf_get_res_data("tno");
echo '<input type="checkbox" name="facebook_checked" id="facebook_checked" ' . (get_cookie('ck_facebook_checked') ? 'checked' : '') . ' value="1">'; } else { $facebook_url = $facebook->getLoginUrl(array("redirect_uri" => G5_SNS_URL . "/facebook/callback.php", "scope" => "publish_stream,read_stream,offline_access", "display" => "popup")); echo '<a href="' . $facebook_url . '" id="facebook_url" onclick="return false;"><img src="' . G5_SNS_URL . '/icon/facebook' . ($facebook_user ? '' : '_off') . '.png" id="facebook_icon"></a>'; echo '<label for="" class="sound_only">페이스북 동시 등록</label>'; echo '<input type="checkbox" name="facebook_checked" id="facebook_checked" disabled value="1">'; echo '<script>$(function(){ $("#facebook_url").live("click", function(){ window.open(this.href, "facebook_url", "width=600,height=250"); }); });</script>'; } echo '</li>'; } //============================================================================ //============================================================================ // 트위터 //---------------------------------------------------------------------------- if ($config['cf_twitter_key']) { $twitter_user = get_session("ss_twitter_user"); if (!$twitter_user) { include_once G5_SNS_PATH . "/twitter/twitteroauth/twitteroauth.php"; include_once G5_SNS_PATH . "/twitter/twitterconfig.php"; $twitter_user = false; /* if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) { $twitter_url = G5_SNS_URL."/twitter/redirect.php"; } else { $access_token = $_SESSION['access_token']; $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']); $content = $connection->get('account/verify_credentials'); switch ($connection->http_code) { case 200: $twitter_user = true;
function chk_captcha() { $captcha_count = (int) get_session('ss_captcha_count'); if ($captcha_count > 5) { return false; } if (!isset($_POST['captcha_key'])) { return false; } if (!trim($_POST['captcha_key'])) { return false; } if ($_POST['captcha_key'] != get_session('ss_captcha_key')) { $_SESSION['ss_captcha_count'] = $captcha_count + 1; return false; } return true; }
$sql = " select * from {$g5['g5_shop_item_table']} where it_id = '{$it_id}' "; $it = sql_fetch($sql); if (!$it) { alert('상품정보가 존재하지 않습니다.'); } if (!$is_auth) { if ($it['pt_id'] != $member['mb_id']) { alert("\\'{$member['mb_id']}\\' 님께서 수정 할 권한이 없는 상품입니다."); } } // 첫번째 분류 $ca_id = $it['ca_id']; $sql = " select * from {$g5['g5_shop_category_table']} where ca_id = '{$ca_id}' "; $ca = sql_fetch($sql); $ss_name = 'ss_item_' . $it_id; if (!get_session($ss_name)) { set_session($ss_name, TRUE); } } else { goto_url("./"); } } $qstr = $qstr . '&sca=' . $sca . '&ap=list&page=' . $page; $frm_submit = '<div class="btn_confirm01 btn_confirm"><input type="submit" value="확인" class="btn_submit" accesskey="s"> <a href="./?' . $qstr . '" class="btn_frmline">목록</a>'; if ($it_id) { $frm_submit .= PHP_EOL . '<a href="' . G5_SHOP_URL . '/item.php?it_id=' . $it_id . '" target="blank" class="btn_frmline">보기</a> <a href="./?ap=item" class="btn_frmline">신규</a>'; } $frm_submit .= '</div>'; include_once $skin_path . '/itemform.skin.php'; // 입력폼 선택 if ($w == "" && !$fn) {
<?php // 캡챠 세션값과 비교하여 맞는지? 틀린지? 결과값을 출력합니다. include_once "_common.php"; header("Content-Type: text/html; charset={$g4['charset']}"); $count = (int) get_session("captcha_count"); if ($count >= 5) { // 설정값 이상이면 자동등록방지 입력 문자가 맞아도 오류 처리 echo false; } else { set_session("captcha_count", $count + 1); echo get_session("captcha_keystring") == $_POST['captcha_key'] ? true : false; }