
04-09-04, 07:06 PM
|
 |
Wannabe Coder
|
|
Join Date: Jul 2003
Posts: 136
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
login page
okay, this all works untill I tried to add cookies... so here is my code
Error: Parse error: parse error in c:\phpdev\www\login.php on line 29
why won't my cookies work??
__________________
God save us from the religious fanatics
|

04-09-04, 08:55 PM
|
 |
Newbie Coder
|
|
Join Date: Jul 2003
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
echo $_COOKIE['login']['user'];
echo $_COOKIE['login']['admin'];
Should be
echo "$_COOKIE['login']['user']"; // <~~ line 29 by the way
echo "$_COOKIE['login']['admin']";
AND
echo $_POST['uname'];
Should Be
echo "$_POST['uname']";
Try that.
|

04-09-04, 08:58 PM
|
 |
Wannabe Coder
|
|
Join Date: Jul 2003
Posts: 136
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
no dice, now it says
Parse error: parse error in c:\phpdev\www\login.php on line 26
HELP PLEASE!
__________________
God save us from the religious fanatics
|

04-10-04, 01:14 PM
|
 |
Community VIP
|
|
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
|
|
Quote:
|
Originally Posted by optix
echo $_COOKIE['login']['user'];
echo $_COOKIE['login']['admin'];
Should be
echo "$_COOKIE['login']['user']"; // <~~ line 29 by the way
echo "$_COOKIE['login']['admin']";
AND
echo $_POST['uname'];
Should Be
echo "$_POST['uname']";
Try that.
|
NEVER use double quotes with associative arrays !
check this post I wrote in another topic:
http://www.programmingtalk.com/showt...5523#post25523
what he did is correct ..
in your setcookie part, you shouldn't write this:
you didn't provide all arguments needed for this function !!
you should give it time, path and domain !
also don't enclose its names user and admin with quotes ! the whole name should be quoted !
it should be like this:
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
|

04-10-04, 01:16 PM
|
 |
Wannabe Coder
|
|
Join Date: Jul 2003
Posts: 136
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
okay, but what should I put for DOMAIN? localhost?
and if so just 'localhost' or 'http://localhost/'
__________________
God save us from the religious fanatics
|

04-10-04, 01:22 PM
|
 |
Community VIP
|
|
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
|
|
localhost isn't a real domain !
domain is something like this:
http://www.programmingtalk.com
in cookies it's preferable to use it like this:
.programmingtalk.com
so it can be accessable in subdomains as well ..
so in your situation:
but if you want the cookie to be strictly used in main domain only then add www but without http://
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
|

04-10-04, 01:26 PM
|
 |
Wannabe Coder
|
|
Join Date: Jul 2003
Posts: 136
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
right got you... -- saga of chaos wow that was a long time ago... Should update that.
Okay, one more question. right now I am just testing on apache on my computer so the site is like http://localhost/login.php or whatever... what should I use in my cookie then?
__________________
God save us from the religious fanatics
|

04-10-04, 01:37 PM
|
 |
Community VIP
|
|
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
|
|
if you are running the script in your local machine then just leave it blank in the domain ! meaning :
but when you upload it to real world then make sure that you change it to the domain name you are using !
and note, you shouln't add file names into the domain or the script wont work properly !
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
|

04-10-04, 01:45 PM
|
 |
Wannabe Coder
|
|
Join Date: Jul 2003
Posts: 136
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
thanks alot, I will test it in a bit
__________________
God save us from the religious fanatics
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|