Zen Cart Logo
Forums / General Questions / Checking Customer Login status from my Flash application?

Checking Customer Login status from my Flash application?

Views: 1,469

Results 1 to 8 of 8
31 Jul 2011, 6:40 PM
#1
xanabobana avatar

xanabobana

New Zenner

Join Date:
Oct 2010
Posts:
10
Plugin Contributions:
0

Checking Customer Login status from my Flash application?

Hi-

I want to use the same login as the zen cart store. I made a flash application so customers can choose custom colors for embroidery patterns they are ordering- http://iandi.com/shop/color_picker.php

When the customer clicks "Save Colors" a php script runs that should check if the customer is logged into Zen Cart. I've tried accessing $_SESSION['customer_id'] and printing all session variables but they are always empty. Right now the flash movie is in the root of my shop folder, but I can put it anywhere...this seems like it should be something straightforward but I've searched & tried suggestions for a few hours with no luck. any help is appreciated- thanks!

-xana

31 Jul 2011, 9:48 PM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Checking Customer Login status from my Flash application?

When and how do you run your PHP script?

31 Jul 2011, 11:35 PM
#3
xanabobana avatar

xanabobana

New Zenner

Join Date:
Oct 2010
Posts:
10
Plugin Contributions:
0

Re: Checking Customer Login status from my Flash application?

in the action script:
var request:URLRequest = new URLRequest ("http://iandi.com/shop/welcome.php");
request.method = URLRequestMethod.POST;

then welcome.php checks the session:
if (isset($_SESSION['customer_id']))
echo "loggedin=true";
else
echo "loggedin=false";

I've determined that the script does run, but doesn't ever return a value in the session

1 Aug 2011, 1:40 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Checking Customer Login status from my Flash application?

Your script needs to run /includes/application_top.php if you want it to start and access a Zen Cart session.

1 Aug 2011, 1:57 AM
#5
xanabobana avatar

xanabobana

New Zenner

Join Date:
Oct 2010
Posts:
10
Plugin Contributions:
0

Re: Checking Customer Login status from my Flash application?

I added include("/includes/application_top.php"); to the php script but I'm still not getting a value for $_SESSION['customer_id'].

1 Aug 2011, 1:59 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Checking Customer Login status from my Flash application?

You won't if you're not logged in.

1 Aug 2011, 2:12 AM
#7
xanabobana avatar

xanabobana

New Zenner

Join Date:
Oct 2010
Posts:
10
Plugin Contributions:
0

Re: Checking Customer Login status from my Flash application?

I tried logging in, out, and in again. still nothing coming up in my session variable.

1 Aug 2011, 2:21 AM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Checking Customer Login status from my Flash application?

Not sure what to tell you. It works for me.
Maybe your problem is with the Flash component.