session_start(); //Conexion BB.DD. require "Stock/conexion.php"; //include "Cotizaciones.php"; //require "Stock/integracionWoo.php"; $INTEGRACIONACTIVA = false; function get_content($file,$url,$hours = 1) { $current_time = time(); $expire_time = $hours * 60 * 60; $file_time = filemtime($file); if(file_exists($file) && ($current_time - $expire_time < $file_time)) { //echo 'returning from cached file'; return file_get_contents($file); } else { $content = file_get_contents($url); file_put_contents($file,$content); return $content; } } function ubicacionArticulo($Art) { include "conexion.php"; $result=mysqli_query($conexion, "SELECT Ubicacion FROM stock WHERE ID = '$Art'"); $Articulo = mysqli_fetch_row($result); if ($result) { return $Articulo[0]; } else { return 0; } } //$Coti = 36.5; $Coti = get_content("cotizacion.txt", "http://intranet.proobra.com.uy/cotiexterna.php"); $Cotizacion = (double)$Coti; $_SESSION["Cotizacion"] = $Cotizacion; //Zona Horaria date_default_timezone_set('America/Montevideo'); //Crear Directorios de Logs si NO existen aun. $today = date("d-m-Y"); $month = substr($today, 3, 7); if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/Stock/Logs/Actualizaciones/$month")) { mkdir($_SERVER['DOCUMENT_ROOT'] . "/Stock/Logs/Actualizaciones/$month", 0777, true); } if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/Stock/Logs/Ventas/$month")) { mkdir($_SERVER['DOCUMENT_ROOT'] . "/Stock/Logs/Ventas/$month", 0777, true); } if (!function_exists("dumpLog")) { function dumpLog($String) { $Fecha = date("d-m-Y h:i:s"); $backtrace = debug_backtrace(); $TheFile = $backtrace[1]['file']; $String = "OUTPUT: ".$Fecha." - ".$String." @ ".$TheFile; $file = fopen($_SERVER['DOCUMENT_ROOT'] . "/Stock/Logs/errores.txt", "a"); fwrite($file, $String. PHP_EOL); } } $currentURL = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; $MetodosDePago = array("Visa", "MasterCard", "OCA", "Cabal", "Credisur", "Creditel", "Italcred", "Anda", "American Express", "Diners", "Pass Card", "Tarjeta D", "Transferencia"); //COMPRUEBA QUE EL USUARIO ESTA AUTENTIFICADO if ($currentURL != "https://sac.gcpsoft.com/index.php") { if ($_SESSION["password"] != "alm") { header("Location: ..//index.php"); exit(); } elseif ($_SESSION["password"] == "alm") { if (!isset($_SESSION['Local'])) { header("Location: ..//index.php"); } } } //error_reporting(0); echo "
"; $showing = false; $Locales = array("LOCAL 1", "DEPO 1", "LOCAL 2"); //$Cotizacion = biller\bcu\Cotizaciones::obtenerCotizacion(); //$Cotizacion = biller\bcu\Cotizaciones::obtenerUltimoCierre(); if($_POST['password']){ $User = $_POST['usuario']; $password = $_POST['password']; if ($User&&$password) { $query = mysqli_query($conexion, "SELECT * FROM usuarios WHERE Usuario='$User'"); $numrows = mysqli_num_rows($query); if ($numrows!=0) { while ($row = mysqli_fetch_assoc($query)) { $dbusername = $row['Usuario']; $dbpassword = $row['PW']; $level = $row['LVL']; } } else echo "El usuario $User especificado no existe! - "; } else die("Ingrese usuario y clave!"); if (md5($password) == $dbpassword && $User == $dbusername) { $_SESSION['password'] = "alm"; $_SESSION['miclave73645'] = "$dbpassword"; $_SESSION['user'] = "$User"; $_SESSION['level'] = "$level"; $showing = false; } else { echo "El usuario y clave no coinciden!"; } } if(!$_SESSION['password']){ echo "
|
|
|
|
|