Archive

Archive for November, 2008

Payment Automation with Liberty Reserve – PHP script

November 28th, 2008 1 comment

Today I will post the solution for payment automation. Since e-gold doesn’t seem to process payments (I’ve submitted my documents and still waiting them to review for about a month), Liberty Reserve becomes another popular payment solution for non-Paypal countries.

We need to have an account with them in order to process payments. We need some basic PHP knowledge to set up payment automation, but if you follow my guide, I think you will be able to set up your payment system without any problems.

As soon as we have an account with LR, we need to do the following steps:

  • Login to your LR account.
  • Click on ‘Merchant Tools.’
  • Click on ‘Create new API.’
  • Fill in the form. ‘API Name’ and ‘Security Word’ are required fields, which are used to protect your account from an unauthorized access via API. ‘Requesting IP Addresses’ is an additional security measure that restricts API access to your account only to the IPs listed in this field. Leaving this field empty will allow any IP to have API access to your account (if they know the API Name and Security Word).
  • Enter your ‘Security PIN’ and submit this form. Make sure the API was
    created and is enabled.

Then we need to download the script package that provides the necessary API functionality. You can find it here.

Then we need to check whether our PHP configuration allows us to use this script. The requirements are: domxml, mhash and curl extensions for PHP4  or mhash and curl for PHP5. Most servers’ PHP configurations are built with these options, but if your server doesn’t have them, you’re welcome to search my blog to find out how to install the missing components.

After our server is OK, we need to extract the contents of the downloaded ZIP archive to a directory on our server. functions.php is the file that will be used for our needs, though you’re welcome to use the sample code provided. I will show you a faster solution without any graphic interface. Here it is:

<?
require(“functions.php”);
// Setting our payment information: login
$payerAcct=”U123456″;
// API name
$apiName=”U123456″;
// And the security word
$securityWord=”JKhfjJHGfjdjh”;
// Most important part: transfer details: recipient account, payment amount, privacy setting (private or not), memo
$transferList=”U654321, 0.05, not-private, Payment Memo”;

$canDisplayForm = false;
$canDisplayResult = true;

if (is_null($payerAcct) || trim($payerAcct) == “”) {
$wasError = true;
$payerAcctError = “Payer account number can’t be empty.”;
}
else if (!isValidAccountNumber($payerAcct)) {
$wasError = true;
$payerAcctError = “Invalid payer account number format.”;
}

if (is_null($securityWord) || trim($securityWord) == ”) {
$wasError = true;
$securityWordError = “Security Word can’t be empty.”;
}

if (is_null($apiName) || trim($apiName) == ”) {
$wasError = true;
$apiNameError = “Api Name can’t be empty.”;
}

$request = new TransferRequest($apiName, $securityWord);
$request->addTransfersFromText($payerAcct, $transferList, $transferListError);

$transferListError = str_replace(“\n”,”<br />”, $transferListError);
if ($transferListError != “”) {
$wasError = true;
}

$responseContent = $request->getResponse();
// Checking whether everything is OK with payment
if (substr_count($responseContent, “ReceiptId”))

echo “OK”;
else echo “Error”;

?>

You may clean up this code to remove some checks to make the script smaller. But… it works and provides you with the ability to use mass payments using Liberty Reserve.

How to View Last Lines of a Big File in Linux

November 27th, 2008 No comments

This post is dedicated to Linux newbies as those who use it for everyday needs should know about this command. If not… I think this will be useful for you in any way.

When you’re a system administrator, you should often deal with logs. On a Linux server logs are permanently updated, that’s why we need to see last written lines of such a file. If you open it useing cat or more, you won’t see how it changes. A simple command will help you to do this.

tail -f error_log

This will show you last lines of error_log file. For a complete list of options you’re welcome to go here: or just type man tail in your console.

Hope this command will help you to monitor your server and increase its uptime :)

Google Launches SearchWiki: What to Expect

November 24th, 2008 No comments

Today when I turned on my computer and searched something in Google, I’ve noticed some strange signs near my search results. My first thought was that my PC has been hacked :) , but when I clicked the link, I got the idea that it’s another Google innovation. Let’s see what’s written at the Official Google Blog:

Today we’re launching SearchWiki, a way for you to customize search by re-ranking, deleting, adding, and commenting on search results. With just a single click you can move the results you like to the top or add a new site. You can also write notes attached to a particular site and remove results that you don’t feel belong. These modifications will be shown to you every time you do the same search in the future. SearchWiki is available to signed-in Google users. We store your changes in your Google Account. If you are wondering if you are signed in, you can always check by noting if your username appears in the upper right-hand side of the page.

The changes you make only affect your own searches. But SearchWiki also is a great way to share your insights with other searchers. You can see how the community has collectively edited the search results by clicking on the “See all notes for this SearchWiki” link.

What does this really mean? I don’t think I input the same queries every day, if I don’t intent to promote my site for this key phrase. Usually my search terms are different and I can’t see the reason to delete or manage the search results: if I’m searching for some information, I get what I need (Thanks, Google) and don’t come back to the same page anymore.

I’ve checked what’s shown for linux terms. Almost nothing at the moment as people don’t yet know what do these little arrow and “X” signs do. But when I checked Searchwiki contents for a competitve keyword, I’ve found that 53 notes were recorded for “car insurance”.

My personal opinion at this time is that this instrument will be widely used by SEO webmasters. Though Google tells that Searchwiki doesn’t affect general search results, I think that this function will be implemented some time later. But… if it’s done, there will be SEO wars, when webmasters will try to pull don concurents’ sites from SERP…

Let’s see how it comes. At the moment, I’ve moved all my sites to the top and I’m happy :)

Categories: Web Services Tags:

Free Base64 Encoder and Decoder Available Online

November 20th, 2008 No comments

base64 encoding is often used to . There is an online tool that allows you to encode and decode the code. Here is the link: Base64 Encoding/Decoding Tool by Thomas Horsten.

It really works with the code you have. It’s a common kind of PHP protection and this tool reveals the opinion that base64 encoding is secure and it’s enough for code protection. If you hae any ideas on how to protect the PHP code, you’re welcome to post them in your comments.

Zend, Ioncube, etc are not enough as there are some paid services that offer “dezend” and “deioncube”. Code obfuscation… hmm, it just increases the time used to modify such a code, but doesn’t really help.

I would like to have my PHP scripts protected, but I don’t know any good protection method at the moment.