| Current Path : /var/www/html/mmishra/indem/iiita/ |
| Current File : /var/www/html/mmishra/indem/iiita/telephone.php |
<script language="javascript">
function GetXmlHttpObject() {
var xmlHttp=null;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
} catch (e) {
// Internet Explorer
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
function showHint(str) {
if (str.length<3) {
document.getElementById("txtHint").innerHTML="";
return;
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null) {
alert ("Your browser does not support AJAX!");
return;
}
var url="telephones.php?pname="+str;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged() {
if (xmlHttp.readyState==4) {
document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
}
}
</script>
<form>
<b>Search</b> telephone directory by name <input type="text" name='pname' size='30' id="txt1" onkeyup="showHint(this.value)">
<br>
Please type name or part of name (at least 3 charaters).
Visit the profiles for more information about persons.
</form>
<span id="txtHint"></span>
<br><br><center><hr width='50%'></center><br>
<b>Directory List:</b> Click the first alphabet of person's name you are looking for.
Total number of persons with each alphabet is indicated inside the bracket.
<br>
<script>
frmStatic.pname.focus();
</script>
<?php
echo "<center>";
$pname = strtolower(htmlsafe(trim($_REQUEST["pname"])));
$rs = mysql_query("select upper(left(full_name,1)) alpha, count(full_name) no from profiles group by lower(left(full_name,1))");
while($o = mysql_fetch_object($rs)) {
if (strtoupper($pname) == $o->alpha)
echo "| <b>$o->alpha ($o->no)</b> |";
else
echo "| <a href='$PHP_SELF?conf=$conf&mode=search&pname=$o->alpha'>$o->alpha ($o->no)</a> |";
}
echo "</center><br>";
if ($pname) {
$rs = mysql_query("select * from profiles where lower(full_name) like '$pname%' order by full_name");
if ($rs) {
$count = mysql_num_rows($rs);
echo "<b>Phone No. found: $count</b>";
echo "<table width='90%' class=normal border=0 cellspacing=4 cellpadding=4>
<tr><th>Name</th><th>Designation</th><th>Phone No.</th><th>Email</th><th>Webpage</th></tr>";
while ($o = mysql_fetch_object($rs)) {
$i++;
if ($i % 2) echo "<tr bgolor='silver'>"; else echo "<tr>";
echo "<td><a href='inner.php?conf=profiles&id=$o->login'>$o->title $o->full_name</a></td>
<td>$o->designation</td><td>$o->phone_no</td>
<td>$o->email</td><td>$o->webpage</td></tr>";
}
echo "</table>";
}
}
?>