logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Video Tutorials
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 04-02-2007, 12:38 PM   #1
Predator
 
Join Date: Apr 2007
Posts: 15
Default security.php

there is something wrong with this code
PHP Code:
if (! isset($_SESSION['id'])) {

header("location: login.php");

exit;


this wnt let me login but when i remove it i am able to login. what have i done wrong?
Predator is offline   Reply With Quote
Old 04-02-2007, 12:43 PM   #2
Predator
 
Join Date: Apr 2007
Posts: 15
Default

ok i found a solution,
when you use session_start before this code it works, however if you use session start after it doesnt.

In the video tutorial it stopped before you ran it and tested it.

This is all good and well but why is this happening, why does it have to be before other than after. I kind of have an idea but it would be better if you would explain it.
Predator is offline   Reply With Quote
Old 04-02-2007, 04:01 PM   #3
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

another gold star

yes i admit there is a bug

i realised what i had done a while ago but waited for someone pointing this out.

well done for finding this and putting it right.

always initialise sessions by using the SESSION_START(); at the begining of a script preferably at the top.

You after my job Predator?
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 04-02-2007, 04:04 PM   #4
Predator
 
Join Date: Apr 2007
Posts: 15
Default

lol of course not i am no expert at this, im just a fast learner. and i just like helping around to return the favour.
Predator is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:36 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com