Wepay, a great alternative to PayPal. They’re support at Wepay is phenomenal which in itself is a great reason to work with wepay. The API at wepay is very simple to use. In this case I have been using their SDK which makes the development much faster! In this tutorial I will show you the code to setup a iframe wepay checkout and an IPN to update your application database. I have attached a zip file of all the code ready to be used.

Alright lets start with the checkout.

1. First you will need to goto https://stage.wepay.com/developer. That is the staging site, which means you can run as many transactions thru it for testing purposes only. You have to test your code in the staging environment before you can go live!

2. Once you register on the staging site you will need to go to the developer section again, click on “Your Apps”

3. Click on “Create an application”, fill out all the fields, and hit submit.

4. You now have registered a app with wepay, which will give you your client secret, access token.

5 . You will now need to create an account you want your money to go into. Click on the “Home” link at the top of the screen. This will bring you to your account home page. You can ether use an account you have created or create a new one. In this case I will use one I already have, so click on the one you want to use.

Once you have clicked on it, in the address bar on your browser will tell you your account number.

Example: https://stage.wepay.com/group/view/<YOUR ACCOUNT NUMBER HERE>

Copy that number you have in your browser, you will need it later.

6. Alright now to the code. I have only set this up in PHP so when I get a chance I will do it in other languages. Keep in mind, you will need the Wepay SDK. You can download it below. You will also need your client id, client secret and access token. All can be found on your applications registration page on Wepay’s staging site. Your account id is the account you want to have the funds into, which you should have that account number from a minute ago.

require 'includes/wepay.php';
 
$client_id = "<YOUR CLIENT ID>";
$client_secret = "<YOUR CLIENT SECRET>";
$access_token = "<YOUR ACCESS TOKEN";
$account_id = "<YOUR ACCOUNT ID>"; 
 
Wepay::useStaging($client_id, $client_secret);
$wepay = new WePay($access_token);
 
try {
$checkout = $wepay->request('/checkout/create', array(
'account_id' => $account_id, // ID of the account that you want the money to go to
'amount' => "1.00", // dollar amount you want to charge the user
'short_description' => "Short product description", // a short description of what the payment is for
'reference_id' => "Order id you want", // A reference id for your application to use.
'type' => "GOODS", // the type of the payment - choose from GOODS SERVICE DONATION or PERSONAL
'mode' => "iframe", // put iframe here if you want the checkout to be in an iframe, regular if you want the user to be sent to WePay
'fee_payer' => "Payee", // Here you put who is paying the fees you or your client. Payee = client, Payer = account holder
'redirect_uri' => "http://www.mysite.com/thanks.php", // The page where you want clients to go after the transaction is completed.
'callback_uri' => "http://www.mysite.com/wepayipn.php", // Location of the file that handles IPN requests
)
);
} catch (WePayException $e) { // if the API call returns an error, get the error message for display later
$error = $e->getMessage();
}

Where ever you want to display your Wepay iframe, here is the additional code you will need.

<div id="checkout_div"></div>

Before the </body> Place this javascript there.

<script type="text/javascript" src="https://stage.wepay.com/js/iframe.wepay.js"> </script>
<script type="text/javascript"> WePay.iframe_checkout("checkout_div", "<?php echo $checkout->checkout_uri ?>"); </script>

You now have a working Iframe checkout from Wepay. Next we will work on the IPN.

7. Here is the code you will need for your IPN:

require 'wepay.php';
 
if (!empty($_POST['checkout_id'])) {$thecheckoutid = $_POST['checkout_id'];}
 
$client_id = "<Your Client ID>";
$client_secret = "<Your Client Secret>";
$access_token = "<Your Client Token>";
$account_id = "<Your Accout ID>"; 
 
/**
* Initialize the WePay SDK object
*/
Wepay::useStaging($client_id, $client_secret);
$wepay = new WePay($access_token);
 
/**
* Make the API request to get the checkout_uri
*
*/
try {
$checkout = $wepay->request('checkout', array(
'checkout_id' => $thecheckoutid, // ID of the account that you want the money to go to
)
);
} catch (WePayException $e) { // if the API call returns an error, get the error message for display later
$error = $e->getMessage();
}
 
///some things you might want to use. Delete this stuff otherwise///
print '<br /><br />';
print $checkout->short_description;
print '<br /><br />';
print $checkout->checkout_id;
print '<br /><br />';
print $checkout->reference_id;
print '<br /><br />';
print $checkout->gross;
print '<br /><br />';
print $checkout->payer_name;
////stop deleteing here///
 
	if ($checkout->state == "captured") {
	///do something here
        } elseif ($checkout->state == "authorized") {
	///do something here
        } elseif ($checkout->state == "cancelled") {
	///do something here
        } elseif ($checkout->state == "refunded") {
	///do something here
        } elseif ($checkout->state == "expired") {
	///do something here
        }

