Friday, 7 July 2017

smtp mail using phpmailer and zoho

<?php

require_once('class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 3;
$mail->SMTPAuth = true;
$mail->Host = "smtp.zoho.com";
$mail->Port = 465;
$mail->SMTPSecure = 'ssl';
$mail->Username = "fullmail@domain.com";
$mail->Password = "12345678";


$mail->SetFrom('fullmail@domain.com', 'Web App');
$mail->Subject = "A Transactional Email From Web App";
$mail->MsgHTML('test');
$mail->AddAddress('fullemail', 'name');
if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}

Friday, 4 December 2015

importing parent stylesheet in child theme css

@import url("../Parallax-One/style.css");

Monday, 17 August 2015

Usefull linux commands

Recursively Zip a Directory and Files on Linux

zip -r filename.zip /path/to/folder
to unzip to current directory,
unzip file.zip -d .
To get the size of directory
 du -sh dirname 

Monday, 22 December 2014

A quick way to generate lorelm ipsum text

I created a small application using appspot to generate lorelm ipsum text quickly and add free one.

http://quicklorem.appspot.com/

I think i will explain you how i created and it will be helpful for others to learn appospot's initials.

Thursday, 24 July 2014

Friday, 25 January 2013

slow ssh connection on ubuntu

Simply edit sshd_config  by typing

 >> sudo vim /etc/ssh/sshd_config

Add the line to the bottom of file

UseDNS no




Restart the ssh service


>> sudo service ssh reload

After this it will not delay for ssh login.

Tuesday, 31 July 2012

Monday, 25 June 2012

Wordpress - set the large image size in editor

The large image size will be depend on the global variable $content_width.


Even if we change the settings in the media settings to a bigger one, we have to put the width to $content_width.


  In functions.php inside the active theme folder, 
   change like this,
   


if ( ! isset( $content_width ) ) 
$content_width = 754;







Monday, 23 April 2012

Javascript array length problem

There is a problem in javascript array.length property.

var myOtherArray = [];
myOtherArray[100] = ‘one’;
and its length property would actually return 101 instead of 1.


Use this function  for correct result ,
function count(array)
{
   var c = 0;
   for(i in array) // in returns key, not object
   if(array[i] != undefined)
   c++;
   return c;
}

Sunday, 23 October 2011

Speech recognition search introduced by google

The new feature had started functioning.

I said "USB" to google.
that resulted



Thursday, 13 October 2011

recurring payment code for paypal using php with NVP

This is a quick code for creating recurring profile on paypal using PHP with NVP

<?php

$environment = 'sandbox'; // or 'beta-sandbox' or 'live'

/**
 * Send HTTP POST Request
 *
 * @param string The API method name
 * @param string The POST Message fields in &name=value pair format
 * @return array Parsed HTTP Response body
 */
function PPHttpPost($methodName_, $nvpStr_) {
 global $environment;

 $API_UserName = urlencode('API Username');
 $API_Password = urlencode('API Password');
 $API_Signature = urlencode('API Signature');
 $API_Endpoint = "https://api-3t.paypal.com/nvp";
 
 if("sandbox" === $environment || "beta-sandbox" === $environment) {
  $API_Endpoint = "https://api-3t.$environment.paypal.com/nvp";
 }
 $version = urlencode('51.0');

 // setting the curl parameters.
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
 curl_setopt($ch, CURLOPT_VERBOSE, 1);

 // turning off the server and peer verification(TrustManager Concept).
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch, CURLOPT_POST, 1);

 // NVPRequest for submitting to server
 $nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";

 // setting the nvpreq as POST FIELD to curl
 curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

 // getting response from server
 $httpResponse = curl_exec($ch);

 if(!$httpResponse) {
  exit("$methodName_ failed: ".curl_error($ch).'('.curl_errno($ch).')');
 }

 // Extract the RefundTransaction response details
 $httpResponseAr = explode("&", $httpResponse);

 $httpParsedResponseAr = array();
 foreach ($httpResponseAr as $i => $value) {
$tmpAr = explode("=", $value);
if(sizeof($tmpAr) > 1) {
$httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];
}
}

