Ir para conteúdo
Fórum Script Brasil
  • 0

Bug Muito Estranho!


Curioso

Pergunta

Pessoal, estou com um problema bem cabeludo aqui...

Peguei um script na Net chamado PHP Planner que nada mais é do que uma agenda tipo a do Outlook, ela é muito boa e já a uso há muito tempo sem nenhum problema... acontece que agora estou tentando adicionar eventos entre os dias 22 e 31 de Outubro de 2004 e estas datas embora sejam aceitas no cadastro e gravadas no BD (eu conferi) elas não aparecem na página de Outubro!

Notem que como eu disse a agenda funciona há muito tempo, consigo cadastrar datas em dias e meses alternados e ela exibe sem nenhum problema... a não ser este entre os dias 22 e 31 de Outubro de 2004.

Sou iniciante em PHP, mas mesmo assim dei uma olhada no código para ver se tinha alguma referencia ao mês de Outubro (onde está o erro) e não encontrei nenhuma referência...

Vocês poderiam me ajudar?

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 0

Abaixo seguem os códigos das páginas:

Adionar evento:

<?
require("include/calvars.inc");
?>
<html>
<head>
<title>Add Rent</title>
<link rel="stylesheet" href="styles/calstyles.css" type="text/css">
<script SRC="include/functions.js"></SCRIPT>
</head>
<?
$conn=mysql_connect($host,$user,$pwd);
$db=mysql_select_db($db,$conn);

