File: /home/austral3d/fourdplan.com/php/subir_excel.php
<?php
//INICIO VARIABLE SESION0
session_start();
if ($_SESSION == NULL ){
session_destroy();
echo'<script>
alert("Acceso denegado.")
self.location="../index.php"
</script>';
}
//coneccion servidor y base de datos
require('conexion.php');
//$con_fecha_actualizacion = mysql_query();
$consulta_rol = mysql_query("select usuario_id, proyecto_id, rol_id from Permisos where usuario_id = '".$_SESSION['id']."'");
$array_rol = mysql_fetch_array($consulta_rol);
//consula para obtener id de usuario segun el nombre de la sesion iniciada
$con_id_usu = mysql_query("select empresa_id from Usuario where id= '".$array_rol['usuario_id']."'");
$emid = mysql_fetch_array($con_id_usu);
$decimales = 2;
if($array_rol['rol_id'] == 2){
$consul = mysql_query("Select * from Proyecto");
$array = mysql_fetch_array($consul);
$consula = mysql_query("Select * from Proyecto");
$consulta_id_proy = mysql_query("Select * from Proyecto");
$array_id = mysql_fetch_array($consulta_id_proy);
$consulta_assembly = mysql_query("select * from Assembly where proyecto_id = '".$array_id['id']."'");
//$consul_toneladas = mysql_query("select P.id, ");
}else{
$consul = mysql_query("Select * from Proyecto where empresa_id = '".$emid['empresa_id']."'");
$consula = mysql_query("Select * from Proyecto where empresa_id = '".$emid['empresa_id']."'");
$array = mysql_fetch_array($consul);
$consulta_id_proy = mysql_query("Select * from Proyecto where empresa_id = '".$emid['empresa_id']."'");
$array_id = mysql_fetch_array($consulta_id_proy);
$consulta_assembly = mysql_query("select * from Assembly where proyecto_id = '".$array_id['id']."'");
}
if(empty($_GET['lenguaje'])){
$lenguaje = false;
}else{
$lenguaje = $_GET['lenguaje'];
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Fourdplan</title>
<link href="../css/bootstrap.min.css" rel="stylesheet">
<meta charset="UTF-8">
<link href="../css/sti.css" rel="stylesheet">
<link rel="icon" href="../img/fdp.ico">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<style type="text/css">
.scrollable-menu {
height: auto;
max-height: 200px;
overflow-x: hidden;
}
</style>
</head>
<body>
<div class="content">
<!-- menu barra negra superior -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" ><img src="../img/logo90x19.png" class="img" /></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<?php
if($lenguaje){
?>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="../index.php?lenguaje=true"><span class="glyphicon glyphicon-home" aria-hidden="true"></span> Inicio</a></li>
</ul>
<!--Derecha barra-->
<ul class="nav navbar-nav navbar-right">
<?php require("barrasuperior.php");?>
<!--li role="presentation"><a href="#"> <span class="label label-primary">(0) <img src="../img/correo.png" /></span></a></li-->
<li role="presentation"><a><span class="glyphicon glyphicon-user" aria-hidden="true"></span> <?php if($_SESSION){echo $_SESSION['nombre'];}?></a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-list" aria-hidden="true"></span><span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="cerrar_session.php">Cerrar sesion</a></li>
<li><a href="subir_excel.php">Ingles</a></li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
<?php
}else{
?>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="../index.php"><span class="glyphicon glyphicon-home" aria-hidden="true"></span> Home</a></li>
</ul>
<!--Derecha barra-->
<ul class="nav navbar-nav navbar-right">
<?php require("barrasuperior.php");?>
<!--li role="presentation"><a href="#"> <span class="label label-primary">(0) <img src="../img/correo.png" /></span></a></li-->
<li role="presentation"><a><span class="glyphicon glyphicon-user" aria-hidden="true"></span> <?php if($_SESSION){echo $_SESSION['nombre'];}?></a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-list" aria-hidden="true"></span><span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="cerrar_session.php">Log Out</a></li>
<li><a href="subir_excel.php?lenguaje=true">Spanish</a></li>
</ul>
</li>
</ul>
</div>
<?php
}
?>
</div><!-- /.container-fluid -->
</nav>
<br><br><br>
<br><br><br>
<br>
<div class="container-fluid">
<div class="container">
<center><h3><b><?php if($lenguaje){echo "SELECCIONE ARCHIVO .CSV DE PRODUCCIÓN";}else{echo "SELECT .CSV INPUT FILE";}?></b></h3></center>
</div>
<div class="container">
<br>
<?php
if($lenguaje){
?>
<div class="container">
<div class="list-group col-xs-10 col-md-4 col-md-offset-4">
<center>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="fileToUpload" id="fileToUpload">
<br>
<input type="submit" class="btn btn-primary" value="Subir" name="submit">
</form>
</center>
</div>
</div>
<div class = "col-md-6 col-md-offset-3" style="background-color:#c7c7c7">
<br>
<center>
<a href="http://www.fourdplan.com/produccion/excels/excel_base.csv">Descargar excel_base.csv</a> <span>(Click derecho -> Guardar como...)</span>
<br>
<a href="http://www.fourdplan.com/webservices/RevertirData.php">Revertir última subida</a>
</center>
<br>
</div>
<?php
}else{
?>
<div class="container" >
<div class="list-group col-xs-10 col-md-4 col-md-offset-4">
<center>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="fileToUpload" id="fileToUpload">
<br>
<input type="submit" class="btn btn-primary" value="Upload" name="submit">
</form>
</center>
</div>
</div>
<div class = "col-md-6 col-md-offset-3" style="background-color:#c7c7c7">
<br>
<center>
<a href="http://www.fourdplan.com/produccion/excels/excel_base.csv">Download excel_base.csv</a> <span>(Right click -> Save as...)</span>
<br>
<a href="http://www.fourdplan.com/webservices/RevertirData.php">Revert last update</a>
</center>
<br>
</div>
<?php
}
?>
</div>
<br>
<br>
</div>
</div>
<!-- pie de pagina-->
<div><?php require("pie.php");?><div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/highcharts.js"></script>
<script src="../js/modules/exporting.js"></script>
<script src="../js/modules/data.js"></script>
</body>
</html>