Example #1
0
    public function checkout($data = NULL)
    {
        $orderNo = substr(number_format(time() * rand(), 0, '', ''), 0, 4);
        $code = base64_encode($orderNo);
        $userId = empty($_POST['userId']) ? $data['userId'] : $_POST['userId'];
        $shipAdd = empty($_POST['shipAdd']) ? $data['shipAdd'] : $_POST['shipAdd'];
        $billAdd = empty($_POST['billAdd']) ? $data['billAdd'] : $_POST['billAdd'];
        $pMode = empty($_POST['pMode']) ? $data['pMode'] : $_POST['pMode'];
        $status = 'pending';
        $ttoott = $_SESSION[totalamount];
        $ship = '0';
        $discount = 0;
        $cpn = 0;
        $data = array('orderId' => $orderNo, 'date' => date('Y-m-d'), 'userId' => $userId, 'payType' => $pMode, 'productId' => 'paypal', 'productId' => $_SESSION['product_id'], 'qty' => $_SESSION['product_qty'], 'color' => $_SESSION['product_col'], 'size' => $_SESSION['product_siz'], 'price' => $_SESSION['product_price'], 'discountAmount' => '', 'totalAmount' => $_SESSION['totalamount'], 'discountId' => '', 'shipAdd' => $_SESSION['shipping'], 'billAdd' => $_SESSION['billing'], 'status' => $status, 'code' => $code);
        if ($this->db->insert(ORDER, $data)) {
            $getid = $this->db->lastInsertID();
        }
        if ($pMode == 'CCavenue') {
            $CCAvenue = explode('|', CCAvenue);
            $Merchant_Id = $CCAvenue[0];
            $Amount = $_SESSION['totalamount'];
            $Order_Id = $orderNo;
            $WorkingKey = $CCAvenue[1];
            $Redirect_Url = site_url . '/redirecturl/';
            $_SESSION['hold'] = $getid;
            ?>
			
			<form id="form2" name="frm1" method="post" action="">
			<input type="hidden" name="Merchant_Id" value="<?php 
            echo $Merchant_Id;
            ?>
">
			<input type="hidden" name="working_key" value="<?php 
            echo $WorkingKey;
            ?>
">
			<input type="hidden" name="Amount" value="<?php 
            echo $_SESSION['totalamount'];
            ?>
">
			<input type="hidden" name="Order_Id" value="<?php 
            echo $Order_Id;
            ?>
">
			<input type="hidden" name="Redirect_Url" value="<?php 
            echo $Redirect_Url;
            ?>
">
			
			<input name="billing_cust_name" type="hidden" value="<?php 
            echo $baddress['fname'] . ' ' . $baddress['name'];
            ?>
">
			<input name="billing_cust_address" type="hidden" value="<?php 
            echo $baddress['address'];
            ?>
">
			<input name="billing_cust_country" type="hidden" value="<?php 
            echo $baddress['country'];
            ?>
">
			<input name="billing_cust_state" type="hidden" value="<?php 
            echo $baddress['state'];
            ?>
">
			<input name="billing_city" type="hidden" value="<?php 
            echo $baddress['city'];
            ?>
">
			<input name="billing_zip" type="hidden" value="<?php 
            echo $baddress['pin'];
            ?>
">
			<input name="billing_cust_tel" type="hidden" value="<?php 
            echo $baddress['phone'];
            ?>
">
			<input name="billing_cust_email" type="hidden" value="<?php 
            echo $data['user_email'];
            ?>
">
			 <input name="<?php 
            echo frontend;
            ?>
" type="hidden" value="ecommerce/ccave" />     
			</form>
			<?php 
            echo '<script>document.frm1.submit();</script>';
            die;
        }
        ##paypal
        if ($pMode == 'paypal') {
            $paypal = explode('|', paypal_standard);
            $_SESSION['hold'] = $getid;
            ?>
		<form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="frm" >
		<input type="hidden" name="cmd" value="_ext-enter">
		<input type="hidden" name="redirect_cmd" value="_xclick">
		<input type="hidden" name="return" value="<?php 
            echo site_url . '/' . userType('slug', 'user') . $code;
            ?>
/paypal/success/">
		<input type="hidden" name="cancel_return" value="<?php 
            echo site_url . '/' . userType('slug', 'user') . $code;
            ?>
/paypal/failed/">
		<input type="hidden" name="business" value="<?php 
            echo $paypal[2];
            ?>
">
		<input type="hidden" name="item_name" value="<?php 
            echo title;
            ?>
">
		<input type="hidden" name="amount" value="<?php 
            echo $_SESSION['totalamount'];
            ?>
">
		 <input type="hidden" name="email" value="<?php 
            echo $locations['paypal'];
            ?>
">   
		<input type="hidden" name="currency_code" value="USD">
		</form>
		<?php 
            echo '<script>document.frm.submit();</script>';
            die;
        }
    }
