Archive for the ‘Scripts’ Category
Posting PayPal forms with PHP
PayPal is a great system for integrating simple shopping cart functionality on a website. Whether your website sells a large number of products or offers simple subscription or donation forms, PayPal allows your users to send you money securely, safely and quickly without you needing to setup a full merchant account with your online banking. With millions of eBay users already holding PayPal accounts, its the obvious choice for any online service requiring payment.
Recently, I was building a system which required the user to fill in their personal details in a form on a website before being sent to PayPal to arrange payment. There weren’t many solutions available online so, when I asked on Twitter for some help, Drew suggested just appending the required form variables to a URL querystring with a simple GET request in your header which would then be encoded on PayPal’s end to avoid (some) tampering.
You know what - it worked. Here’s the necessary code:
<?php
$data = 'cmd=_xclick';
$data .= '&no_note=1';
$data .= '&no_shipping=1';
$data .= '¤cy_code=GBP';
$data .= '&amount=' . $total_cost;
$data .= '&item_name=' . urlencode('Your Product Name');
$data .= '&business=' . urlencode('your.email@yourwebsite.com');
$data .= '&return=' . urlencode('http://yourwebsite.com/confirmation.php');
$data .= '&cpp_header_image=' . urlencode('http://yourwebsite.com/images/logo_paypal.gif');
header("Location: https://www.paypal.com/cgi-bin/webscr/?" . $data);
?>
This is a very basic adaptation of what PayPal can do - I’ve completely overlooked the IPN confirmation side of things (which would be highly recommended to confirm the amount hadn’t been tampered with).
Profile Based Email Signatures with Exchange
I worked with a colleague this week to create a standardardised email signature for all the users on our internal Microsoft Exchange.
The signature template was already defined so it was just a case of tapping into trhe LDAP to extract each user’s individual profile and use the data in there to create their personal signature.
After a bit of Googling, we couldn’t find any scripts that automated the process of:
- Connect with LDAP
- Create a text-based signature
- Create a rich text signature
- Create an HTML signature
- Automatically apply the rendered signatures to the user’s Outlook profile
With a bit of digging around, we managed to create a single VB Script that would be processed when the user logged on to the Exchange. Using this method, the signature should automatically be updated if any of the information is updated on Exchange such as new telephone numbers, job titles or department moves.
I’ve uploaded the script to Github so it is available for anyone to use. Find all the details and latest revisions on the Profile Based Exchange Signatures repository.
If you find this useful, leave a comment below. It would be great to know if this script has been used elsewhere.
Also, feel free to contribute to the repository, such as tidying up any loose code. The whole exercise was a few hours work so it’s not perfect but does the job.





