Ads

PHP: How to Get MAC Address for Current System Using PHP

May 1, 2010 · Leave a Comment
Filed under: Featured, PHP 

Here is the below code in PHP that is used to get MAC address in PHP

<?php

ob_start(); // Turn on output buffering

system('ipconfig /all'); //Execute external program to display output 

$capout=ob_get_contents(); // Capture the output into a variable 

ob_clean(); // Clean the output buffer

$findcurrentsystem = "Physical";

$pmac = strpos($capout, $findcurrentsystem); // Find the position of Physical text 

$mac=substr($capout,($pmac+36),17); // Get Physical Address

echo $mac;

?>

How to install the APC PHP Cache on Debian (Lenny)

February 12, 2010 · Leave a Comment
Filed under: Featured, PHP, Zend 
The APC cache can significantly improve your PHP script performance, just by installing it, which basically takes 5 minutes! (Plus, it’s actually supported by the core PHP developers and will probably be integrated into PHP6…) Here’s what I did on my Debian Lenny box… First you may want to have a reference benchmark to see if it actually improves: Code:

ab -c5 -n100 http://www.yoursite.com/yourscript.php

Now install the APC package: Code:

aptitude install php-apc

Now, restart apache: Code:

/etc/init.d/apache2 restart
Now, you can run your benchmark again and see the difference! Tada! :)
Follow up: APC comes with a control panel script, that allows you to check cache usage. Here’s how to make it available on your web root (for example):Code:
gunzip /usr/share/doc/php-apc/apc.php.gz
ln -s /usr/share/doc/php-apc/apc.php /var/www/apc.php

Note that you should also have the php-gd package installed in order to get nice charts! ;)

Netbeans 6.8 beta : support de JSF 2 et PHP 5.3

February 1, 2010 · Leave a Comment
Filed under: Featured, JAVA, NetBeans 

La version 6.8 de Netbeans est disponible en version beta. Parmi les principales avancées proposées, on relève le support de JavaFX 1.2.1 (qui n’était pas présent dans la dernière version de travail).

Netbeans 6.8 supporte en outre JavaServer Faces 2.0 et Java Persistence JPA 2.0 Web Services Restful, ainsi que GlassFish 3. Sur le terrain de PHP, l’environnement de développement intègre la version 5.3 du langage, et supporte l’infrastructure Symfony. Enfin, la prise en charge des langages C/C++ et Ruby, et la combinaison de l’IDE avec Maven et JRuby sont améliorés.

Télécharger Netbeans 6.8 beta

Simple Steps to Publish On FaceBook Fan Page Using PHP

January 26, 2010 · 11 Comments
Filed under: FaceBook Integration, Featured, PHP 

After Done with my previous post http://blog.theunical.com/facebook-integration/5-steps-to-publish-on-a-facebook-wall-using-php/ that only publish’s on a Facebook wall.

So now we will see how to publish on a facebook Fan’s page.

First we need to follow the 5 steps that I described in my previous post Next just create a Fan Page in Facebook.

Then get the page ID that you can get by the Page URL.

Then replace the APIKey, Secret Key and Session Key with your keys.

Then replace $target_id with your page id. That is Fan’s Page id.

Here is the code in PHP to publish on a Facebook FAN Page

<?php
define('FB_APIKEY', 'APIKEYxx');
define('FB_SECRET', 'SECRETKEYxxxxxxxxxxxxxxxxxxx');
define('FB_SESSION', 'SESSIONKEYxxxxxxxxxxxxxxxxxxxx');

require_once('facebook-platform/php/facebook.php');

try {
$facebook = new Facebook(FB_APIKEY, FB_SECRET);
$facebook->api_client->session_key = FB_SESSION;
$fetch = array('friends' =>
array('pattern' => '.*',
'query' => "select uid2 from friend where uid1={$user}"));
echo $facebook->api_client->admin_setAppProperties(array('preload_fql' => json_encode($fetch)));

$message = 'From My App: publish steven on facebook Fan Page';

$target_id ="273641842409";

if( $facebook->api_client->stream_publish($message, $attachment,$action_links, $target_id))
echo "Added on FB Wall on Fan Page";
} catch(Exception $e) {
echo $e . "<br />";

}
?>

