After moving a clients Associate-o-matic store to a new hosting, images have stopped showing. If we attempted to view the image the following error would appear:
Warning: file_get_contents() [function.file-get-contents]:… File(/aom/img.php) is not within the allowed path(s)
Even after updating to the new version of AOM I could not get it to work. The work around I found is to use cURL intead of file_get_contents(); To do this I followed these simple steps.
- Download and open file /aom/img.php
- copy the function CURL replacement for file_get_contents to the end of the file before ?>
- comment out the line echo file_get_contents($img); (just add # at the start of the line, do this for both instances of the line)
- add echo file_get_contents_curl($img); under both lines you have just commented out.
- Save and upload the file.
If you are using CardSave (UK Version) and you come across the following error:
“This transaction cannot be processed. It was rejected because the passed transaction date/time has expired. Please press “Back” in your browser and resubmit the transaction.”
It’s caused by your server providing a different timezone to your CardSave Gateway. You need to setup your server/script time zone to UTC. In PHP you can do this by simply adding this line to your script: date_default_timezone_set(‘UTC’);
For example, I was having a problem with the Cardsave(hosted) payment extension for OpenCart. If you are having the same problem do this:
- Open the file /catalog/controler/payment/cardsave_hosted.php
- Find this line $this->data[‘fields’][‘TransactionDateTime’] = (date(“Y-m-d H:i:s”). ‘ +00:00’); (line 305 I think)
- Just before that line add this : date_default_timezone_set(‘UTC’);
- Upload file to server and you are sorted.
Here are the steps for creating a simple Plugin for a Random Ad Widget . This is also a good startup script for those (like me) wanting to learn how to create Plugins and Widgets for WordPress.
The idea here is to create an Ad delivery widget that will show a random ad on every visited page. Firstly I will show you the whole code, for those who know what they are doing and just want to diss my code and style. Then it will be broken into pieces with detailed explanation for those interested. If you want to skip it all just download the source code here.
For the sake of this exercise I will call the file random_ads.php but feel free to call it whatever you like. Here we go… Read more »