当前位置: 首页>>代码示例>>PHP>>正文


PHP User_Model::logged_in方法代码示例

本文整理汇总了PHP中User_Model::logged_in方法的典型用法代码示例。如果您正苦于以下问题:PHP User_Model::logged_in方法的具体用法?PHP User_Model::logged_in怎么用?PHP User_Model::logged_in使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在User_Model的用法示例。


在下文中一共展示了User_Model::logged_in方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

	<div id="root">
		<div id="header">
			<h1><a href="http://<?php 
echo My_Template_Controller::getCurrentSite()->url;
?>
" title="MyChocolateHearts.com - Custom Chocolate Hearts"><img src="/env/images/<?php 
echo My_Template_Controller::getViewPrefix();
?>
/logo.png" alt="MyChocolateHearts.com - Custom Chocolate Hearts"/></a></h1>
<?php 
if (User_Model::logged_in()) {
    $user = User_Model::logged_user();
    ?>
			<div id="login_box" class="logged">
				<a class="logout" href="/customers/logout"><img src="/env/images/login/logout_btn.jpg" /></a>
				Logged in as: <strong><?php 
    echo $user->firstname . ' ' . $user->lastname;
    ?>
</strong><br />
				<a href="/customers/my_account" class="my-account">View My Account Details</a>
			</div>
<?php 
} else {
    ?>
			<div id="login_box" class="login">
				<form method="POST" action="/customers/login">
					<div class="col">
						<img src="/env/images/login/customer_login.jpg" /><br />&nbsp;
					</div>
					<div class="col">
						<input type="text" name="email" value="Type your email." onfocus="if($(this).val()=='Type your email.') $(this).val('');" onblur="if($(this).val()=='') $(this).val('Type your email.');" /><br />
开发者ID:VinceOmega,项目名称:mcb-nov-build,代码行数:31,代码来源:header.php

示例2: paypal_ok

 public function paypal_ok()
 {
     $trans_id = $this->input->get('token');
     // In Kohana, all views are loaded and treated as objects.
     $this->template->content = new View('paypal_status');
     $postvars = $_POST;
     $db = new Database();
     $result = $db->query('SELECT * FROM orders WHERE trans_id = \'' . $trans_id . '\'');
     $order = $result[0];
     $this->template->content->_order = ORM::factory('order', $order->id);
     //CREATE PAYMENT
     $result = $db->query('INSERT INTO payments (transaction_number, statusID, transaction_date) VALUES (\'' . $trans_id . '\', 3, ' . time() . ')');
     $paymentid = mysql_insert_id();
     //CREATE Order ID Entry
     $_res = $db->query('SELECT id FROM order_ids WHERE order_id="' . $order->id . '"');
     if (!$_res[0] || !$_res[0]->id) {
         //CREATE Order ID Entry
         $_res = $db->query('INSERT INTO order_ids (order_id) VALUES (' . $order->id . ')');
         $new_order_id = mysql_insert_id();
     } else {
         $new_order_id = $_res[0]->id;
     }
     //UPDATE THE ORDER TABLE
     $result = $db->query('UPDATE orders SET paymentID = ' . $paymentid . ', payment_method = "PayPal", statusID = 2, order_total= ' . $order->subtotal . ', shipping_total = ' . $order->shipping_total . ', order_date = \'' . date("Y-m-d H:i:s", time()) . '\', date_modified = ' . time() . ' WHERE id = ' . $order->id . '');
     $result = $db->query('SELECT orders.*, users.email, user_billing_infos.firstname as billfname, user_billing_infos.lastname as billlname, user_billing_infos.address1 as billaddress, user_billing_infos.city as billcity, user_billing_infos.state as billstate, user_billing_infos.zip as billzip, user_billing_infos.country as billcountry, user_billing_infos.phone1 as billphone, user_shipping_infos.firstname as shipfname, user_shipping_infos.lastname as shiplname, user_shipping_infos.address1 as shipaddress, user_shipping_infos.city as shipcity, user_shipping_infos.state as shipstate, user_shipping_infos.zip as shipzip, user_shipping_infos.country as shipcountry FROM orders LEFT JOIN user_billing_infos ON orders.billingID = user_billing_infos.id LEFT JOIN user_shipping_infos ON orders.shippingID = user_shipping_infos.id LEFT JOIN users ON orders.user_id = users.id WHERE orders.id = ' . $order->id . '');
     $order = $result[0];
     $shippingInfo = $order->shipfname . ' ' . $order->shiplname . '<br/>' . $order->shipaddress . '<br/>' . $order->shipcity . ' ' . $order->shipstate . '<br/>' . $order->shipzip . '<br/>' . $order->shipcountry;
     $billingInfo = $order->billfname . ' ' . $order->billlname . '<br/>' . $order->billaddress . '<br/>' . $order->billcity . ' ' . $order->billstate . '<br/>' . $order->billzip . '<br/>' . $order->billcountry;
     $dateTime = date('Y-m-d H:i:s');
     $res = $db->query('SELECT p.name, ob.qty, ob.subtotal, ob.id as ob_id FROM products p JOIN orders_baskets ob ON (ob.product_id=p.id) WHERE ob.order_id="' . $order->id . '"');
     $description = '';
     $subtotal = 0;
     foreach ($res as $item) {
         $basket = ORM::factory('orders_basket', $item->ob_id);
         $product_name = $item->name;
         if ($basket->packaging_id != 0) {
             $product_name .= ' - ' . $basket->packaging->name;
         }
         $description .= '' . $item->qty . ' x ' . $product_name . ' = ' . money_format('%.2n', $item->subtotal) . '<br/>';
         $subtotal += $item->subtotal;
     }
     if (!empty($order->comment)) {
         $description .= 'Comment:' . $order->comment . '<br/>';
     }
     $total = 'Subtotal: ' . money_format('%.2n', $subtotal) . '<br/>Shipping:' . money_format('%.2n', $order->shipping_total);
     $total .= '<br/>Total:' . money_format('%.2n', $order->order_total);
     $emailAddr = $order->email;
     $res = $db->query('SELECT id FROM order_ids WHERE order_id = ' . $order->id . '');
     $orderid = $res[0]->id;
     $order->id = $orderid;
     $new_order_id = 'MCH' . $orderid;
     $to = array($emailAddr, 'info@mychocolatecoins.com', 'freddyfalck@hotmail.com', 'info@deligance.com', 'contact@polardesign.com');
     foreach ($to as $address) {
         Autoresponder::sendEmail('order.status.changed', $address, $order, array('shipping_info' => $shippingInfo, 'billing_info' => $billingInfo, 'date_time' => $dateTime, 'description' => $description, 'total' => $total, 'order_id' => $new_order_id));
     }
     $this->template->content->status = 'Your paypal paymeny was successful!';
     $this->template->content->trans_id = $trans_id;
     $this->template->content->order_id = $order->id;
     $user_id = FALSE;
     if (User_Model::logged_in()) {
         $user_id = User_Model::logged_user()->id;
     }
     Session::instance()->regenerate();
     if ($user_id) {
         ORM::factory('user')->find($user_id)->forceLogin();
     }
     // Meta Description and Meta Keywords for individual pages are, at this point, hard coded.
     $this->template->metaDescription = $this->description;
     $this->template->metaKeywords = $this->keywords;
     $this->template->metaTitle = $this->title;
     // You can assign anything variable to a view by using standard OOP
     // methods. In my welcome view, the $title variable will be assigned
     // the value I give it here.
     $this->template->title = $this->title;
 }
开发者ID:VinceOmega,项目名称:mcb-nov-build,代码行数:75,代码来源:shopping_cart.php

示例3:

      
      </script>
      
     <script>
	$(function() {
		$( "#requesteddate" ).datepicker({dateFormat: 'yy-mm-dd'});
	});
	</script>

<div id="content">
			<div id="pink-section-header">
				<h2 class="curly">Checkout</h2>
			</div><!-- header -->
			<div class="grey-border">
<?php 
if (FALSE === User_Model::logged_in()) {
    ?>
				<h3>Login</h3>
				<form method="POST" action="/customers/login">
					<input type="text" name="email" placeholder="Type your email." /><br />
					<input type="password" name="password" placeholder="Type your password." />
					<br />
					<input type="submit" value="Sign in" />
					<input type="hidden" name="redirect" value="/shopping_cart/checkout" />
				</form>
				<a href="/customers/forgot_password">Forgot password?</a>
				<h3>Or fill this form</h3>
<?php 
}
?>
			</div>
开发者ID:VinceOmega,项目名称:mcb-nov-build,代码行数:30,代码来源:checkout.php

示例4: register

 public function register()
 {
     if (User_Model::logged_in()) {
         url::redirect('/customers/my_account');
     }
     $this->template->content = new View('customers/register');
     $this->template->metaDescription = $this->description;
     $this->template->metaKeywords = $this->keywords;
     $this->template->metaTitle = $this->title;
     $this->template->title = $this->title;
     $formFields = User_Model::getFormFields();
     if (User_Model::logged_in()) {
         $user = User_Model::logged_user();
         $this->template->content->user = $user;
         foreach ($formFields as $section => &$fields) {
             if ($section == 'user') {
                 continue;
             }
             foreach ($fields as &$field) {
                 switch ($field->form) {
                     case 'billing':
                         $field->value = $user->user_billing_info->{$field->db_name};
                         break;
                     case 'shipping':
                         $field->value = $user->user_shipping_info->{$field->db_name};
                         break;
                 }
             }
         }
     }
     $this->template->content->formFields = $formFields;
     $this->template->content->countries = ORM::factory('country')->find_all();
     $this->template->content->states = ORM::factory('state')->find_all();
     if (request::method() === 'post') {
         $post = new Validation($_POST);
         $post->add_rules('email', 'email');
         $post->add_rules('password', 'required');
         $post->add_rules('first_name', 'required');
         $post->add_rules('last_name', 'required');
         $post->add_rules('address_1', 'required');
         $post->add_rules('city', 'required');
         $post->add_rules('state', 'required');
         $post->add_rules('zip', 'required');
         $post->add_rules('country', 'required');
         $post->add_rules('phone', 'required');
         if ($post->validate()) {
             $db = new Database();
             //$auth = _Auth::factory();
             $user = ORM::factory('user');
             $user->email = $post->email;
             $user->password = $post->password;
             $user->firstname = $post->first_name;
             $user->lastname = $post->last_name;
             $user->company = $post->company;
             $user->address1 = $post->address_1;
             $user->address2 = $post->address_2;
             $user->city = $post->city;
             $user->state = $post->state;
             $user->zip = $post->zip;
             $user->country = $post->country;
             $user->phone1 = $post->phone;
             $user->phone2 = $post->second_phone;
             $user->save();
             unset($user);
             $id = $db->query("SELECT id\n\t\t\t\t\t\t\t\t  FROM users\n\t\t\t\t\t\t\t\t  WHERE email = '{$post->email}'");
             //print_r(mysql_fetch);
             foreach ($id as $keys => $value) {
                 //	echo 'Key: '. $keys."<br>";
                 if (is_object($value)) {
                     foreach ($value as $vkeys => $vvalue) {
                         //			echo 'VKeys: '.$vkeys."<br>";
                         //			echo 'VValue: '.$vvalue."<br>";
                         if ($vkeys == 'id') {
                             $id = $vvalue;
                         }
                     }
                 } else {
                     //	echo 'Value: '.$value."<br>";
                 }
             }
             //die();
             if (!$post->address_2) {
                 $post->address_2 = "none";
             }
             if (!$post->second_phone) {
                 $post->second_phone = "none";
             }
             $billing = $db->query("INSERT into user_billing_infos\n\t\t\t\t\t\t\tSET user_id = '{$id}', \n\t\t\t\t\t\t\tfirstname = '{$post->first_name}',\n\t\t\t\t\t\t\tlastname = '{$post->last_name}',\n\t\t\t\t\t\t\tcompany = '{$post->company}',\n\t\t\t\t\t\t\taddress1 = '{$post->address_1}',\n\t\t\t\t\t\t\taddress2 = '{$post->address_2}',\n\t\t\t\t\t\t\tcity = '{$post->city}',\n\t\t\t\t\t\t\tstate = '{$post->state}',\n\t\t\t\t\t\t\tzip = '{$post->zip}',\n\t\t\t\t\t\t\tcountry = '{$post->country}',\n\t\t\t\t\t\t\tphone1 = '{$post->phone}',\n\t\t\t\t\t\t\tphone2 = '{$post->second_phone}'\n\t\t\t\t\t\t\t");
             //$results = $db->excute();
             // $user = ORM::factory('user_billing_infos');
             // $user->email = $post->email;
             // $user->password = md5($post->password);
             // $user->firstname = $post->first_name;
             // $user->lastname = $post->last_name;
             // $user->company = $post->company;
             // $user->address1 = $post->address_1;
             // $user->address2 = $post->address_2;
             // $user->city = $post->city;
             // $user->state = $post->state;
             // $user->zip = $post->zip;
//.........这里部分代码省略.........
开发者ID:VinceOmega,项目名称:mcb-nov-build,代码行数:101,代码来源:customers.php

示例5: wrapper_MCB

 protected function wrapper_MCB($_product)
 {
     $db = new Database();
     $this->template->content = new View('wrapper_builder_mcb');
     $productarray = Router::$arguments;
     $productname = $productarray[0];
     $products = $db->query('SELECT products_descriptions.*, products.*  FROM products_descriptions LEFT JOIN products ON products_descriptions.id = products.products_description_id WHERE products_descriptions.title_url = \'' . $productname . '\'');
     $product = ORM::factory('product')->where('products.id', $_product->id)->find();
     $category = $db->query("SELECT cps.* FROM categories_products as cps WHERE product_id = '{$_product->id}'");
     $this->template->content->products = $products[0];
     $this->template->content->user = FALSE;
     $this->template->content->category = $category[0];
     if (User_Model::logged_in()) {
         $user = User_Model::logged_user();
         $this->template->content->user = $user;
     }
     // $this->template->content->xmlHeader = $product->getConfiguratorFile(Configurator_file_Model::TYPE_HEADER)->file;
     // $this->template->content->xmlContent = $product->getConfiguratorFile(Configurator_file_Model::TYPE_CONTENT)->file;
 }
开发者ID:VinceOmega,项目名称:mcb-nov-build,代码行数:19,代码来源:products.php


注:本文中的User_Model::logged_in方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。