Pretty self explanatory, if you need more API object states, click here to see them all with explainations.

Now you have a working IPN and Iframe checkout in the staging environment. In my next tutorial I will post how to switch from staging to production.

Also if you have an error on your iframe checkout that is similar to this:

SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Please see this post here to fix this issue.

All the code in this tutorial, click here to download the IPN and Iframe Checkout with the SDK wepay file.

SDK Download (wepay.php) : https://github.com/wepay/PHP-SDK/blob/master/wepay.php

Wepay API Reference Pages:

API Object States

Checkout API Calls

API Change Log

Feel free to comment and let me know if you need help.

Okay here is the write up on how to setup pop3 ticket creation.

 

No need to setup piping here!

 

Okay so make sure you have php pear and php pear mime installed. In my case I have centos so the command to get that install is: (NOTE: Make sure you have centosplus repo enabled!)

 

yum install php-pear php-pear-Mail php-pear-Mail-Mime

 

or if you want to check to see if its installed use this command:

rpm -qa –qf “%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n” php-\* | sort

 

you should see something like this:

php-cli-5.1.6-3.el4s1.10.i386

php-common-5.1.6-3.el4s1.10.i386

php-devel-5.1.6-3.el4s1.10.i386

php-gd-5.1.6-3.el4s1.10.i386

php-imap-5.1.6-3.el4s1.10.i386

php-ldap-5.1.6-3.el4s1.10.i386

php-mysql-5.1.6-3.el4s1.10.i386

php-odbc-5.1.6-3.el4s1.10.i386

php-pdo-5.1.6-3.el4s1.10.i386

php-pear-1.4.11-1.el4s1.1.noarch

php-pear-Auth-SASL-1.0.2-4.el4.centos.noarch

php-pear-Mail-1.1.14-1.el4.centos.noarch

php-pear-Mail-Mime-1.3.1-8.el4.centos.noarch

php-pear-Net-SMTP-1.2.8-5.el4.centos.noarch

php-pear-Net-Socket-1.0.6-5.el4.centos.noarch

php-xmlrpc-5.1.6-3.el4s1.10.i386

 

Alright now that we got all that installed, restart your web server.

 

service httpd restart

 

Setup you email account in your department, pretty straight forward.

 

Now the fun part!!!!

Setup cron for every 5 minutes.

 

Crontab –e

 

Here is the command you will need:

*/5 * * * * lynx -dump http://www.somedomain.com/yoursupportdirectory/sources/pop3.php

That’s it. You should be ready to go.

 

So I ran into this recently. Basically jquery plugin Validation doesn’t work in IE8. I found other issues with this problem and they even had problems with IE7. In my case it was just IE8. So I searched the net and found this site. Which basically said if I used the mini version of validation, it would work. And guess what? IT DID! Yea! For those of you having this problem just use the minified version and that should get you up and running.

So I decided since I have about 20 requests a day or more for how to fix this or how to work around that with PHP, I figured why not build a simple blog site for just php tutorials and tips so I did. Its not pretty and it was one of those things I threw up in 20 minutes. But at the end of the day it should help all the emails I get and calls. Feel free to check it out www.phptutorialsnow.com

Posted in PHP.

Alright this tutorial is under the assumption that you have a motherboard or nic that supports wake on lan (WOL.)

Once you have confirmed this and turned it on if it isn’t already, boot up Centos and we will start.

1. Create this file /usr/bin/activatewol
2. Add this to that file

#!/bin/bash
ethtool -s eth0 wol g

3. Now go to edit this file /etc/sysconfig/network-scripts/ifdown-post and /etc/sysconfig/network-scripts/ifup-post

4. In both files just before the end } tag add this to both of them:

ethtool -s eth0 wol g

5. Once you have done that set permissions on the activatewol file

chmod 755 /usr/bin/activatewol

6. Restart your network

service network restart

7. Run ifconfig to get your MAC address to send the WOL packet to this machine.

8. Test it, generally I use it to wake my backup server for backups and other things. So I would run the command

pm-hibernate – (Assuming you have pm-utils installed in your copy of Centos.)

Once it is in full hibernation mode, send your WOL packet to your Centos Machine and it should awaken from its hibernation!

All I have to say, thank god for the government! I called this the day that they announced the merger, Sure as shit the DOJ said no way! I can gladly say the DOJ is doing their job and doing it well. The merger of AT&T with T-Mobile, is not only a bad idea for the market but for the consumers as well. Think cell phone pricing is bad now, consolidate the market and see what happens with pricing. T-Mobile and its great service would be no more, plus you add in the fact AT&T has a shitting network, and you have a shit sandwich. There you go AT&T, your network is bad enough, lets not make it twice as bad.

If your having the issue where you send a email to a email account on your Ispconfig server and you receive a message like this:

Relay Access Denied State 14

You will need to double check your postfix config. Run this command below to fix two entries in your postfix install.

