Log in

View Full Version : Page Blowout on Host change..Help!



kuau
05-24-2008, 02:47 AM
I have just moved a domain from one host to another and the identical code, which looks fine on the old one, (seen here: www.calendarmaui.com )

suddenly explodes with a ton of warning messages that blow out the page, seen here: http://69.89.31.238/~arakireg/_calmaui/

Seems to be a data-type error but I can't see where the type is set. Here is the code line it is complaining about:


<td <?php if(($x+1 == date("d")) && (date("m") == $curMonth) && (date("Y") == $curYear)){?>class="miniCalToday"<?php }elseif(in_array($x+1, $events)){?>class="miniCalEvents"<?php }else{?>class="miniCal"<?php }?> onclick="window.location.href='/day.php?year=<?php echo $curYear?>&amp;month=<?php echo $curMonth;?>&amp;day=<?php echo $x+1;?>';"><?php echo date("d", mktime(0,0,0,$curMonth,$x+1,$curYear));?></td>

I'm just the css person.. please help!! Thanks.

thetestingsite
05-24-2008, 02:49 AM
Whats the code before that; more specifically, how is $events being assigned?

thetestingsite
05-24-2008, 03:02 AM
remove the highlighted and change the part in red to $events = Array();



<?php

/* $hc_calStartDay = 1; // Calendar First Day of the Week */
?>
<form name="frmJump" id="frmJump" action="">
<table cellpadding="0" cellspacing="0" border="0" class="miniCalTable" align="center">
<?php
if(isset($_GET['day']) && is_numeric($_GET['day'])){
$curDay = $_GET['day'];
} else {
$curDay = date("d");
}//end if

if(isset($_GET['month']) && is_numeric($_GET['month'])){
$curMonth = $_GET['month'];
} else {
$curMonth = date("n");
}//end if

if(isset($_GET['year']) && is_numeric($_GET['year'])){
$curYear = $_GET['year'];
} else {
$curYear = date("Y");
}//end if

if(($curMonth < date("n") && $curYear == date("Y")) && $hc_browsePast == 0){
$curMonth = date("n");
} elseif(($curYear < date("Y")) && $hc_browsePast == 0){
$curMonth = date("n");
$curYear = date("Y");
}//end if

/* $query = " SELECT DISTINCT e.StartDate
FROM events e
LEFT JOIN eventcategories ec ON (e.PkID = ec.EventID)
LEFT JOIN locations as l ON (e.LocID = l.PkID)
WHERE e.IsActive = 1 AND
e.IsApproved = 1 AND
(e.StartDate BETWEEN '" . date("Y-m-d", mktime(0,0,0,$curMonth,1,$curYear)) . "' AND '" . date("Y-m-d", mktime(0,0,0,$curMonth+1,0,$curYear)) . "')";

if(isset($_SESSION['hc_favCat']) && $_SESSION['hc_favCat'] != ''){
$query = $query . " AND ec.CategoryID in (" . $_SESSION['hc_favCat'] . ") ";
}//end if

if(isset($_SESSION['hc_favCity']) && $_SESSION['hc_favCity'] != ''){
$query = $query . " AND (e.LocationCity IN (" . $_SESSION['hc_favCity'] . ") OR l.City IN (" . $_SESSION['hc_favCity'] . "))";
}//end if

$query = $query . " ORDER BY StartDate";
$result = doQuery($query);

$events[] = "";
if(hasRows($result)){
while($row = mysql_fetch_row($result)){
$events[] = stampToDate($row[0], "d");
}//end while
}//end if
*/
$navBackMonth = ($curMonth-1) % 12;
$navBackYear = $curYear;
$navForwMonth = ($curMonth+1) % 12;
$navForwYear = $curYear;
if($curMonth == 1){
$navBackMonth = 12;
$navBackYear = $curYear - 1;
} elseif($curMonth == 11) {
$navForwMonth = 12;
} elseif($curMonth == 12){
$navForwYear = $curYear + 1;
}//end if
?> <tr>
<td class="miniCalNav" onclick="window.location.href='/day.php?year=<?php echo $navBackYear?>&amp;month=<?php echo $navBackMonth;?>';">&lt;</td>
<td class="miniCalTitle" colspan="5">
<select name="jumpMonth" id="jumpMonth" class="miniCalJump" onchange="window.location.href=document.frmJump.jumpMonth.value;">
<?php $jumpMonth = date("n", mktime(0,0,0,$curMonth-12,1,$curYear));
$jumpYear = date("Y", mktime(0,0,0,$curMonth-12,1,$curYear));
for($i = 0; $i < 25; $i++){ ?>
<option <?php if($i == 12){echo "selected=\"selected\"";}?> value="/day.php?year=<?php echo date("Y", mktime(0,0,0,$jumpMonth + $i,1,$jumpYear));?>&amp;month=<?php echo date("n", mktime(0,0,0,$jumpMonth + $i,1,$jumpYear));?>"><?php echo date("M Y", mktime(0,0,0,$jumpMonth + $i,1,$jumpYear));?></option>
<?php }//end for?>
</select>
</td>
<td class="miniCalNav" onclick="window.location.href='/day.php?year=<?php echo $navForwYear?>&amp;month=<?php echo $navForwMonth;?>';">&gt;</td>
</tr>
<?php $d = $hc_calStartDay;

