Genesis730 Posted July 3, 2010 Share Posted July 3, 2010 I hope someone can find an error with this. I keep getting "Parse error: parse error in process.php on line 145" 131 function procCreate(){ 132 global $session, $form; 133 if($session->logged_in){ 134 $dir = preg_replace("/(.*)(\/)$/","\\1", $dir); 135 $dir = $session->username; 136 $absolute_dir = $_SERVER['DOCUMENT_ROOT'].''.$dir; 137 if (!is_dir($absolute_dir)) { 138 mkdir($absolute_dir, 0777); 139 chmod($absolute_dir, 0777); 140 return $absolute_dir; 141 } 142 else { 143 echo "There was an error processing your request"; 144 } 145 else { 146 header("Location: index.php"); 147 } 148 } 149 } Link to comment https://forums.phpfreaks.com/topic/206664-syntax-error/ Share on other sites More sharing options...
AtomicRax Posted July 3, 2010 Share Posted July 3, 2010 You have two concurrent else statements. The following will redirect to index.php if NOT logged in...is that what you're trying to achieve? function procCreate(){ global $session, $form; if($session->logged_in){ $dir = preg_replace("/(.*)(\/)$/","\\1", $dir); $dir = $session->username; $absolute_dir = $_SERVER['DOCUMENT_ROOT'].''.$dir; if (!is_dir($absolute_dir)) { mkdir($absolute_dir, 0777); chmod($absolute_dir, 0777); return $absolute_dir; } else { echo "There was an error processing your request"; } } else { header("Location: index.php"); } } Link to comment https://forums.phpfreaks.com/topic/206664-syntax-error/#findComment-1080872 Share on other sites More sharing options...
Genesis730 Posted July 3, 2010 Author Share Posted July 3, 2010 Yeah, if they're not logged in, go to index.php, else create the directory, then if there's an error with the directory, echo there was an error processing the request. Link to comment https://forums.phpfreaks.com/topic/206664-syntax-error/#findComment-1080873 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.