Files
agc_2-X/LANG_www/vicidial_el/listloaderMAIN.php
T
mattf 7d8b8f48da Updated non-English Administrative interface translations and static builds
git-svn-id: svn://192.168.202.10@1808 3d104415-ff17-0410-8863-d5cf3c621b8a
2012-04-20 20:02:35 +00:00

108 lines
3.2 KiB
PHP

<?php
# listloaderMAIN.php
#
# Copyright (C) 2012 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
#
# this is the main frame page for the lead loading section. This is where you
# would upload a file and have it inserted into vicidial_list
#
# changes:
# 60620-1149 - Added variable filtering to eliminate SQL injection attack threat
# 60822-1105 - fixed for nonwritable directories
# 90508-0644 - Changed to PHP long tags
# 120223-2151 - Removed logging of good login passwords if webroot writable is enabled
#
require("dbconnect.php");
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
$PHP_SELF=$_SERVER['PHP_SELF'];
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active,user_territories_active FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
$i=0;
while ($i < $qm_conf_ct)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$webroot_writable = $row[1];
$SSoutbound_autodial_active = $row[2];
$user_territories_active = $row[3];
$i++;
}
##### END SETTINGS LOOKUP #####
###########################################
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$STARTtime = date("U");
$TODAY = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$FILE_datetime = $STARTtime;
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if ($webroot_writable > 0) {$fp = fopen ("./project_auth_entries.txt", "a");}
$date = date("r");
$ip = getenv("REMOTE_ADDR");
$browser = getenv("HTTP_USER_AGENT");
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\"");
Header("HTTP/1.0 401 Unauthorized");
echo "Ακυρο Ονομα Χρήστη/Κωδικός Πρόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
else
{
header ("Content-type: text/html; charset=utf-8");
if($auth>0)
{
$office_no=strtoupper($PHP_AUTH_USER);
$password=strtoupper($PHP_AUTH_PW);
$stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGload_leads =$row[0];
if ($LOGload_leads < 1)
{
echo "You do not have permissions to load leads\n";
exit;
}
if ($webroot_writable > 0)
{
fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n");
fclose($fp);
}
}
else
{
if ($webroot_writable > 0)
{
fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n");
fclose($fp);
}
}
}
?><HTML>
<HEAD>
<TITLE>VICIDIAL: Υπομονάδα εισαγωγής οδηγών</TITLE>
</HEAD>
<FRAMESET ROWS="300,*" border=0>
<FRAME SRC="listloader.php" NAME="main">
<FRAME SRC="count.htm" NAME="lead_count">
</HTML>