if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
}

return $httpParsedResponseAr;
}

/*--------------------*/
// Collect the payment info

// Set request-specific fields.
$firstName = urlencode('sajin');
$lastName = urlencode('tm');
$creditCardType = urlencode('Visa');
$creditCardNumber = urlencode('4824255179800020');
$expDateMonth = '10';
// Month must be padded with leading zero
$padDateMonth = urlencode(str_pad($expDateMonth, 2, '0', STR_PAD_LEFT));

$expDateYear = urlencode('2016');
$cvv2Number = urlencode('');
$address1 = urlencode('address 1');
$address2 = urlencode('address 2');
$city = urlencode('United States ');
$state = urlencode('New York');
$zip = urlencode('13355');
$country = urlencode('US');    // US or other valid country code
$amount = urlencode('12');
$currencyID = urlencode('USD');       // or other currency ('GBP', 'EUR', 'JPY', 'CAD', 'AUD')
/*--------------------*/


$token = urlencode("");
$paymentAmount = urlencode("12");
$currencyID = urlencode("USD");      // or other currency code ('GBP', 'EUR', 'JPY', 'CAD', 'AUD')
$startDate = urlencode("2011-12-12T0:0:0");
$billingPeriod = urlencode("Month");    // or "Day", "Week", "SemiMonth", "Year"
$billingFreq = urlencode("1");      // combination of this and billingPeriod must be at most a year
$desc = urlencode('desc sample');
$nvpStr="&CREDITCARDTYPE=$creditCardType&ACCT=$creditCardNumber&EXPDATE=$padDateMonth$expDateYear&FIRSTNAME=$firstName&LASTNAME=$lastName&AMT=$paymentAmount&CURRENCYCODE=$currencyID&PROFILESTARTDATE=$startDate";
$nvpStr .= "&BILLINGPERIOD=$billingPeriod&BILLINGFREQUENCY=$billingFreq&DESC=$desc";

$httpParsedResponseAr = PPHttpPost('CreateRecurringPaymentsProfile', $nvpStr);
echo "
";
if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
exit('CreateRecurringPaymentsProfile Completed Successfully: '.print_r($httpParsedResponseAr, true));
} else  {
exit('CreateRecurringPaymentsProfile failed: ' . print_r($httpParsedResponseAr, true));
}
echo "
"; ?>

The output in normal case will be

CreateRecurringPaymentsProfile Completed Successfully: Array
(
    [PROFILEID] => I%2dK1EXE5JU3JCC
    [TIMESTAMP] => 2011%2d10%2d23T13%3a30%3a55Z
    [CORRELATIONID] => a2133526075
    [ACK] => Success
    [VERSION] => 51%2e0
    [BUILD] => 2183220
)

Monday, 27 June 2011

regular expression for checking the text without specified extension

Hi ,
This regular expression example is useful to check whether our SQL queries accidentally contain database name ,

like, "SELECT purchases.* from shopdatabase.purchases" .

For finding and removing the database names from sql ,
use regular expression pattern " shopdatabase\.[^(com|php)] "
where the " com|php " is the extensions we want to avoid.

Tuesday, 8 March 2011

adding single selection of radio button in asp.net grid column on click

Hi ,
This is the control code for the radio button




Then add the following javascript code

Tuesday, 22 February 2011

zencart email debug

For debugging emails in zencart,
use this , in includes\functions\functions_email.php
if (!defined('EMAIL_SYSTEM_DEBUG')) define('EMAIL_SYSTEM_DEBUG','5');

Saturday, 18 December 2010

Me at cricet match


Pic during our first match

Technopark roundabout


A view from the top of tejaswini building

Tuesday, 14 December 2010

Block unethickal sites using free Microsoft software

Hi,
Please save our kids and ourselves by installing this free Microsoft software from unethical websites.
See http://explore.live.com/windows-live-family-safety-xp