if(isset($addrec) && $addrec == "Add Record")  // 'Add Record' BUTTON CLICKED
{
?>
<body class="popdetail">
<?
  //$dstring = $dstring." ".$TZONE;
  $datestamp = strtotime($dstring);
  if($time_standard == 0) //24 hour time
  {
     $stimestamp = strtotime($ststring);
     $etimestamp = strtotime($etstring);
 }
  else if($time_standard == 1) //12 hour time
  {
      $ststring = $ststring.$saorp;
      $stimestamp = strtotime($ststring);
      $etstring = $etstring.$eaorp;
      $etimestamp = strtotime($etstring);
  }
  if(!isset($resource) || $resource == "")
     $resource = "";
  $sql="INSERT INTO ".$events_table." VALUES ('',".$datestamp.",".$stimestamp.",".$etimestamp.",'".$resource."','".$desc."')";
  mysql_query($sql,$conn) or die("couldn't add<BR>");

  if($recur != "none")
  {
      $i=1;
      while($i < $numrecur)
      {
          if($recur == "daily")
             $nextdstamp = future_date($datestamp,"d",1);
          else if($recur == "weekly")
             $nextdstamp = future_date($datestamp,"w",1);
          else if($recur == "monthly")
             $nextdstamp = future_date($datestamp,"m",1);
          else if($recur == "yearly")
             $nextdstamp = future_date($datestamp,"y",1);
          $datestamp = $nextdstamp;
          $sql="INSERT INTO ".$events_table." VALUES ('',".$nextdstamp.",".$stimestamp.",".$etimestamp.",'".$resource."','".$desc."')";
          mysql_query($sql,$conn) or die("couldn't add<BR>");
          $i++;
      }
  }
  print "<CENTER><BR>Rent has been added to the calendar<BR><BR>";
  print "<a href=\"index.php\" target=\"mymain\" onClick=\"self.close()\">click here to refresh calendar</a></CENTER>";

  mysql_close($conn);
}
else  // HAVE NOT CLICKED 'Add Record' YET
{
if (isset($Res) && $Res=="Add location")
{
  $sql="INSERT into ".$locations_table." VALUES ('".$ResDesc."')";
  mysql_query($sql,$conn);
}
else if(isset($delLoc) && $delLoc == "Delete location")
{
  $sql = "DELETE FROM ".$locations_table." WHERE `resource`='".$resource2."';";
  mysql_query($sql,$conn);
}
$sql="SELECT * FROM ".$locations_table." ORDER by Resource";
$result=mysql_query($sql,$conn);
?>
<body class="popdetail" onLoad="document.AddEvnt.dstring.focus()">
<em><b>Add a New Rent Item</b></em>
<form action="add.php" method="POST" name="AddEvnt">
<?
if($date_standard == 0) // ISO Standard yyyy-mm-dd
{
?>
Rent Date: <input type="text" size="10" name="dstring" <?if(isset($pasdstring)){?>value="<?=$pasdstring?>"<?}?>> (yyyy-mm-dd)
<?
} // end ISO Standard
else if($date_standard == 1) // American style mm/dd/yyyy
{
?>
Rent Date: <input type="text" size="10" name="dstring" <?if(isset($pasdstring)){?>value="<?=$pasdstring?>"<?}?>> (Use mm/dd/yyyy format)
<?
} // end American style
if($time_standard == 0) //24 hour time
{
?>
<p>
Start Time: <input type="text" size="5" name="ststring"> (Use hh:mm format)
</p>
<p>
End Time: <input type="text" size="5" name="etstring"> (Use hh:mm format)
</p>
<?
} //end 24 hour time
else if($time_standard == 1)  //12 hour time
{
?>
<p>
Start Time: <input type="text" size="5" name="ststring">
<input type="radio" name="saorp" value="am">AM
<input type="radio" name="saorp" value="pm">PM (Use hh:mm format)
</p>
<p>
End Time: <input type="text" size="5" name="etstring">
<input type="radio" name="eaorp" value="am">AM
<input type="radio" name="eaorp" value="pm">PM (Use hh:mm format)
</p>
<?
} //end 12 hour time
?>
<p>Location: <select name="resource" size="1"></p>
<?
// Populate drop-down box with resources (locations)
if (mysql_num_rows($result)>0)
{
   while($rs=mysql_fetch_array($result))
   {
?>
    <OPTION><? echo $rs["resource"]; ?></OPTION>
<? }
}
//mysql_free_result($result);
//mysql_close($conn);
?>
    </select></p>
<p>Description: <input type="text" size=50 maxlength=50 name="desc"></p>
<DIV id="recurdiv">
Recurrence:&nbsp;
<SELECT name="recur" onChange="rbox_handler()">
  <OPTION value="none">none</OPTION>
  <OPTION value="daily">daily</OPTION>
  <OPTION value="weekly">weekly</OPTION>
  <OPTION value = "monthly">monthly</OPTION>
  <OPTION value="yearly">yearly</OPTION>
</SELECT>&nbsp;&nbsp;one day only
</DIV>
<BR>
<input type="submit" name="addrec" value="Add Record">
<input type="reset" name="clear" value="Clear">
</form>
<form action="add.php" method="POST" name="AddRes">
<input type="text" size=20 maxlength=50 name="ResDesc">
<input type="submit" name="Res" value="Add location">
<BR>
<?if(isset($Res) && $Res == "Add location")
  print "<FONT COLOR=red><I>$ResDesc was added</I></FONT><BR>";
  ?>
<select name="resource2" size="1">
<?
mysql_data_seek($result,0);
while($rs = mysql_fetch_array($result))
{
?>
    <OPTION><?=$rs['resource']?></OPTION>
<?
}
?>
</SELECT>
&nbsp;<INPUT type="submit" name="delLoc" value="Delete location">
<?if(isset($delLoc) && $delLoc == "Delete location")
   print "<BR><FONT COLOR=red><I>$resource2 was deleted</I></FONT>";
?>
</form>
</p>
</body>
</html>
<?
} //end top else
?>
Página Principal, onde é mostrada as datas e os respectivos compromissos cadastrados.
<?
require("include/calvars.inc");
//print "ADMIN = $ADMIN";
?>
<html>
<head>
       <title>Availability</title>
<script SRC="include/functions.js"></SCRIPT>
<link rel="stylesheet" href="styles/calstyles.css" type="text/css">
<?
$today = getdate();
$y2 = $today['year'];
$m2 = $today['mon'];
$d2 = $today['mday'];
$hour = $today['hours'];
$min = $today['minutes'];
//print "time = $hour:$min<BR>";

$todaystring = $y2."-".$m2."-".$d2." ".$hour.":".$min;
//print "today = $todaystring<BR>";
$todaystamp = fixsdate( $todaystring );
//print "todaystamp = $todaystamp<BR>";
$systime = getcurtime();
//print "systime = $systime";

if(!isset($noinc))
{
 $timestamp = $todaystamp;
}

$m = strftime("%m",$timestamp);
$y = strftime("%Y",$timestamp);
$monthname = strftime("%B",$timestamp);
$startcol = date("w",mktime(1,1,1,$m,1,$y));
$daysinmonth = date("t",mktime(1,1,1,$m,1,$y));

