Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 General help me questions
 Login/Logout Toggle Link
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

CHAVOUSA
VP-CART New User

USA
86 Posts

Posted - September 22 2004 :  23:29:52  Show Profile  Visit CHAVOUSA's Homepage  Reply with Quote
With the help of Dulrr in this forum I was able to create some code for a Login/Logout Toggle Link. However, I need some more help to refine it.

the I have the code below for a login/logout link. The problem with this is that when the user clicks on the logout link, it clears the shopping cart, but if they go to customer service, they can still access their account information. What is the best way to both, clear the shopping cart and the user info. I guess the ideal option would be to call both the shopend.asp?end=1 and the shopcustadminlogin.asp?new=yes


Sub Loginout
if getSess("Customerid")="" then
Response.Write "<a href='shopcustadminlogin.asp'>Login</a>"
else
Response.Write "<a href='shopend.asp?end=1'>Logout</a>"
end if
end sub


jonmadrid
VP-CART New User

USA
192 Posts

Posted - September 23 2004 :  08:39:44  Show Profile  Visit jonmadrid's Homepage  Reply with Quote
Are you sure they are still able to access their customer information? I have tried this same thing on several different VP-ASP sites and have not been able to produce the same results. When shopend.asp?end=1 is called, it clears any and all session values for that visit. That being the case, there should be no way that they can still get into their customer information unless the page is cached and not reloading when they call it after having logged out. If thats the case, you can insert a bit of ASP code that will prevent the page from being cached (thus be required to reload every time its accessed). It would look like this:

*******
<% Response.Expires = 0 %>
*******

Just insert that at the top of the page in question and see if that does the trick.

I hope that helps!

All the best,

Jon Madrid
--------------------
Madrid Communications
Web Design, Development, and Hosting
www.madridcom.com
Go to Top of Page

CHAVOUSA
VP-CART New User

USA
86 Posts

Posted - September 24 2004 :  09:37:20  Show Profile  Visit CHAVOUSA's Homepage  Reply with Quote
quote:

Are you sure they are still able to access their customer information? I have tried this same thing on several different VP-ASP sites and have not been able to produce the same results. When shopend.asp?end=1 is called, it clears any and all session values for that visit. That being the case, there should be no way that they can still get into their customer information unless the page is cached and not reloading when they call it after having logged out. If thats the case, you can insert a bit of ASP code that will prevent the page from being cached (thus be required to reload every time its accessed). It would look like this:

*******
<% Response.Expires = 0 %>
*******

Just insert that at the top of the page in question and see if that does the trick.

I hope that helps!

All the best,

Jon Madrid
--------------------
Madrid Communications
Web Design, Development, and Hosting
www.madridcom.com




I had the feature of the login with cookie enabled, that's why even after clickin on the logout link, when I went back to the customer service section, the information was already there. Thanks for your help though, that's how I realized what I was doing.

Go to Top of Page

greatphoto
VP-CART Super User

USA
304 Posts

Posted - January 23 2005 :  15:52:44  Show Profile  Reply with Quote
This is a great idea! I expanded it a bit to list the person's name who is logged in. Here is the new code:

 
dim loginid
dim fullname
loginid=GetSess("Customerid")
if loginid="" then
Response.Write "<a class='small' href='shopcustadminlogin.asp'>Login</a>"
else
fullname="<b>" & GetSess("firstname") & " " & GetSess("lastname")& "</b>"
Response.Write "<span class ='small'>You are logged in as: " & fullname & "</span><br>"
Response.Write "<span class ='tiny'> (" & loginid & ")          </span>"
Response.Write "<a class='small' href='shopend.asp?end=1'>Logout</a>"
end if


You'll notice the use of the CSS "class" to format the text. You can replace this with your own formatting, or add the following code to your shop.css to handle the formatting for you:

 
span.tiny {
FONT-WEIGHT: normal;
FONT-SIZE: 6pt;
COLOR: #000000;
FONT-FAMILY: Tahoma, Verdana;
TEXT-DECORATION: none
}
span.small {
FONT-WEIGHT: normal;
FONT-SIZE: 8pt;
COLOR: #000000;
FONT-FAMILY: Tahoma, Verdana;
TEXT-DECORATION: none
}
A.small:link {
FONT-WEIGHT: normal;
FONT-SIZE: 8pt;
COLOR: #00AA00;
FONT-FAMILY: Tahoma, Verdana;
TEXT-DECORATION: none
}
A.small:visited
{
FONT-WEIGHT: normal;
FONT-SIZE: 8pt;
COLOR: #006600;
FONT-FAMILY: Tahoma, Verdana;
TEXT-DECORATION: none
}


Also, notice that I also printed the loginid itself in tiny text. This is the index into the customers table. I'm using this to help debug multiple entries of the same customer, etc. I may remove it later so it looks nicer, or just leave it to help debug customer problems later.

Go to Top of Page

Dulrr
VP-CART New User

57 Posts

Posted - January 27 2005 :  08:59:52  Show Profile  Visit Dulrr's Homepage  Reply with Quote
Hi! Great to see that the code still works! For using the cookie login, you can force the cookie to expire when the user logs out. I had fixed the problem after finding the name of the cookie being used and editing shopend.asp. Find "if request.querystring("end") ..." in shopend, and use:

If Request.QueryString ("end") <> "" Then
Session.Abandon
Response.Cookies("CartLogin").Expires=Date-1
...


~D
Go to Top of Page

ccbangler
Starting Member

USA
12 Posts

Posted - October 05 2005 :  09:01:33  Show Profile  Visit ccbangler's Homepage  Reply with Quote
Thanks for the code! Its saved me time and works great!
I used it for the header and tweaked it for the side navigation, and it works perfectly!



******************
ccbangler
Go to Top of Page

anisha
Starting Member

25 Posts

Posted - October 17 2005 :  22:31:03  Show Profile  Reply with Quote
I am still not able to get the login/logout button going. NewB to asp i guess is the reason. can someone tell me how to get it working properly?

Tx in advance

Go to Top of Page

greatphoto
VP-CART Super User

USA
304 Posts

Posted - October 19 2005 :  19:52:44  Show Profile  Reply with Quote
quote:

can someone tell me how to get it working properly?



Hi Anisha-

This somewhat depends on where you want it to show up. If you want it to show up on the top of all your pages except the home page, then add it to the end of your shoppage_header.htm. Since this is an html file, you'll need to make it be in ASP mode for this code. In other words, put "<%" before the code I gave, and put "%>" after the code.

Beyond that, if you describe what you've done and what the results are, we'll be able to help more.

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00