Aug
27

Zend Framework Quick Start in xampp and Windows

Author admin    Category Uncategorized     Tags

Now i am writing what i have done for my project learning from the zend documentation. It(Zend) follows the MVC design pattern (with some extension, like form).

Create Project

1. Start>Run (cmd)

zf create project E:\Faruque\Projects\gyneca\Source\trunk\test_php\test_zend test_zend

Create Layout

go to the application directory(in command pormpt.) where .zfproject.xml remains

execute this command:

zf enable layout

In application/configs/application.ini file append

; Add to [production] section:

resources.view[] =

Add a function to Bootstrap

protected function _initDoctype()
{
$this->bootstrap(‘view’);
$view = $this->getResource(‘view’);
$view->doctype(‘XHTML1_STRICT’);
}
make a file in application/layouts/scripts/layout.phtml

Aug
25

Enabling layout for zend framework

Author admin    Category Zend     Tags

It gives error when we execute the command

zf enable layout

Solution:

1. Go to the app path

C:\Documents and Settings\Faruque> E:
E:\>cd E:\Faruque\Projects\gyneca\Source\trunk\test_php\test_zend
now run the command:
E:\Faruque\Projects\gyneca\Source\trunk\test_php\test_zend>zf enable layout
yap, done.
Aug
25

Installing zend framework in windows xampp

Author admin    Category Zend     Tags

1. Download zend framework. keep it any where in your hard disk.

After downloading the ZF, we can add the library in two ways

i. In php.ini file add include_path to library.

include_path = “.;D:\xampp\php\PEAR;E:\Faruque\Projects\gyneca\Source\trunk\test_php\Zend\library”

or

ii. Keep the Zend folder of library folder to

PEAR folder and make sure the following code is uncommented in php.ini file

include_path = “.;D:\xampp\php\PEAR”

2. Copy the zf.bat and zf.php from bin to D:\xampp\php\

3. Set environment variable (Right click on mycomputer>properties>advance>Environment variables)

  • make a user variable zf = D:\xampp\php\zf.bat
  • make a user variable php = D:\xampp\php\php.exe

4. use command (Start>Run:cmd)

5. type:

zf create project path/to/application ( Ex: E:\Faruque\Projects\gyneca\Source\trunk\test_php\test_zend) project name (Ex: test_zend)

6.  make virtual host

  • Open the file  : D:\xampp\apache\conf\extra\httpd-vhost.conf
  • Uncomment NameVirtualHost *:80

type

<VirtualHost *:80>
ServerName test_zend.local
DocumentRoot “E:/Faruque/Projects/gyneca/Source/trunk/test_php/test_zend/public”
SetEnv APPLICATION_ENV “development”
<Directory “E:/Faruque/Projects/gyneca/Source/trunk/test_php/test_zend/public”>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
7. write the server name in host file:(C:\windows\system32\drivers\etc\hosts)
127.0.0.1 test_zend.local
8. Run it through browser: http://test_zend.local
hey it should work.
Aug
24

Preliminaries for Zend Framework installation

Author admin    Category Zend     Tags

Changing directory in cmd prompt(windows)

C:\Documents and Settings\Faruque>cd /d D:

or

C:\Documents and Settings\Faruque>D:

Aug
18

Learning Zend FrameWork(Introduction)

Author admin    Category Zend     Tags

From today i have started learning Zend Framework.

First step is downloading the framework: http://framework.zend.com/.

2nd step is unzip the framework.

complete. (As i have done only this portion)

Aug
10

Paypal Integration(4th day)

Author admin    Category Uncategorized     Tags

What do u think? Is it completed? No. We have made the form to submit.

Now,

1. Data will go to paypal

2. paypal shows the payment form.

3. After transaction it(paypal) will send a notification to my site(The location i  have given at the form.).

<input type=”hidden” name=”notify_url” value=”http://www.abcd.com/ipn/ipn.php”>

4.  Now I have to send the notification data to paypal for verification.(I missed this step to my project and i fell in gr8 trouble)

5.  After verification, paypal sends me another notification.

6. Then i start processing the data(inserting in db , sending mail etc).

Its hard.na?

Paypal provides this handler for different language. So …. no problem.

The code of paypal ipn handler:

