eaglelegend Posted July 27, 2008 Share Posted July 27, 2008 Hello guys, sorry I havent been online for a while!, I could really appreciate your help, since my database had messed up, and I want to create a filebased notifing system if you dont understand, allow me to explain, admin, or such, can log in to there filebased accounts, to notify the users that the site is down, in the way, you could say they can access this page to close the site, and put a reason why and date and time when the site will be back, as you will soon see in my code!. The problem I am having is an old one, in terms, you probably get this ALOT!... Parse error: syntax error, unexpected $end in common.php on line 119 This is in the common.php file, basically where everything processes, you all probably, and should know that anyway. Thanks again, I could really appreciate your help. <?php session_start(); function registerUser($user,$pass1,$pass2){ $errorText = ''; // Check passwords if ($pass1 != $pass2) $errorText = "Passwords are not identical!"; elseif (strlen($pass1) < 6) $errorText = "Password is to short!"; // Check user existance $pfile = fopen("userpwd.txt","a+"); rewind($pfile); while (!feof($pfile)) { $line = fgets($pfile); $tmp = explode(':', $line); if ($tmp[0] == $user) { $errorText = "The selected user name is taken!"; break; } } // If everything is OK -> store user data if ($errorText == ''){ // Secure password string $userpass = md5($pass1); fwrite($pfile, "\r\n$user:$userpass"); } fclose($pfile); return $errorText; } function loginUser($user,$pass){ $errorText = ''; $validUser = false; // Check user existance $pfile = fopen("userpwd.txt","r"); rewind($pfile); while (!feof($pfile)) { $line = fgets($pfile); $tmp = explode(':', $line); if ($tmp[0] == $user) { // User exists, check password if (trim($tmp[1]) == trim(md5($pass))){ $validUser= true; $_SESSION['userName'] = $user; } break; } } fclose($pfile); if ($validUser != true) $errorText = "Invalid username or password!"; if ($validUser == true) $_SESSION['validUser'] = true; else $_SESSION['validUser'] = false; return $errorText; } function logoutUser(){ unset($_SESSION['validUser']); unset($_SESSION['userName']); } function checkUser(){ if ((!isset($_SESSION['validUser'])) || ($_SESSION['validUser'] != true)){ header('Location: login.php'); } } function Maintain($reason,$month,$day,$year,$hour,$min,$sec){ $errorText = ''; // Check info existance $pfile = fopen("maintain.txt","a+"); rewind($pfile); while (!feof($pfile)) { $line = fgets($pfile); $tmp = explode(':', $line); if ($tmp[0] == $reason) { $errorText = "There is an error with the reason!"; if ($tmp[0] == $month) { $errorText = "There is an error with the month!"; if ($tmp[0] == $day) { $errorText = "There is an error with the day!"; if ($tmp[0] == $year) { $errorText = "There is an error with the year!"; if ($tmp[0] == $hour) { $errorText = "There is an error with the hour!"; if ($tmp[0] == $min) { $errorText = "There is an error with the minute!"; if ($tmp[0] == $sec) { $errorText = "There is an error with the second!"; break; } } // If everything is OK -> store user data if ($errorText == ''){ fwrite($pfile, "\r\n$reason:$month:$day:$year:$hour:$min:$sec"); } fclose($pfile); return $errorText; ?> Link to comment https://forums.phpfreaks.com/topic/116868-common-problem-in-commonphp/ Share on other sites More sharing options...
Nhoj Posted July 27, 2008 Share Posted July 27, 2008 Your last function appears to be missing the closing brace before the ?> at the end of the document Link to comment https://forums.phpfreaks.com/topic/116868-common-problem-in-commonphp/#findComment-600947 Share on other sites More sharing options...
DarkWater Posted July 27, 2008 Share Posted July 27, 2008 An error involving $end usually means that you forgot a closing curly brace ( } ). Link to comment https://forums.phpfreaks.com/topic/116868-common-problem-in-commonphp/#findComment-600948 Share on other sites More sharing options...
eaglelegend Posted July 27, 2008 Author Share Posted July 27, 2008 just added 1 } to the bottom before ?> but still haveing the same problem... Link to comment https://forums.phpfreaks.com/topic/116868-common-problem-in-commonphp/#findComment-600950 Share on other sites More sharing options...
DarkWater Posted July 27, 2008 Share Posted July 27, 2008 Did you upload a new copy to the web server...? >_> Also, check every single opening brace for a matching closing brace. Link to comment https://forums.phpfreaks.com/topic/116868-common-problem-in-commonphp/#findComment-600953 Share on other sites More sharing options...
Nhoj Posted July 27, 2008 Share Posted July 27, 2008 You also didn't close 90% of the if statements in the last function starting with: if ($tmp[0] == $reason) { $errorText = "There is an error with the reason!"; if ($tmp[0] == $month) { $errorText = "There is an error with the month!"; if ($tmp[0] == $day) { $errorText = "There is an error with the day!"; if ($tmp[0] == $year) { $errorText = "There is an error with the year!"; if ($tmp[0] == $hour) { $errorText = "There is an error with the hour!"; if ($tmp[0] == $min) { $errorText = "There is an error with the minute!"; if ($tmp[0] == $sec) { $errorText = "There is an error with the second!"; break; } You probably meant to do else if but didnt. Link to comment https://forums.phpfreaks.com/topic/116868-common-problem-in-commonphp/#findComment-600954 Share on other sites More sharing options...
eaglelegend Posted July 27, 2008 Author Share Posted July 27, 2008 OH of course LOL I see, what I done was kind of a copy paste job to save me time, ok thanks! Link to comment https://forums.phpfreaks.com/topic/116868-common-problem-in-commonphp/#findComment-600957 Share on other sites More sharing options...
eaglelegend Posted July 27, 2008 Author Share Posted July 27, 2008 Thanks "Nhoj"!, I have successfully done that, now for the output code LOL! Link to comment https://forums.phpfreaks.com/topic/116868-common-problem-in-commonphp/#findComment-600959 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.