Overhaul of Spanish Agent and Admin language translations based on new contributed language files Overhaul of Dutch Agent translation, and added contributed images git-svn-id: svn://192.168.202.10@2126 3d104415-ff17-0410-8863-d5cf3c621b8a
146 lines
4.4 KiB
PHP
146 lines
4.4 KiB
PHP
<?php
|
|
# voicemail_check.php version 2.8
|
|
#
|
|
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
|
#
|
|
# This script is designed purely to check whether the voicemail box on the server defined has new and old messages
|
|
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
|
#
|
|
# required variables:
|
|
# - $server_ip
|
|
# - $session_name
|
|
# - $user
|
|
# - $pass
|
|
# optional variables:
|
|
# - $format - ('text','debug')
|
|
# - $vmail_box - ('101','1234',...)
|
|
#
|
|
#
|
|
# changes
|
|
# 50422-1147 - First build of script
|
|
# 50503-1241 - added session_name checking for extra security
|
|
# 50711-1201 - removed HTTP authentication in favor of user/pass vars
|
|
# 60421-1147 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
|
# 60619-1204 - Added variable filters to close security holes for login form
|
|
# 90508-0727 - Changed to PHP long tags
|
|
# 130328-0025 - Converted ereg to preg functions
|
|
# 130603-2202 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
|
# 130802-1038 - Changed to PHP mysqli functions
|
|
#
|
|
|
|
require_once("dbconnect_mysqli.php");
|
|
require_once("functions.php");
|
|
|
|
### If you have globals turned off uncomment these lines
|
|
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
|
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
|
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
|
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
|
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
|
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
|
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
|
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
|
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
|
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
|
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
|
|
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
|
|
|
|
$user=preg_replace("/[^0-9a-zA-Z]/","",$user);
|
|
$pass=preg_replace("/[^0-9a-zA-Z]/","",$pass);
|
|
$session_name = preg_replace("/\'|\"|\\\\|;/","",$session_name);
|
|
$server_ip = preg_replace("/\'|\"|\\\\|;/","",$server_ip);
|
|
|
|
# default optional vars if not set
|
|
if (!isset($format)) {$format="text";}
|
|
|
|
$version = '0.0.7';
|
|
$build = '130328-0025';
|
|
$StarTtime = date("U");
|
|
$NOW_DATE = date("Y-m-d");
|
|
$NOW_TIME = date("Y-m-d H:i:s");
|
|
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
|
|
|
$auth=0;
|
|
$auth_message = user_authorization($user,$pass,'',0,0,0);
|
|
if ($auth_message == 'GOOD')
|
|
{$auth=1;}
|
|
|
|
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
|
{
|
|
echo "Ikke gyldigt Brugernavn/Password: |$user|$pass|$auth_message|\n";
|
|
exit;
|
|
}
|
|
else
|
|
{
|
|
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
|
{
|
|
echo "Ikke gyldigt server_ip: |$server_ip| or Ikke gyldigt session_name: |$session_name|\n";
|
|
exit;
|
|
}
|
|
else
|
|
{
|
|
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
|
if ($DB) {echo "|$stmt|\n";}
|
|
$rslt=mysql_to_mysqli($stmt, $link);
|
|
$row=mysqli_fetch_row($rslt);
|
|
$SNauth=$row[0];
|
|
if($SNauth==0)
|
|
{
|
|
echo "Ikke gyldigt session_name: |$session_name|$server_ip|\n";
|
|
exit;
|
|
}
|
|
else
|
|
{
|
|
# do nothing for now
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($format=='debug')
|
|
{
|
|
echo "<html>\n";
|
|
echo "<head>\n";
|
|
echo "<!-- VERSION: $version BUILD: $build VMBOX: $vmail_box server_ip: $server_ip-->\n";
|
|
echo "<title>Voicemail check";
|
|
echo "</title>\n";
|
|
echo "</head>\n";
|
|
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
|
}
|
|
|
|
$MT[0]='';
|
|
$row=''; $rowx='';
|
|
if (strlen($vmail_box)<1)
|
|
{
|
|
$channel_live=0;
|
|
echo "voicemail box $vmail_box er ikke valid\n";
|
|
exit;
|
|
}
|
|
else
|
|
{
|
|
$stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;";
|
|
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
|
$rslt=mysql_to_mysqli($stmt, $link);
|
|
$vmails_list = mysqli_num_rows($rslt);
|
|
$loop_count=0;
|
|
while ($vmails_list>$loop_count)
|
|
{
|
|
$loop_count++;
|
|
$row=mysqli_fetch_row($rslt);
|
|
echo "$row[0]|$row[1]";
|
|
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
|
}
|
|
}
|
|
|
|
|
|
if ($format=='debug')
|
|
{
|
|
$ENDtime = date("U");
|
|
$RUNtime = ($ENDtime - $StarTtime);
|
|
echo "\n<!-- skriptets tidsforbrug: $RUNtime sekunder -->";
|
|
echo "\n</body>\n</html>\n";
|
|
}
|
|
|
|
exit;
|
|
|
|
?>
|