Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with isset 1

Status
Not open for further replies.

danno74

IS-IT--Management
Nov 13, 2002
295
US
Greetings,

I am writing a software download page for our campus, where after it authenticates the account in LDAP, then sends you to a page based on your affiliation as either a student or staff member.

Once the account is verified, I use header to redirect to the download page. Here is the code:

Code:
<?php
session_start();

if (isset($_SESSION['fullname']))

echo "You win!!!!!!! ";
echo 'Welcome ', $_SESSION['fullname'], '!';
echo $_Session['fullname'];
include('downloads.php')

if (!isset($_SESSION['fullname']))

header("Location: [URL unfurl="true"]http://www/index.php");[/URL]

?>

I tried putting curly braces on both if statements and get this error:

[Tue Apr 21 10:43:47 2009] [error] [client ] PHP Parse error: syntax error, unexpected '}' in /web/shtml-docs/obcr/swdl/success.php on line 10, referer:
When I take them out I get this:

[Tue Apr 21 10:44:19 2009] [error] [client ] PHP Parse error: syntax error, unexpected T_IF in /web/shtml-docs/obcr/swdl/success.php on line 11, referer:
What's the deal? I'm fairly new with PHP so I'm assuming some sorta stupid formatting error?

Thanks for your help.

- Dan
 
In PHP you use periods to concatenate, variables are case sensitive, and if you want your If statements to execute more than one of the follwing commands then you need to surround them with curly braces.

Code:
<?php
session_start();

if (isset($_SESSION['fullname']))[red]{[/red]

echo "You win!!!!!!! ";
echo 'Welcome '[red].[/red] $_SESSION['fullname'][red].[/red] '!';
echo $_[red]SESSION[/red]['fullname'];
include('downloads.php')
[red]}[/red]

if (!isset($_SESSION['fullname']))[red]{[/red]

header("Location: [URL unfurl="true"]http://www/index.php");[/URL]
[red]}[/red]
?>

Your errors basically stemmed from your malformed echo statements.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Still gives me the error:

[Tue Apr 21 14:53:34 2009] [error] [client 129.3.72.161] PHP Parse error: syntax error, unexpected '}' in /web/shtml-docs/obcr/swdl/success.php on line 10, referer:
Any other ideas?
 
You are missing a semi colon after your include.
Code:
echo $_SESSION['fullname'];
include('downloads.php')[red];[/red]
}

Missed it the first time.


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
See, I told you it was stupid formatting issues. I'll get this right someday... thanks Phil.

- Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top