postconf -e 'virtual_maps = hash:/etc/postfix/virtusertable'
postconf -e 'mydestination = /etc/postfix/local-host-names'

After that restart postfix.

service postfix restart

And you should no longer receive that message.

I recently ran into this issue, and I know there are many others out there having this issue. The problem is simple, postfix runs but it doesn’t respond to telnet requests. This normally is due to the fact postfix isn’t running properly and something isn’t configured properly. In my case a recent update causes postfix to be switched to a seconded mta and exim was the main mta. Because of this, when I started postfix, I would get a line like this in the maillog:

fatal: open database /etc/aliases.db: No such file or directory

Most said to just run newaliases but when I did, it didn’t create the /etc/aliases.db file that needs to be there. This is exactly what I did to get everything back in order, bare in mind I use centos 5.6 x64 in this example.

1. Reset the MTA back to postfix:
alternatives --config mta

Selected postfix, which was number 2 in the selection and hit enter. Now Postfix is the main MTA.

2. Run newaliases
newaliases

3. Confirm everything

Check to make sure /etc/aliases.db was created. Double check your postfix/main.cf config

4. Reload postfix

Once you checked both files you should now have a working install of postfix. Reload postfix, and then check your maillog for any other errors.

service postfix reload

I had an epiphany this morning, and realized it was time to release this project.

What is project DOM?

To explain it, I have to explain its existence. In today’s world, there are issues all over.The world has always been like this, but never at such a prevalent level in my opinion. The world is ever changing, we as a human race should be able to control its path as best we can. In the U.S they say, “Voice your opinion by voting for….” who ever is running for president, senator, city mayor, whatever it may be. Voting some one in a political position doesn’t necessarily give you a voice. I would say its an easier way in some cases to snuff out others voices. Which has happened in this country. I’m not saying our politicians are bad people, I’m saying our system is doesn’t work.

In other countries the people don’t have a voice because their country snuffs out their voice. Its time this ends. Forever. Around the world life is treated of no value, of no meaning. Life should not be treated lightly, every life should be cherished just like every opinion and thought should be listened to.

Its time we as a people voice our opinions in a global form, in a method that is clean, organized, and to the point. To let the people in power, know where we really stand as a people.

Last notes

I leave you with this. I built this to change the world. Period. And I undoubtedly know it will.  If I crash and burn so be it but I know it won’t. I have been working on it for months and it is  finished. I was waiting for just that right time. I came to the conclusion that there is no right time, the right time is now. I have a few things I need to do before I push it live.

What you need to know is this:

Our release date is 12/1/11. Release date was pushed back for further development.

It will change the internet and the world as we know it.

I will post updates on my blog alanpinnt.com

New malware email is spreading again, similar to the other one I posted last week. DO not open the attachement on this email.

Here is what it normally says:

“Thank you for ordering from Puremobile Inc.

This message is to inform you that your order has been received and is currently being processed.

Your order reference is 937568.

You will need this in all correspondence.
This receipt is NOT proof of purchase.
We will send a printed invoice by mail to your billing address.

You have chosen to pay by credit card.
Your card will be charged for the amount of 424.00 USD and “Puremobile Inc.” will appear next to the charge on your statement.
Your purchase information appears below in the file.”

SQL injection attacks occur when a client manipulates a web page to pass invalid data to a query. This can be down to force errors, bypass security, or even delete data. The <cfqueryparam> tag prevents SQL injection by binding values into the query; the bound values cannot be interpreted as SQL. It also results in faster queries.

Bad Code:

<cfquery name="QCheckUser" datasource="blahblah">
SELECT *
FROM USERS
WHERE username = '#FORM.username#'
AND password = '#FORM.password#'
</cfquery>

GOOD CODE:

<cfquery name="QCheckUser" datasource="blahblah">
SELECT *
FROM USERS
WHERE username = <cfqueryparam cfsqltype="cf_sql_varchar" value="#FORM.username#">
AND password = <cfqueryparam cfsqltype="cf_sql_varchar" value="#FORM.password#">
</cfquery>

New malware email is spreading again. DO not open the attachement on this email.

Here is what it normally says:

“Thank you for ordering from Broadcast Music, Inc.

This message is to inform you that your order has been received and is currently being processed.

Your order reference is 134184. You will need this in all correspondence. This receipt is NOT proof of purchase. We will send a printed invoice by mail to your billing address.

You have chosen to pay by credit card. Your card will be charged for the amount of 412.00 USD and “Broadcast Music, Inc.” will appear next to the charge on your statement. l

Your purchase information appears below in the file.

Broadcast Music, Inc.”

This will be a short post. The new version of WordPress 3.1 is a great addition to the world of php scripts but I have to say if your upgrading it will cause issues. The more plug ins you have the more likely it will cause issues. I have been getting phone calls from all over asking if they should upgrade, and I recommend that every one holds off. A lot of plug ins have not been updated to work with 3.1 properly and its causing issues across the board.