<?php
// PHP 4.1
// read the post from PayPal system and add ‘cmd’
$req = ‘cmd=_notify-validate’;
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= “&$key=$value”;
}
// post back to PayPal system to validate
$header .= “POST /cgi-bin/webscr HTTP/1.0\r\n”;
$header .= “Content-Type: application/x-www-form-urlencoded\r\n”;
$header .= “Content-Length: ” . strlen($req) . “\r\n\r\n”;
$fp = fsockopen (‘ssl://www.sandbox.paypal.com’, 443, $errno, $errstr, 30);
// assign posted variables to local variables
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];
if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, “VERIFIED”) == 0) {
// check the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your Primary PayPal email
// check that payment_amount/payment_currency are correct
// process payment
}
else if (strcmp ($res, “INVALID”) == 0) {
// log for manual investigation
}
}
fclose ($fp);
}
?>
=============================================================
Completed.  \m/
Alhamdulillah (All praise is due to Allah).
Jul
14

Paypal Integration(3rd day)

Author admin    Category Uncategorized     Tags
1. <form action=”https://www.sandbox.paypal.com/cgi-bin/webscr” method=”post”>
form action is ”https://www.sandbox.paypal.com/cgi-bin/webscr” ,bcoz i am testing my integration is correct or not. When it is correct, change it to “https://www.paypal.com/cgi-bin/webscr”
2. <input type=”hidden” name=”cmd” value=”_xclick”>
I dont know why i had to give it sorry.
3. <input type=”hidden” name=”business” value=”abcd_1278228107_biz@yahoo.com”>
It is my paypal merchant account.
I think u can understand the purpose of other input
<input type=”hidden” name=”custom” value=”<?php echo $_SESSION['username'];?>”>
to get the username to my IPN handler i hav written this.
Any question?
No? good.
Jul
8

Paypal Integration(2nd day)

Author admin    Category Uncategorized     Tags

The minimalistic order form:

<form action=”https://www.sandbox.paypal.com/cgi-bin/webscr” method=”post”>
<input type=”hidden” name=”cmd” value=”_xclick”>
<input type=”hidden” name=”business” value=”abcd_1278228107_biz@yahoo.com”>
<input type=”hidden” name=”item_name”
value=”abcdaNow Service”>
<input type=”hidden” name=”item_number” value=”1″>
<input type=”hidden” name=”amount” value=”3″>
<!– <input type=”hidden” name=”tax” value=”1″>–>
<input type=”hidden” name=”quantity” value=”1″>
<input type=”hidden” name=”no_note” value=”1″>
<input type=”hidden” name=”currency_code” value=”USD”>
<!– Enable override of payer’s stored PayPal address –>
<input type=”hidden” name=”address_override” value=”1″>
<!– Set prepopulation variables to override stored address –>
<input type=”hidden” name=”address_name” value=”safaruque”>
<input type=”hidden” name=”first_name” value=”john pancraft”>
<input type=”hidden” name=”last_name” value=”last sent”>
<input type=”hidden” name=”notify_url” value=”http://www.abcd.com/ipn/ipn.php”>
<input type=”hidden” name=”return” value=”http://www.adbc.com/success.php”>
<input type=”hidden” name=”cbt” value=”Continue >>”>
<input type=”hidden” name=”custom” value=”<?php echo $_SESSION['username'];?>”>
<input type=”image” name=”submit” border=”0″
src=”https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif”
alt=”PayPal – The safer, easier way to pay online”>
</form>
Wanna explanation? which <input> is for what?
–Give comments or i will publish automatically. :)
Jul
7

Paypal Integration(1st day)

Author admin    Category Uncategorized     Tags

Yap, atlast i have integrated my project to paypal. Its easy but need some guidence.

For my project scenario is -

  1. Client will login to my page
  2. They put the quantity of products
  3. And click buy now button
  4. 1 notification(IPN) will come to me(Site Admin).
  5. I will store the info(user_name, amount) to DB.

Thats it.

I have made a order form given in next post. Now i m busy. :p:p:p:p:p

Jun
30

Paypal Integration(Introduction)

Author admin    Category Uncategorized     Tags

Again i have started learning paypal.

Flickr Photostream
logo_elegentlogo_monochromiclogo_structure_alphabets_aralmost-final-with-axis
ADSENSE Test