can i check is there any wrong with this?
it prompted me error in line 5
Parse error: syntax error, unexpected T_IF

<?php 
session_start()
if (!(isset($_SESSION['email']) && $_SESSION['email'] != '')) {
header ("Location: login.php");
}

Recommended Answers

All 6 Replies

Member Avatar for Zagga

Firstly, the line number mentioned in the error message is just where you start looking for a problem. You then work BACKWARDS through your script. The error message is saying it found an unexpected IF statement. This means the error is just before the IF statement. Look closely at the line above it (line 2 in this case).

Member Avatar for diafol

Yes have a look at the end of line 2. It's missing something.

you forgot a semi-colon on line 2

session_start();
Member Avatar for diafol

... there was always gonna be one... :)

@ardav he never marked it as "Solved", so I figure the person was too lazy to solve your riddle. Stupid semi-colons!

@ardav he never marked it as "Solved", so I figure the person was too lazy to solve your riddle. Stupid semi-colons!

thanks! so careless of me.. thanks everyone here..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.