Code Errors

I’m still learning PHP and I’m testing a login system. When I try to access the form page, I get this error: “Parse error: syntax error, unexpected $end in /home/accoun80/public_html/login_form.php on line 27”. The code of the page is this:
[php]<?php
session_start();
require_once ‘classes/Membership.php’;
$membership = new Membership();
//If the user clicks the Log out link
if(isset($_GET[‘status’]) && $_GET[‘status’] == ‘loggedout’) {
$membership->Log_User_Out();
//Did the user enter a password/username and click submit
if($_POST && !empty($_POST[‘username’]) && !empty($_POST[‘pwd’])) {
$response = $membership->validate_User($_POST[‘username’], $POST[‘pwd’]);
}
?>

Login Test

Login

Username:

Password:

[/php] Can someone help me?

You’re missing the } after the first if statement
[php]if(isset($_GET[‘status’]) && $_GET[‘status’] == ‘loggedout’) {
$membership->Log_User_Out();
} // missing in yours
[/php]

I still get another error: “Parse error: syntax error, unexpected ‘}’ in /home/accoun80/public_html/classes/Membership.php on line 10”.

Then look through the class and make sure you’re not missing any } in there.

I still get the same error. The code is this:
[php]<?php
require ‘Mysql.php’;
class Membersip {
function validate_user($un, $pwd) {
$mysql = New Mysql();
$ensure_credentials = $mysql->verify_Username_and_Pass($un, $pwd);
if($ensure_credentials) {
$_SESSION[‘status’] = ‘authorized’;
header(“Location: status.php”)
} else return “Please enter the correct username and password”;
function Log_User_Out() {
if (isset($_SESSION[‘status’])) {
unset($_SESSION[‘status’]);
if(isset($_COOKIE[session_name()])) set cookie(session_name(), ‘’, time() - 1000);
session_destroy();
}
}
function confirm_Member() {
session_start();
if($_SESSION[‘status’] !=‘authorized’) header(“Location:test1.php”);
}
}
}
?>[/php]

I still see {'s that don’t have matching }'s.

Lines 8, 10, 12 & 13

Sponsor our Newsletter | Privacy Policy | Terms of Service