PHP

Difference between php4 and php5 PHP5 introduces many new features, I have mentioned some of them:Unified Constructors and Destructors:
In PHP4, constructors had same name as the class name where In PHP5, you simply need to name your constructors as __construct()

Abstract:
In PHP5 you can declare a class as Abstract.

Startic Methods and properties:
Static methods and properties are also available. When you declare a class member as static, then you can access members using :: operator without  creating an instance of class.


_autoload()
PHP5 introduces a special function called __autoload()

Final:
PHP5 allows you to declare a class or method as Final 

Magic Methods
PHP5 introduces a number of magic methods.
__call, __get, __set and __toString

————————————————————————————————————————————————————–

PHP Server variables :

PHP : $_SERVER[‘PHP_SELF’]

PHP : $_SERVER[‘argv’]

PHP : Super global variable: $argc

PHP : $_SERVER[‘GATEWAY_INTERFACE’]

PHP : $_SERVER[‘SERVER_ADDR’]

PHP : $_SERVER[‘SERVER_NAME’]

PHP : $_SERVER[‘SERVER_SOFTWARE’]

PHP : $_SERVER[‘SERVER_PROTOCOL’]

PHP : $_SERVER[‘REQUEST_METHOD’]

PHP : $_SERVER[‘REQUEST_TIME’]

PHP : $_SERVER[‘QUERY_STRING’]

PHP : $_SERVER[‘HTTP_ACCEPT’]

PHP : $_SERVER[‘HTTP_ACCEPT_CHARSET’]

PHP : $_SERVER[‘HTTP_HOST’]

PHP : $_SERVER[‘HTTP_USER_AGENT’];

PHP : $_SERVER[‘REMOTE_PORT’]

PHP : $_SERVER[‘SCRIPT_FILENAME’]

PHP : $_SERVER[‘SERVER_ADMIN’]

PHP : $_SERVER[‘SERVER_PORT’]

PHP : $_SERVER[‘SERVER_SIGNATURE’]

PHP : $_SERVER[‘PATH_TRANSLATED’]

PHP : $_SERVER[‘SCRIPT_NAME’]

PHP : $_SERVER[‘SCRIPT_URI’]

– See more at: http://www.w3resource.com/php/super-variables/$_SERVER.php#sthash.hKXsezPK.dpuf

————————————————————–

To change the date format :

$payment_date = date(‘Y-m-d H:i:s’,strtotime($_POST[‘payment_date’]));
Dubai Time Zone :
Example : 1
<?php
date_default_timezone_set(‘Asia/Dubai’);
print date(“F d, Y H:i:s”, time())
?>
Example : 2
$timezone = “Asia/Dubai”;
if(function_exists(‘date_default_timezone_set’)) date_default_timezone_set($timezone);
—————————————-
Live server configuration :
This program makes use of the Zend Scripting Language Engine:
  • Linux Server (Apache)
  • PHP Version 5.2.17
  • Mysql Version 5.5.23
  • PHPmyadmin version 3.4.11.1
  • Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
  • With the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and
  • With Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies
  • IonCube Loader Enabled
  • GD Library needs to be installed
  • option to edit php.ini file
  • mod_rewrite Enabled
  • mime_magic.debug – OFF
  • Session Support – Enabled

Java script Validation :

