<% @Language="JScript" %> <% Response.Expires = 0; // Make browser not cache pg. Response.Buffer = true; // Buffer content. var application_title="Addressbook ASP by Pappu"; var dbName="paddress.mdb"; // database file name var db="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" + Server.Mappath(dbName); var pViewPageSize=5; /* ##################################################### # Address book Application by Mahbubur Rahman Pappu. I tried to associate # # features as much as possible right now. I love JavaScript , so this ASP # # application is done with JavaScript. Any Problems or Suggestion-- please # # Email me at pappu@inbox.net. Oh O. this script do not have copyright. But # # if you use this in some commercial purpose, you must ask me. # ##################################################### ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ Function below shows paging navigation of the ^ ^ results found from the query ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ function showPageNavigator(totalRecords,currentPage,totalPages,href,reqParams){ var pStr=""; var lastPagesRecords=(currentPage==totalPages) ? totalRecords : totalPages*pViewPageSize-totalRecords; var fromRecords=currentPage*pViewPageSize-pViewPageSize+1; var toRecords=0; if(currentPage==totalPages){ toRecords=lastPagesRecords; } else{ toRecords=currentPage*pViewPageSize; } if(parseInt(totalRecords)==1){ pStr="[ Showing reco" +"rd "+totalRecords+" of "+totalRecords+" ]  \n"; } else{ pStr="[ Showing reco" +"rds "+fromRecords+" - "+toRecords+" of "+totalRecords+" ]  \n"; } var backNavigator=(currentPage>1) ? "<< " : ""; var forwardNavigator=(currentPage>>" : ""; pStr+=backNavigator; for(var i=1; i"+i+" \n" } pStr+=" |\n"+forwardNavigator; return pStr; } /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ This function displays message in a nice ^ ^ graphic window. ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ function showMessage(caption,contents){ var pStr=""; pStr+="\n\n\n\n\n\n\n\n\n" +"\n\n\n \n\n\n\n \n \n \n\n
\n"+caption+"\n\n
\n\n" +"\n
"+contents+"
\n" +"\n
 
" return pStr; } /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ Function below shows alphabet based navigation of the ^ ^ results found from the query ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ function showAlphabetList(requestURL){ var pStr=""; var currLetter=""; var pRecord=""; var letters="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var activeLinkLetters=new Array(); var pRecordSet=Server.CreateObject("Adodb.Recordset"); var pSQL="SELECT first_name FROM pAddressTable ORDER by first_name ASC"; pRecordSet.Open(pSQL,db); pRecordSet.moveFirst(); while(!pRecordSet.EOF){ pRecord=String(pRecordSet.fields("first_name")).toUpperCase(); p=pRecord.charAt(0); if(!activeLinkLetters.keyExists(p)) activeLinkLetters.push(p); pRecordSet.moveNext(); } pRecordSet.close(); activeLinkLetters.sort(); for(i=0; i"+letters.charAt(i)+"<\/a> \n"; } else{ pStr+=""+letters.charAt(i)+"<\/font> \n"; } } return pStr; } // Just adding a search form on the page function showSearchBox(targetURL,search_box_text){ var pStr=""; pSearch_text_value=search_box_text || ""; pStr+="
  
"; return pStr; } // This function writes the search results in a division function showSearchResult(res){ var pStr=""; pStr="
"+res+"<\/div>"; return pStr; } // Stripping bad characters from search phrase cuz they create troubles // in SQL queries. function filter_content(input_text){ input_text=input_text.replace(/\\/g,""); input_text=input_text.replace(/\*/g,""); input_text=input_text.replace(/\{/g,""); input_text=input_text.replace(/\}/g,""); input_text=input_text.replace(/\^/g,""); input_text=input_text.replace(/\[/g,""); input_text=input_text.replace(/\]/g,""); input_text=input_text.replace(/\`/g,""); input_text=input_text.replace(/\$/g,""); input_text=input_text.replace(/\?/g,""); input_text=input_text.replace(/\+/g,""); input_text=input_text.replace(/\./g,""); return input_text; } /* ********************************************************************* ****** This function below shows up a nice logon panel for the administrator ***** ****** of the address book. Graphics-in Fireworks and totally by me ***** ********************************************************************* */ function show_logon(){ var pStr=""; pStr="
\n\n\n\n\n\n\"\"\n\n\n\n\n\n\n\n\n\n\n\n
\nUser Name ::
Password ::
&nbs" +"p; 
\n\n\n \n \n\n\"\"\n\n"; return pStr; } function logout(){ Session("valid_user")=false; Response.redirect("index.asp"); } //**************** Array and String custom METHODS ******************** //****************** Array.push() method not by me ********************** String.prototype.trim=function(){ // Remove traling white spaces var s=this.replace(/^\s+/g,""); return s.replace(/\s+$/g,"") }; function isUndefined(property) { return (typeof property == 'undefined'); } Array.prototype.keyExists=function(key){ var result=false; for(var i=0; i
Make your own free website on Tripod.com