Saturday, June 25, 2011

Ajax to PHP

     If you are planing to develop a real time web application or a web based tool, you may use javascripts or action scripts. In javascripts you can only develop only client side applications. If you want to develop a server side application, like a registration form or login page, then you need to use server side scripting language to do that. Most popular server side scripting languages are PHP,ASP.NET and JSP.

The main disadvantage of the server side scripting languages is you need to submit the entire web page to the server.

Is there any solution ?

Yes, simply you can use jQuery.

How to use jQuery ? where can I find that ?

You can download jQuery (it's not a program, it's a javascript .js file) from their official web site. click here

This is a simple usage of jQuery.



This is the ajax code which calls the php function. You can call this in button click event or any other event.

1. The java script function should be call with a string parameter.

2. You should include the path of the jquery.js inside <script>  tags.

3. make a variable which include the path of .php file. (line 5)

4. In line number 6-8 is the function of jquery.js which makes a html post to the php script.

5. You may see a few parameters in that function.
             url - which explained before
             name - you can directly call $_POST['name'] in php. It will gives                             the  value of param
             param - the parameter should pass to this function when it calls.
             mname - a variable which takes the returning value in php script.

6. line 7, Div1 is the id of a div tag and by calling html().show() function, it's inner html should assign with mname value.



This is the php code, which gets the input from the html page and return the string to the html page. (strrev() is the function which reverse a string).

Wednesday, June 8, 2011

Find them all (nmap usage)

Nmap is a useful port scanner for networking stuff. You can download Nmap from their official site. click here

For linux users, you can directly use your mirror sites to download.

ex: In debian type

# apt-get install nmap

Wanna do something crazy ?



check your current public IP. click here

and type this in your terminal. ( If you are using Windows cmd, type in cmd )



you have to change 192.168.1.0 to your subnetwork address (you can get it from your public IP) and give the range as 255.

If there is no error, the scan should start.

It will show all the public IPs within the range which are up.

PS: This is Nmap Ping Scan - go no further than determining if host is online