Below is the code for a simple php file with some functions that run perfectly happily when the inside of the php tag is commented out. isLoggedIn() is a function that I know is coded correctly in the session.php file as it is used elsewhere and works.
For some weird reason, firefox console is telling me there is a syntax error on line 1:
[00:11:56.115] SyntaxError: syntax error @ admin_script.php:1
Any help would be greatly appreciated!
<?php
include('../includes/session.php');
if(isLoggedIn() == false)
{
header('HTTP/1.0 404 Page Not Found');
}
?>
$(document).ready(function(){
/* All the JS code here for the admin page to be sent to the HTML.
Two functions, one needs to provide the sections to the "editor-sections" div and another the content to the "editor-content" div.
*/
$('button[id=exercises_button]').click(function(){
exercise_editor();
});
$('button[id=problems_button]').click(function(){
problems_editor();
});
var exercise_editor = function(){
window.alert("Exercise button clicked");
};
var problems_editor = function(){
window.alert("Problems button clicked");
};
});
Thank you!
So I solved it, thank you for all your responses, but the directory was all correct and everything. I decided to re-write the small php segment, just wondering if spaces made any difference (even though I knew they wouldn't) and miraculously it worked. I believe that the location of the heaader()
was causing the trouble as when I re-wrote it, I simply changed it to header('Location: http://www.google.com
and no problem came about.
So very very strange, especially as the change had nothing to do with line 1. Thank you for all your responses!
i think your directory is wrong .. if you have session file on same folder , do include("file.php")
let this be folder structure
-folderA
__ |-folderB
___|-folderC
if you have your index file on folder A and you have session file on B or C , do include("folderA(B).php") . if you have index.php on folder B or C and your session.php on A, then do include("../folderA/session.php")
I think your path is wrong the error message says that the error is on the line 1
SyntaxError: syntax error @ admin_script.php:1
if the file structure is
admin_script.php
-includes/session.php
the path is include('includes/session.php');
if you are in this condition
-folder/admin_script.php
-includes/session.php
than the correct path is include('../includes/session.php');