Parse error: syntax error, unexpected '{' in /home/joshua/domains/matematyczna.pl/public_html/projekt/functions/funcLayout.php on line 73
W skrypcie linijka 73 to początek bloku try, a tak wygląda cały fragment odpowiadający za logowanie:
/* cały poniższy kod trzymam w innej funkcji i potem sobie wyświetlam tam gdzie chc
ę, ale to chyba nie ma znaczenia :) */ <?php CreateTitle('Logowanie'); $blnLogged = CheckUser(); if ($blnLogged === FALSE){ CreateLoginForm(); else{ try{ $arrData = Login($_POST['username'], $_POST['password']); $_SESSION['userid'] = $arrData['userid']; $_SESSION['username'] = $arrData['username']; $_SESSION['firstname'] = $arrData['firstname']; $_SESSION['surname'] = $arrData['surname']; Greeting(); } catch(Exception $e){ CreateLoginForm(); } } } else{ $strPage = ''; $strPage = $_GET['page']; if($strPage != 'logout') Greeting(); else CreateLoginForm(); } ?>
A to funkcja Login():
<?php function Login($strUserName, $strPass){ $objDB = DBConnect(); $mixDBData = $objDB->query("SELECT * FROM `users` WHERE `username` = '$strUserName' AND `password` = sha1('$strPass')"); if($mixDBData->num_rows<1) throw new Exception('Wpisano niepoprawne dane.'); else $arrDBData = $mixDBData->fetch_assoc(); $mixDBIfAdmin = $objDB->query("SELECT * FROM `admin` WHERE `userid` = ".$arrDBData['userid'].""); if($mixDBIfAdmin->num_rows>0){ $arrData['admin'] = 'YES'; } foreach($arrDBData as $key => $value){ if($key=='password') continue; $arrData[$key] = $value; } return $arrData; } ?>
Dodam jeszcze, że na tym samym serwerze używałem już wyjątków pisząc inne strony i wszystko było ok.
Siedzę na tym długo i nie wiem co może być przyczyną :/