Example #2
0
 function __construct($propery, $input)
 {
     parent::__construct();
     if ($input) {
         $this->slug = $input;
     }
     $pg = array_filter(explode("/", $this->slug));
     $num = count($pg);
     //print_r($pg);
     $ecommerce = unserialize(ecommerce);
     $ekey = array_keys($ecommerce);
     /*check CATEGORY table*/
     if ($single = $this->db->getRecord(CATEGORY, '', " slug='" . current($pg) . "' OR ( folder = '" . current($pg) . "' AND slug = '" . next($pg) . "' ) ")) {
         //&& ( $num == '1' )
         @($setting = json_decode(stripslashes($single[0]['setting']), TRUE));
         if (in_array('session', explode(',', $single[0][options])) && $_SESSION[userType('session', $setting['userType'])] == '') {
             redirect();
         }
         $row = (object) current($single);
         $ty = '1';
     } else {
         if ($ecommerce['status'] == '1') {
             /*product*/
             if (in_array($pg[0], $ekey) && ($single = $this->db->getRecord(PRODUCT, '', "slug = '" . $pg[1] . "' "))) {
                 $page = $ecommerce[$pg[0]]['page'];
                 $row = (object) current($single);
                 $row->goto = $page;
                 $row->page_name = $row->mPartNum;
                 $ty = '2';
             }
             /*category*/
             if (in_array($pg[0], $ekey) && ($single = $this->db->getRecord(CAT, '', "slug = '" . $pg[1] . "' "))) {
                 $page = $ecommerce[$pg[0]]['page'];
                 $row = (object) current($single);
                 $row->goto = $page;
                 $row->page_name = $row->category_title;
                 $ty = '2';
             } else {
                 /*mycart*/
                 foreach ($ecommerce as $key => $value) {
                     if (@$value['slug'] == $pg[0]) {
                         @($row->page_name = $value['name']);
                         @($row->goto = $value['page']);
                         @($row->slug = $value['slug']);
                         @($row->product_title = $value['slug']);
                         $ty = '2';
                         break;
                     }
                 }
             }
         }
     }
     /*ecommerce*/
     if ($user = $this->db->getRecord(USERS, '', "userId = '" . $_SESSION[$this->sessType()] . "' ")) {
         @($data['user'] = current($user));
     }
     @($seo1 = explode('||', $row->seo));
     //seo1 = page
     $meta_key = $seo1[0] == '' ? meta_key : $seo1[0];
     $meta_des = $seo1[1] == '' ? meta_des : $seo1[1];
     $meta_tit = $seo1[2] == '' ? $row->page_name : $seo1[2];
     $meta_title = current($pg) == HOMEPAGE ? $meta_tit : $meta_tit . ' | ' . title;
     if ($ty == '1') {
         $data['setting']['option'] = $row->options;
         if (!$row->slug) {
             $row->slug = 'home';
         }
         $data['pageDetail'] = array('id' => $row->page_id, 'name' => $row->page_name, 'slug' => $row->slug, 'page' => $row->folder . '/' . $row->goto, 'seo' => (object) array('meta_key' => $meta_key, 'meta_des' => $meta_des, 'meta_title' => ucwords($meta_title)));
     } else {
         if ($ty == '2') {
             $data['setting']['option'] = 'header,footer';
             $data['pageDetail'] = array('id' => $row->id, 'parentId' => $row->category_parent, 'catId' => $row->catId, 'parameter' => $row->parameter, 'name' => $row->page_name, 'slug' => $row->slug, 'page' => $row->folder . '/' . $row->goto, 'seo' => (object) array('meta_key' => $meta_key, 'meta_des' => $meta_des, 'meta_title' => ucwords($row->page_name . ' | ' . title)));
         }
     }
     //echo '<pre>'; print_r($data);
     /*special class call like dashboard data */
     if (in_array($row->slug, array('dashboard', 'edit-profile'))) {
         $this->className = str_replace("-", '_', $row->slug);
         $this->load->ClassValidation = false;
         $this->load->controller('user');
         if (method_exists('user', $this->className)) {
             $data[$this->className] = $this->load->user->{$this->className}(array('user' => $data['user']));
         }
     }
     /*CALL Controllers CLASS IF EXIST*/
     if ($row) {
         $this->load->ClassValidation = false;
         $this->className = str_replace("-", '_', $row->slug);
         $this->load->controller($this->className);
         if (method_exists($this->load->{$this->className}, index)) {
             $this->load->{$this->className}->index($data);
         } else {
             $this->load->view($row->folder . '/' . $row->goto, $data);
         }
         //default
     } else {
         $this->load->view($row->goto);
     }
     //!$row- page not found
 }
Example #3
0
 public function signin()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules('c_email', 'email', 'required');
     $this->form_validation->set_rules('password', 'password', 'required');
     if ($this->form_validation->run() == FALSE) {
         redirect('', 'error|invalid input');
     } else {
         if ($user = $this->db->getRecord(USERS, '', "email = '" . $this->db->clearText($_POST['c_email']) . "' AND password = '******'password'])) . "' ")) {
             if ($user[0]['status'] == 'active') {
                 $_POST['notification'] = 'profilemsg';
                 $_SESSION[userType('session', $user[0]['type'])] = $user[0]['userId'];
                 redirect(userType('slug', $user[0]['type']), 'succ|login successfully', 'javascript');
             } else {
                 if ($user[0]['status'] != 'active') {
                     redirect('', 'error|your account is ' . $user[0]['status'] . '');
                 }
             }
         } else {
             redirect('referer', 'error|invalid username or password');
         }
     }
 }
<?php

/**
 * Created by PhpStorm.
 * User: Anderson
 * Date: 20/08/2015
 * Time: 03:41
 */
include "conection.inc";
if (isset($_POST['login_id'])) {
    $l_login = $_POST['L_user'];
    $l_senha = $_POST['L_Senha'];
    if (isUser($l_login, $l_senha)) {
        $acesso = "<p style='color: greenyellow;'>Acesso Permitido</p>";
        if (userType($l_login, $l_senha) > 1) {
            header("Location: dashboard.php");
            exit;
        } else {
            header("Location: consulta/index.php");
            exit;
        }
    } else {
        $acesso = "<p style='color: red;'>Acesso Negado</p>";
    }
}
?>

<!DOCTYPE html>
<html lang="pt">
<head>
    <meta charset="UTF-8">