Jump to content

Giving a Error Easy Fix


Stotty

Recommended Posts

Ive just uploaded this script

 

<?php
$action = $_GET['action'];
if($action == "") {
$include = "home.php";
}
$include2 = $include . ".php";
if(file_exists($include2) {
include($include2);
} else {
echo 'Page Cannot Be Found.<br>';
echo 'Requested File: ' . strip_tags($include2);
}
?> 

 

Ive had this error before but carnt rember how i fixedd

 

this is the error i get

 

Parse error: syntax error, unexpected '{' in /home/a5499887/public_html/Setoxis/index.php on line 7

 

Thanks in Advanced

Link to comment
https://forums.phpfreaks.com/topic/156650-giving-a-error-easy-fix/
Share on other sites

<?php

$action = $_GET['action'];

if($action == "") {

$include = "home.php";

}

$include2 = $include . ".php";

if(file_exists($include2)) {

include($include2);

} else {

echo 'Page Cannot Be Found.<br>';

echo 'Requested File: ' . strip_tags($include2);

}

?>

 

 

and the error is

 

 

Parse error: syntax error, unexpected '{' in /home/a5499887/public_html/Setoxis/index.php on line 7

<?php
$action = $_GET['action'];
if($action == "") {
$include = "home";
}
$include2 = $include . ".php";
if(file_exists($include2)) {
include($include2);
} else {
echo 'Page Cannot Be Found.<br>';
echo 'Requested File: ' . strip_tags($include2);
}
?>

 

That should work

Nothing wrong with the new code.

 

Check that you are uploading and overwriting the script, if you are uploading to a website. Check that the script is not being cached. Check you are executing the correct script in the browser.

 

Add an echo in there and see if that shows.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.