Tuesday, July 31, 2007

Simple AJAX script


function ajaxFunction(x)
  {
  var xmlHttp;
  try
    {
      xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
 
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
   
    }
   
    xmlHttp.onreadystatechange=function()
      {
     
       if(xmlHttp.readyState==4)
           alert(xmlHttp.responseText);
   
       
      }
   
    xmlHttp.send(null);
    var url="http://localhost/sajjad/ajax.php"+"?q="+document.compose.recv.value;
   xmlHttp.open("GET",url,true);
  }

Wednesday, July 25, 2007

download a file withoutshowing its url

php program

header('Content-type: application/'.$fileext);
header('Content-Disposition: attachment; filename="'.$file_name.'"');
readfile("softwares/".$file_name);

MysqlWord searching

SELECT * FROM articles WHERE MATCH (title,body)
-> AGAINST ('*apple*' IN BOOLEAN MODE);

so that we would get back results:

appleby
appleseed
bigapple
redapple