October 28, 2015

jQuery - Validation set custom message.



Add this code in a separate script included after the validation plugin to override the messages:

jQuery.extend(jQuery.validator.messages, {
    required: "This field is required.",
    remote: "Please fix this field.",
    email: "Please enter a valid email address.",
    url: "Please enter a valid URL.",
    date: "Please enter a valid date.",
    dateISO: "Please enter a valid date (ISO).",
    number: "Please enter a valid number.",
    digits: "Please enter only digits.",
    creditcard: "Please enter a valid credit card number.",
    equalTo: "Please enter the same value again.",
    accept: "Please enter a value with a valid extension.",
    maxlength: jQuery.validator.format("Please enter no more than {0} characters."),
    minlength: jQuery.validator.format("Please enter at least {0} characters."),
    rangelength: jQuery.validator.format("Please enter a value between {0} and {1} characters long."),
    range: jQuery.validator.format("Please enter a value between {0} and {1}."),
    max: jQuery.validator.format("Please enter a value less than or equal to {0}."),
    min: jQuery.validator.format("Please enter a value greater than or equal to {0}.")
});

For more read see <a href="http://stackoverflow.com/questions/2457032/jquery-validation-change-default-error-message" target='_blank'>Here:</a>

Enjoy!





October 23, 2015

PHP - Dynamic IP block script.



Please enter the following script in header file of your site which call in all pages for e.g. header.php file,

And also define IP addressed which you want to redirect to another page/link,

Example

<?php $blacklist = array("111.222.333", "444.555.666", "777.888.999");

if(in_array($_SERVER['REMOTE_ADDR'], $blacklist)) {

header("Location: http://sitename.com/404");

exit();
} ?>

Enjoy!

October 15, 2015

Magento - The PDO extension is required for this adapter but the extension is not loaded.



When I upload site live from my local server and getting such kind of error that the PDO extension is required for this adapter but the extension is not loaded.

So I think that the pdo.so php extension must be required in server. And first check in php.ini file If you have access of that file.

;extension=pdo_mysql.so

Please uncomment the above line to activate it

extension=pdo_mysql.so

Save the file and restart the server.


If you have no access of the php.ini file, follow the following steps

Step 1. Please check your Magento installation directory there must me a file named as php.ini.sample.

Step 2. Now rename the file from php.ini.sample to php.ini

Step 3. Put the below code into it

extension = pdo.so
extension = pdo_sqlite.so
extension = sqlite.so
extension = pdo_mysql.so

Step 4. Now refresh your browser cache and the problem has been solved.


Enjoy!

Magento - 1050 Table 'adminnotification_inbox' already exists.




Oho, I already face this type of bug in past,

Here I post solution of this bug: Please check in you database


Drop Table if exists 'adminnotification_inbox'

When you drop this table then magento again create this default new table,

Enjoy!

Integrating Google reCAPTCHA v3 in HTML Form with PHP

  What is Google reCAPTCHA v3? Google reCAPTCHA is a free service that helps protect websites from spam and abuse. reCAPTCHA v3 is the lates...