Its not working like just blank screen but when it's in localhost it works just fine i also looked how to check error using firefox dev tools and it just says 500 Internal Server Error
the site is http://mabatanghealth.lovestoblog.com/scheduling.php
it should display a calendar of some sort.. Thank you guys.
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="CSS/bootstrap.min.css">
<link rel="stylesheet" href="CSS/indexdesign011.css">
<link rel="stylesheet" href="CSS/all.min.css">
<style>
@media only screen and(max-width: 760px),
(min-device-width:802px) and(max-device-width:1020px){
table,
thead,
tbody,
th,
td,
tr{
display:block;
}
.empty{
display:none;
}
th{
position:absolute;
top:-9999px;
left:-9999px;
}
tr{
border:1px solid #ccc;
}
td{
border:none;
border-bottom: 1px solid #eee;
position:relative;
padding-left:50%;
}
td:nth-of-type(1):before{
content:"Sunday";
}td:nth-of-type(2):before{
content:"Monday";
}td:nth-of-type(3):before{
content:"Tuesday";
}
td:nth-of-type(4):before{
content:"Wednesday";
}td:nth-of-type(5):before{
content:"Thursday";
}
td:nth-of-type(6):before{
content:"Friday";
}
td:nth-of-type(7):before{
content:"Saturday";
}
}
@media only screen and (min-device-width:802px) and(max-device-width:1020px){
body{
width:495px;
}}
@media(min-width:641px){
table{
table-layout:fixed;
}
td{
width:33%;
}
}
.row{
margin-top:20px;
}
.today{
background:yellow;
}
</style>
</head>
<body>
<div class="container01">
<div class="navigation">
<div class= "logo">
<ul>
<li>Mabatang</li>
<ul>
</div>
<div class= "logo2">
<ul>
<li> </li>
<li>|Health </li>
<ul>
</div>
<nav>
<ul>
<li><a href="HOME.php">Home</a></i></li>
<li><a href="Quiz.php">Quiz</a></i></li>
<li><a href="scheduling.php">Schedule</a></i></li>
</ul>
</nav>
<div class="user">
<?php Session_START();
if(isset($_SESSION['user_email'])) {
$session_name=$_SESSION['user_email'];
if($session_name=="admin@gmail.com"){
echo $_SESSION['user_email'];
echo '<a href="Report.php?namevar=name&strandvar=strand&gradevar=grade"><i class="fas fa-book"></i></a>
</a></li>';
echo '<a href="scheduling.php"><i class="fas fa-book"></i></a>
</a></li>';
echo '<a href="studlist.php"><i class="fas fa-address-card"></i></a>
</a></li>';
echo ' <a href="changeuser.php?user_email=<?php echo $result[$k]["user_email"]>
</a></li>';
echo ' <a href="logout.php">
<i class="fas fa-sign-out-alt"></i></a>
</a></li>';
}
if($session_name=="grades@gmail.com"){
echo $_SESSION['user_email'];
echo '<a href="grade11_sems.php"><i class="fas fa-desktop"></i></a>
</a></li>';
echo '<a href="studlist.php"><i class="fas fa-address-card"></i></a>
</a></li>';
echo ' <a href="changeuser.php?user_email=<?php echo $result[$k]["user_email"]>
</a></li>';
echo ' <a href="logout.php">
<i class="fas fa-sign-out-alt"></i></a>
</a></li>';
}
if( ($session_name != "admin@gmail.com")&&($session_name != "grades@gmail.com")){
$session_name=$_SESSION['user_email'];
echo $_SESSION['user_email'];
echo '<a href="scheduling.php"><i class="fas fa-book"></i></a>';
echo '<a href="changeuser.php?user_email=<?php echo $result[$k]["user_email"]></a> ';
echo "<a href='studgrades11.php?emailvar=$session_name'>11</a>";
echo "<a href='studgrades12.php?emailvar=$session_name'>12</a>";
echo ' <a href="logout.php"><i class="fas fa-sign-out-alt"></i></a>';
}}
else{
echo'<a href="login.php">
<i class="fas fa-user"></i></a> </a></li>';
}
?>
</ul>
</nav></div></div>
</div></div>
<div class="container">
<div class="row">
<div class="col-md-12">
<?php
$dateComponents=getDate();
if(isset($_GET['month']) && isset($_GET['year'])){
$month = $_GET['month'];
$year = $_GET['year'];
}else{
$month = $dateComponents['mon'];
$year = $dateComponents['year'];
}
echo build_calendar($month,$year);
?>
<?php
function build_calendar($month,$year){
$mysqli = new mysqli ("127.0.0.1", "root","user","guidance");
// $stmt=$mysqli->prepare('select * from user_info where MONTH(date)= ? AND YEAR(date)= ?');
// $stmt->bind_param('ss',$month,$year);
// $bookings=array();
// if($stmt->execute()){
// $result=$stmt->get_result();
// if($result->num_rows > 0){
// while($row=$result->fetch_assoc()){
// $bookings[]=$row['date'];
// }
// $stmt->close();
// }
// }
//name of days
$daysOfWeek=array('Sunday','Monday','Tuesday','Wednesday','Thursday', 'Friday', 'Saturday');
//first day of month
$firstDayOfMonth=mktime(0,0,0,$month,1,$year);
//number of days in a month
$numberDays=date("t",$firstDayOfMonth);
//info on 1st day of month
$dateComponents=getdate($firstDayOfMonth);
//getting name of this month
$monthName =$dateComponents['month'];
//index value of the 1st day
$dayOfWeek=$dateComponents['wday'];
//currentdate
$dateToday=date('Y-m-d');
$prev_month=date('m',mktime(0,0,0,$month-1,1,$year));
$prev_year=date('Y',mktime(0,0,0,$month-1,1,$year));
$next_month=date('m',mktime(0,0,0,$month+1,1,$year));
$next_year=date('Y',mktime(0,0,0,$month+1,1,$year));
$calendar="<center><h2>$monthName $year</h2>";
$calendar.="<a class= 'btn btn-xs btn-primary' href='?month=".$prev_month."&year=".$prev_year."'>Previous Month</a>";
$calendar.="<a class= 'btn btn-xs btn-primary' href='?month=".date('m')."&year=".date('Y')."'>Current Month</a>";
$calendar.="<a class= 'btn btn-xs btn-primary' href='?month=".$next_month."&year=".$next_year."'>Next Month</a> <center>";
$calendar.="<table class='table table-bordered'>";
$calendar.="<tr>";
foreach($daysOfWeek as $day){
$calendar.="<th class='header'>$day</th>";
}
$calendar.="</tr><tr>";
$currentDay=1;
if($dayOfWeek>0){
for($k=0;$k<$dayOfWeek;$k++){
$calendar.="<td class='empty'></td>";
}
}
$month=str_pad($month,2,"0",STR_PAD_LEFT);
while($currentDay<=$numberDays){
if($dayOfWeek==7){
$dayOfWeek=0;
$calendar.="</tr><tr>";
}
$currentDayRel=str_pad($currentDay,2,"0",STR_PAD_LEFT);
$date="$year-$month-$currentDayRel";
$dayName=strtolower(date('l',strtotime($date)));
$today=$date==date('Y-m-d') ? 'today': '';
if($dayName =='saturday' || $dayName =='sunday'){
$calendar.="<td class='$today'><h4>$currentDay</h4><a class='btn btn-danger btn-xs'>No Classes</td>";
}
elseif($date<date('Y-m-d')){
$calendar.="<td class='$today'><h4>$currentDay</h4><a class='btn btn-danger btn-xs'>N/A</td>";
}
else{
$totalbookings=checkSlots($mysqli,$date);
if($totalbookings==8){
$calendar.="<td class='$today'><h4>$currentDay</h4><a href='#' class='btn btn-danger btn-xs'>Fully Booked</td>";
}else{
$availableslots=8-$totalbookings;
$calendar.="<td class='$today'><h4>$currentDay</h4><a href='book.php?date=".$date."'
class='btn btn-success btn-xs'>Book</a> <small><i>$availableslots Slots Left</i></small>";}
}
$currentDay++;
$dayOfWeek++;
}
if($dayOfWeek<7){
$remainingDays = 7 - $dayOfWeek;
for($i=0;$i<$remainingDays;$i++){
$calendar.="<td clas s='empty'></td>";
}
}
$calendar.="</tr></table>";
return $calendar;
}
function checkSlots($mysqli,$date){
$stmt=$mysqli->prepare('select * from user_info where date = ?');
$stmt->bind_param('s',$date);
$totalbookings=0;
if($stmt->execute()){
$result=$stmt->get_result();
if($result->num_rows > 0){
while($row=$result->fetch_assoc()){
$totalbookings++;
}
$stmt->close();
}
}
return $totalbookings;
}
?>
</div>
</div>
</div>
</body>
</html>