permalinks not working in ubuntu


i have solved that problem in few mintue

please follow that step then Enjoy ūüėõ

 sudo a2enmod rewrite

nano /etc/apache2/sites-enabled/000-default

 

AllowOverride None replace to AllowOverride All

please find that line

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None # change this line
    Order allow,deny
    allow from all
</Directory>

replace that
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All # now it will read .htaccess
    Order allow,deny
    allow from all
</Directory>


sudo service apache2 restart

paypal pro script in php


At first I develop the form where user give all information. I did not validate all form fields but when you use it for your website please validate all form fields then process in next step. I name it index.php

After click submit, using ajax post request all the form data will send to send.php. In send.php page I silently send all the value to paypal site using cURL. But here I need to put my paypal pro cardinal details like username, password, signature. When you create paypal pro account paypal will generate thin things for you. You can use this link also for creating paypal pro account. https://www.paypal.com/webapps/mpp/paypal-payments-pro or http://stackoverflow.com/questions/7820298/how-to-create-paypal-website-payment-pro-sandbox-account

The above code will send all your information to paypal, make your payment done and send a payment status information to my site. I check the status information, if it is ok then save it to database and also you can send mail to your user. After successful payment process I redirect the user to success page. If there is some error I show the error message to user.

Now make success.php page. Here i just simply show a message, but for you, you can show any thing you want.

json date convert to timestamp in php


You can use regular expression to fetch your timestamp and offset:

preg_match('~(\d+)\d{3}((?:\+|-)\d+)~', $sale['Date'], $match);
print_r($match);

return will be:

Array
(
    [0] => 1386834199000+0200
    [1] => 1386834199
    [2] => +0200
)

With fetched timestamp you can now format your datetime. When formating timestamp, you can also take offset into account (given one, or set your timezone), if needed so:

$dt = new DateTime('@' . $match[1]);
$dt = new DateTime($dt->format('Y-m-d H:i:s') . ' ' . $match[2]);
# $dt->setTimezone(new DateTimezone("your_timezone"));
print_r($dt);

return will be DateTime object:

DateTime Object
(
    [date] => 2013-12-12 07:43:19
    [timezone_type] => 1
    [timezone] => +02:00
)

which can be formated for your needs:

$createdDate = dt->format('d-m-Y H:i:s');