Jump to content

Syntax error??


Genesis730

Recommended Posts

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

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

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.