$nextstamp = strtotime("+1 month",$timestamp);
$prevstamp = strtotime("-1 month",$timestamp);
$stamp2 = $timestamp;
//print "m = $m, y = $y<BR>";
?>

</head>
<body bgcolor="#FFFFFF">
<p align="center"><B><FONT FACE="Verdana" SIZE=4 COLOR=black>Availability</FONT></B><BR>
  <FONT FACE="Verdana" SIZE=1> 
  <table border="0" align="center">
  <tr align="center" valign="middle"> 
    <td align="right"><a href="index.php?timestamp=<?=$prevstamp?>&noinc=0" onMouseOver="window.status='Previous Month';return true" onMouseOut="window.status='';return true"><img src="images/prevbtn1.gif" border=0 height=30 width=30></a></td>
    <td width="200"><FONT FACE="Verdana" SIZE=3 COLOR=black><B> 
      <?print "$monthname $y";?></B></FONT></td>
    <td align="left"><a href="index.php?timestamp=<?=$nextstamp?>&noinc=0" onMouseOver="window.status='Next Month';return true" onMouseOut="window.status='';return true"><img src="images/nextbtn1.gif" border=0 height=30 width=30></a></td>
  </tr>
</table>
<table border=0 cellpadding=10 align=center>
<TR>
    <TD><?if($ADMIN){?><a href="#" onClick="popup('add.php', 'mywin1', 450, 425)" onMouseOver="window.status='Add Rent To Calendar';return true" onMouseOut="window.status='';return true"><img src="images/addbtn1.gif" border="0"></a>&nbsp;&nbsp;<?}?>
</TR>
</TABLE>
<table border=<?=$tb_border?> cellspacing=<?=$tb_cellspacing?> bordercolor="black" width="80%" align="center" height="60%">
<tr class="daytitle">
   <td align="center" height="<?=$rowht1?>" width="14%" class="daytitle" bgcolor=<?=$wkendbg?>>Sun</td>
   <td align="center" height="<?=$rowht1?>" width="14%" class="daytitle" bgcolor=<?=$wkbg?>>Mon</td>
   <td align="center" height="<?=$rowht1?>" width="14%" class="daytitle" bgcolor=<?=$wkbg?>>Tue</td>
   <td align="center" height="<?=$rowht1?>" width="14%" class="daytitle" bgcolor=<?=$wkbg?>>Wed</td>
   <td align="center" height="<?=$rowht1?>" width="14%" class="daytitle" bgcolor=<?=$wkbg?>>Thu</td>
   <td align="center" height="<?=$rowht1?>" width="14%" class="daytitle" bgcolor=<?=$wkbg?>>Fri</td>
   <td align="center" height="<?=$rowht1?>" class="daytitle" bgcolor=<?=$wkendbg?>>Sat</td>
</tr>
<?
$d = 1;
$i = 0;
//start first row
print "<tr align=left valign=top bgcolor=$cellbg>";
//increment through the days before the start of the month
while($i < $startcol)
{
    print "<TD>&nbsp;</TD>";
    $i++;
}
//step through day 1 to day n
//make the timstamp for day 1 of the month/year
$daystring = $y."-".$m."-01";//.$TZONE;
$daystamp = strtotime($daystring);

