Jump to content

Check Session


Guest rembot

Recommended Posts

Guest rembot

Hey all,

I was just wondering if anyone out there could help me. All my friends that know php seem to hate cube cart and because of that won't help >.<

ok first thing you need to know is im adding other pages onto cube cart. The visitor will click the link and the popup will load. Now this popup needs to have a script to make sure only logged in users can view it....

to put it really simply i need a script that goes:

check cube cart session, if session exists continue to load popup else redirect to register page.

I would really love some help

Thanks

Sam

Link to comment
Share on other sites

Guest wow1111

this is what cubecart does with the welcome message....

if($ccUserData[0]['customer_id']>0){

$box_content->assign("LANG_WELCOME_BACK",$lang['front']['boxes']['welcome_back']);

$box_content->assign("TXT_USERNAME",$ccUserData[0]['firstName']." ".$ccUserData[0]['lastName']);

$box_content->assign("LANG_LOGOUT",$lang['front']['boxes']['logout']);

$box_content->assign("LANG_YOUR_ACCOUNT",$lang['front']['boxes']['your_account']);

$box_content->parse("session.session_true");

} else {

$box_content->assign("LANG_WELCOME_GUEST",$lang['front']['boxes']['welcome_guest']);

$box_content->assign("VAL_SELF",urlencode(currentPage()));

$box_content->assign("LANG_LOGIN",$lang['front']['boxes']['login']);

$box_content->assign("LANG_REGISTER",$lang['front']['boxes']['register']);

$box_content->parse("session.session_false");

}

$box_content->parse("session");

$box_content = $box_content->text("session");

( /includes/boxes/session.inc.php )

hope this helps !?

Link to comment
Share on other sites

Guest rembot

nah, not really. It just confused me.

i was using this

<php?

// INCLUDE CORE VARIABLES & FUNCTIONS

include_once("includes/global.inc.php");

if(!isset($_SESSION['ccUser']) || $results == FALSE

header("Location: index.html");

?>

but it doesnt work >.<

can anyone else help?

Link to comment
Share on other sites

Guest rembot

so what you are saying is this should make it better?

<php?

// INCLUDE CORE VARIABLES & FUNCTIONS

include_once("includes/global.inc.php");

// initiate db class

include_once("classes/db.inc.php");

$db = new db();

include_once("includes/functions.inc.php");

$config = fetchDbConfig("config");

include_once("includes/sslSwitch.inc.php");

// get session data

include_once("includes/session.inc.php");

if(!isset($_SESSION['ccUser']) || $results == FALSE

header("Location: index.html");

?>

well i don't think it does :)

i can't see any other includes that look relevant. Can anyone tell me if it's a problem in my actuall php code.

Link to comment
Share on other sites

OMG, little bit better however <php? does your code 'incurable' B) , IF condition SYNTAX ERROR and useless. Look at this

<?

include_once("includes/global.inc.php");



session_start();



include_once("classes/db.inc.php");



$db = new db();

include_once("includes/functions.inc.php");

$config = fetchDbConfig("config");



include_once("includes/sslSwitch.inc.php");



include_once("includes/session.inc.php");



if($ccUserData[0]['customer_id']>0){

	echo "i am logged in";

} else {

	echo "i am NOT logged in";

}

?>

I think that next steps are completely clear :)

Regards

Link to comment
Share on other sites

  • 3 years later...

I know this is an old post but I have modified the output of this code though it does not detect ..

$ccUserData[0]['customer_id']>0

.. for some reason, I would really appreciate it if someone could advise why and offer a solution.

Link to comment
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...