<?php header('Cache-Control: no-cache'); header('Pragma: no-cache'); include "../_util/Sesion.php"; $objSesion = new Sesion(); if (!isset($_SESSION['username']) && !isset($_SESSION['userid'])) { header("Location: ../login/logout.php"); } include "../_util/Datos.php"; $dirses = new Sesion(); $dirses->setVariableSession("dir", ""); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>INSERTAR BANNER </title> <!-- include para formulario --> <script type="text/javascript" src="../js/jquery_1.5.2.js" ></script> <script type="text/javascript" src="../js/ajaxupload.3.5.js" ></script> <script type="text/javascript" src="../js/uploader3.js" ></script> <script type="text/javascript" src="../javascripts/jquery.js"></script> <script type="text/javascript" src="../javascripts/parsley.js"></script> <script type="text/javascript" src="../javascripts/_util.js"></script> <link rel="stylesheet" type="text/css" href="../stylesheets/bootstrap.css"/> <link rel="stylesheet" type="text/css" href="../stylesheets/forms.css"/> <link rel="stylesheet" type="text/css" href="../stylesheets/styles.css" /> <!-- fin include para formulario -->
<?php /******************************************************************************** * This script is brought to you by Vasplus Programming Blog * Website: www.vasplus.info * Email: info@vasplus.info *********************************************************************************/ include "../_util/Sesion.php"; $dirses = new Sesion(); $uploaded_files_location = '../../convocatorias/'; //This is the directory where uploaded files are saved on your server $final_location = $uploaded_files_location . basename($_FILES['file_to_upload']['name']); /****************************************************** 1. recuperar el id del banner 2. hacer un selec a la tabla y traer el nombre del banner = ../imgs_banner/foto1.jpg 3. @unlink($uploaded_files_location); 4. update a la tabla banner = foto2222.jpg ******************************************************/ if (move_uploaded_file($_FILES['file_to_upload']['tmp_name'], $final_location)) { //Here you can save the uploaded file to your database if you wish before the success message below echo "file_uploaded_successfully"; $dirses->setVariableSession("dir", basename($_FILES['file_to_upload']['name'])); } else { echo "file_upload_was_unsuccessful"; }
<?php include "../_util/Sesion.php"; $objSesion = new Sesion(); $username = $objSesion->getVariableSession("username"); $userid = $objSesion->getVariableSession("userid"); if (!isset($username) && !isset($userid)) { include "../_util/Mysql.php"; $objMysql = new Mysql(); try { $sql = "SELECT usuario,clave,idusuario FROM " . DB_PREFIJO . "_usuarios WHERE usuario='" . $_POST['login_username'] . "' && clave='" . md5($_POST['login_userpass']) . "' LIMIT 0,1"; $rs = $objMysql->ejecutar($sql); $num_rows = $rs->rowCount(); if ($num_rows == 1) { $user = $rs->fetch(PDO::FETCH_ASSOC); $objSesion->setVariableSession("username", $user['usuario']); $objSesion->setVariableSession("userid", $user['idusuario']); echo 1; } else { echo 0; } } catch (PDOException $exc) { print $exc->__toString(); echo 0; } } else { echo 0; }