Saturday, January 19, 2013

Active Directory Authentication for APACHE Web Server

For authenticating users against their Active Directory account in APACHE Web Server, you have to edit the /etc/apache2/httpd.conf .

Notes

  1. You should bind some other common AD account with LDAP
  2. Provide LDAP URL of you Domain Controller . Here I assume the Domain is DC.EXAMPLE.COM and IP of the Domain Controller is 192.168.40.1 .
  3. I am binding with another account guest@example.com . So give FQDN of this acount .
  4. You should enable the authnz_ldap module for apache.

Sunday, January 13, 2013

PHP-MySQLi Class

What is MySQLi

MySQLi (MySQL improved) is a driver used in PHP to access MySQL databases. PHP 5.5.0 deprecate the use of old mysql driver and it gives warning that old driver will be removed in the future versions. Also it recommends the use of MySQLi or PDO_MySQL extension.

PHP-MySQLi Class

https://github.com/ajillion/PHP-MySQLi-Database-Class/blob/master/MysqliDb.php provides a good PHP class for MySQLi, MySqliDb Class . Go get the code. Now import the Class into your project:

String to MySQL date format in PHP

String to Date in PHP

Sometimes when I export some MS Excel/ MS Access data to MySQL , It is required to convert some date in string to MySQL compatible date format. You can use DateTime class to convert the string to date in any format you want. The code is below.
function _mk_date($str)
{
 $temp = new DateTime($datestr);
 return date_format($temp, 'Y-m-d');
}

Tuesday, January 08, 2013

Configuring BSNL MTNL Internet on D-Link Wireless N 300 ADSL2+ (DSL-2750U) Router

New year wishes to all.
In this new year, the first thing i bought from Flipkart is a Dlink router/modem. They provided some CD along with the product. When i started to run the application in it , It got stuck at some stage. So i tried the usual way i configure a router . So i thought of sharing this so that it may help someone.


Configuring The modem

Physical set up

  1. Unpack your router. Connect the power adapter and switch on. Now the power led will be lit
  2. Connect a LAN cable from your computer to one of the four yellow LAN ports. And see whether the corresponding LED start blinking
  3. Now wait sometime so that the router will assign an IP to your computer.