Monday, 13 December 2010

Delete Joomla sample data using SQL

Please take a backup of the database if you have any reusable data in tables.

This is the screen shot after a fresh installation of Joomla.




After executing the following query , the page will look like this.


Remeber if you had entered any additional data other than default , then it may deleted.

Run the following SQL queries.

TRUNCATE TABLE `jos_banner`;
TRUNCATE TABLE `jos_bannerclient`;
TRUNCATE TABLE `jos_bannertrack`;
TRUNCATE TABLE `jos_categories`;
TRUNCATE TABLE `jos_content`;
TRUNCATE TABLE `jos_content_frontpage`;
TRUNCATE TABLE `jos_newsfeeds`;
TRUNCATE TABLE `jos_polls`;
TRUNCATE TABLE `jos_poll_data`;
TRUNCATE TABLE `jos_poll_date`;
TRUNCATE TABLE `jos_sections`;
TRUNCATE TABLE `jos_weblinks`;
TRUNCATE TABLE `jos_contact_details`;
TRUNCATE TABLE `jos_menu`;
INSERT INTO `jos_menu` VALUES (1, 'mainmenu', 'Home', 'home', 'index.php?option=com_content&view=frontpage', 'component', 1, 0, 20, 0, 1, 0, '0000-00-00 00:00:00', 0, 0, 0, 3, 'num_leading_articles=1\nnum_intro_articles=4\nnum_columns=2\nnum_links=4\norderby_pri=\norderby_sec=front\nshow_pagination=2\nshow_pagination_results=1\nshow_feed_link=1\nshow_noauth=\nshow_title=\nlink_titles=\nshow_intro=\nshow_section=\nlink_section=\nshow_category=\nlink_category=\nshow_author=\nshow_create_date=\nshow_modify_date=\nshow_item_navigation=\nshow_readmore=\nshow_vote=\nshow_icons=\nshow_pdf_icon=\nshow_print_icon=\nshow_email_icon=\nshow_hits=\nfeed_summary=\npage_title=\nshow_page_title=1\npageclass_sfx=\nmenu_image=-1\nsecure=0\n\n', 0, 0, 1);
TRUNCATE TABLE `jos_modules`;

INSERT INTO `jos_modules` VALUES (1, 'Main Menu', '', 1, 'left', 0, '0000-00-00 00:00:00', 1, 'mod_mainmenu', 0, 0, 1, 'menutype=mainmenu\nmoduleclass_sfx=_menu\n', 1, 0, '');
INSERT INTO `jos_modules` VALUES (2, 'Login', '', 1, 'login', 0, '0000-00-00 00:00:00', 1, 'mod_login', 0, 0, 1, '', 1, 1, '');
INSERT INTO `jos_modules` VALUES (3, 'Popular','',3,'cpanel',0,'0000-00-00 00:00:00',1,'mod_popular',0,2,1,'',0, 1, '');
INSERT INTO `jos_modules` VALUES (4, 'Recent added Articles','',4,'cpanel',0,'0000-00-00 00:00:00',1,'mod_latest',0,2,1,'ordering=c_dsc\nuser_id=0\ncache=0\n\n',0, 1, '');
INSERT INTO `jos_modules` VALUES (5, 'Menu Stats','',5,'cpanel',0,'0000-00-00 00:00:00',1,'mod_stats',0,2,1,'',0, 1, '');
INSERT INTO `jos_modules` VALUES (6, 'Unread Messages','',1,'header',0,'0000-00-00 00:00:00',1,'mod_unread',0,2,1,'',1, 1, '');
INSERT INTO `jos_modules` VALUES (7, 'Online Users','',2,'header',0,'0000-00-00 00:00:00',1,'mod_online',0,2,1,'',1, 1, '');
INSERT INTO `jos_modules` VALUES (8, 'Toolbar','',1,'toolbar',0,'0000-00-00 00:00:00',1,'mod_toolbar',0,2,1,'',1, 1, '');
INSERT INTO `jos_modules` VALUES (9, 'Quick Icons','',1,'icon',0,'0000-00-00 00:00:00',1,'mod_quickicon',0,2,1,'',1,1, '');
INSERT INTO `jos_modules` VALUES (10, 'Logged in Users','',2,'cpanel',0,'0000-00-00 00:00:00',1,'mod_logged',0,2,1,'',0,1, '');
INSERT INTO `jos_modules` VALUES (11, 'Footer', '', 0, 'footer', 0, '0000-00-00 00:00:00', 1, 'mod_footer', 0, 0, 1, '', 1, 1, '');
INSERT INTO `jos_modules` VALUES (12, 'Admin Menu','', 1,'menu', 0,'0000-00-00 00:00:00', 1,'mod_menu', 0, 2, 1, '', 0, 1, '');
INSERT INTO `jos_modules` VALUES (13, 'Admin SubMenu','', 1,'submenu', 0,'0000-00-00 00:00:00', 1,'mod_submenu', 0, 2, 1, '', 0, 1, '');
INSERT INTO `jos_modules` VALUES (14, 'User Status','', 1,'status', 0,'0000-00-00 00:00:00', 1,'mod_status', 0, 2, 1, '', 0, 1, '');
INSERT INTO `jos_modules` VALUES (15, 'Title','', 1,'title', 0,'0000-00-00 00:00:00', 1,'mod_title', 0, 2, 1, '', 0, 1, '');

