Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 Customization
 Log In, Log Out
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

leem
Starting Member

United Kingdom
17 Posts

Posted - February 13 2003 :  06:36:51  Show Profile  Reply with Quote
Hello Everybody,

I have been atempting to provide a more personal website for my visitors by having them log in if they are returning. Cam provided me with some code which I have changed to provide links and messages I would like printed. This sits in my shoppageheader.html template. Called via a routine called usercheck. The code is as follows:-
<%sub usercheck
'=======================
'YourVirtualStore code
'=======================
'Source Code modified
'From YourVirtualStore


RestoreCustomerDetailsCookie

If GetSess("Firstname")<>"" then
Response.Write "<font face ='verdana' size='1' color=' #46648C'><b>Welcome Back "
Response.Write Getsess("Firstname") & " " &Getsess("Lastname") & "<b></font>"
Response.Write "<a href='shopend.asp'>Log out</a>"
else
Response.Write "<font face ='verdana' size='1' color=' #46648C'>Returning Customers "
Response.Write "<a href='#' OnClick=window.open('shopcustadminlogin.asp','','width=550,"
Response.Write "height=400,menubar=no,toolbar=no,location=no,status=no"
Response.Write "directories=no,copyhistory=no,resizable=no,scrollbars=no')>Login Here</a>"

end if
'=======================
'End YourVirtualStore code
'=======================
end sub%>

I have also made some changes to the shopcustadmin.asp page that deals with logging in so that it now redirects to the main website page which calls it, this is as follows:-

<%Option explicit%>
<!--#include file="shop$db.asp"-->
<!--#include file="usercheck.asp"-->
<%
'*******************************************************
' Customer Service Menu
' VP-ASP Version 4.50 May 13, 2002
' add more menus at the botom of this code
'
'*******************************************************
Dim menus(20), urls(20), menucount
Dim loginError, infomsg
Dim NumProc
dim LoginFlag
NumProc = 0
Infomsg=request("msg")
Shopinit
If GetSess("CustomerLoginCID")="" then
Setsess("Customerlogincid"),getsess("Customerid")
end if
SetSess "CurrentUrl","shopcustadmin.asp"
ShopPageHeader
Checklogin loginflag
SetupMenus
if sError<> "" then
response.write getconfig("xfont") & "<b>" & SError & "</b></font><br><br>"
Serror=""
end if
if Infomsg<> "" then
response.write getconfig("xfont") & "<b>" & Infomsg & "</b></font><br><br>"
Infomsg=""
end if

AddMenu
AddNewUser
ShopPageTrailer

Sub Checklogin (loginflag)
LoginFlag="Yes"
If GetSess("Customerid")<>"" and Getsess("Lastname") <>"" then
If getsess("Customerlogincid")="" then
SetSess "CustomerLoginCID",Getsess("Customerid")
Loginflag="No"
else
Loginflag="No"
end if
end if
end sub

'**********************************************************************
' Version 3.00
' Shopadmin.asp forces relogin
' shopadmin1.asp (this routine checks to see if you are already logdded in
'***********************************************************************
'******** Display table
Sub AddMenu
dim i
FormatHeader
For i = 0 to menucount
Formatrow Menus(i), urls(i)
next
FormatTrailer
end sub
'
Sub FormatHeader
Response.write "<center>" & Custadmintable
Response.write CustAdminHeaderRow
Response.write CustAdminHeaderFont & LangCustAdmin01 & CustAdminHeaderEnd
end sub
'
Sub FormatRow (name, url)
NumProc=Numproc+1
response.write CustAdminRow
Response.write CustAdminNumColumn & NumProc & "." & CustAdminNumEnd
Response.write CustAdminColumn & "<a href='" & url & "'>" & CustAdminFont & name & "</a>" & CustAdminColumnEnd
end sub
'
Sub FormatTrailer
%>
</table></center><br>

<%
end sub
'
Sub AddMenuItem (caption, url, flag)
If flag<>"Yes" then exit sub
menus(menucount)=caption
urls(menucount)=url
menucount=menucount+1
end sub
'
Sub addnewUser
response.write ("<p><font size=1><a href=shopcustadminlogin.asp?new=yes>" & LangLogin02 & "</a></font></p>")
end sub


Sub SetUpMenus
'***********************************************************************
' First field is the caption the customer sees
' Second is URL to go to
' Third is "Yes" (case sensitive) If Yes menu is displayed
'************************************************************************
menucount=0
AddMenuItem LangAdminLogin,"shopcustadminlogin.asp", LoginFlag
AddMenuItem LangSaveCartPrompt,"shopsavecart.asp", getconfig("xAllowSaveCart")
AddMenuItem LangCustAdminStatus,"shopstatus.asp", getconfig("xAllowReviewOrders")
AddMenuItem LangCouponDiscount,"shopcustadmincoupon.asp",getconfig("xAllowCoupons")
AddMenuItem LangGiftRedeem,"shopcustadmingift.asp", getconfig("xGiftCertificates")
AddMenuItem LangGiftBuy,"shopgift.asp", getconfig("xGiftCertificates")
AddmenuItem LangCustAdminDetails,"shopcustupdate.asp",getconfig("xAllowCustomerUpdates")
AddMenuItem LangLoginForgot,"shopmailpwd.asp", getconfig("xPassword")
AddMenuItem LangMaillistSubject,"shopcustregister.asp", getconfig("xAllowcustomerregister")
AddMenuItem LangCustAdminMailList,"shopmaillist.asp", getconfig("xAllowMailList")
AddMenuItem LangSupplierAdmin,"shopsupplierregister.asp", getconfig("xAllowSupplierRegister")
AddMenuItem LangGiftRegistry,"shopgiftregadmin.asp", getconfig("xgiftregistry")
AddMenuItem LangContactus,"shopcustcontact.asp", getconfig("xcontactform")
menucount=menucount-1
end sub
%>

The intention is that the person visits the site and logs in, once logged in there name is displayed and a log out button. However getting the log out function to work is proving to be difficult because I have tried all sorts of suggestions to clear the sesion details and they don't seem to work. At the moment I am working from a PWS in order to develop the site, I am hoping to get the site up within the next week or so, I would like this feature to be implemented but unfortuantely I am at my wits end with trying. I am a beginner in the realms of ASP so any help would be appreciated.

Thanks All,

Regards

Lee Mulholland

leem

adker
Starting Member

7 Posts

Posted - February 26 2003 :  09:42:40  Show Profile  Reply with Quote
Lee,

Instead of just shopend.asp use shopend.asp?end=1, This will logout your customer and clear the session variables.

However, you are using cookie login, so as soon as the customer is redirected to any page in your cart they are automatically logged back in.

Instead of using the auto cookie login you might try using the cookies to fill in the login form then have the customer submit the form by clicking a login button or link.

You could use the cookie to welcome back the customer and then ask if they would like to login.

Changes will need to be made to shopsess.asp so it does not automatically log your customer back in.

Hope this help you get started...


John

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