publish on facebook fan wall page using php
That’s it your are now done enjoy!!! publishing on fan’s page wall.

You can see my Fan Page here http://www.facebook.com/pages/Fan-Page/273641842409?v=wall Where I published using above example.


Increase Memory PHP, Magento, Wordpress by just changing in .htaccess

If you are on a virtual hosting then its a big problem to increase server php memory usage. Then we can simply modify the .htaccess file in root directory and increase memory.

if .htaccess file is not there then create one and add below code.

Then  simply modify the variable “php_value memory_limit 120M”

by default we will have 32M allocated we can increase it according to our requirement.

We can do this in any php apache technology or in Zend, Prado, Symfony, Joomla, CakePHP, CodeIgniter etc.

<IfModule mod_php5.c>

############################################

## adjust memory limit

#    php_value memory_limit 64M

php_value memory_limit 120M

php_value max_execution_time 18000

############################################

## disable magic quotes for php request vars

php_flag magic_quotes_gpc off

############################################

## disable automatic session start

## before autoload was initialized

php_flag session.auto_start off

############################################

## enable resulting html compression

#php_flag zlib.output_compression on

###########################################

# disable user agent verification to not break multiple image upload

php_flag suhosin.session.cryptua off

###########################################

# turn off compatibility with PHP4 when dealing with objects

php_flag zend.ze1_compatibility_mode Off

</IfModule>

Pixy-Open-Source Vulnerability Scanner for PHP Applications

January 9, 2010 · Leave a Comment
Filed under: DB Tool, Databases, Featured, MS SQL Server, MySql, Oracle, PHP, Postgres, SQL 

An Open-Source Vulnerability Scanner for PHP Applications.

The Secure Systems Lab at the Technical University of Vienna has released the newest version of Pixy, an open-source vulnerability scanner. Here are some of the highlights:

Detection of SQL injection and XSS vulnerabilities in PHP source code

  1. Automatic resolution of file inclusions
  2. Computation of dependence graphs that help you understand the causes of reported vulnerabilities
  3. Static analysis engine (flow-sensitive, interprocedural, context-sensitive)
  4. Platform-independent written in Java.

http://pixybox.seclab.tuwien.ac.at

Pixy-Open-Source Vulnerability Scanner for PHP Applications

Magento how to create a Custom Plugin/ Module / example / tutorial Part II

December 25, 2009 · 2 Comments
Filed under: Featured, Magento Cart, PHP, Shopping Carts, Zend, eCommerce 

Controller

/app/code/local/<Namespace>/<Module>/controllers/Adminhtml/<Module>Controller.php

NOTE: you need to manually add line 16, which is currently missing in this file. As per suggestion from mkd at page http://www.magentocommerce.com/boards/viewthread/11228/

<?php
 class >Namespace<_<Module>_Adminhtml_<Module>Controller extends
        {
      protected function _initAction()

     {
        $this->loadLayout()
        ->_setActiveMenu('/items')
        ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
        return $this;
        }
        public function indexAction() {
        $this->_initAction();
        $this->_addContent($this->getLayout()->createBlock('/adminhtml_'));
        $this->renderLayout();
        }

      public function editAction()

     {
        $Id     = $this->getRequest()->getParam('id');
        $Model  =	Mage::getModel('/')->load($Id);
    if ($Model->getId() || $Id ==	0) {
  	  Mage::register('_data', $Model);
  	  $this->loadLayout();
          $this->_setActiveMenu('/items');

	  $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item	Manager'), Mage::helper('adminhtml')->__('Item Manager'));
 	  $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));

      $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);

        $this->_addContent($this->getLayout()->createBlock('/adminhtml__edit'))
        ->_addLeft($this->getLayout()->createBlock('/adminhtml__edit_tabs'));

      $this->renderLayout();

      } else {

      Mage::getSingleton('adminhtml/session')->addError(Mage::helper('')->__('Item does not exist'));

      $this->_redirect('*/*/');

      }

      }

      public function newAction()
        {
        $this->_forward('edit');
        }

      public function saveAction()

      {

      if ( $this->getRequest()->getPost() ) {

      try {

      $postData = $this->getRequest()->getPost();

      $Model = Mage::getModel('/');

      $Model->setId($this->getRequest()->getParam('id'))

      ->setTitle($postData['title'])

      ->setContent($postData['content'])

      ->setStatus($postData['status'])

      ->save();

      Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully saved'));

      Mage::getSingleton('adminhtml/session')->setData(false);

      $this->_redirect('*/*/');

      return;

      } catch (Exception $e) {

      Mage::getSingleton('adminhtml/session')->addError($e->getMessage());

      Mage::getSingleton('adminhtml/session')->setData($this->getRequest()->getPost());

      $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));

      return;

      }

      }

      $this->_redirect('*/*/');

      }

      public function deleteAction()

      {

      if( $this->getRequest()->getParam('id') > 0 ) {

      try {

      $Model = Mage::getModel('/');

      $Model->setId($this->getRequest()->getParam('id'))

      ->delete();

      Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));

      $this->_redirect('*/*/');

      } catch (Exception $e) {

      Mage::getSingleton('adminhtml/session')->addError($e->getMessage());

      $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));

      }

      }

      $this->_redirect('*/*/');

      }

      }