TRUNCATE TABLE `jos_modules_menu`;
INSERT INTO `jos_modules_menu` VALUES (1,0);
TRUNCATE TABLE `jos_menu_types`;
INSERT INTO `jos_menu_types` VALUES (1, 'mainmenu', 'Main Menu', 'The main menu for the site');
TRUNCATE TABLE `jos_templates_menu`;

# Dumping data for table `jos_templates_menu`
INSERT INTO `jos_templates_menu` VALUES ('rhuk_milkyway', '0', '0');
INSERT INTO `jos_templates_menu` VALUES ('khepri', '0', '1');

Friday, 29 October 2010

drupal view system implementation

http://drupal.org/project/module_template_system

Monday, 18 October 2010

http://gftp.seul.org/

gFTP is a free multithreaded file transfer client for *NIX based machines. It has the following features:

* Distributed under the terms of the GNU Public License Agreement
* Written in C and has a text interface and a GTK+ 1.2/2.x interface
* Supports the FTP, FTPS (control connection only), HTTP, HTTPS, SSH and FSP protocols
* FTP and HTTP proxy server support
* Supports FXP file transfers (transferring files between 2 remote servers via FTP)
* Supports UNIX, EPLF, Novell, MacOS, VMS, MVS and NT (DOS) style directory listings
* Bookmarks menu to allow you to quickly connect to remote sites
* Fully Internationalized. The following translations of gFTP that are available: Albanian (sq), Amharic (am), Arabic (ar), Azerbaijan (az), Bangla (bn), Belarusian (be), Bulgarian (bg), Catalan (ca), Chinese (zh_CN,zh_HK,zh_TW), Croatian (hr), Czech (cs), Danish (da), Dutch (nl), Dzongkha (dz), English (en_CA, en_GB, en_US), Finnish (fi), French (fr), Galician (gl), German (de), Greek (el), Gujarati (gu), Hebrew (he), Hungarian (hu), Irish (ga), Italian (it), Kinyarwanda (rw), Korean (ko), Japanese (ja), Latvian (lv), Lithuanian (lt), Macedonian (mk), Malayalam (ml), Malay (ms), Nepali (ne), Norwegian (no), Norwegian bokmål (nb), Occitan (oc), Polish (pl), Portuguese (pt,pt_BR), Punjabi (pa), Romanian (ro), Russian (ru), Serbian (sr,sr@Latn), Slovak (sk), Spanish (es), Swedish (sv), Tamil (ta), Thai (th), Turkish (tr) and Ukrainian (uk) translations available.