Sanjoy Roy

[MCM, MCP, SCJP] – Senior PHP Programmer

Monthly Archives: August 2012

Block Google and bots using htaccess and robots.txt

User-agent: *
Disallow: /


RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} AltaVista [OR]
RewriteCond %{HTTP_USER_AGENT} Googlebot [OR]
RewriteCond %{HTTP_USER_AGENT} msnbot [OR]
RewriteCond %{HTTP_USER_AGENT} Slurp
RewriteRule ^.*$ “http\:\/\/domainname\” [R=301,L]

How to force browser to resize when window resizing doesn’t work

How to hide window scrollbar for IE, FF and Google Chrome

It is easy if you add the attribute scrollbars=no inside the‘s window attributes. But what if you wish to hide them when the popup window is already open. Thank you CSS! Yes, it is possible by using Javascript and accessing the window style’s property overflow. However, there is a cross-browser issue. Both IE and Firefox/Google Chrome have different codes that make this work. You can place both their codes in the same page and/or Javascript function. If the browser does not understand the property, it will ignore it anyway so there is no need to do a browser check to execute the code specific to that certain browser.
The code below does the trick: = 'hidden'; // firefox, chrome
document.body.scroll = "no"; // ie only

Just in case you wish to disable either just the horizontal or vertical scrollbar, this code works for non IE browsers = 'hidden'; // horizontal scrollbar will be hidden = 'hidden'; // vertical scrollbar will be hidden

Bluehost error: [an error occurred while processing this directive]


For the benefit of anyone encountering a similar problem, try the steps that follow:

– Go to cPanel
– Open File Manager from Files section
– Navigate to domain folder
– Check “Perms” column on far right hand side
– Files should be set to: 0644 (this is the UNIX file permissions)
– Folders should be set to: 0755

This will change your file permissions to their proper settings for the Bluehost file system. Additionally, if you have PHP code within.htm or .html files, you will need to add an additional Apache handler to tell Bluehost to parse these files as PHP. Do this using Apache Handlers in cPanel:

HANDLER: application/x-httpd-php5s
EXTENSIONS: .php .htm .html

Opencart coupon history not working with Paypal

in catalog/model/checkout/coupon.php


  public function getCoupon($code) {



 public function getCoupon($code,$noverify=0) {

AND change


       if ($status) {
             return array(



       if (($status)||($noverify)) {
             return array(

Next, in catalog/model/total/coupon.php in the confirm function right near the bottom change


    $coupon_info = $this->model_checkout_coupon->getCoupon($code);



    $coupon_info = $this->model_checkout_coupon->getCoupon($code,1);

Here is the VQMod xml file:

<?xml version="1.0" encoding="utf-8"?>
<id>Fix Coupon Codes (so they register after using paypal or similar payment gateway)</id>
<author>Sanjoy Roy </author>
<file name="catalog/model/checkout/coupon.php">
<search position="replace"><![CDATA[ public function getCoupon($code) { ]]></search>
<add><![CDATA[ public function getCoupon($code, $verify = true) { ]]></add>
<search position="replace"><![CDATA[ if ($status) { ]]></search>
<add><![CDATA[ if ($status || $verify === false) { ]]></add>

<file name="catalog/model/total/coupon.php">
<search position="replace"><![CDATA[ $coupon_info = $this->model_checkout_coupon->getCoupon($code); ]]></search>
<add><![CDATA[ $coupon_info = $this->model_checkout_coupon->getCoupon($code, false); ]]></add>

Combining animation and ActionScript using Flash Professional CS5 and Flash Builder 4

Adobe Configuration Error 130:10

Configuration Error 130:10

How to bypass Apache password protected directories without showing popup login

.htaccess for CMSMS

 Options +FollowSymLinks
 DirectoryIndex index.htm index.html index.php
 Options -Indexes 
  order allow,deny
  deny from all 
 ErrorDocument 403 /forbidden403.shtml
 ServerSignature Off

.htaccess for creloaded or osCommerce root

Options +FollowSymLinks
DirectoryIndex index.htm index.html index.php
RewriteEngine On
# proc/self/environ? no way!
RewriteCond %{QUERY_STRING} proc/self/environ [OR]
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*(.*) [OR]
# Block out any script that includes a  tag in URL
RewriteCond %{QUERY_STRING} (|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
php_flag register_long_arrays On
php_flag register_globals On 
php_flag display_errors Off
php_value session.use_trans_sid 0
php_value register_globals 1
php_flag display_errors On
php_flag track_errors Off

www redirect issues Fix

How to change to

if ($_SERVER['HTTP_HOST'] != '') header('Location:' . $_SERVER['REQUEST_URI']);

If we use the cart, the cookies will be stored differently if we don’t use it. So, it will be always storing under domain Applied for the client SHE Lights.

%d bloggers like this: