Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - Drakaris

#231
PHP / Cambiar mes por mes en calendario php.
27 Febrero 2017, 16:49 PM
Hola,tengo un calendario php.


<?php

$week 1;


for ($i=1$i<=date('t'); $i++) { 

$day_week date('N'strtotime(date('Y-m').'-'.$i));

$calendar [$week] [$day_week] = $i;

if ($day_week == 7) { $week++; };

?>

<?php
$Nombre_mes date("F");
$Nombre_año date("Y");
?>

<!DOCTYPE html>
<html>
<head>

</head>

<body>

<table border="4" id="calendar" style="border: solid; border-color: #B45F04; background-color: #F7D358; font-family: segoe script;">

<thead>
<tr>
<td><center><input type="button" name="previousbutton" style="width:40px; cursor: pointer;" value="<<"></center></td>
<td colspan="5"><center><b><?php echo $Nombre_mes."&nbsp;de&nbsp;".$Nombre_año?></b></center></td>
<td><center><input type="button" name="nextbutton" style="width:60px; cursor: pointer;" value=">>"></center></td>
</tr>
<tr>
<td><center><b>Lunes</b></center></td>
<td><center><b>Martes</b></center></td>
<td><center><b>Mi&eacute;rcoles</b></center></td>
<td><center><b>Jueves</b></center></td>
<td><center><b>Viernes</b></center></td>
<td><center><b>S&aacute;bado</b></center></td>
<td><center><b>Domingo</b></center></td>
</tr>
</thead>
<tbody>
<?php foreach($calendar as $days) :?>
<tr>
<?php  for ($i=1;$i<=7;$i++) :?>
<td>
<?php  echo isset($days[$i]) ? $days[$i] : ''?>
</td>
<?php  endfor; ?>
</tr>
<?php endforeach ?>
</tbody>
</table>
</body>
</html>


Tengo arriba dos botones para cambiar los meses (mes por mes, y cuando se acaba los meses, cambia a un año más y atrás) y lo tengo que hacer pero no se como hacerlo, me ayudé de un vídeo pero no me funciona, no sé como buscarlo en google, y lo busco pero no encuentro.

Gracias
#232
Cita de: Skynet en 27 Febrero 2017, 01:18 AM
Gracias por la ayuda... ya no sabia que pensar

Denada, para esto estamos aquí, para ayudarnos entre todos y aprender
#233
Hola la solución es que cuando pones texto en el lenguaje html, con acentos, al abrirlo en el navegador, el ordenador no lo lee

ej: (Tu pones este texto en el editor de html)

Editor de Html
<font>Tengo más de 30 años</font>

En el navegador no lee los acentos

Navegador:

Tengo mÃs de 30 años

Sale Ã

Tienes que poner códigos cada palabra con acento ya sea abierto o cerrado van con códigos

Editor de html
<font>Tengo m&aacute;s de 30 años</font>
Navegador
Tengo más de 30 años

Aquí una lista de códigos de caracteres especiales para html: http://ascii.cl/es/codigos-html.htm

Espero haberte ayudado  :)
#234
La solución fue:


<?php

$week 1;


for ($i=1$i<=date('t'); $i++) { 

$day_week date('N'strtotime(date('Y-m').'-'.$i));

$calendar [$week] [$day_week] = $i;

if ($day_week == 7) { $week++; };

?>

<?php
$Nombre_mes date("F");
$Nombre_año date("Y");
?>

<!DOCTYPE html>
<html>
<head>
<script>
function goLastMonth(month, year){
if (month == 1) {
--year;
month = 12;
}
document.location.href = "<?php $_SERVER['PHP_SELF'];?>?month="+month+"&year="+year;
}

function goNextMonth(month, year){
if (month == 12) {
++year
month = 1;
}
document.location.href = "<?php $_SERVER['PHP_SELF'];?>?month="+month+"&year"+year;
}
</script>
</head>

<body>

<table border="4" id="calendar" style="border: solid; border-color: #B45F04; background-color: #F7D358; font-family: segoe script;">

<thead>
<tr>
<td><center><input type="button" name="previousbutton" onclick="goLastMonth(<?php echo $month.",".$year ?>)" style="width:40px; cursor: pointer;" value="<<"></center></td>
<td colspan="5"><center><b><?php echo $Nombre_mes."&nbsp;de&nbsp;".$Nombre_año?></b></center></td>
<td><center><input type="button" name="nextbutton" onclick="goNextMonth(<?php echo $month.",".$year ?>)" style="width:60px; cursor: pointer;" value=">>"></center></td>
</tr>
<tr>
<td><center><b>Lunes</b></center></td>
<td><center><b>Martes</b></center></td>
<td><center><b>Mi&eacute;rcoles</b></center></td>
<td><center><b>Jueves</b></center></td>
<td><center><b>Viernes</b></center></td>
<td><center><b>S&aacute;bado</b></center></td>
<td><center><b>Domingo</b></center></td>
</tr>
</thead>
<tbody>
<?php foreach($calendar as $days) :?>
<tr>
<?php  for ($i=1;$i<=7;$i++) :?>
<td>
<?php  echo isset($days[$i]) ? $days[$i] : ''?>
</td>
<?php  endfor; ?>
</tr>
<?php endforeach ?>
</tbody>
</table>
</body>
</html>
#235
Bases de Datos / Hola, me podrían ayudar?
25 Febrero 2017, 19:59 PM
Hola estoy haciendo un calendario php mysql, ayudandome de un video.

https://www.youtube.com/watch?feature=player_embedded&v=T0y32_nEbys

hay un paso en que tienes que hacer "el contenido del calendario" los días en números.

Lo hice bien pero cuando lo subo a mi servidor el resultado no es el mismo.
la imagen esta en el enlace
https://drive.google.com/file/d/0B6mh5xJztGS9bHZrd0tJNDA5cTg/view?usp=sharing

<style>
   table.calendar{
       border: solid;
       border-color: #B45F04;
       background-color: #F7D358;
       font-family: segoe script;
   }
</style>
<html lang="es">
   <head>

   </head>
   <body>
   <?php
     
if (isset($_GET['day'])) {
       
$day $_GET['day'];
      }else{
       
$day date("j");
      }

     if (isset(
$_GET['month'])) {
       
$month $_GET['month'];
      }else{
       
$month date("n");
      }

     if (isset(
$_GET['year'])) {
       
$year $_GET['year'];
      }else{
       
$year date("Y");
      }
    
     
//calender variable
     
$currentTimeStamp strtotime("$year-$month-$day");
     
$monthName date("F"$currentTimeStamp);
     
$numDays date("t"$currentTimeStamp);
     
$counter 0;
    
?>

          <table border="1" class="calendar">
                  <tr>
                      <td><input width="50px" type="button" value="<" name="previousbutton" style="cursor: pointer;"></td>
                      <td colspan="5"><center><b><?php echo $monthName ."&nbsp;de&nbsp;".$year ?></b></center></td>
                      <td><input  width="50px" type="button" value=">" name="nextbutton" style="cursor: pointer;"></td>
                  </tr>
                  <tr>
                      <td width="50px"><center><b>Lunes</b></center></td>
                      <td width="50px"><center><b>Martes</b></center></td>
                      <td width="50px"><center><b>Mi&eacute;rcoles</b></center></td>
                      <td width="50px"><center><b>Jueves</b></center></td>
                      <td width="50px"><center><b>Viernes</b></center></td>
                      <td width="50px"><center><b>S&aacute;bado</b></center></td>
                      <td width="50px"><center><b>Domingo</b></center></td>
                  </tr>
                  <?php 
                        
echo "<tr>";

                        for (
$i 1$i $numDays+1$i++, $counter++) { 
                          
$timeStamp strtotime("$year-$month-$i");
                          if (
$i == 1) {
                            
$firstDay date("w"$timeStamp);
                            for(
$j 0$j $firstDay$j++, $counter++) { 
                             
//black space
                             
echo "<td>&nbsp;</td>";
                            } 
                          }
                         if (
$counter == 0) {
                           echo 
"<tr></tr>";
                           echo 
"<td align='center'>".$i."</td>";
                          }
                        }
                        echo 
"</tr>";
                   
?>

          </table>
   </body>
</html>


No sé lo que está mal lo revisé todo dos veces y no sé donde está el fallo.

Gracias.
#236
Hola estoy haciendo un calendario php mysql, ayudandome de un video.

https://www.youtube.com/watch?feature=player_embedded&v=T0y32_nEbys

hay un paso en que tienes que hacer "el contenido del calendario" los días en números.

Lo hice bien pero cuando lo subo a mi servidor el resultado no es el mismo.
la imagen esta en el enlace
https://drive.google.com/file/d/0B6mh5xJztGS9bHZrd0tJNDA5cTg/view?usp=sharing

<style>
   table.calendar{
       border: solid;
       border-color: #B45F04;
       background-color: #F7D358;
       font-family: segoe script;
   }
</style>
<html lang="es">
   <head>

   </head>
   <body>
   <?php
     
if (isset($_GET['day'])) {
       
$day $_GET['day'];
      }else{
       
$day date("j");
      }

     if (isset(
$_GET['month'])) {
       
$month $_GET['month'];
      }else{
       
$month date("n");
      }

     if (isset(
$_GET['year'])) {
       
$year $_GET['year'];
      }else{
       
$year date("Y");
      }
    
     
//calender variable
     
$currentTimeStamp strtotime("$year-$month-$day");
     
$monthName date("F"$currentTimeStamp);
     
$numDays date("t"$currentTimeStamp);
     
$counter 0;
    
?>

          <table border="1" class="calendar">
                  <tr>
                      <td><input width="50px" type="button" value="<" name="previousbutton" style="cursor: pointer;"></td>
                      <td colspan="5"><center><b><?php echo $monthName ."&nbsp;de&nbsp;".$year ?></b></center></td>
                      <td><input  width="50px" type="button" value=">" name="nextbutton" style="cursor: pointer;"></td>
                  </tr>
                  <tr>
                      <td width="50px"><center><b>Lunes</b></center></td>
                      <td width="50px"><center><b>Martes</b></center></td>
                      <td width="50px"><center><b>Mi&eacute;rcoles</b></center></td>
                      <td width="50px"><center><b>Jueves</b></center></td>
                      <td width="50px"><center><b>Viernes</b></center></td>
                      <td width="50px"><center><b>S&aacute;bado</b></center></td>
                      <td width="50px"><center><b>Domingo</b></center></td>
                  </tr>
                  <?php 
                        
echo "<tr>";

                        for (
$i 1$i $numDays+1$i++, $counter++) { 
                          
$timeStamp strtotime("$year-$month-$i");
                          if (
$i == 1) {
                            
$firstDay date("w"$timeStamp);
                            for(
$j 0$j $firstDay$j++, $counter++) { 
                             
//black space
                             
echo "<td>&nbsp;</td>";
                            } 
                          }
                         if (
$counter == 0) {
                           echo 
"<tr></tr>";
                           echo 
"<td align='center'>".$i."</td>";
                          }
                        }
                        echo 
"</tr>";
                   
?>

          </table>
   </body>
</html>


No sé lo que está mal lo revisé todo dos veces y no sé donde está el fallo.

Gracias.
#237
Hola no se mucho para prevenir ataques SQL, puse un CAPTCHA y me gustaria poner
Código :
mysql_real_escape_string que es para escapar los caracteres especiales, eso que significa? Significa que impide los caracteres como comillas simples ('), comillas dobles ("), barras inclinadas (/). y que más?

Como lo podría usar? Me podrían dar un ejemplo?

Gracias.
#238
Hola. Al fin pude hacerlo!!

Muchas gracias por vuestras respuestas

;-) ;-)
#239
Hola hice lo que me dijo y no me funcionó, me pone lo mismo, que esta los datos enviado correctamente pero que en PHPMyAdmin me sale el mensaje, lo devuelve, no se porque :huh:

<?php
//Recibir los datos y almacenarlos en variables
include 'conectar.php';
$data $_POST["ardata"];
$materia $_POST["armateria"];
$tarea $_POST["artarea"];
//consulta para insertar
$insertar "INSERT INTO 1esoa(Data, Materia, Tarea)VALUES('$data','$materia','$tarea')";
$verificar_usuario mysql_query($conexion"SELECT * FROM 1esoa WHERE Data = '$data'");
if(
mysqli_num_rows($verificar_usuario)> 0){
echo 'La data ya se esta puesta';
exit;
}
//Ejecutar consulta
$resultado mysqli_query($conn$insertar);
if(!
resultado){
echo 'Error al insertar los datos';
echo '<a href="form3.php">Volver</a>';
}else{
echo 'Los datos se han insertado correctamente';
echo '<a href="form3.php">Volver</a>';
}
//Cerrar conexion
mysqli_close($conn);
?>
#240
Sí, lo tenía bien, cuando yo puse el código entre [/b] y lo publico al publicarlo se pone el código en la "cajita" y predeterminadamente los códigos como mysqli_query,mysqli_num_rows,mysql_close... por un enlace que lleva a www.php.net.
Gracias por la respuesta, pero me sigue sin funcionar, no se si es por el código o por un problema de PHPMyAdmin

No entiendo cuando dice que no debe ir allí, a que se refiere, debería ir a otro sitio?
Gracias.