Posts

Showing posts from November, 2009

How to make suggetion box using ajax in php from database onchange event

Image
Hell Friends Here is the example to get data from database using ajax in php (autocomplete) This is the front page viewable to the user. Here is the input box that get input by the user and showData function take the request and send it to the getdata.php file via ajax and send response to the user. index.php <html> <head> <title>autocomplete | Home</title> <script type="text/javascript"> var xmlhttp; function showData(str) { xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Browser does not support HTTP Request"); return; } var url="getdata.php"; url=url+"?q="+str; url=url+"&sid="+Math.random(); xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(nodata); } function stateChanged() { if (xmlhttp.readyState == 4) { document.getElementById("txtHint").innerHTML=xmlhttp.resp...

Check username availability from database in php using jQuery

Hell Friends here is an example to Check username availability from database in php using jQuery. This will be done with three steps. First create a file " index.php " or whatever you want. Create a " user_availability.php ". Create database named "test" and table named "login". What is jquery? JQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. index.php( This is the file from where you will input username ) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Username availability Checking using jQuery</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script src="jquery-1....

Ajax login Form using Moo Tool

Image
Hello Friends I have created an Ajax login application with Moo Tool. What is Moo Tool? MooTools is a  compact ,  modular ,  Object-Oriented  JavaScript framework designed for the intermediate to advanced JavaScript developer. It allows you to write  powerful ,  flexible , and  cross-browser  code with its elegant, well documented, and  coherent API . Some Screen Shots are here of it. This is the main login page. This is the page after logged in by user. If you want download it, please Click here

select all checkboxes in single check

<html> <title> select all checkboxes in single check </title>  <head>  <script language=javascript> checked=false; function checkedAll (form1) {     var aa= document.getElementById('form1');      if (checked == false)           {            checked = true           }         else           {           checked = false           }     for (var i =0; i < aa.elements.length; i++)     {      aa.elements[i].checked = checked;     }       } </script </head>  <body> <form name="form1" meth...

How to do autorefresh using javascript

If you want to refresh your page automatically after loading the page <html> < head> < script type="text/JavaScript"> function timedRefresh(timeoutPeriod) { setTimeout("location.reload(true);",timeoutPeriod); } < /script> < /head> < body onload="JavaScript:timedRefresh(5000);"> This page will refresh every 5 seconds. Here we are using the "onload" event to call our function. We are passing in the value '5000', which equals 5 seconds. < /body> < /html > I f you want to refresh a page " on click ", type the following code as:- < a href="javascript:location.reload(true)" > Refresh this page < /a >

how to use explode function in php

Here is the example to use explode function on an array fetched from database values separated by comma ( , ) and count duplicate values also. First create database " your database" and a table named "blog". Enter some data a:- For first row- insert following data---   Ankit, Om For second row- insert following data---   Ankit, Ajeet, Santosh. After that create a php page and paste following coding and change username, password and database name . <table cellpadding="0" cellspacing="0" class="backcolor" style="border: 1px solid rgb(204, 204, 204);"> <?php mysql_connect('localhost','Username','Password'); mysql_select_db('database_name'); $sql = "select tag from blog"; $result = mysql_query($sql)or die('Error in get blog detail'.mysql_error()); $toTagArray = array(); $i=0; while($tag = mysql_fetch_row($result)){ $TagArray = explode(",", $tag[0]); ...

How to ban an IP address or site name using .htaccess

Ban using IP address. These are sample IP addresses... 42.12.5.34 193.110.145.185 Code For .htaccess: <Limit GET POST> order allow,deny deny from 42.12.5.34 deny from 193.110.145.185 allow from all </Limit> To ban using site name. Do NOT include the "http://www." portion! These are sample site names:... domain.com abc.com ## SITE REFERRER BANNING RewriteEngine on # Options +FollowSymlinks RewriteCond %{HTTP_REFERER} domain\.com [NC,OR] RewriteCond %{HTTP_REFERER} abc\.com [NC] RewriteRule .* - [F]

How to enable right click on site that is disabled

In Fierfox Got to the menu bar, click on Tool menu and go to the "Option" and click here. Click on "content" . Click on "advanced" button. Uncheck the "Disable or replace context menus". Refresh the page , right click will work. In Internet Explorer   Go to "Internet Options"    Click the "Security" tab Click "Custom Level"   S croll down to the "Scripting" section   Set "Active Scripting" to "disable"   Click "Ok" a couple of times.

How to disable the right click

<html> <head> <script> var isNS = (navigator.appName == "Netscape") ? 1 : 0; if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP); function mischandler(){ return false; } function mousehandler(e){ var myevent = (isNS) ? e : event; var eventbutton = (isNS) ? myevent.which : myevent.button; if((eventbutton==2)||(eventbutton==3)) return false; } document.oncontextmenu = mischandler; document.onmousedown = mousehandler; document.onmouseup = mousehandler; </script> </head> <body></body> </html>

How to add Your Blogspot Blog Sitemap to Google Webmaster Tools

 First open the Google Webmaster Tools website at google.com/webmasters and click "Add a Site" button to submit You can either type the web address (URL) of your blogspot.com blog or even a self-hosted blog where you are using the Blogger platform with your personal domain. Google will ask you to verify that you are the owner of this blog. Just copy-paste the given meta code and then paste this information into the template of your blog. You must switch to the "HTML" version of your blog template and paste the code just between the head . ........tag  Go back to Google Webmaster Tools and click on "Sitemaps" from the right sidebar. Type the url atom.xml ?redirect=false otherwise you can write atom.xml it will also work. Once the clock status icon changes to a green tick, your Blogger sitemap has been successfully submitted to Google for indexing. If you are using Feed Burner for your Blogger RSS feed, then redirect=false paramater will force to ...

StringList class and use of it

This class can be used to manage lists of strings. It can take a list of strings separated by line breaks and extracts key value pairs separated by the = character.The class can return the list of strings as an array, add more strings to the list, and save or load the list from a file. stringlist_class.php class StringList{ private $Values=array(); private $Text; private $Lines=array(); /** * It's constructor func * * @param mixed $string String you want parse. * @return StringList */ public function StringList($string){ $this->Text=$string; $this->Lines=explode("\n",$string); $Count=count($this->Lines); Foreach ($this->Lines As $LineText){ $EsitPos=strpos($LineText,'='); $this->Values[substr($LineText,0,$EsitPos)]=substr($LineText,$EsitPos+1,strlen($LineText)); } return $this; } /** * Return The Text Or Set Text (ReCreate Object). * * @param mixed $SetTex it will change if it...

Now PHP at IBM

Now the greate news for PHP developersis that:-  IBM has created a mainframe version of  PHP , that widely used for scripting-language software that lets servers create Web pages on the fly from information stored in a database. The company published the work on its AlphaWorks Web site for research projects it wants others to try out.  The software requires version 1.6 or later of the z/OS mainframe operating system. The software uses version 5.1.2 of PHP.

Microsoft burrow into PHP

Open-source initiatives at Microsoft are important to the open-source community because they give developers greater exposure for their products through access to a broadly adopted platform... But that's only part of the Web battle. Web scripting languages like PHP have been heavily influential in developing the Web, and today, PHP and its clan are largely hardwired for MySQL, not Microsoft's SQL Server.

My First Blog

Hi viewers                 This is my first blog. I am starting it to give you the updates and any type of help on latest computer technology. So please follow me to get daily update.