Categories
linux PHP Technology

How to debug if phpinfo() is Disabled ?

Some server (hosting) providers choose to disable the PHP function phpinfo() for security reasons or say vulnerability in PHP 5.3 CVE-2014-4721, because it displays information which can be used to compromise the server that your site is running on. phpinfo() outputs almost every information about PHP’s configuration, such as the values of PHP directives, loaded extensions and environment variables.

In cases where phpinfo() is disabled, debugging problems in PHP is much more difficult. But, even though phpinfo() is disabled, you can still find that information using php’s core functions:

<?php
//PHP directives
echo ini_get(upload_max_filesize); // 2M

//Extensions/modules
print_r(get_loaded_extensions());

//Environment variables
print_r($_ENV);

//PHP or extension version
echo phpversion(); // 5.3.26
echo phpversion('pdo_mysql'); // 1.0.2
?>

In case you have SSH access to the server, “php -i” can also be used to get PHP configuration settings. For example, to get the configuration for the PDO – MySQL extension:

$ php -i|grep pdo_mysql

Or to get the version of PHP:

$ php -v

Though you can get lot of information without need of enabling phpinfo() but still if you want to enable it, learn “How to Enable and disable phpinfo()“.

'Coz sharing is caring
Categories
Javascript PHP

jQuery Watermark shadow effect on Input box

How to create watermark / shadow effect on Input type textbox? How to get watermark using jQuery ?

using jQuery watermark on input box
You can add default text on form elements that look like watermarks or work as placeholders. Using jQuery and bit of CSS rules, you can easily achieve the watermark effect. This is very handy if you want to prevent unwanted information to be sent to the server, as can happen with the default watermark text. It’s really very simple using jQuery. There is no need to write long Javascript function to check the value and populating default text onblur/onfocus/onclick/onchange… etc.

A simple jQuery example to show you how to implement a watermark text effect on an input field.

Just follow three steps and it’s done.

1) Create textbox in your HTML file

<input type="text" name="zipCode" id="zipCode" value="Enter Zip Code" />

2) Create CSS class for Dim effect (watermarking theme)

.watermarkEffectText {
    color : #9B9B9B;
}

3) Javascript code

$( document ).ready(function() {
	// apply class
	$("#zipCode").addClass("watermarkEffectText")

	// set default value (If you've not assigned in HTML, else skip this line) 

	// assigning in HTML doesn't wait for DOM load, and reflects immediately
	.val("Enter Zip Code")

	// on gaining focus
	.focus(function() {

		if( $(this).val() == "Enter Zip Code" ) { // remove default value
			// remove class and value
			$(this).removeClass("watermarkEffectText").val("");
		}
	})
	// on loosing focus
	.blur(function() {
		if($(this).val() == "") {
			// set default value with watermark effect
			$(this).val("Enter Zip Code").addClass("watermarkEffectText");
		}
	});
});

1, 2, 3… it’s as simple to achieve watermark effect.

'Coz sharing is caring