XML Configuration Changes

/app/code/local/<Namespace>/<Module>/etc/config.xml

<?xml version="1.0"?>

<config>

<modules>

<[Namespace]_[Module]>

<version>0.1.0</version>

</[Namespace]_[Module]>

</modules>

<frontend>

<routers>

<[module]>

<use>standard</use>

<args>

<module>[Namespace]_[Module]</module>

<frontName>[module]</frontName>

</args>

</[module]>
</routers>

<layout>

<updates>

<[module]>
<file>[module].xml</file>

</[module]>

</updates>

</layout>

</frontend>

<admin>

<routers>

<[module]>

<use>admin</use>

<args>

<module>[Namespace]_[Module]</module>

<frontName>[module]</frontName>

</args>

</[module]>

</routers>

</admin>

<adminhtml>

<menu>

<[module] module="[module]">

<title>[Module]</title>

<sort_order>71</sort_order>

<children>

<action>[module]/adminhtml_[module]</action>

</items>

</children>

</[module]>

</menu>

<acl>

<resources>

<all>

<title>Allow Everything</title>

</all>

<admin>

<children>
<[module]>
<title>[Module] Module</title>

<sort_order>200</sort_order>

</[module]>

</children>

</admin>

</resources>

</acl>

<layout>

<updates>

<[module]>

<file>[module].xml</file>

</[module]>

</updates>

</layout>

</adminhtml>

<global>

<models>

<[module]>

<class>[Namespace]_[Module]_Model</class>

<resourceModel>[module]_mysql4</resourceModel>

</[module]>

<[module]_mysql4>

<class>[Namespace]_[Module]_Model_Mysql4</class>

<entities>

<[module]>

<table>[module]</table>

</[module]>

</entities>

</[module]_mysql4>

</models>

<resources>

<[module]_setup>

<setup>

<module>[Namespace]_[Module]</module>

</setup>

<connection>

<use>core_setup</use>

</connection>

</[module]_setup>

<[module]_write>

<connection>

<use>core_write</use>

</connection>

</[module]_write>

<[module]_read>

<connection>

<use>core_read</use>

</connection>

</[module]_read>

</resources>

<blocks>

<[module]>

<class>[Namespace]_[Module]_Block</class>

</[module]>

</blocks>

<helpers>

<[module]>

<class>[Namespace]_[Module]_Helper</class>

</[module]>

</helpers>

</global>

</config>

XML Layout

/app/design/adminhtml/<interface>/<theme>/layout/<module>.xml

<?xml version="1.0"?>

<layout version="0.1.0">

<[module]_adminhtml_[module]_index>

<reference name="content">
Source : http://www.magentocommerce.com/wiki/custom_module_with_custom_database_table

Store Manager For Magento Cart Torrent Free Full Download Store

November 21, 2009 · Leave a Comment
Filed under: Featured, Magento Cart, PHP 

