Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\IndonusaCMS\admin\index.php on line 544

admin/index.php

<?PHP

require('../include/config.php');

if (empty($_SESSION['login'])) 

{ 

    header ("location: login.php");

}

else if ($_SESSION['level']!= 1) {

    header ("location: ../");

}

else{

include "./include/class.php";

$site = new site();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">



<head>



<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title>SCN administrator</title>





<link href="./stylesheets/master.css" media="screen" rel="stylesheet" type="text/css" />



<script type="text/javascript">

<!--

var timeout         = 500;

var closetimer      = 0;

var ddmenuitem      = 0;



// open hidden layer

function mopen(id)

{   

    // cancel close timer

    mcancelclosetime();



    // close old layer

    if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';



    // get new layer and show it

    ddmenuitem = document.getElementById(id);

    ddmenuitem.style.visibility = 'visible';



}

// close showed layer

function mclose()

{

    if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

}



// go close timer

function mclosetime()

{

    closetimer = window.setTimeout(mclose, timeout);

}



// cancel close timer

function mcancelclosetime()

{

    if(closetimer)

    {

        window.clearTimeout(closetimer);

        closetimer = null;

    }

}



// close layer when click-out

document.onclick = mclose; 

// -->

</script>



<?PHP

if (isset($_GET["page"])) 



{

    $page = $_GET["page"];

    switch ($page)

    {



    case action:

    $class1 = "active";

    $include = "action.php";

    break;



    case home:

    $class1 = "active";

    $include = "home.php";  

    break;



    case about_us:

    $class2 = "active";

    $include = "about_us.php";  

    break;



    case ikuti:

    $class2 = "active";

    $include = "ikuti.php"; 

    break;



    case fokus:

    $class3 = "active";

    $include = "fokus.php"; 

    break;



    case program:
    case voice:
    case video: 
    case building:
    case hotel:
    case call:
    case unified:   
    case microsoft:
    case connection_setup:
    case email_setup:
    case payment:
    case billing:
    case faq:
    case change_psw:
    case careers:
    case agent:
    $class3 = "active";
    $include = "dynamic.php";   
    break;

    case reg_online:
    $class3 = "active";
    $include = "reg_online.php";    
    break;

    case ceritadahsyat:
    $class3 = "active";
    $include = "dynamic.php";   
    break;



    /* case testimonial:

    $class3 = "active";

    $include = "testimonial.php";   

    break; */



    case events:

    $class3 = "active";

    $include = "dynamic.php";   

    break;



    case menu:

    $class4 = "active";

    $include = "menu.php";  

    break;


    case menu_other:

    $class4 = "active";

    $include = "menu_other.php";    

    break;



    case plugins:

    $class4 = "active";

    $include = "plugins.php";   

    break;



    case promo:

    $class4 = "active";

    $include = "promo.php"; 

    break;



    case banner:

    $class4 = "active";

    $include = "banner.php";    

    break;



    case contact:

    $class4 = "active";

    $include = "contact.php";   

    break;



    case user_admin:

    $class4 = "active";

    $include = "user_admin.php";    

    break;



    case katamutiara:

    $class4 = "active";

    $include = "kamut.php"; 

    break;



    case edituser:

    case profile:

    $class5 = "active";

    $include = "edit_profile.php";  

    break;



    case editpromo:

    $class4 = "active";

    $include = "edit_promo.php";    

    break;



    case editbanner:

    $class4 = "active";

    $include = "edit_banner.php";   

    break;



    case addbanner:

    $class4 = "active";

    $include = "add_banner.php";    

    break;



    case addpromo:

    $class9 = "active";

    $include = "add_promo.php"; 

    break;



    case addcontent:

    $class3 = "active";

    $include = "add_content.php";   

    break;



    case editcontent:

    $class3 = "active";

    $include = "edit_content.php";  

    break;



    case addstatic:

    $class2 = "active";

    $include = "add_static.php";    

    break;





    case editstatic:

    $class2 = "active";

    $include = "edit_static.php";   

    break;



    case addkamut:

    case updatekamut:

    $include = "addkamut.php";  

    break;



    case jadwal: 

    $class3 = "active";

    $include = "jadwal.php";    

    break;



    case addjadwal:

    case editjadwal:

    $class3 = "active";

    $include ="add_jadwal.php"; 

    break;



    default:

    $include = "home.php";  

    }

}

else 

{

$body = "dashboard";

$include = "home.php";

}

?>

</head>



<body class="dashboard">

<?php

include ("header.php");

$query = mysql_query("SELECT * FROM menu_order");

while ($menudata = mysql_fetch_assoc($query))

{

    $menuarray[] = $menudata;

}

$querymenu = mysql_query("SELECT COUNT(*) as total FROM menu_order");

$getmennu = mysql_fetch_assoc($querymenu);

$totalmenu = $getmennu['total'];

?>

<div id="wrap">

    <?php

    include ("sideright.php");

    ?>

    <div id="mainContent">

    <?php

    include ($include);

    ?>

    </div>

</div>

</body>

</html>

<?

}

?>

Netbeans suppose to show me red exclamation mark "!" if I am missing a parentheses correct?

I can see a few yellow triangle exclamation marks "!" even in the admin/index.php file.

Do I need to check all the include files as well for a red exclamation mark?

-----------------------

Also, cek the last line of my codes (line 538 - 542):

<?
}
?>

Line 542 : Unnecessary closing delimiter - if I remove it the same error still remains

Parse error: syntax error, unexpected end of file in E:xampphtdocsIndonusaCMSadminindex.php on line 544

If I add <?php to line 538 then lots of errors start appearings.

Your code is very messy in my opinion, so a quick glance does not find me your unexpected end of file.

Note it could be a problem if your file was not saved right or uploaded correctly.

But I can tell you your closing bracket on line 538-542 is NOT unnecessary. The displayed code has 12 opening brackets and 12 closing brackets. So maybe you should try and understand why you think it is unnecessary, it could be placed wrong?

Also, all your case's should be strings. You are switch()'ing a string $_GET['page'] but you are using constants, example: case action:.

While it will probably work because PHP is very helpful and convert action into (string)'action' when it can't find a matching constant, you should fix it to avoid any conflicts. So put quotes around all those case's.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.