Forum Moderators: coopster
<?php
// checks if page has auto-refreshed, if not checks if logout cookie set, if unavailable last refresh session used
if (!isset($_SERVER["HTTP_REFERER"])) {
$latest = $_SESSION['lastrefresh'];
} else if (isset($_COOKIE['lastlogout'])) {
$latest = $_COOKIE['lastlogout'];
} else {
$latest = $_COOKIE['lastsessionrefresh'];
}
// selects all comments posted since last logout/refresh
$query_n = "SELECT * FROM tblNotes WHERE Date > '$latest'";
$result_n = mysql_query($query_n);
// adds new comment bubble to job brief in schedule if new comments added
while ($notifications = mysql_fetch_array($result_n)) {
if ($notifications > 0 && ($notifications['JobNo']) == ($jobs[0]) && (strpos($_SERVER["HTTP_REFERER"],$jobs[0]) != true)) {
echo '<a href="jobbrief.php?jobno='.$jobs[0].'"><img src="img/comment_bubble.gif" alt="New comment added to brief" /></a>';
}
}
?> $_SESSION['jobs'] .= '/|#|job1';
$_SESSION['jobs'] .= '/|#|job2';
$_SESSION['jobs'] .= '/|#|job3';
$job_array = explode("/|#|", $_SESSION['jobs']);
To$job_array[1];
$job_array[(count($job_array) - 1)]
(Note that $job_array[0] will be an empty string)array(
[0] =>
[1] => job1
[2] => job2
[3] => job3
)