Hey guys!
I have the following error and I an not sure why because I thought that we can include the header.php and footer.php? The footer.php is my bottom of the page copyright logo…
This is my footer.php file
<!DOCTYPE html>
<html>
<head>
<title>Copyright 2018</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Aldrich" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
</head>
<body>
<footer>
<div class="copyright clearfix">
<div class="container clearfix">
<div class="text float left">
Copyright PianoCourse101 2018
</div>
<ul class="links float right">
<li><a href=""><i class="fab fa-facebook-square"></i></a></li>
<li><a href=""><i class="fab fa-twitter-square"></i></a></li>
<li><a href=""><i class="fab fa-instagram"></i></a></li>
<li><a href=""><i class="fab fa-youtube-square"></i></a></li>
</ul>
</div>
</div>
</footer>
</body>
This is my level1.php file:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<?php
include_once 'header.php';
include_once 'footer.php';
$level1promo_expirydate = date('Y-m-d H:i:s', strtotime("+2 day"));
$paidbydate = date('Y-m-d H:i:s', strtotime("+2 day"));
$emailreminder = 1;
$emailreminderreset = null;
$subscriptionplandelete = null;
$paidbydatedelete = null;
$subscriptionplandatedelete = null;
$expirydatedelete = null;
$feemonthlysdelete = null;
$feesyearlydelete = null;
$paidreset = null;
$totalfees = null;
$overdue = 1;
$overduereset = 0;
$activatereset = 0;
$level1promo_activate = 0;
if(!isset($_SESSION['u_uid'])) {
header("Location: index.php?level1=notlogin");
exit();
} else {
include_once 'includes/dbh.php';
//Created a template
$sql = "SELECT * FROM memberships WHERE user_uid = ?;";
//Create a prepared statement
$stmt = mysqli_stmt_init($conn);
//Prepare the prepared statement
if (!mysqli_stmt_prepare($stmt, $sql)) {
echo 'SQL statement failed';
} else {
//Bind parameters to the placeholder
mysqli_stmt_bind_param($stmt, "s", $_SESSION['u_uid']);
//Run parameters inside database
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
while ($row = mysqli_fetch_assoc($result)) {
if ($row['subscriptionplan'] === 'Level 1' && $row['activate'] == 0 && $row['level1promo_activate'] == 0) {
header("Location: update.php?level1=notactivated");
exit();
} else {
if ($row['subscriptionplan'] === 'Level 1' && $row['activate'] == 1 && $row['emailreminder'] == 0 && $row['overdue'] == 0 && $row['paid'] == 0 && $row['feesmonthly'] != 0 && date("Y-m-d H:i:s") > $row['paidbydate']) {
$company = "[email protected]";
$subject = "Level 1 monthly subscriptionplan payment is overdue: Please pay by the ".$paidbydate;
$mailTo = $_SESSION['u_email'];
$headers = "From: ".$company;
$txt = "Hello ".$_SESSION['u_first']." ".$_SESSION['u_last']."! \n\n Your payment was due on the ".$row['paidbydate'].". It has now been extended to the following due date ".$paidbydate."\n\nPlease make sure that you have made your payment ASAP in order to access your Level 1 videos by the current due date. \n\nFailure to make payment will result in the cancellation of your Level 1 monthly subscriptionplan";
mail($mailTo, $subject, $txt, $headers);
$sql = "UPDATE memberships
SET paidbydate = ?, emailreminder = ?, overdue = ?
WHERE user_uid = ?
";
$stmt = mysqli_stmt_init($conn);
//Prepare the prepared statement
if (!mysqli_stmt_prepare($stmt, $sql)) {
echo 'SQL statement failed';
} else {
//Bind parameters to the placeholder
mysqli_stmt_bind_param($stmt, "siis", $paidbydate, $emailreminder, $overdue, $_SESSION['u_uid']);
//Run parameters inside database
mysqli_stmt_execute($stmt);
}
header("Location: update.php?level1=overdue");
exit();
} else {
if ($row['subscriptionplan'] === 'Level 1' && $row['activate'] == 1 && $row['emailreminder'] == 1 && $row['overdue'] == 1 && $row['paid'] == 0 && $row['feesmonthly'] != 0 && date("Y-m-d H:i:s") > $row['paidbydate']) {
$company = "[email protected]";
$subject = "Level 1 monthly subscriptionplan payment has been cancelled!";
$mailTo = $_SESSION['u_email'];
$headers = "From: ".$company;
$txt = "Hello ".$_SESSION['u_first']." ".$_SESSION['u_last']."! \n\n Your payment was due on the ".$row['paidbydate'].". Your Level 1 monthly subscriptionplan has been cancelled because you have failed to make payment and already have received an email reminder! \n\nPlease subscribe again if you wish to access your Level 1 videos!";
mail($mailTo, $subject, $txt, $headers);
$sql = "UPDATE memberships
SET subscriptionplan = ?, subscriptionplandate = ?, feesmonthly = ?, expirydate = ?, paidbydate = ?, emailreminder = ?, overdue = ?, activate = ?
WHERE user_uid = ?
";
$stmt = mysqli_stmt_init($conn);
//Prepare the prepared statement
if (!mysqli_stmt_prepare($stmt, $sql)) {
echo 'SQL statement failed';
} else {
//Bind parameters to the placeholder
mysqli_stmt_bind_param($stmt, "ssissiiis", $subscriptionplandelete, $subscriptionplandatedelete, $feemonthlysdelete, $expirydatedelete, $paidbydatedelete, $emailreminderreset, $overduereset, $activatereset, $_SESSION['u_uid']);
//Run parameters inside database
mysqli_stmt_execute($stmt);
}
header("Location: update.php?level1=cancelled");
exit();
} else {
if ($row['subscriptionplan'] === 'Level 1' && $row['activate'] == 1 && $row['emailreminder'] == 0 && $row['overdue'] == 0 && $row['paid'] == 0 && $row['feesyearly'] != 0 && date("Y-m-d H:i:s") > $row['paidbydate']) {
$company = "[email protected]";
$subject = "Level 1 yearly subscriptionplan payment is overdue: Please pay by the ".$paidbydate;
$mailTo = $_SESSION['u_email'];
$headers = "From: ".$company;
$txt = "Hello ".$_SESSION['u_first']." ".$_SESSION['u_last']."! \n\n Your payment was due on the ".$row['paidbydate'].". It has now been extended to the following due date ".$paidbydate."\n\nPlease make sure that you have made your payment ASAP in order to access your Level 1 videos by the current due date. \n\nFailure to make payment will result in the cancellation of your Level 1 yearly subscriptionplan";
mail($mailTo, $subject, $txt, $headers);
$sql = "UPDATE memberships
SET paidbydate = ?, emailreminder = ?, overdue = ?
WHERE user_uid = ?
";
$stmt = mysqli_stmt_init($conn);
//Prepare the prepared statement
if (!mysqli_stmt_prepare($stmt, $sql)) {
echo 'SQL statement failed';
} else {
//Bind parameters to the placeholder
mysqli_stmt_bind_param($stmt, "siis", $paidbydate, $emailreminder, $overdue, $_SESSION['u_uid']);
//Run parameters inside database
mysqli_stmt_execute($stmt);
}
header("Location: update.php?level1=overdue");
exit();
} else {
if ($row['subscriptionplan'] === 'Level 1' && $row['activate'] == 1 && $row['emailreminder'] == 1 && $row['overdue'] == 1 && $row['paid'] == 0 && $row['feesyearly'] != 0 && date("Y-m-d H:i:s") > $row['paidbydate']) {
$company = "[email protected]";
$subject = "Level 1 yearly subscriptionplan payment has been cancelled!";
$mailTo = $_SESSION['u_email'];
$headers = "From: ".$company;
$txt = "Hello ".$_SESSION['u_first']." ".$_SESSION['u_last']."! \n\n Your payment was due on the ".$row['paidbydate'].". Your Level 1 yearly subscriptionplan has been cancelled because you have failed to make payment and already have received an email reminder! \n\nPlease subscribe again if you wish to access your Level 1 videos!";
mail($mailTo, $subject, $txt, $headers);
$sql = "UPDATE memberships
SET subscriptionplan = ?, subscriptionplandate = ?, feesmonthly = ?, expirydate = ?, paidbydate = ?, emailreminder = ?, overdue = ?, activate = ?
WHERE user_uid = ?
";
$stmt = mysqli_stmt_init($conn);
//Prepare the prepared statement
if (!mysqli_stmt_prepare($stmt, $sql)) {
echo 'SQL statement failed';
} else {
//Bind parameters to the placeholder
mysqli_stmt_bind_param($stmt, "ssissiiis", $subscriptionplandelete, $subscriptionplandatedelete, $feemonthlysdelete, $expirydatedelete, $paidbydatedelete, $emailreminderreset, $overduereset, $activatereset, $_SESSION['u_uid']);
//Run parameters inside database
mysqli_stmt_execute($stmt);
}
header("Location: update.php?level1=cancelled");
exit();
// Up to this point, the code is working
} else {
if ($row['subscriptionplan'] === 'Level 1' && $row['feesmonthly'] != 0 && $row['activate'] == 1 && $row['paid'] == 1 && date("Y-m-d H:i:s") > $row['expirydate']) {
$company = "[email protected]";
$subject = "Level 1 monthly subscriptionplan payment has been cancelled!";
$mailTo = $_SESSION['u_email'];
$headers = "From: ".$company;
$txt = "Hello ".$_SESSION['u_first']." ".$_SESSION['u_last']."! \n\n Your payment was due on the ".$row['paidbydate'].". Your Level 1 monthly subscriptionplan has been cancelled because you have failed to make payment and already have received an email reminder! \n\nPlease subscribe again if you wish to access your Level 1 videos!";
mail($mailTo, $subject, $txt, $headers);
$sql = "UPDATE memberships
SET subscriptionplan = ?, subscriptionplandate = ?, feesmonthly = ?, paid = ?, expirydate = ?, paidbydate = ?, emailreminder = ?, overdue = ?, activate = ?
WHERE user_uid = ?
";
$stmt = mysqli_stmt_init($conn);
//Prepare the prepared statement
if (!mysqli_stmt_prepare($stmt, $sql)) {
echo 'SQL statement failed';
} else {
//Bind parameters to the placeholder
mysqli_stmt_bind_param($stmt, "ssiissiiis", $subscriptionplandelete, $subscriptionplandatedelete, $feemonthlysdelete, $paidreset, $expirydatedelete, $paidbydatedelete, $emailreminderreset, $overduereset, $activatereset, $_SESSION['u_uid']);
//Run parameters inside database
mysqli_stmt_execute($stmt);
}
header("Location: update.php?level1=expired");
exit();
} else {
if ($row['subscriptionplan'] === 'Level 1' && $row['feesyearly'] != 0 && $row['activate'] == 1 && $row['paid'] == 1 && date("Y-m-d H:i:s") > $row['expirydate']) {
$company = "[email protected]";
$subject = "Level 1 yearly subscriptionplan payment has been cancelled!";
$mailTo = $_SESSION['u_email'];
$headers = "From: ".$company;
$txt = "Hello ".$_SESSION['u_first']." ".$_SESSION['u_last']."! \n\n Your payment was due on the ".$row['paidbydate'].". Your Level 1 yearly subscriptionplan has been cancelled because you have failed to make payment and already have received an email reminder! \n\nPlease subscribe again if you wish to access your Level 1 videos!";
mail($mailTo, $subject, $txt, $headers);
$sql = "UPDATE memberships
SET subscriptionplan = ?, subscriptionplandate = ?, feesyearly = ?, paid = ? expirydate = ?, paidbydate = ?, emailreminder = ?, overdue = ?, activate = ?
WHERE user_uid = ?
";
$stmt = mysqli_stmt_init($conn);
//Prepare the prepared statement
if (!mysqli_stmt_prepare($stmt, $sql)) {
echo 'SQL statement failed';
} else {
//Bind parameters to the placeholder
mysqli_stmt_bind_param($stmt, "ssiissiiis", $subscriptionplandelete, $subscriptionplandatedelete, $feeyearlysdelete, $paidreset, $expirydatedelete, $paidbydatedelete, $emailreminderreset, $overduereset, $activatereset, $_SESSION['u_uid']);
//Run parameters inside database
mysqli_stmt_execute($stmt);
}
header("Location: update.php?level1=expired");
exit();
// last working code!
} if ($row['subscriptionplan'] === 'Level 1' && $row['activate'] == 1 && $row['paid'] == 1 && date("Y-m-d H:i:s") <= $row['expirydate']) {
header("Location: level1videos.php?levelvideos=success");
exit();
} else {
if ($row['subscriptionplan'] === 'Level 1' && $row['activate'] == 1 && $row['paid'] == 0 && date("Y-m-d H:i:s") <= $row['expirydate']) {
header("Location: update.php?level1=notpaid");
exit();
} else {
if ($row['subscriptionplan2'] === 'Level 2' && $row['level2promo_activate'] == 1 && date("Y-m-d H:i:s") > $row['expirydate2'] && $row['paid2'] == 0 && $row['activate2'] == 0) {
header("Location: update.php?level1promo=expired");
exit();
} else {
if ($row['subscriptionplan2'] === 'Level 2' && $row['level2promo_activate'] == 1 && date("Y-m-d H:i:s") <= $row['expirydate2'] && $row['paid2'] == 0 && $row['activate2'] == 0) {
header("Location: level2videos.php?level1promo=success");
exit();
} else {
header("Location: update.php?level1=notchosen");
exit();
}
}
}
}
}
}
}
}
}
}
}
}
}