Forums

ASP

This topic is locked

welcome messege

Posted 19 Dec 2005 12:51:13
1
has voted
19 Dec 2005 12:51:13 andy bertaut posted:
When my users return to the site, I woule liek to have a personalised greeting for them Welcome Back John, Frak, Mary....AT present I have inserted the name field as dynamic text into the welcome back page, but all users are being greeted with the sanme name - the first one in line in the database.
Does anyone know an easy way to fix this, or where my problems may lie?
Cheers. Code of welcome back page below.

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<%
// *** Logout the current user.
MM_Logout = String(Request.ServerVariables("URL") + "?MM_Logoutnow=1";
if (String(Request("MM_Logoutnow")=="1" {
Session.Contents.Remove("MM_Username";
Session.Contents.Remove("MM_UserAuthorization";
var MM_logoutRedirectPage = "main.asp";
// redirect with URL parameters (remove the "MM_Logoutnow" query param).
if (MM_logoutRedirectPage == "" MM_logoutRedirectPage = String(Request.ServerVariables("URL");
if (String(MM_logoutRedirectPage).indexOf("?" == -1 && Request.QueryString != "" {
var MM_newQS = "?";
for (var items=new Enumerator(Request.QueryString); !items.atEnd(); items.moveNext()) {
if (String(items.item()) != "MM_Logoutnow" {
if (MM_newQS.length > 1) MM_newQS += "&";
MM_newQS += items.item() + "=" + Server.URLencode(Request.QueryString(items.item()));
}
}
if (MM_newQS.length > 1) MM_logoutRedirectPage += MM_newQS;
}
Response.Redirect(MM_logoutRedirectPage);
}
%>
<!--#include file="../Connections/connSLEVCAT.asp" -->
<%
var rsUsers = Server.CreateObject("ADODB.Recordset";
rsUsers.ActiveConnection = MM_connSLEVCAT_STRING;
rsUsers.Source = "SELECT Name FROM Users";
rsUsers.CursorType = 0;
rsUsers.CursorLocation = 2;
rsUsers.LockType = 1;
rsUsers.Open();
var rsUsers_numRows = 0;
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/slevin_shop.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<title>Slevin OE Group Online Store</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../slevin_shop.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image: url(../images/bg_image.gif);
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape"&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function addToFavorite(favTitle){
if ((navigator.appVersion.indexOf("MSIE" > 0) && (parseInt(navigator.appVersion) >= 4)) {
window.external.AddFavorite(location.href, unescape(favTitle));
}
}
//-->
</script>
</head>

<body>
<div id="BodyLayer" style="position:absolute; width:200px; height:115px; z-index:1; left: 1; top: 1;">
<table width="950" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" bgcolor="#FFFFFF"> </td>
<td width="800"><table width="800" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="169"><img src="../images/slevin_logo_raised.jpg" alt="Slevin OE Group" width="169" height="93"></td>
<td><img src="../images/banner_2.gif" alt="Slevin OE Group" width="631" height="93" border="0" usemap="#Map"></td>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
<td width="150" height="261" valign="top" bgcolor="#FFFFFF"><div id="navdiv">
<ul>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="quick_order.asp">Quick Order</a></li>
<li><a href="terms_cond.asp">Terms & Conditions</a></li>
</ul>
</div>
<iframe id="preview" name="preview" width="160px" height="100px" align="left" scrolling="yes" src="cart_prv.asp"></iframe></td>
<td rowspan="2" valign="top" bgcolor="#FFFFFF"><!-- InstanceBeginEditable name="body" -->
<br/><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="70"><div align="center"></div></td>
<td colspan="3" id="bodytxt"><div align="center">
<br/>Welcome Back, <%=(rsUsers.Fields.Item("Name".Value)%>.<br/>
<br/><script language="JavaScript">
//CN Insert Greeting Ver 1.0.2 - CEA CrystalNet
CN_Now = new Date();
localtime = CN_Now.toString();
CN_Hours = CN_Now.getHours();
if (CN_Hours < 12) {
document.write("Good Morning and";
} else {
if (CN_Hours >= 12 && CN_Hours < 17) {
document.write("Good Afternoon and";
} else {
if (CN_Hours >= 17) {
document.write("Good Evening and";
} else {
document.write("Good Day and";
}
}
}
</script>
Welcome to Slevin's all new Online Shopping Experience. Here you can browse the thousands of products offered by our catalogue, and buy without ever having to pick up the phone.<br/><br/>
If you already know what you want, then simply <a href="quick_order.asp">click here to go to the Quick Order</a> section.<br/><br/>
</div></td>
</tr>
<tr>
<td> </td>
<td colspan="3" id="formtxt"> </td>
</tr>
<tr>
<td> </td>
<td width="315" id="formtxt"><div align="center"></div></td>
<td colspan="2" id="formtxt"><div align="center"></div></td>
</tr>
<tr>
<td> </td>
<td width="315" id="formtxt"> </td>
<td colspan="2" id="formtxt"> </td>
</tr>
<tr>
<td> </td>
<td width="315" id="formtxt"> </td>
<td colspan="2" id="formtxt"> </td>
</tr>
<tr>
<td> </td>
<td width="315" id="formtxt"><a href="<%= MM_Logout %>">Log out <%=(rsUsers.Fields.Item("Name".Value)%></a></td>
<td width="260" id="formtxt"><div align="right"><a href="#" onClick="addToFavorite('Slevin%20Online%20Shopping')">Add Slevin Online Shopping to your Favourites</a></div></td>
<td width="55" id="formtxt"><a href="#"><img src="../images/favs.gif" width="55" height="50" border="0" onClick="addToFavorite('Slevin%20Online%20Shopping')"></a></td>
</tr>
</table>
<!-- InstanceEndEditable --></td>
<td rowspan="4"> </td>
</tr>
<tr>
<td height="49" valign="top" bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF"> </td>
<td valign="top" bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td valign="top" bgcolor="#009FB1"> </td>
<td valign="top" bgcolor="#009FB1"><div align="center"><img src="../images/doing_bus.gif" alt="Doing Business The Slevin Way" width="485" height="50"></div></td>
</tr>
</table>
<map name="Map">
<area shape="rect" coords="464,26,585,68" href="cart.asp" alt="Checkout and Pay for your Purchases">
</map>
</div>

</body>
<!-- InstanceEnd --></html>
<%
rsUsers.Close();
%>

Replies

Replied 19 Dec 2005 13:48:45
19 Dec 2005 13:48:45 andy bertaut replied:
i have found a couple of other simialr problems on here and tried to adopt their solutions but without knowing asp coding better, i can't get any of them to work.
Cheers
Andy
Replied 19 Dec 2005 16:25:57
19 Dec 2005 16:25:57 andy bertaut replied:
never mind...i sorted it!

Reply to this topic