Friday, March 28, 2014

Ninja Run Cycle Walk Cycle Runner Game by NinjaStop.com

Thursday, September 26, 2013

Davao Web Developers

Davao Web Developers Logo


We just created a new website for Davao Web Developers. Look for jobs, web developers, events, activities, and other related information about Davao City's web development industry. Find the right developer for your business, project, start up or I.T. company.



We are growing our database of top professional developers to help us better our search results and help you find what you are looking for.

If you want to be included in the list please visit this page: http://bit.ly/davaowebdevelopers

Thanks for visiting http://davaowebdevelopers.com





Friday, November 30, 2012

Paypal Integration

http://developer.paypal.com

create account pre-configured account
create a personal / buyer
create a business / seller

Enter Sandbox test site

go to profile > My Settings >

Under Account Information
> API Access
https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_profile-api-access

View API Signature
Get your
API Usernamexxxxxx.xxxx.xxx
API Passwordxxxx
Signature xxxxxxx--xxx-xxxxxx


https://www.paypal-labs.com/integrationwizard/index.php

Choose Express Checkout - Digital goods

Follow the process...
Click Next

Start Wizard

Enter url for confirm.php and cancel.php

http://localhost/confirm.php

http://localhost/cancel.php



Create index.html ... product page

For the Button
Copy the 2a. Creating Button: Insert this code snippet on the page that will have Pay with PayPal button.* 

Copy Before closing the HTML tag </html>
2b. Adding in-context experience: Insert this code snippet before the closing of the html body tag. 

Download paypalfunctions.php
Same folder of your app... root


Create checkout.php... copy the code

3a. Insert this code snippet into the section of your code that initiates Payment. 


Create cancel.php... copy the code

3c. Insert this code snippet into the section of your code that handles Payment Cancellation 

Create confirm.php or/and orderconfirm.php... copy the code

test your code...




Thursday, November 29, 2012

Simple Auth of FuelPHP


uncomment this ... packages/auth/config/simpleauth

-1   => array('name' => 'Banned', 'roles' => array('banned')),
0    => array('name' => 'Guests', 'roles' => array()),
1    => array('name' => 'Users', 'roles' => array('user')),
50   => array('name' => 'Moderators', 'roles' => array('user', 'moderator')),
100  => array('name' => 'Administrators', 'roles' => array('user', 'moderator', 'admin')),

),

create user database

php oil generate admin users username:varchar[50] password:string group:int email:string last_login:int login_hash:string profile_fields:text

More code Snippets for FuelPHP


config.php

return array(
'always_load'  => array('packages'  => array('orm', 'auth',)),

'whitelisted_classes' => array(
'Fuel\\Core\\Response',
'Fuel\\Core\\View',
'Fuel\\Core\\ViewModel',
'Fuel\Core\Validation',
'Closure',
)


);



db.php


return array(
'default' => array(
'connection'  => array(
'dsn'        => 'mysql:host=localhost;dbname=shop',
'username'   => 'root',
'password'   => '',
),
),
);




Code Snippets for the FuelPHP Training in AdDU


return array(
'default' => array(
'connection'  => array(
'dsn' => 'mysql:host=localhost;dbname=shop',
'username'   => 'root',
'password'   => '',
),
),
);

set path=C:\wamp\bin\php\php5.3.13\

php oil generate model users username:varchar[50] password:string group:int email:string last_login:int login_hash:string profile_fields:text

php oil refine migrate

create users with different levels
Auth::create_user('admin', 'secret', 'philippineoutsourcing@gmail.com', 100);
Auth::create_user('guest', 'secret', 'guest@philippineglobaloutsourcing.com', 0);

Auth::create_user('user', 'secret', 'user@philippineglobaloutsourcing.com', 1);
Auth::create_user('moderator', 'secret', 'moderator@philippineglobaloutsourcing.com', 50);
Auth::create_user('user2', 'secret', 'user2@philippineglobaloutsourcing.com', 0);
Auth::create_user('banned', 'secret', 'banned@philippineglobaloutsourcing.com', -1);




oil generate admin products title:string slug:string summary:text body:text price:int:unsigned qty:int:unsigned user_id:int
php oil refine migrate


--- updating crud


public function action_create($id = null)
{
  $view = View::forge('admin/products/create');
  if (Input::method() == 'POST')
  {
 $product = Model_Product::forge(array(
'title' => Input::product('title'),
'slug' => Inflector::friendly_title(Input::product('title'), '-', true),
'summary' => Input::product('summary'),
'price' => Input::product('price'),
'qty' => Input::product('qty'),
'body' => Input::product('body'),
'user_id' => Input::product('user_id'),
 ));
 if ($product and $product->save())
 {
Session::set_flash('success', 'Added product #'.$product->id.'.');
Response::redirect('admin/products');
 }
 else
 {
Session::set_flash('error', 'Could not save product.');
 }
  }
  // Set some data
  $view->set_global('users', Arr::assoc_to_keyval(Model_User::find('all'), 'id', 'username'));
  $this->template->title = "Create Products";
  $this->template->content = $view;
}


public function action_edit($id = null)
{
  $view = View::forge('admin/products/edit');
  $product = Model_Product::find($id);
  if (Input::method() == 'POST')
  {
 $product->title = Input::product('title');
 $product->slug = Inflector::friendly_title(Input::product('title'), '-', true);
 $product->summary = Input::product('summary');
 $product->body = Input::product('body');
 $product->user_id = Input::product('user_id');
 if ($product->save())
 {
Session::set_flash('success', 'Updated product #' . $id);
Response::redirect('admin/products');
 }
 else
 {
Session::set_flash('error', 'Could not update product #' . $id);
 }
  }
  else
  {
 $this->template->set_global('product', $product, false);
  }
  // Set some data
  $view->set_global('users', Arr::assoc_to_keyval(Model_User::find('all'), 'id', 'username'));
  $this->template->title = "Edit Product";
  $this->template->content = $view;
}

view


<div class="clearfix">
<?php echo Form::label('User', 'user_id'); ?>
<div class="input">
<?php echo Form::select('user_id', Input::post('user_id', isset($product) ? $product->user_id : $current_user->id), $users, array('class' => 'span6')); ?>
</div>
</div>




fuel/app/classes/controller/products.php

class Controller_Products extends Controller_Base
{
   public function action_index()
   {
      $view = View::forge('products/index');
      $view->products = Model_Product::find('all');
      $this->template->title = 'My Products about Stuff';
      $this->template->content = $view;
   }
}

view


<h2>Recent Products</h2>
<?php foreach ($products as $product): ?>
   <h3><?php echo Html::anchor('product/view/'.$product->slug, $product->title) ?></h3>
   <p><?php echo $product->summary ?></p>
<?php endforeach; ?>




public function action_view($slug)
{
   $product = Model_Product::find_by_slug($slug);
   $this->template->title = $product->title;
   $this->template->content = View::forge('products/view', array(
      'product' => $product,
   ));
}

<h2><?php echo $product->title ?></h2>
<p><strong>Posted: </strong><?php echo date('nS F, Y', $product->created_at) ?> (<?php echo Date::time_ago($product->created_at)?>)</p>
<p><?php echo nl2br($product->body) ?></p>

model
protected static $_belongs_to = array('user');
protected static $_has_many = array('product');


$product = Model_Product::find('first');
$product->user->username


view

<h2><?php echo $product->title ?></h2>
<p>
   <strong>Posted: </strong><?php echo date('nS F, Y', $product->created_at) ?> (<?php echo Date::time_ago($product->created_at)?>)
   by <?php echo $product->user->username ?>
</p>
<p><?php echo nl2br($product->body) ?></p>