Hi I have a little php script that we are using to see calls from any extension number into our company. we get the information from a database. I am trying to put a select box on my php script so I can select the user that I want to see his call. if you see bellow is te actual script and after the page_header there is a option that if I change remote user = to a name and his extension it will appear on the web page. However if i go this way I am going to see just the actual extension number and it will be display for everyone the same estension number. I dont want that. That I want is a selection box that I can choice wich extension and user I can see his calls. Please could you give advice.
<?
//do some required files.
include("$DOCUMENT_ROOT/st
atic/page.
php");
require("/etc/intranet/con
fig.php.in
c");
//print page header
page_header("<a href='/smdr/'>My Calls</a> > My Calls");
$posix_info = posix_getpwnam($REMOTE_USE
R);
$uinfo = split(",",$posix_info['gec
os']);
$EXTEN = ($REMOTE_USER=='john'&&$EX
TEN)?$EXTE
N:6702;
//$EXTEN = ($EXTEN)?$EXTEN:6702;
mysql_connect("localhost",
"wwwdata",
"") || die(show_error($php_errorm
sg));
mysql_select_db("intranet"
) || die(show_error($php_errorm
sg));
$links_result = mysql_query("select TYP, EXT,DATE_FORMAT(END,'%h:%i
%p %b %e') as DATE,DIALED,ELAPSED
from SMDR
where ((EXT=$EXTEN and TYP <> 'RG' ) or ( EXT = '*****' and DIGITS=$EXTEN) or (EXT = '2503' and DIGITS=$EXTEN and TYP <> 'RG' ))
and (END > (CURDATE() - interval 14 day))
order by END desc
");
print "<table align=\"center\" bordercolor=\"#000000\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\">";
print "<tr>";
print "<th> </th>";
print "<th>Number</th>";
print "<th>Duration</th>";
print "<th>Time/Date</th>";
print "</tr>";
print <<<EOF
<script language='JavaScript1.2' type='text/javascript'>
function pop(PHONENO){
MM_openBrWindow('soap.php?
PHONENO='+
PHONENO,'s
oap','widt
h=350,heig
ht=50');
}
</script>
EOF;
while ($CALLS = mysql_fetch_array($links_r
esult))
{
print "<tr align=center>";
if ($CALLS[EXT] == '*****'){
print "<td><img src=missed.png alt='Missed call'></td>";
}elseif ($CALLS[EXT] == '2503'){
print "<td><img src=vm.png alt='Voicemail'></td>";
}elseif ($CALLS[TYP] == 'IN'){
print "<td><img src=in.png alt='Incomming'></td>";
}else {
print "<td><img src=out.png alt='Outgoing'></td>";
}
$CALLS[DIALED] = preg_replace("/^1{1}-/",""
,$CALLS[DI
ALED]);
if ($CALLS[DIALED]=="3333"){
$CALLS[DIALED] = "500-000-$CALLS[DIALED]";
}
if (strlen($CALLS[DIALED])==4
){
$CALLS[DIALED] = "500-000-$CALLS[DIALED]";
}
if (strlen($CALLS[DIALED])==8
){
$CALLS[DIALED] = "516-$CALLS[DIALED]";
}
$PHONENO = preg_replace("/\D+/","",$C
ALLS[DIALE
D]);
print "<td>$CALLS[DIALED] <img src=info.png alt='Get caller info' onClick='pop($PHONENO)'></
td>";
// if ($CALLS[ELAPSED]<60){
// print "<td>$CALLS[ELAPSED]\"</td
>";
// } else {
print "<td>".intval($CALLS[ELAPS
ED]/60)."'
".($CALLS[ELAPSED]%60)."\"
</td> ";
// }
print "<td>$CALLS[DATE]</td>";
print "</tr>\n";
};
print "</table>";
//print page footer
page_footer();
?>
Start Free Trial