📁 PHP Dosya Yöneticisi
/
/
home
/
demodesigncom
/
e-ticaretv9.demodesign.com.tr
📝
ajax.php
← Geri Dön
<?php include('init.php'); if ($_POST) { switch (m_u_p('type')) { case 'scroll_data': $_GET['page_no'] = m_u_p('page_no'); $products = ''; $json = array(); $json['status'] = true; switch (m_u_p('sc_type')) { case 'category': $s_join = ''; $v_join = ''; switch ($_POST['product_list_order']) { case "asc"; $order_type = 'p.sale_price asc'; break; case "desc"; $order_type = 'p.sale_price desc'; break; default: $order_type = 'p.id desc'; } if (count($_POST['filter']['variants']) > 0) { foreach ($_POST['filter']['variants'] as $variant) { $vp = explode(':', $variant); $v_title = $vp[0]; $v_content = $vp[1]; $where .= " or (v.title='" . $v_title . "' and v.content='" . $v_content . "' )"; } $v_join = 'INNER JOIN product_variants v on v.p_id=p.id'; } if (count($_POST['filter']['specifications']) > 0) { foreach ($_POST['filter']['specifications'] as $specification) { $sp = explode(':', $specification); $s_title = $sp[0]; $s_content = $sp[1]; $where .= " and (s.title='" . $s_title . "' and s.content='" . $s_content . "' )"; } $s_join = 'INNER JOIN product_specifications s on s.p_id=p.id'; } if (count($_POST['filter']['brands']) > 0) { $brands = implode(',', $_POST['filter']['brands']); $where .= " and p.b_id IN($brands)"; } $prices = explode(' ', $_POST['price']); $min_price = $prices[0]; $max_price = $prices[2]; $where .= " and p.sale_price BETWEEN $min_price and $max_price"; $where = trim($where, 'and '); $where = trim($where, 'or '); $where = trim($where); if ($where != '') { $where = 'and ' . $where . ''; } $informations = $db->query("SELECT p.* FROM products p " . $v_join . " " . $s_join . " where p.c_id LIKE '%[" . m_u_p('c_id') . "]%' " . $where . "")->fetchAll(PDO::FETCH_ASSOC); $total_count = count($informations); $c_per_page = 40; $page_count = ceil($total_count / $c_per_page); if ($page_count == 1) { $page_count = 0; } $current_page = (integer)m_u_g(DB_PAGINATION_GET) ? (integer)m_u_g(DB_PAGINATION_GET) : 1; $current_limit = ($current_page - 1) * $c_per_page; $informations = $db->query("SELECT p.* FROM products p " . $v_join . " " . $s_join . " where p.c_id LIKE '%[" . m_u_p('c_id') . "]%' " . $where . " order by " . $order_type . " limit " . $current_limit . "," . $c_per_page . "")->fetchAll(PDO::FETCH_ASSOC); if (count($informations) > 0) { $products .= '<div class="scroll_stop" style="display:none;height:50px;width:100%;"></div>'; foreach ($informations as $info) { $product_image = m_image_url($info['image']); $product_title = $info['title']; $product_link = m_permalink('product', $info['sef'], $info['id']); $undiscounted_price = m_currency($info['undiscounted_price']); $product_sale_price = m_currency($info['sale_price']); $product_currency_type = currency_types($info['currency_type'], 'value'); $undiscounted_html = ''; if ($undiscounted_price > 0) { $undiscounted_html = '<span class="old-price">' . $undiscounted_price . ' ' . $product_currency_type . '</span>'; } $cart_control = cart_control($info['id']); $products .= ' <div class="col"> <div class="item"> <div class="img"> '; if($product['cargo_price'] == "0.00"){ $products .= '<span class="d-flex bdgs"> <span class="bdg green">Ücretsiz Kargo!</span> </span>'; } $products .= '<a href="'.$product_link.'"> <img src="'.$product_image.'" width="238" height="175" class="img-fluid" alt=""> </a> </div> <a href="'.$product_link.'" class="title"><h3>'.$product_title.'</h3></a> <div class="pb"> <?php echo $undiscounted_html ?> <div class="price">'.$product_sale_price." ".$product_currency_type.'</div> '.$cart_control.' </div> </div> </div>'; } } else { $products .= '<div class="col-lg-12"><div class="alert alert-info"><i class="fa fa-info-circle"></i> <strong>' . LG_INFO . ':</strong> ' . LG_FILTER_NO_RESULTS . '</div></div>'; } $json['products'] = $products; $json['total_page'] = $page_count; echo json_encode($json); break; } break; case 'add_cart': $result = array(); $product = $db->table('products')->where('id', '=', m_u_p('id'))->where('status', '=', 1)->order('id', 'desc')->get(); $product_info = $product['data'][0]; if ($product['total_count'] > 0) { $cart_added_count = $_SESSION['cart'][m_u_p('id')]['count']; if ($cart_added_count == '') { $cart_added_count = 0; } $cart_added_count = $cart_added_count + m_u_p('quantity'); $variants = ''; foreach ($_POST['variants'] as $variant_title => $variant_content) { $variants .= '<b>' . $variant_title . ':</b> ' . $variant_content . '<br>'; } if ($product_info['stock'] >= $cart_added_count) { $result['status'] = true; $result['cart_html'] = ''; if ($_SESSION['cart'][m_u_p('id')][0]['added'] == '') { $_SESSION['cart'][m_u_p('id')][0]['added'] = 'ok'; $_SESSION['cart'][m_u_p('id')][0]['variants'] = $_POST['variants']; $_SESSION['cart'][m_u_p('id')][0]['count'] = m_u_p('quantity'); } else { $var = 0; $keys = 0; foreach ($_SESSION['cart'][m_u_p('id')] as $key => $vv) { if ($vv['variants'] == $variants) { $var = 1; $keys = $key; break; } } if ($var) { //['added'] = 'ok'; //$_SESSION['cart'][m_u_p('id')]['variants'] = $variants; //$_SESSION['cart'][m_u_p('id')]['count'] = m_u_p('quantity'); $_SESSION['cart'][m_u_p('id')][$keys]['count'] = $_SESSION['cart'][m_u_p('id')][$keys]['count'] + m_u_p('quantity'); } else { array_push($_SESSION['cart'][m_u_p('id')], [ 'added' => 'ok2', 'variants' => $_POST['variants'], 'count' => m_u_p('quantity') ]); } } $var = 0; } else { $result['status'] = false; $result['title'] = LG_ERROR; $result['msg'] = LG_NO_STOCK; } } else { $result['status'] = false; } $n = 0; foreach ($_SESSION['cart'] as $p_id => $c_p) { $product = $db->table('products')->where('id', '=', $p_id)->get_vars(); $product_image = m_image_url($product['image']); $product_title = $product['title']; $product_link = m_permalink('product', $product['sef'], $product['id']); $undiscounted_price = m_currency($product['undiscounted_price']); $product_sale_price = m_currency($product['sale_price']); $product_currency_type = currency_types($product['currency_type'], 'value'); $result['cart_html'] .= ' <li class="header_cart_product" rel="' . $p_id . '"> <div class="shopping-cart-img"> <div class="product_cart_list_image_cover"> <a href="' . $product_link . '" title="' . $product_title . '"><img alt="' . $product_title . '" class="product_cart_list_image" src="' . $product_image . '"></a> </div> </div> <div class="shopping-cart-title"> <h4><a href="' . $product_link . '" title="' . $product_title . '">' . $product_title . '</a></h4> <h4><span>' . $c_p['count'] . ' × </span>' . $product_sale_price . ' ' . $product_currency_type . '</h4> </div> <div class="shopping-cart-delete"> <a href="javascript:void(0);" class="add_cart cart_added" data-type="header" rel="' . $p_id . '"><i class="fi-rs-cross-small"></i></a> </div> </li>'; $n++; if ($n > 4) { if (count($_SESSION['cart']) > 5) { $other_count = count($_SESSION['cart']) - 5; $result['cart_html'] .= '<li class="other_cart_count"><span class="badge bg-info">+' . $other_count . ' ' . LG_PRODUCT . '</span></li>'; } break; } } $result['cart_html'] .= '<span class="btn btn-sm btn-info header_cart_no_results" style="display:none;">' . LG_CART_NO_RESULTS . '</span>'; $result['cart_total'] = cart_total(); $result['cart_count'] = count($_SESSION['cart']); echo json_encode($result); break; case 'remove_cart': $result = array(); $product = $db->table('products')->where('id', '=', m_u_p('id'))->where('status', '=', 1)->order('id', 'desc')->count(); if ($product > 0) { $result['status'] = true; if ($_SESSION['cart'][m_u_p('id')]['added'] != '') { unset($_SESSION['cart'][m_u_p('id')]); $result['cart_total'] = cart_total(); $result['cart_count'] = count($_SESSION['cart']); } } else { $result['status'] = false; } echo json_encode($result); break; case 'quantity_action': $result = array(); $product = $db->table('products')->where('id', '=', m_u_p('id'))->where('status', '=', 1)->order('id', 'desc')->get(); $product_info = $product['data'][0]; if ($product['total_count'] > 0) { foreach($_SESSION['cart'][m_u_p('id')] as $key=>$value){ if ($value['added'] != '') { if (m_u_p('q_type') == 'up') { if($value['variants'] != m_u_p('variant')[0]){ continue; } $product_count = $_SESSION['cart'][m_u_p('id')][$key]['count'] + 1; if ($product_info['stock'] >= $product_count) { $_SESSION['cart'][m_u_p('id')][$key]['count'] = $product_count; $result['status'] = true; } else { $result['status'] = false; $result['title'] = LG_ERROR; $result['msg'] = LG_NO_STOCK; } } else { if($value['variants'] != m_u_p('variant')[0]){ continue; } $product_count = $_SESSION['cart'][m_u_p('id')][$key]['count'] - 1; if ($product_count == 0) { unset($_SESSION['cart'][m_u_p('id')][$key]); } else { $_SESSION['cart'][m_u_p('id')][$key]['count'] = $product_count; } $result['status'] = true; } } } } echo json_encode($result); break; case 'favorite_action': $result = array(); if (m_user_check()) { $product = $db->table('products')->where('id', '=', m_u_p('id'))->where('status', '=', 1)->order('id', 'desc')->count(); if ($product > 0) { $favorite = $db->table('customer_favorites')->where('u_id', '=', m_user('id'))->where('p_id', '=', m_u_p('id'))->get(); if (m_user_check() and $favorite['total_count'] > 0) { $result['status'] = true; $result['favorite'] = 0; $result['title'] = LG_SUCCESS; $result['msg'] = LG_FAVORITE_DELETED; $db->table('customer_favorites')->where('id', '=', $favorite['data'][0]['id'])->delete(); } else { $data = [ 'u_id' => m_user('id'), 'p_id' => m_u_p('id') ]; $result['favorite'] = 1; $query = $db->table('customer_favorites')->insert($data); $result['status'] = true; $result['title'] = LG_SUCCESS; $result['msg'] = LG_FAVORITE_ADDED_TRANSACTION; } } else { $result['status'] = false; } } else { $result['status'] = false; $result['title'] = LG_ERROR; $result['msg'] = LG_PLEASE_LOGIN; } echo json_encode($result); break; case 'price_follow_action': $result = array(); if (m_user_check()) { $product = $db->table('products')->where('id', '=', m_u_p('id'))->where('status', '=', 1)->order('id', 'desc')->get_vars(); if ($product['title'] != '') { $follow = $db->table('customer_price_follows')->where('u_id', '=', m_user('id'))->where('p_id', '=', m_u_p('id'))->get(); if (m_user_check() and $follow['total_count'] > 0) { $result['status'] = true; $result['follow'] = 0; $result['title'] = LG_SUCCESS; $result['msg'] = LG_PRICE_FOLLOW_DELETED; $db->table('customer_price_follows')->where('id', '=', $follow['data'][0]['id'])->delete(); } else { $data = [ 'u_id' => m_user('id'), 'p_id' => m_u_p('id'), 'price' => $product['sale_price'] ]; $result['follow'] = 1; $query = $db->table('customer_price_follows')->insert($data); $result['status'] = true; $result['title'] = LG_SUCCESS; $result['msg'] = LG_PRICE_FOLLOW_TRANSACTION; } } else { $result['status'] = false; } } else { $result['status'] = false; $result['title'] = LG_ERROR; $result['msg'] = LG_PLEASE_LOGIN; } echo json_encode($result); break; case 'cart_coupon_apply': $result = array(); if (m_setting('coupon_usage') == 1) { $coupons = $db->table('coupons')->where('coupon_code', '=', m_u_p('coupon_code'))->where('status', '=', 1)->order('id', 'desc')->get(); if ($coupons['total_count'] > 0) { $coupon = $coupons['data'][0]; $cart_info = cart_info(); if ($cart_info['sub_total'] >= $coupon['minumum_order']) { $result['status'] = true; $_SESSION['coupon_code'] = $coupon['coupon_code']; } else { $result['status'] = false; $result['title'] = LG_ERROR; $result['msg'] = LG_COUPON_MINUMUM_ORDER_ERROR . ' ' . m_currency($coupon['minumum_order']) . ' ' . currency_types(m_setting('currency_type'), 'value'); } } else { $result['status'] = false; $result['title'] = LG_ERROR; $result['msg'] = LG_INVALID_COUPON_CODE; } } else { $_SESSION['coupon_code'] = ''; $result['status'] = false; $result['title'] = LG_ERROR; $result['msg'] = LG_COUPON_USAGE_DISABLED_ERROR; } echo json_encode($result); break; case 'cart_coupon_delete': $result = array(); $_SESSION['coupon_code'] = ''; $result['status'] = true; echo json_encode($result); break; case 'add_stock_follow': $result = array(); if (m_user_check()) { $product = $db->table('products')->where('id', '=', m_u_p('id'))->where('status', '=', 1)->order('id', 'desc')->count(); if ($product > 0) { $follows = $db->table('customer_stock_follows')->where('u_id', '=', m_user('id'))->where('p_id', '=', m_u_p('id'))->get(); if (m_user_check() and $follows['total_count'] > 0) { $result['status'] = true; $result['title'] = LG_SUCCESS; $result['msg'] = LG_STOCK_FOLLOW_DELETED; $db->table('customer_stock_follows')->where('id', '=', $follows['data'][0]['id'])->delete(); } else { $data = [ 'u_id' => m_user('id'), 'p_id' => m_u_p('id') ]; $query = $db->table('customer_stock_follows')->insert($data); $result['status'] = true; $result['title'] = LG_SUCCESS; $result['msg'] = LG_STOCK_FOLLOW_ADDED_TRANSACTION; } } else { $result['status'] = false; } } else { $result['status'] = false; $result['title'] = LG_ERROR; $result['msg'] = LG_PLEASE_LOGIN; } echo json_encode($result); break; case 'cart_address_update': $result = array(); if (m_user_check()) { $informations = $db->table('customer_address')->where('u_id', '=', m_user('id'))->where('id', '=', m_u_p('id'))->get(); if ($informations['total_count'] > 0) { $info = $informations['data'][0]; $result['status'] = true; $result['address_info'] = ' <div class="bg-white rounded shadow-sm overflow-hidden mt-2"> <div class="p-3 bg-light"> <h6 class="m-0 text-dark d-flex align-items-center">' . $info['title'] . '</h6> </div> <div class="p-3" style="min-height:100px;"> ' . $info['address'] . ' <br> ' . $db->table('regions')->where('id', '=', $info['county'])->get_var('title') . ' / ' . $db->table('regions')->where('id', '=', $info['city'])->get_var('title') . ' / ' . $db->table('regions')->where('id', '=', $info['country'])->get_var('title') . ' <br> </div> </div> '; } else { $result['status'] = false; } } else { $result['status'] = false; $result['title'] = LG_ERROR; $result['msg'] = LG_PLEASE_LOGIN; } echo json_encode($result); break; case 'cart_payment': echo '<div class="calculate-shiping p-40 border-radius-15 border"> <h4 class="mb-10">' . LG_PAYMENT_PROCCESS . '</h4> '; if (m_user_check()) { $customer_address = $db->table('customer_address')->where('u_id', '=', m_user('id'))->where('id', '=', m_u_p('customer_address'))->get(); } else { if (m_u_p('identity_number') == '' or m_u_p('email') == '' or m_u_p('name') == '' or m_u_p('lastname') == '' or m_u_p('phone') == '' or m_u_p('address') == '' or m_u_p('country') == '' or m_u_p('city') == '' or m_u_p('county') == '') { $customer_address['total_count'] = 0; } else { $customer_address['total_count'] = 1; $customer_address['data'][0]['identity_number'] = m_u_p('identity_number'); $customer_address['data'][0]['email'] = m_u_p('email'); $customer_address['data'][0]['name'] = m_u_p('name'); $customer_address['data'][0]['lastname'] = m_u_p('lastname'); $customer_address['data'][0]['phone'] = m_u_p('phone'); $customer_address['data'][0]['address'] = m_u_p('address'); $customer_address['data'][0]['for_directions'] = m_u_p('for_directions'); $customer_address['data'][0]['country'] = m_u_p('country'); $customer_address['data'][0]['city'] = m_u_p('city'); $customer_address['data'][0]['county'] = m_u_p('county'); } } if (cart_count() > 0) { if ($customer_address['total_count'] > 0) { switch (m_u_p('payment_type')) { case '1': $payment_active = 'bank_payment'; break; case '2': $payment_active = 'credit_card_payment'; break; case '3': $payment_active = 'door_payment'; break; default: $payment_active = ''; } if (m_setting($payment_active) == 1 and $payment_active != '') { if (m_u_p('payment_type') == 1) { $status = 1; $order_id = create_order($customer_address, m_u_p('payment_type'), $status, true); if (m_user_check()) { m_customer_log('Sipariş Verildi: ' . $order_id . ''); } echo m_alert(LG_SUCCESS, LG_ORDER_SUCCESS_BANK_PAYMENT); $bank_accounts = $db->table('bank_accounts')->where('status', '=', 1)->order('title', 'asc')->get(); echo '<h6>' . LG_ORDER_NUMBER . ': ' . $order_id . '</h6><br>'; echo '<div class="row">'; foreach ($bank_accounts['data'] as $bank_account) { echo ' <div class="col-lg-4 col-sm-12"> <div class="card"> <div class="card-header"><h6 class="cart-title">' . $bank_account['title'] . '</h6></div> <div class="card-body"> <b>' . LG_BANK_ACCOUNT_BUYER_NAME . ': </b> ' . $bank_account['buyer_name'] . '<br> <b>' . LG_BANK_ACCOUNT_IBAN . ': </b> ' . $bank_account['iban'] . '<br> <b>' . LG_BANK_ACCOUNT_BRANCH . ': </b> ' . $bank_account['branch'] . '<br> <b>' . LG_BANK_ACCOUNT_SWIFT_CODE . ': </b> ' . $bank_account['swift_code'] . '<br> <b>' . LG_BANK_ACCOUNT_NUMBER . ': </b> ' . $bank_account['account_number'] . '<br> </div> </div> </div>'; } echo '</div>'; unset($_SESSION['cart']); } if (m_u_p('payment_type') == 2) { $status = 1; if (DEMO) { echo m_alert(LG_ERROR, LGA_DEMO_ERROR); } else { $current_virtual_pos = m_setting('virtual_pos'); if ($current_virtual_pos > 0) { $order_id = create_order($customer_address, m_u_p('payment_type'), $status, false); if (m_user_check()) { m_customer_log('Sipariş Verildi: ' . $order_id . ''); } $cart_info = cart_info(); if ($current_virtual_pos == 1) { if (m_user_check()) { echo paytr($order_id, $customer_address['data'][0]['address'], m_user('identity_number'), m_user('name'), m_user('lastname'), m_user('phone'), m_user('email'), $cart_info['total']); } else { echo paytr($order_id, $customer_address['data'][0]['address'], $customer_address['data'][0]['identity_number'], $customer_address['data'][0]['name'], $customer_address['data'][0]['lastname'], $customer_address['data'][0]['phone'], $customer_address['data'][0]['email'], $cart_info['total']); } } else { if ($current_virtual_pos == 2) { if (m_user_check()) { echo m_iyzico($order_id, m_user('identity_number'), m_user('name'), m_user('lastname'), m_user('phone'), m_user('email'), $cart_info['total']); } else { echo m_iyzico($order_id, $customer_address['data'][0]['identity_number'], $customer_address['data'][0]['name'], $customer_address['data'][0]['lastname'], $customer_address['data'][0]['phone'], $customer_address['data'][0]['email'], $cart_info['total']); } } else { if ($current_virtual_pos == 3) { if (m_user_check()) { echo m_shopier($order_id, $customer_address['data'][0]['address'], m_user('name'), m_user('lastname'), m_user('phone'), m_user('email'), $cart_info['total']); } else { echo m_shopier($order_id, $customer_address['data'][0]['address'], $customer_address['data'][0]['name'], $customer_address['data'][0]['lastname'], $customer_address['data'][0]['phone'], $customer_address['data'][0]['email'], $cart_info['total']); } } else { if($current_virtual_pos == 5){ if (m_user_check()) { echo m_paymax($order_id, $customer_address['data'][0]['address'], m_user('name'), m_user('lastname'), m_user('phone'), m_user('email'), $cart_info['total']); }else{ echo m_paymax($order_id, $customer_address['data'][0]['address'], $customer_address['data'][0]['name'], $customer_address['data'][0]['lastname'], $customer_address['data'][0]['phone'], $customer_address['data'][0]['email'], $cart_info['total']); } }else{ echo m_alert(LG_ERROR, LG_PAYMENT_RESULT_POS_TECHNICAL_ERROR); } } } } } else { echo m_alert(LG_ERROR, LG_PAYMENT_TYPE_NOT_ACTIVE); } } } if (m_u_p('payment_type') == 3) { $status = 0; $order_id = create_order($customer_address, m_u_p('payment_type'), $status, true); if (m_user_check()) { m_customer_log('Sipariş Verildi: ' . $order_id . ''); echo '<script>window.location.href="' . m_permalink('account_orders') . '";</script>'; } else { echo '<script>window.location.href="' . m_permalink('order_tracking') . '/' . $order_id . '";</script>'; } unset($_SESSION['cart']); } } else { echo m_alert(LG_ERROR, LG_PAYMENT_TYPE_NOT_ACTIVE); } } else { if (m_user_check()) { echo m_alert(LG_ERROR, LG_ADDRESS_NOT_FOUND); } else { echo m_alert(LG_ERROR, LG_CART_PAYMENT_ADDRESS_ERROR); } } } else { echo m_alert(LG_ERROR, LG_CART_NO_RESULTS); } echo '</div>'; break; case 'login': $result = array(); if (m_user_check()) { $result['status'] = false; $result['error'] = LG_ALREADY_LOGGED; } else { if(!isValid(m_setting('recaptcha_secret'),m_u_p('g-recaptcha-response'),$_SERVER['REMOTE_ADDR']) && m_setting('recaptcha_valid') == 1){ $result['status'] = false; $result['error'] = "Robot Doğrulama Başarısız"; }elseif (m_u_p('email') == '' or m_u_p('password') == '') { $result['status'] = false; $result['error'] = LG_PLEASE_FILL_ALL_FIELD;; } else { $informations = $db->table('customers')->where('email', '=', m_u_p('email'))->where('password', '=', m_password(m_u_p('password')))->where('status', '=', 1)->order('id', 'desc')->get(); if ($informations['total_count'] == 0) { $result['status'] = false; $result['error'] = LG_INVALID_LOGIN; } else { $info = $informations['data'][0]; m_set_session('m_user', $info['id']); $data = [ 'last_login' => $db->now(), 'last_ip' => m_ip() ]; $query = $db->table('customers')->where('id', '=', $info['id'])->update($data); m_customer_log('Giriş yapıldı'); $result['status'] = true; } } } echo json_encode($result); break; case 'register': $result = array(); if (m_u_p('name') == '' or m_u_p('lastname') == '' or m_u_p('password') == '' or m_u_p('email') == '' or m_u_p('phone') == '' or m_u_p('identity_number') == '') { $result['status'] = false; $result['error'] = LG_PLEASE_FILL_ALL_FIELD; } elseif(!isValid(m_setting('recaptcha_secret'),m_u_p('g-recaptcha-response'),$_SERVER['REMOTE_ADDR']) && m_setting('recaptcha_valid') == 1){ $result['status'] = false; $result['error'] = "Robot Doğrulama Başarısız"; }else { if ($db->table('customers')->where('email', '=', m_u_p('email'))->count() == 0) { $hash = md5(uniqid()); $data = [ 'identity_number' => m_u_p('identity_number'), 'name' => m_u_p('name'), 'lastname' => m_u_p('lastname'), 'phone' => m_u_p('phone'), 'email' => m_u_p('email'), 'gender' => m_u_p('gender'), 'country' => m_u_p('country'), 'password' => m_password(m_u_p('password')), 'register_date' => $db->now(), 'register_ip' => m_ip(), 'last_login' => $db->now(), 'last_ip' => m_ip(), 'status' => 1 ]; $query = $db->table('customers')->insert($data); m_set_session('m_user', $query); m_customer_log('Kayıt olundu'); m_customer_log('Giriş yapıldı'); if ($query) { $result['status'] = true; } else { $result['status'] = false; $result['error'] = LG_REGISTER_ERROR; } } else { $result['status'] = false; $result['error'] = LG_EMAIL_IS_USED; } } echo json_encode($result); break; case 'region_select': $result = array(); $result['citys'] = '<select class="form-control address_regions" name="city" rel="city">'; $result['countys'] = '<select class="form-control address_regions" name="county" rel="county">'; if (m_u_p('r_type') == 'country') { $informations = $db->table('regions')->where('r_id', '=', m_u_p('id'))->where('r_type', '=', 'city')->order('title', 'asc')->get(); $first_city = $informations['data'][0]['id']; foreach ($informations['data'] as $info) { $result['citys'] .= '<option value="' . $info['id'] . '">' . $info['title'] . '</option>'; } $informations = $db->table('regions')->where('r_id', '=', $first_city)->where('r_type', '=', 'county')->order('title', 'asc')->get(); foreach ($informations['data'] as $info) { $result['countys'] .= '<option value="' . $info['id'] . '">' . $info['title'] . '</option>'; } } else { $informations = $db->table('regions')->where('r_id', '=', m_u_p('id'))->where('r_type', '=', 'county')->order('title', 'asc')->get(); foreach ($informations['data'] as $info) { $result['countys'] .= '<option value="' . $info['id'] . '">' . $info['title'] . '</option>'; } } $result['citys'] .= '</select>'; $result['countys'] .= '</select>'; echo json_encode($result); break; case 'search_suggestion': if (mb_strlen(m_u_p('q'), 'UTF-8') < 3) { echo '<div class="search_suggestion"><span class="search_suggestion_error">' . LG_SEARCH_ERROR . '</span></div>'; } else { if (m_u_p('c_id') == '0' or m_u_p('c_id') == '') { $products = $db->table('products')->where('status', '=', 1)->where_set('title', 'LIKE', "'%" . m_u_p('q') . "%'")->limit(5)->order('id', 'desc')->get(); } else { $products = $db->table('products')->where('status', '=', 1)->where_set('title', 'LIKE', "'%" . m_u_p('q') . "%'")->where_set('c_id', 'LIKE', "'%[" . m_u_p('c_id') . "]%'")->limit(5)->order('id', 'desc')->get(); } if ($products['total_count'] == 0) { echo '<div class="search_suggestion"><span class="search_suggestion_error">' . LG_SEARCH_NO_RESULT . '</span></div>'; } else { foreach ($products['data'] as $product) { echo '<div class="search_suggestion"><a href="' . m_permalink('product', $product['sef'], $product['id']) . '">' .'<img src="'.m_image_url($product['image']).'" style="width:20px;height:20px;">'. preg_replace('#(' . m_u_p('q') . ')#si', '<b>$1</b>', $product['title']) . '</a></div>'; } } } break; } }
💾 Kaydet
İptal
📝 Yeniden Adlandır
İptal
Kaydet
🔐 Dosya İzinleri (chmod)
İzin Değeri:
Hızlı Seçim:
777
755
644
600
777
= Herkes okur/yazar/çalıştırır
755
= Sahip tam, diğerleri okur/çalıştırır
644
= Sahip okur/yazar, diğerleri okur
600
= Sadece sahip okur/yazar
İptal
Uygula