echo "<tr>";
$daysOfWeek = array(0 => "Sun", 1 => "Mon", 2 => "Tue", 3 => "Wed", 4 => "Thu", 5 => "Fri", 6 => "Sat");
for($i = 0; $i < 7; $i++){ ?>
<td class="miniCalDOW"><?php echo $daysOfWeek[$d % 7];?></td>
<?php $d++;
}//end for
echo "</tr><tr>";

$fillCnt = date("w", mktime(0,0,0,$curMonth,1,$curYear));
if($hc_calStartDay > 0){
if($hc_calStartDay <= date("w", mktime(0,0,0,$curMonth,1,$curYear))){
$fillCnt = $fillCnt - $hc_calStartDay;
} else {
$fillCnt = 7 - ($hc_calStartDay - $fillCnt);
}//end if
}//end if

for($i = 0; $i < $fillCnt; $i++){ ?>
<td class="miniCalFiller">&nbsp;</td>
<?php }//end for

for($x = 0; $x < date("t", mktime(0,0,0,$curMonth,1,$curYear)); $x++){
if($i % 7 == 0){echo "</tr><tr>";}?>
<td <?php if(($x+1 == date("d")) && (date("m") == $curMonth) && (date("Y") == $curYear)){?>class="miniCalToday"<?php }elseif(in_array($x+1, $events)){?>class="miniCalEvents"<?php }else{?>class="miniCal"<?php }?> onclick="window.location.href='/day.php?year=<?php echo $curYear?>&amp;month=<?php echo $curMonth;?>&amp;day=<?php echo $x+1;?>';"><?php echo date("d", mktime(0,0,0,$curMonth,$x+1,$curYear));?></td>
<?php $i++;
}//end for

if($i % 7 > 0){
for($i = $i % 7; $i < 7; $i++){ ?>
<td class="miniCalFiller">&nbsp;</td>
<?php }//end for
}//end if ?>
</tr>
</table>
</form>


Hope this helps.

kuau
05-24-2008, 03:17 AM
I'm pretty tired but I can't see anything in red (?). I should tell you this code doesn't belong to this database, which is why I commented out that section. Anyway, I did it and got this:

Fatal error: Call to undefined function doquery() in /home2/arakireg/public_html/_calmaui/calendar3.php on line 50

thetestingsite
05-24-2008, 03:20 AM
Sorry, forgot to add the color red to the part I was referring to (I edited my above post to fix that). Anyways, go ahead and keep that part uncommented and change this:


$result = doQuery($query);


to:



$result = mysql_query($query);


That should do it.
Hope this helps.

kuau
05-24-2008, 04:18 AM
Oh no, now something worse. When I click on a Featured Event on the left here: http://69.89.31.238/~arakireg/_calmaui/index-title.php

why do I get an "Invalid Entry ID" error? When I click on the same thing here: www.calendarmaui.com, it works. What is going on? Is there something I have to change in php.ini or something to make it work? This is driving me nuts. How can it work in one place and not the other? I don't know what to do. Please help.

thetestingsite
05-24-2008, 05:27 AM
Did you make sure to copy over your database(s) over to the new host? That seems to be the majority of the problem (the db info that is).

kuau
05-24-2008, 06:20 PM
Thanks, testingsite. Yes, I imported the database; otherwise, there would be no events at all listed on the homepage. I just realized that it is because it was running on php4 on the old host and the new host has only php5. I read about things that changed between 4 and 5, but it's all Greek, as they say. Here is the code that is generating the error:


function add_duration ( $time, $duration ) {
$hour = (int) ( $time / 10000 );
$min = ( $time / 100 ) % 100;
$minutes = $hour * 60 + $min + $duration;
$h = $minutes / 60;
$m = $minutes % 60;
$ret = sprintf ( "%d%02d00", $h, $m );
//echo "add_duration ( $time, $duration ) = $ret <BR>";
return $ret;
}

if ( ! empty ( $year ) )
$thisyear = $year;
if ( ! empty ( $month ) )
$thismonth = $month;
$pri[1] = translate("Low");
$pri[2] = translate("Medium");
$pri[3] = translate("High");

$unapproved = FALSE;

<?php

if ( $id < 1 ) {
echo translate("Invalid entry id") . ".";
exit;
}

// first see who has access to view this entry
$is_my_event = false;
$sql = "SELECT cal_id FROM webcal_entry_user " .
"WHERE cal_login = '$login' AND cal_id = $id";
$res = dbi_query ( $sql );
if ( $res ) {
$row = dbi_fetch_row ( $res );
if ( $row[0] == $id )
$is_my_event = true;
dbi_free_result ( $res );
}

$sql = "SELECT cal_create_by, cal_date, cal_time, cal_mod_date, " .
"cal_mod_time, cal_duration, cal_priority, cal_type, cal_access, " .
"cal_name, cal_description, cal_location FROM webcal_entry WHERE cal_id = " . $id;
$res = dbi_query ( $sql );
if ( ! $res ) {
echo translate("Invalid entry id") . ": $id";
exit;
}
$row = dbi_fetch_row ( $res );
$create_by = $row[0];
$cal_date = $date = $row[1];
$name = $row[9];
$description = $row[10];
$cal_id = $id;
$location = $row[11];

Is there some new php5 way of doing whatever that is doing? I *really* want to get off that old host. The new host tech just told me there is no way to run 4 on that server. I just need it to work enough to run while I explore upgrade options. Is there any hope? Thanks.