Store Manager For Magento Cart Torrent download, Store Manager For Magento Cart Torrent crack, Store Manager For Magento Cart Torrent serial, Store Manager

http://www.rapidsharemegaupload.com/store-manager-for-magento-cart-torrent-crack-serial-keygen-free-download.htm

Store Manager For Magento Cart Torrent

Rapidshare Megaupload Download Links

Download links are ready to be downloaded. Latest update: Friday, January 8, 2010

Related for Store Manager For Magento Cart TorrentFile SizeDownloads
X-Cart RSS Export module – X Cart Mod 4.0 0.029 MB 5346 Times
X-Cart All-in-One Product Feeds 10.7.6 1.68 MB 3564 Times
Fortune3 Shopping Cart and E-Commerce 6.1 6.60 MB 10230 Times
Electric Golf Cart 1.0 0.89 MB 2178 Times
Ewisoft eCommerce Builder 4.0 8.58 MB 10296 Times
x-Cart Google Checkout L2 module 2.0 0.029 MB 11814 Times
Torrent Toolbar 1.0.1.30 0.49 MB 21384 Times
TorrentRatioKeeper 2.3 0.88 MB 7458 Times
eOrdering Complete 2.5.5 2.69 MB 3366 Times
Social Bookmarks Supercharged – Zen Cart Module 2.0 0.064 MB 6270 Times
X-Cart 5-in-One Product Feeds – X Cart Mod 4.0 0.029 MB 5610 Times
X-Cart All-in-One Product Feeds – X Cart Mod 4.0 0.29 MB 5676 Times
CoffeeCup Shopping Cart Designer Professional 3.7 31.70 MB 264 Times
AdVantShop.NET Pro 2.1 9.76 MB 2244 Times
Point of Sale (POS) for Zen Cart 1.0.0 1.14 MB 858 Times
VevoCart 3.0.4 12.18 MB 990 Times
Apellicon easyTrader Web Store 1.0 5.93 MB 3630 Times
Shopping Cart Professional 6.05 3.60 MB 5412 Times
Site Map for Zen Cart – Zen Cart Module 1.0 0.063 MB 4224 Times
RapidShop Shopping Cart and ECommerce 3.1 0.28 MB 9174 Times
Torrent Searcher Toolbar IE 1.1 1.05 MB 23364 Times
RapidShop 3.1 0.351 MB 11220 Times
X-Cart 10-in-One Product Feeds 10.6.7 1.67 MB 3696 Times
X-Cart 5-in-One Product Feeds 10.6.7 1.67 MB 3036 Times
Movie Torrent 3.0.0 13.9 MB 2838 Times
X-Cart shopping.com Data Feed module – X Cart Mod 4.0 0.029 MB 5082 Times
Music Torrent 3.5.0 13.9 MB 990 Times
VIP Torrent 3.1.0 13.9 MB 2904 Times
X-Cart MySimon.com Data Feed – X Cart Mod 4.0 0.029 MB 5874 Times
Torrent2Exe 1.0 0.29 MB 22110 Times
Cart4you Shopping Cart 1.11 0.30 MB 9900 Times
MidiCart ASP Shopping Cart 5.45 0.35 MB 6402 Times
DartCart Shopping Cart Demo .exe 1.1 5.20 MB 6996 Times
Zen Cart PriceRunner.com Data Feed 8.7.4 1.45 MB 8910 Times
Social Bookmarks Supercharged – X-Cart Mod 3.1 0.029 MB 6072 Times

Kohana PHP 3.0 (KO3) Tutorial

November 21, 2009 · Leave a Comment
Filed under: Featured, PHP, Web 3.0 

So you might have read my aricle on frameworks and/or my series of tutorials on Kohana PHP 2.3.x and you are wanting more. Today, I drop the old 2.3.x and bring the new and shiny! So I bring you information to get you started with Kohana PHP 3.0!

Lets check to make sure we have everything needed before going on.

Lets go!
Download:
Download the latest Kohana 3.0 PHP (At the time of this writing: 3.0.1.2) and unpack it somewhere.

