gaugeboson Posted February 14, 2008 Share Posted February 14, 2008 syntax error, unexpected T_VARIABLE on line 12 <?php include("config.php"); if(isset($_GET['id']) == TRUE) { if(is_numeric($_GET['id']) == FALSE) { header("Location: " . $config_basedir); } $validforum = $_GET['id']; } else { header("Location:" $config_basedir); } require("header.php"); Link to comment https://forums.phpfreaks.com/topic/91009-syntax-error-unexpected-t_variable/ Share on other sites More sharing options...
cooldude832 Posted February 14, 2008 Share Posted February 14, 2008 It be great if we knew which line was line 12 (considering you showed us 10 lines that seems to be impossible!!!) Link to comment https://forums.phpfreaks.com/topic/91009-syntax-error-unexpected-t_variable/#findComment-466476 Share on other sites More sharing options...
AndyB Posted February 14, 2008 Share Posted February 14, 2008 I give up. You quote 10 lines of code and an error message for line 12. Best guess. config.php might have an error. Link to comment https://forums.phpfreaks.com/topic/91009-syntax-error-unexpected-t_variable/#findComment-466479 Share on other sites More sharing options...
gaugeboson Posted February 14, 2008 Author Share Posted February 14, 2008 oops <?php include("config.php"); if(isset($_GET['id']) == TRUE) { if(is_numeric($_GET['id']) == FALSE) { header("Location: " . $config_basedir); } $validforum = $_GET['id']; } else { header("Location:" $config_basedir); } require("header.php"); it is the line: header("location: " $config_basedir); Link to comment https://forums.phpfreaks.com/topic/91009-syntax-error-unexpected-t_variable/#findComment-466483 Share on other sites More sharing options...
trq Posted February 14, 2008 Share Posted February 14, 2008 Should be... <?php include("config.php"); if (isset($_GET['id'])) { if (!is_numeric($_GET['id'])) { header("Location: " . $config_basedir); } $validforum = $_GET['id']; } else { header("Location:" . $config_basedir); } require("header.php"); ?> Link to comment https://forums.phpfreaks.com/topic/91009-syntax-error-unexpected-t_variable/#findComment-466485 Share on other sites More sharing options...
gaugeboson Posted February 14, 2008 Author Share Posted February 14, 2008 I added in that period previously, though I got a 404 not found message (and still do). Link to comment https://forums.phpfreaks.com/topic/91009-syntax-error-unexpected-t_variable/#findComment-466493 Share on other sites More sharing options...
haku Posted February 14, 2008 Share Posted February 14, 2008 If thats the case then your base directory probably doesn't hold the correct value. What happens when you echo $config_basedir? Link to comment https://forums.phpfreaks.com/topic/91009-syntax-error-unexpected-t_variable/#findComment-466496 Share on other sites More sharing options...
gaugeboson Posted February 14, 2008 Author Share Posted February 14, 2008 I get a blank page. Link to comment https://forums.phpfreaks.com/topic/91009-syntax-error-unexpected-t_variable/#findComment-466509 Share on other sites More sharing options...
haku Posted February 14, 2008 Share Posted February 14, 2008 Then you need to set a value for $config_basedir somewhere. Right now its empty. Link to comment https://forums.phpfreaks.com/topic/91009-syntax-error-unexpected-t_variable/#findComment-466510 Share on other sites More sharing options...
gaugeboson Posted February 14, 2008 Author Share Posted February 14, 2008 I do have a value there: http://127.0.0.1/sites/forums/ When I input the period as you recommended I get the 404 error, and it links to that url. Whereas the code was written for viewforum, which should come up through localhost/viewforum.php Link to comment https://forums.phpfreaks.com/topic/91009-syntax-error-unexpected-t_variable/#findComment-466576 Share on other sites More sharing options...
haku Posted February 14, 2008 Share Posted February 14, 2008 What is the value contained in $config_basedir The period is required. There is no way around it. Link to comment https://forums.phpfreaks.com/topic/91009-syntax-error-unexpected-t_variable/#findComment-466577 Share on other sites More sharing options...
gaugeboson Posted February 14, 2008 Author Share Posted February 14, 2008 $config_basedir = "http://127.0.0.1/sites/forums/"; Link to comment https://forums.phpfreaks.com/topic/91009-syntax-error-unexpected-t_variable/#findComment-466583 Share on other sites More sharing options...
haku Posted February 14, 2008 Share Posted February 14, 2008 There is your problem - that page doesn't exist. Link to comment https://forums.phpfreaks.com/topic/91009-syntax-error-unexpected-t_variable/#findComment-466587 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.