$lowday = mktime(0,0,0,$m,1,$y);
$highday = mktime(23,59,59,$m,1,$y);
//print "low = $lowday<BR>high = $highday<BR>";
//$test = strftime("%Y-%m-%d %H:%M",$daystamp);
//print "daystamp = $daystamp<BR>";
//print "test = $test<BR>";
//$daystamp = mktime ($hour,0,0,$m,1,$y);
while($d <= $daysinmonth)
{
    /*$string1 = strftime("%Y-%m-%d",$daystamp);
    $string2 = strftime("%Y-%m-%d",$timestamp);
    $string3 = strftime("%Y-%m-%d",$todaystamp);
    print "day = $string1<BR>time = $string2<BR>today = $string3<BR><BR>";
    */
    if($i > 6)
    {
        //start new row
        print "</TR><tr align=left valign=top bgcolor=$cellbg>";
        $i = 0;
    }
    //print day
    /* THIS CHUNK DISPLAYS THE EVENTS ON EACH DAY FOR EACH DAY */
         $conn2=mysql_pconnect($host,$user,$pwd);
         mysql_select_db($db,$conn2);
         $sql2="SELECT * FROM ".$events_table." WHERE datestamp >= ".$lowday." AND datestamp <= ".$highday;
         $sql2=$sql2." ORDER BY stimestamp";
         $result2=mysql_query($sql2,$conn2);
         if (mysql_num_rows($result2)>0)
         {
         ?>
        <td bgcolor=<?if(($todaystamp > $lowday) && ($todaystamp < $highday))echo $curcellbg; else echo $cellbg;?> height="<?=$rowht2?>" width="14%" class="dayno">
        <A HREF="#" onMouseOver="window.status='Click for popup day schedule';return true" onMouseOut="window.status='';return true" onClick="popup('popday.php?daystamp=<?=$daystamp?>', 'Win1', 500, 100); return false" class="daylink">
        <?=$d?></A><BR>
        <?
            while($rs=mysql_fetch_array($result2))
            {
               $thisid = $rs['id'];
               $datestamp = $rs['datestamp'];
               /*if($date_standard == 0)
                  $date = strftime("%Y-%m-%d",$datestamp);
               else if($date_standard == 1)
                  $date = strftime("%m/%d/%Y",$datestamp);
               */
               $stimestamp = $rs['stimestamp'];
               if($time_standard == 0)
                  $stime = strftime("%H:%M",$stimestamp);
               else if($time_standard == 1)
               {
                   $stime = strftime("%I:%M",$stimestamp);
                   $saorp = strftime("%p",$stimestamp);
                   $saorp = strtolower($saorp);
                   $stime = $stime.$saorp;
                   
               }
               
               $etimestamp = $rs['etimestamp'];
               if($time_standard == 0)
                  $etime = strftime("%H:%M",$etimestamp);
               else if($time_standard == 1)
               {
                   $etime = strftime("%I:%M",$etimestamp);
                   $eaorp = strftime("%p",$etimestamp);
                   $eaorp = strtolower($eaorp);
                   $etime = $etime.$eaorp;
               }
                  
               $loc = $rs['resource'];
               $desc = $rs['descr'];
               
            ?>

        <span title="<?echo "$desc  ($loc)";?>">
        <A HREF="#" onMouseOver="window.status='Click for popup detail';return true" onMouseOut="window.status='';return true" onClick="popup('popdetail.php?loc=<?=$loc?>&stime=<?=$stime?>&etime=<?=$etime?>&desc=<?=$desc?>&id=<?=$thisid?>&daystamp=<?=$daystamp?>', 'Win1', 500, 100); return false" class="eventlink">
        <?print "$stime-$etime<BR>";?>
        </a></span>
        <?
            } // end while
      }// end if(mysql_num_rows($result2)>0)
         /* END DAY EVENTS CHUNK */
      else
      {?>
        <td bgcolor=<?if(($todaystamp > $lowday) && ($todaystamp < $highday))echo $curcellbg; else echo $cellbg;?> height="<?=$rowht2?>" width="14%" class="dayno">&nbsp;<?=$d?><BR>
      <?}
    //print "day = $daystamp";
    print "</TD>";
    $daystamp = strtotime("+1 day",$daystamp);
    $lowday = strtotime("+1 day",$lowday);
    $highday = strtotime("+1 day",$highday);
    $i++;
    $d++;
}// end while($d < 4daysinmonth)
?>
</TABLE>
<BR>
<CENTER>
  <p><a href="javascript:history.back()"><img border="0" src="/imagens/voltar.gif" width="78" height="20"></a>
</p>
<br>
<B>
<?if(!$ADMIN){?><A HREF="#" onMouseOver="window.status='Login';return true" onMouseOut="window.status='';return true" onClick="popup('login.php', 'Win1', 300, 150); return false" class="eventlink">ADMIN</A><?}?>
<?if($ADMIN){?><A HREF="#" onMouseOver="window.status='Logout';return true" onMouseOut="window.status='';return true" onClick="popup('logout.php', 'Win1', 300, 150); return false" class="eventlink">LOGOUT</A><?}?>
<BR><?if($ADMIN){?><a href="#" onClick="popup('purgeold.php?daystamp=<?=$stamp2?>', 'purgewin1', 450, 150)" class="eventlink" style="color:maroon">PURGE OLD</a><?}?>
</B>
</CENTER>
</body>
</html>
<?include("include/footer.inc");?>

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,3k
×
×
  • Criar Novo...