Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

my header.php page says error still can anyone help me please. <!DOCTYPE html PU

ID: 3805016 • Letter: M

Question

my header.php page says error still can anyone help me please.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script>
function startCountdown() {
window.setTimeout(alertSessionTimeout, (<%=session.getMaxInactiveInterval()%> * 1000));
}
  
function alertSessionTimeout() {
alert("You're login session has been expired, LOGIN again to continue :) ");
setTimeout('Redirect()', 500);
}
function Redirect() {
       window.location = "logout.php";
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>GAMESKART</title>
<style type="text/css">
.right {
   text-align: right;
}
#form1 {
   text-align: center;
}
.normal {
   text-align: left;
   font-weight: bold;
   font-family: Arial, Helvetica, sans-serif;
}
.unormal {
   font-family: Arial, Helvetica, sans-serif;
}
.center1 {   text-align: center;
}


</style>
</head>
<body background="images/bg-box.gif" <%if(session.getAttribute("userInfo") != null) { %>onload="startCountdown();"<%} %>>
<center><img alt="voxvilla" src="images/voxvilla.gif"></center>
   <table width="100%" border="0">
       <tr>
       <td width="20%">
           <a href="home.php"><img src="images/home.png" width="100" height="88" alt="Logo" /></a>
       </td>
   <td width="80%" class="right"><font size="04">
       24X7 Customer Support -<a href="contact.php">Contact Us</a> | <a href="home.php">Home</a> |
<%
   if(session.getAttribute("userInfo") == null) {
%>
                               <a href="login.php">Login</a> | <a href="register.php">Register</a>
<%
   } else {
%>
                       <a href="logout.php">Logout</a><br>
                       <%
                       Users user = (Users)session.getAttribute("userInfo");
                       if(user.getUserType().equals(UserTypes.ADMIN.toString())) {
                       %>
                       <a href="adminHome.php">
                       <%
                       } else if(user.getUserType().equals(UserTypes.SELLER.toString())) {
                       %>
                       <a href="sellerHome.php">
                       <%
                       } else if(user.getUserType().equals(UserTypes.CUSTOMER.toString())) {
                       %>
                       <a href="customerHome.php">
                       <%
                       }
                       %>
                       Main</a> |
                       <%
                           if(user.getUserType().equals(UserTypes.CUSTOMER.toString())) {
                               Connection con = BaseDAO.getConnection();
                       Statement stmt = con.createStatement();
                       ResultSet rslt = stmt.executeQuery("SELECT item_qnty " +
                               " FROM cart c, users u, items i " +
                               " WHERE c.user_id = " + user.getId() +
                               " AND c.user_id = u.id " +
                               " AND c.item_id = i.id;");
                      
                       int noOfItemsInCart = 0;
                       while(rslt.next()) {
                           noOfItemsInCart = noOfItemsInCart + rslt.getInt(1);
                       }
                   %>
                       <a href="cart.php">Cart(<%=noOfItemsInCart %>)</a>
                   <%
                           rslt.close();
                           stmt.close();
                   BaseDAO.closeConnection(con);
                           }//CUSTOMER
                       %>
                       |
                       Logged As: <%=session.getAttribute("username")%>
<%
   }
%>
<br><br>
            <form id="form1" name="form1" method="post" action="search.php">
                <input name="searchString" type="text" id="searchString" />
                <label>
                   <input type="submit" name="submit" value="Search" />
               </label> </font>
            </form>
        </td>
   </tr>
   </table>
<hr />

Explanation / Answer

Below is the required code:-

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script>
function startCountdown() {
window.setTimeout(alertSessionTimeout, (<%=session.getMaxInactiveInterval()%> * 1000));
}
  
function alertSessionTimeout() {
alert("You're login session has been expired, LOGIN again to continue :) ");
setTimeout('Redirect()', 500);
}
function Redirect() {
       window.location = "logout.php";
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>GAMESKART</title>
<style type="text/css">
.right {
   text-align: right;
}
#form1 {
   text-align: center;
}
.normal {
   text-align: left;
   font-weight: bold;
   font-family: Arial, Helvetica, sans-serif;
}
.unormal {
   font-family: Arial, Helvetica, sans-serif;
}
.center1 {   text-align: center;
}


</style>
</head>
<body background="images/bg-box.gif" <%if(session.getAttribute("userInfo") != null) { %>onload="startCountdown();"<%} %>>
<center><img alt="voxvilla" src="images/voxvilla.gif"></center>
   <table width="100%" border="0">
       <tr>
       <td width="20%">
           <a href="home.php"><img src="images/home.png" width="100" height="88" alt="Logo" /></a>
       </td>
   <td width="80%" class="right"><font size="04">
       24X7 Customer Support -<a href="contact.php">Contact Us</a> | <a href="home.php">Home</a> |
<%
   if(session.getAttribute("userInfo") == null) {
%>
                               <a href="login.php">Login</a> | <a href="register.php">Register</a>
<%
   } else {
%>
                       <a href="logout.php">Logout</a><br>
                       <%
                       Users user = (Users)session.getAttribute("userInfo");
                       if(user.getUserType().equals(UserTypes.ADMIN.toString())) {
                       %>
                       <a href="adminHome.php">
                       <%
                       } else if(user.getUserType().equals(UserTypes.SELLER.toString())) {
                       %>
                       <a href="sellerHome.php">
                       <%
                       } else if(user.getUserType().equals(UserTypes.CUSTOMER.toString())) {
                       %>
                       <a href="customerHome.php">
                       <%
                       }
                       %>
                       Main</a> |
                       <%
                           if(user.getUserType().equals(UserTypes.CUSTOMER.toString())) {
                               Connection con = BaseDAO.getConnection();
                       Statement stmt = con.createStatement();
                       ResultSet rslt = stmt.executeQuery("SELECT item_qnty " +
                               " FROM cart c, users u, items i " +
                               " WHERE c.user_id = " + user.getId() +
                               " AND c.user_id = u.id " +
                               " AND c.item_id = i.id;");
                      
                       int noOfItemsInCart = 0;
                       while(rslt.next()) {
                           noOfItemsInCart = noOfItemsInCart + rslt.getInt(1);
                       }
                   %>
                       <a href="cart.php">Cart(<%=noOfItemsInCart %>)</a>
                   <%
                           rslt.close();
                           stmt.close();
                   BaseDAO.closeConnection(con);
                           }//CUSTOMER
                       %>
                       |
                       Logged As: <%=session.getAttribute("username")%>
<%
   }
%>
<br><br>
            <form id="form1" name="form1" method="post" action="search.php">
                <input name="searchString" type="text" id="searchString" />
                <label>
                   <input type="submit" name="submit" value="Search" />
               </label> </font>
            </form>
        </td>
   </tr>
   </table>
<hr />