<script type=”text/javascript”>
function team_regform()
{
var Errmsg = true;

if(document.getElementById(“logo”).value == “”)
{
document.getElementById(“err_logo”).style.display = “block”;
document.getElementById(“err_logo”).innerHTML = “Logo field is required”;
document.getElementById(“logo”).focus();
Errmsg = false;
}

if(document.getElementById(“logo”).value != “”)
{
var fup = document.getElementById(‘logo’);
var fileName = fup.value;
var ext = fileName.substring(fileName.lastIndexOf(‘.’) + 1);
if(ext == “gif” || ext == “GIF” || ext == “JPEG” || ext == “jpeg” || ext == “jpg” || ext == “JPG” || ext == “png”)
{
Errmsg = true;
}
else
{
document.getElementById(“err_logo”).innerHTML = “Invalid logo format”;
document.getElementById(“logo”).focus();
Errmsg = false;
}
}

if(document.getElementById(“contact_person”).value == “”)
{
document.getElementById(“err_contact_person”).style.display = “block”;
document.getElementById(“err_contact_person”).innerHTML = “Contact person field is required”;
document.getElementById(“contact_person”).focus();
Errmsg = false;
}

if(document.getElementById(“phone”).value == “”)
{
document.getElementById(“err_phone”).style.display = “block”;
document.getElementById(“err_phone”).innerHTML = “Phone no field is required”;
document.getElementById(“phone”).focus();
Errmsg = false;
}

var checkString = document.getElementById(“phone”).value;
if (checkString != “”)
{
if(!checkString.match(/^[0-9\+\-\(\)]/))
{
document.getElementById(“err_phone”).style.display = “block”;
document.getElementById(‘err_phone’).innerHTML = “Please enter valid contact number”;
document.getElementById(‘phone’).focus();
Errmsg = false;
}
}

if(document.getElementById(“email”).value == “”)
{
document.getElementById(“err_email”).style.display = “block”;
document.getElementById(“err_email”).innerHTML = “Email is required”;
document.getElementById(“email”).focus();
Errmsg = false;
}

if(document.getElementById(’email’).value != “”)
{

var email_id = document.getElementById(’email’);
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter.test(email_id.value))
{
document.getElementById(“err_email”).style.display = “block”;
document.getElementById(‘err_email’).innerHTML = “Please enter valid email”;
document.getElementById(’email’).focus();
Errmsg = false;
}
}

if(document.getElementById(“password”).value == “”)
{
document.getElementById(“err_password”).style.display = “block”;
document.getElementById(“err_password”).innerHTML = “Password is required”;
document.getElementById(“password”).focus();
Errmsg = false;
}

if(document.getElementById(“user_name”).value == “”)
{
document.getElementById(“err_user_name”).style.display = “block”;
document.getElementById(“err_user_name”).innerHTML = “Username is required”;
document.getElementById(“user_name”).focus();
Errmsg = false;
}

if(document.getElementById(“team_name”).value == “”)
{

document.getElementById(“err_team_name”).style.display = “block”;
document.getElementById(“err_team_name”).innerHTML = “Team name is required”;
document.getElementById(“team_name”).focus();
Errmsg = false;
}

if(Errmsg == false)
{
return false;
}
else
{
return true;
}
}

function empty(id)
{
document.getElementById(id).innerHTML = “”;
return true;
}

</script>

———————————————————————————————-

SEO Friendly URL : (Linscan/.htaccess)

Options +FollowSymLinks
RewriteEngine on
RewriteRule index-(.*)-(.*)\.html$ index.php?id=$1&lang=$2
RewriteRule index-(.*)\.html$ index.php?logo=$1
RewriteRule career-(.*)-(.*)\.html$ career.php?id=$1&lang=$2
RewriteRule sitemap-(.*)-(.*)\.html$ sitemap.php?id=$1&lang=$2
RewriteRule sitemap-(.*)\.html$ sitemap.php?id=$1
RewriteRule enquiry-(.*).html$ enquiry.php?id=$1
RewriteRule feedback-(.*)\.html$ feedback.php?id=$1
RewriteRule vision-mission-(.*)-id-(.*)\.html$ vision_mission.php?sno=$1&id=$2
RewriteRule aboutus-(.*)\.html$ who_we_are.php?id=$1
RewriteRule location-map-(.*)\.html$ location_map.php?id=$1
RewriteRule disclaimer-(.*)\.html$ disclaimer.php?id=$1
RewriteRule privacy-policy-(.*)\.html$ privacy_policy.php?id=$1
RewriteRule help-(.*)\.html$ help.php?id=$1
RewriteRule contest-(.*)\.html$ contest_form.php?id=$1
RewriteRule search-(.*)\.html$ search.php?lang=$1
RewriteRule result-(.*)-(.*)\.html$ search_result.php?id=$1&lang=$2
RewriteRule location-map-(.*)\.html$ location_map.php?id=$1
RewriteRule vision-mission-(.*)-(.*)\.html$ vision_mission.php?sno=$1&id=$2
RewriteRule news-press-release-(.*)-(.*)\.html$ news_press_release.php?sid=$1&id=$2
RewriteRule news-press-viewall-(.*)\.html$ news_press_viewall.php?id=$1
RewriteRule (.*)-(.*)-(.*)\.html$ submenu.php?name=$1&id=$2&lang=$3

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s