i developed a system in xampp 1.7.2, and now i run it in xampp 1.8.2 (lastest version)
i got this error
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\
hint: in xampp 1.7.2 no error
anybody can tell me why?
i developed a system in xampp 1.7.2, and now i run it in xampp 1.8.2 (lastest version)
i got this error
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\
hint: in xampp 1.7.2 no error
anybody can tell me why?
is mod_rewrite enabled in your new version?
yes
I'm not too sure here. Could this be down to deprecation causing a stray curly brace? It would be really helpful to see the code.
<?php
require_once(dirname(__FILE__) . "/config/conf.php");
require_once(dirname(__FILE__) . "/functions/list_functions.php");
$action = getParam("act");
$show = getParam("show");
$adm = getParam("adm");
include("viewer/header.php");
include("viewer/left_sidebar.php");
if ($action == "showSW") {
if (isAdminLogin() || isGuruLogin() || isSiswaLogin($username)) {
include("viewer/show_siswa.php");
} else {
?> <script>alert('Akses Ditolak!');</script>
<?php goToUrl("index.php") ?>
<?
}
} elseif ($action == "showGR") {
include("viewer/show_guru.php");
} elseif ($action == "showLB") {
if (isGuruLogin()){
if(isKoordinator()){
include("viewer/show_laporanbelajar_guru.php");
}
else{
include("viewer/show_laporanbelajar_nonkoo.php");
}
}
else if(isSiswaLogin()){
include("viewer/show_laporanbelajar_siswa.php");
}
else if(isAdminLogin()){
include("viewer/show_laporanbelajar_nonkoo.php");
}
else {
?>
<script>alert('Akses Ditolak!');</script>
<?php goToUrl("index.php") ?>
<?
}
}
elseif ($action == "ShowGalery") {
if (isAdminLogin() || isGuruLogin() || isSiswaLogin()) {
include("viewer/show_galery.php");
} else {
?>
<script>alert('Akses Ditolak!');</script>
<?php goToUrl("index.php") ?>
<?
}
}
elseif ($action == "showVM") {
include("viewer/show_visimisi.php");
}
elseif ($action == "adm") {
if (isAdminLogin()) {
goToUrl("admin.php");
} else {
?><script>alert('Access Denied!');</script><?
goToURL("index.php");
}
}
elseif ($action == "showPengumuman") {
include("viewer/pengumuman.php");
}
elseif ($action == "gantiPassword") {
include("viewer/change_password.php");
}
elseif ($action == "showPeraturan") {
include("viewer/show_peraturan.php");
}
elseif ($action == "showDaftarBuku") {
include("viewer/show_daftar_buku.php");
}
elseif ($action == "showSejarah") {
include("viewer/show_sejarah.php");
}
elseif ($action == "ShowContact") {
include("viewer/show_contact.php");
}
elseif ($action == "showMateriPraktikum") {
include("viewer/show_materi_praktikum.php");
}
elseif ($action == "showMateriPelajaran") {
include("viewer/show_materi_pelajaran.php");
}
elseif($show == "showlist"){
include("viewer/show_laporanbelajar_guru.php");
}
elseif($adm == "insertNilai"){
include("viewer/show_laporanbelajar_guru.php");
}
elseif($adm =="insertNilaiUTSUASUpdate"){
include("viewer/show_laporanbelajar_guru.php");
}
elseif($show =="ShowListforUpdate"){
include("viewer/show_laporanbelajar_guru.php");
}
elseif($show =="updateNilaiKe"){
include("viewer/show_laporanbelajar_guru.php");
}
elseif($adm=="updateNilaiTugas"){
include("viewer/show_laporanbelajar_guru.php");
}
else {
if(isAdminLogin()|| isGuruLogin() || isSiswaLogin()){
include("viewer/center.php");
include("viewer/right_sidebar.php");
}
else{
include("viewer/show_visimisi.php");
}
}
include("viewer/details.php");
include("viewer/footer.php");
?>
Pass... blocks look fine. Did you cut out some of your error?
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\
Error could be in an include rather than this script.
complete:
Parse error: syntax error, unexpected $end in C:\xampp\htdocs\SMKFArjuna\index.php on line 126
i don't think so, I've had problem like this twice, including this, and in my previous project no "include"
i just don't understand, it's works in xampp 1.7.2
suggests a missing brace. As mm states, could be in an include file.
Couldn't help noticing that you have a lot of code here, which could be shortened somewhat:
elseif($show == "showlist"){
include("viewer/show_laporanbelajar_guru.php");
}
elseif($adm == "insertNilai"){
include("viewer/show_laporanbelajar_guru.php");
}
elseif($adm =="insertNilaiUTSUASUpdate"){
include("viewer/show_laporanbelajar_guru.php");
}
elseif($show =="ShowListforUpdate"){
include("viewer/show_laporanbelajar_guru.php");
}
elseif($show =="updateNilaiKe"){
include("viewer/show_laporanbelajar_guru.php");
}
elseif($adm=="updateNilaiTugas"){
include("viewer/show_laporanbelajar_guru.php");
}
with
elseif(in_array($show, array('showlist','ShowListforUpdate','updateNilaiKe')) || in_array($adm, array('insertNilai','insertNilaiUTSUASUpdate','updateNilaiTugas'))){
include("viewer/show_laporanbelajar_guru.php");
}
just a thought.
@1a2p3a4c5h6e,
!Warning! Codes are not tested... but should work with pretty minor tweaks, just fix my excess parenthesis or missing quotes...
Just another humble thoughts of refactoring your codes is to use a framework style routing. To be able to do this, you will have to ** rename your php pages after the action** (the same as the action name, literally).
Can pretty much eliminate the elseif --if not all, as shown by simple routing function below.. You can also use FILE to make it like a wordpress style.. the choice is yours.. You are always welcome to add switch within the function to accomodate other file names as needed..
function get_Action($action,$directory){
$include_this_file = basename($_SERVER['SCRIPT_NAME'], '.php');
if(($include_this_file !=="") || (file_exists($directory .'/'. $include_this_file))){
return $directory.'/'.$include_this_file;
}
else{
return $directory.'/show_laporanbelajar_guru.php';
}
}
We can easily use it like this
include_once(get_Action(getParam('act'),'viewer'));
We can further refactor the above function by using a single line return.. similar to the common practices in Ruby or Python..thus, eliminating the else completely..
return((($include_this_file !=="") || (file_exists($directory .'/'. $include_this_file)))? $directory.'/'.$include_this_file : $directory.'/show_laporanbelajar_guru.php');
sorry, I forgot to comment on your original question..
change this on line 62
<script>alert('Access Denied!');</script><?
goToURL("index.php");
to this
<script>alert('Access Denied!');</script>
<?php
goToURL("index.php");
Make sure to make corrections on all occurences of <?. For now, stay away from using the short tags. You can use later on..
thanks @veedeoo
it's works
<? must be <?php
for refactoring, i will clean it up
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.