Magento – get client’s IP

To get customer’s IP, behind a proxy or not, you can use this build in function in magento

 Mage::app()->getRequest()->getClientIp(true);

refers to lib/Zend/Controller/Request/Http.php

 /**
     * Get the client's IP addres
     *
     * @param  boolean $checkProxy
     * @return string
     */
    public function getClientIp($checkProxy = true)
    {
        if ($checkProxy && $this->getServer('HTTP_CLIENT_IP') != null) {
            $ip = $this->getServer('HTTP_CLIENT_IP');
        } else if ($checkProxy && $this->getServer('HTTP_X_FORWARDED_FOR') != null) {
            $ip = $this->getServer('HTTP_X_FORWARDED_FOR');
        } else {
            $ip = $this->getServer('REMOTE_ADDR');
        }

        return $ip;
    }

Magento – create new table column from installer

TO create a new table columnusing magento installer, you can use this method :

$installer = $this;
$connection = $installer->getConnection();
$installer->startSetup();
  if ($connection->tableColumnExists($this->getTable('adin/slider'), 'image_mobile') === false) {
        $installer->run("ALTER TABLE `{$installer->getTable('adin/slider')}` ADD COLUMN  `image_mobile` VARCHAR(255)  NOT NULL DEFAULT '' ;");
    }
$installer->endSetup();

Gmail & Our system has detected that this message does 550-5.7.1 not meet IPv6 sending guidelines regarding PTR records and 550-5.7.1 authentication.

Your webserver is sending emails but gmail refused them with this message :

Dec 23 08:44:30 extranet postfix/smtp[24387]: F3443907: to=, relay=gmail-smtp-in.l.google.com[2a00:1450:400c:c06::1b]:25, delay=0.32, delays=0.02/0.01/0.19/0.11, dsn=5.7.1, status=bounced (host gmail-smtp-in.l.google.com[2a00:1450:400c:c06::1b] said: 550-5.7.1 [2001:41d0:1008:2b5a::] Our system has detected that this message does 550-5.7.1 not meet IPv6 sending guidelines regarding PTR records and 550-5.7.1 authentication. Please review 550-5.7.1 https://support.google.com/mail/?p=IPv6AuthError for more information 550 5.7.1 . 196si30999080wmg.139 – gsmtp (in reply to end of DATA command))

To fix it add this on your main.cf postfix configuration file :
inet_protocols=ipv4

That’s all