Hello,
I'm working on Joomla 1.5.15 that runs on Windows/Apache server. I have a block of PHP code named "Research Calculator". The program asks a user to enter the beginning date and the due date of an assignment and it calculates and displays the number of days to do with suggested steps to complete the assignment in time. I have this PHP code on Joomla 1.5.15 which is wrapped in Jumi tags but it is not working. When I submit, it simply takes me back to the home page. When I insert the same PHP code (wrapped in Jumi tags) on a Linux/Apache web server, it works fine. So, I know that the code itself is fine. It appears that some settings on the Winodws/Apache server is blocking this PHP code to execute. I looked into php.ini but I couldn't tell. The program requires instructions.php and it is properly located in the root directory. Again, the code works fine on the Linux/Apache server. I have a snapshot of working research calculator but this forum doesn't seem to allow me to attach an attachment. I can email it to you if you are interested. Please let me know.
I'm using Jumi to wrap the PHP code to put on a Joomla page but I also tried the mod_php extension and it didn't work either.
Any insight would be greatly appreciated! Thank you in advance!
The following is the PHP code in question.
<?php
include("instructions.php");
?>
<form action="<?php echo $_SERVER['PHP_SELF'];?>">
<table align="center" border="0" >
<tr>
<td align="right" class="txt1">Date you will begin the assignment:</td>
<td valign="top" class="txt5">
<?php pres_date(one,date("j"),date("n"),date("Y")); ?>
</td>
</tr>
<tr><td align="right" class="txt1">Date the assignment is due:</td>
<td valign="top" class="txt5">
<?php pres_date(two,"","",date("Y")); ?>
</td></tr></table>
<center><input type="submit" name="submit" value="Calculate Assignment Schedule!"></center>
</form>
<?php
/***********************************************************
Comments:
Modified to allow register_globals to be turned off.
**********************************************************/
if($_REQUEST['submit']){
$today = date("Ymd");
//set up the times
$date1 = "$_GET[monthone]/$_GET[dayone]/$_GET[yearone]";
$date2 = "$_GET[monthtwo]/$_GET[daytwo]/$_GET[yeartwo]";
$time1 = strtotime($date1) + 43200;
$time2 = strtotime($date2);
?>
<div class="div2_2">
<div><strong>Starting on: <?php echo $date1;?></strong></div>
<div><strong>Ending on: <?php echo $date2;?></strong></div>
<?php $days = days_between($time1, $time2);?>
<div><strong>According to the dates you have entered, you have <span class="txt1"><?php echo (int) $days; ?> days</span> to finish.</strong> </div>
</div>
<?php
$dates = out_of_time($time1, $time2, $instructions, $bedTime, $ampm);
?>
<div style="color:#FF0000;"><?php if(days_between($time1, $time2)<0) {
echo "<b>Negative Number of Days:</b> Probably you entered the dates wrong...<br />";
} else if(days_between($time1, $time2)<1) {
echo "You have <b>less than one day</b> to get this done. I hope you're just playing with this thing.<br />";
}
if(days_between($time1, $time2)>99) {
echo "It's never too early to start!<br />";
}?></div>
<?php
echo "<br /><table cellpadding=4 width=100%>";
for($i=0;$i<sizeof($instructions);$i++) {
$j=$i+1; //hacked in because someone forgot the zero item in the array...
?><tr <?php if($i%2==0){ echo 'class="div6"';}?> ><td align=left width=120><div class="txt1">Step <?php echo $j; ?></div></td><td>
<?php
//description
echo "<b>By $dates[$i]:</b> <i>";
$datum = date("Ymd", strtotime($dates[$i]));
echo $instructions[$i][1] . "</i></td></tr>";
?>
<tr <?php if($i%2==0){ echo 'class="div6"';}?>><td></td><td>
<?php
//what should be done
for($j=0; $j<sizeof($instructions[$i][2]); $j++){
echo "• " . $instructions[$i][2][$j] . '<br />';
}
echo "<br />";?>
</td></tr>
<?php
}
echo "</table>";
}
?>