Install:
Open the file we just downloaded in your favorite archive program and extract it to a temporary location. Open that temporary location and you should have a folder that is named “kohana” or something like that. Open that folder. Open a new window and open the root directory of your *AMP install. Since I’m using WAMP Server – mine is “C:\wamp\www\”. Next make a new folder in there named “mykohana3″. Copy the files from the “kohana” directory to the “mykohana3″. Make sure your *AMP installation is up and running then point your browser to “http://yourserver/mykohana3/”. You should have a screen stating that everything is “OK”.

If everything is “OK”, then remove or rename the “install.php” file in the “mykohana3″ directory. Next open up the “example.htaccess” file and change the following line:

RewriteBase /kohana/

to:

RewriteBase /mykohana3/

Save it as “.htaccess”.

Now open the “bootstrap.php” file located in the “application” folder and cange the following line:

Kohana::init(array('base_url' => '/kohana/'));

to:

Kohana::init(array('base_url'  => '/mykohana3/',
                   'index_file'=> ''));

Save this file then refresh your browser. You should get something that reads “hello, world!” on your screen.

You might already notice that configuration for KO3 is a little bit more involved, editing two files instead of one, which isn’t a big deal at all.

Now to make our first controller! Open a new document and put the following into it:

<?php
defined('SYSPATH') or die('No direct script access.');

class Controller_Ko3 extends Controller
 {
    public function action_index()
     {
        $this->request->response = 'My First Kohana 3.0 Controller';
     }
 } // End

Save this as “ko3.php” in the “application/classes/controller” folder. You might have noticed another difference between Kohana 2.3.x and 3.0 is the directory structure, not really all that much of difference. Now that you have it saved, point your browser to “http://yourhost/mykohana3/ko3″. You should she “My First Kohana 3.0 Controller” on your screen now.

Now for an explanation of the code.

defined('SYSPATH') or die('No direct script access.');

This line basically tells PHP not load this file directly. It can only be included from the framework.

class Controller_Ko3 extends Controller

This creates an controller which is a class that is extended from the Controller class that is part of the framework.

public function action_index()

This created a public method called “action_index”. The “action_index” method is a default action that is loaded by the framework. It’s like your index.php file so to say.

$this->request->response = 'My First Kohana 3.0 Controller';

This will output “My First Kohana 3.0 Controller” to the screen. This basically works like “echo”.

Pretty easy eh? Now if you wanted to add addition action to your controller you would add another public method that has a prefix of “action_” and the you would access via going to “http://yourserver/mykohana3/controller/action”

Let go ahead and add a new method to our “ko3″ controller by adding the following after the “action_index” method:

    public function action_another()
     {
        $this->request->response = 'Another action';
     }

Save the file and loaded up “http://yourserver/mykohana3/ko3/another” in your browser. If all goes well you should see “Another action” in your browser.

That was fun an all, but lets make it a little bit more dynamic!

Copy this code and put it after the “action_another” method:

    public function action_dynamic($say)
     {
        $this->request->response = 'You said: '.$say;
     }

Save this and load “http://yourserver/mykohana3/ko3/dynamic/Monkey” and you should see “You said: Monkey”

Untill next time, when I will go over the first part of views, happy coding!
Sources used: Unofficial Kohana 3 Wiki

registration form validation using ajax with php

November 2, 2009 · Leave a Comment
Filed under: Featured, JavaScript 
 false, 'msg' => "Please specify a username");
        } else if (!preg_match('/^[a-z0-9\.\-_]+$/', $username)) {
            $resp = array('ok' => false, "msg" => "Your username can only contain alphanumerics and period, dash and underscore (.-_)");
        } else if (in_array($username, $taken_usernames)) {
            $resp = array("ok" => false, "msg" => "The selected username is not available");
        } else {
            $resp = array("ok" => true, "msg" => "This username is free");
        }

        return $resp;
    }
?>

      Ajax - PHP example

      
Input text: Output text:
hello.... i want to do the validations in registration form. but my validation is when the user enters the value in textbox that value automatically cheks that value is already in database or not. for example..........username textbox is there..now i am entering value first three letter "kal" then comes beside the textbox "username 'kal' is available for you". and next i am entering nextletter "kalp" then comes beside the textbox "kalp is available". plz help me.....any chances to do this task.