Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Hardware>>"Login ID" pass over to subsequent pages visited

"Login ID" pass over to subsequent pages visited

seekinfo
02-03-2005, 10:18 PM
Hello all the wizards out there:

I am looking for a way in which the "login id" gets passed over to subsequent pages visited.

I have tried to do this using cookies - the "login id" is getting created, but it is not being read by the subsequent pages visited. I am using the following codes for this purpose:

<HEAD>
<SCRIPT LANGUAGE="Javascript">
<!--

function getexpirydate( nodays){
var UTCstring;
Today = new Date();
nomilli=Date.parse(Today);
Today.setTime(nomilli+nodays*24*60*60*1000);
UTCstring = Today.toUTCString();
return UTCstring;
}
function getcookie(cookiename) {
var cookiestring=""+document.cookie;
var index1=cookiestring.indexOf(cookiename);
if (index1==-1 || cookiename=="") return "";
var index2=cookiestring.indexOf(';',index1);
if (index2==-1) index2=cookiestring.length;
return
unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}
function setcookie(name,value,duration){
cookiestring=name+"="+escape(value)+";EXPIRES="+getexpirydate(duration);
document.cookie=cookiestring;
if(!getcookie(name)){
return false;
}
else{
return true;
}
}
//-->
</SCRIPT>



<script>
<!--
if(getcookie("visitorname")){
document.calmaira3.sample_n.value=getcookie("visitorname");
}
//-->
</script>

Any help in this matter is greatly appreciated.
Thanks!

Willy Duitt
02-06-2005, 04:53 PM
What happens when you: alert(getcookie("visitorname"))

You need to check that what you think is being returned , actually is...
Questions like these really require that you post a link so that we can visit the page(s) and confirm what is happening ourselves...

......Willy

seekinfo
02-07-2005, 09:49 PM
Hi Willy,

Thanks for the reply.

I am posting the links to the prototype pages that I have set up for
a)LogIn and
b)a typical page
that I need.

http://www.geocities.com/infoseek8888/index.html

The codes used on the two pages are included in the earlier postings.
I want the "logIn ID" to passover as a vasriable that I can read from the "test-page".

Thanks!
seekinfo

Willy Duitt
02-07-2005, 10:08 PM
I just visited your page and there is absolutely no javascript other than that placed by Geoshytty...


<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<p align="center" class="style22">&nbsp;</p>
<table width="947" border="0">
<tr>
<td width="137" class="style22"><div align="center" class="style18"></div></td>
<td width="800" class="style22"><div align="right">
<p align="center">&nbsp;</p>
</div></td>
</tr>
<tr>
<td height="397" class="style22"><p class="style20">&nbsp; </p></td>
<td class="style22"><p align="left" class="style10 style20 style23">&nbsp; </p>
<p align="center" class="style5">Please Enter the following information </p>
<p align="center" class="style5">When entering your name, make sure that it is in the format: &quot;FIRST NAME_LAST NAME&quot; </p>
<p align="right" class="style10 style20 style23">&nbsp; </p>
<div align="center" class="style23">
<p><span class="style20">Enter Name (e.g., John_Doe):</span>
<INPUT TYPE=TEXT NAME="nameField" onBlur="setCookie()">
<p><a href=http://www.codingforums.com/archive/index.php/"test-page.html">Click To Continue </a></div></td>
</tr>
</table>
<p></p>
***
<p align="center">&nbsp;</p>
</body>
</html>


Additionally, if you are trying to fire the getCookie function onload chances are Geoshyty is already using the onload event for one or more of the numerous scripts they place on your pages... I would think this is where your problem lies... Try getting a real host because once you even fix the multiple onload event problem you will need to deal with the numerous cookies they are also using and need to find yours amongst theirs...

.....Willy

seekinfo
02-09-2005, 02:14 AM
Hi Willy,

I tried uploading the page - but, all it would let anyone see by clicking "view page source" is the html.

Therefore, I am putting the entire code for the page here again. Also, I am not planning on using Geocities as my host.

Please help!!!


***********************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Name Login</title>
<script language="javascript">
<!-- Hide script from older browsers
expireDate = new Date
expireDate.setMonth(expireDate.getMonth()+1)
function setCookie(form)
{

userName = document.myForm.nameField.value
document.cookie = "userName="+userName+";expires=" +
expireDate.toGMTString()
}
</script>
</head>
<body>

<p align="center" class="style22">&nbsp;</p>
<table width="947" border="0">
<tr>
<td width="137" class="style22"><div align="center" class="style18">DO NOT <br>
use the &quot;BACK&quot; button on the Browser to navigate </div></td>
<td width="800" class="style22"><div align="right">
<p align="center"><img src=http://www.codingforums.com/archive/index.php/"embark.gif" width="468" height="72"><img src=http://www.codingforums.com/archive/index.php/"youthtravel-bar.jpg" width="800" height="53"></p>
</div></td>
</tr>
<tr>
<td height="397" class="style22"><p class="style20"><img src=http://www.codingforums.com/archive/index.php/"TravelAgent_airlines-circle.gif" width="72" height="57"></p>
<p class="style20"><img src=http://www.codingforums.com/archive/index.php/"TravelAgent_car-circle.gif" width="71" height="57"></p>
<p class="style20"><img src=http://www.codingforums.com/archive/index.php/"TravelAgent_cruise-circle.gif" width="73" height="57"></p>
<p class="style20"><img src=http://www.codingforums.com/archive/index.php/"TravelAgent_hotel-circle_0000.gif" width="72" height="57"></p>
<p class="style20"><img src=http://www.codingforums.com/archive/index.php/"TravelAgent_vacation-circle.gif" width="71" height="57"></p>
<p class="style20">&nbsp; </p>
</td>
<td class="style22"><p align="left" class="style10 style20 style23"> Please provide us with the following information so that we are able to give you credit points for your participation.</p>
<p align="right" class="style10 style20 style23">Thank you ...</p>
<p align="center" class="style5">Please Enter the following information (for class credit only) </p>
<p align="center" class="style5">When entering your name, make sure that it is in the format: &quot;FIRST NAME_LAST NAME&quot; </p>
<p align="right" class="style10 style20 style23">&nbsp; </p>
<div align="center" class="style23">

<p><span class="style20">Enter Name (e.g., John_Doe):</span>
<form name="myform">
<INPUT TYPE=TEXT NAME="nameField" onBlur='setCookie(this.form)'>
<p><a href=http://www.codingforums.com/archive/index.php/"http://www.arches.uga.edu/%7Emoutushi/home-a3.html">Click To Continue</a>

</div> </td>
</tr>
</table>
</p>
&nbsp;&nbsp;&nbsp;<p align="center"><a href=http://www.codingforums.com/archive/index.php/"http://www.arches.uga.edu/%7Emoutushi/home-a3.html"><img src=http://www.codingforums.com/archive/index.php/"CONTINUE.JPG" width="81" height="27" border="0"></a>
</p>
<div align="center" class="style22"> </div>
<p align="center" class="style5"><span class="style20">For questions regarding login,<br>
contact Moutusi Maity at <a href=http://www.codingforums.com/archive/index.php/"mailto:moutushi@uga.edu">moutushi@uga.edu</a> or call (706) 542 3764 </span></p>
</body>
</html>
*****************

Willy Duitt
02-09-2005, 02:34 AM
You can not view the script because it is not there and I am not going to even guess why it isn't... I am going to excuse myself from any further participation in this thread because I can not help you without seeing the cookie script in action and going from page to page to see what values are being passed or what errors are being thrown... Perhaps someone else can help you...

Good Luck;
.....Willy


 

TOP

For more info

setting a minimum size
Auto Preview of Image 
Refresh with a query s
JS Validation obsolete
Javascript Pop up func
Slide show transitions
I'm a newbie...please!
how to write coding in
Advanced Debug Info 
.js file doesn't work 

News Archive

Adding Graphic To Text
re-direct form after s
pop up window controls
Clock on homepage - He
passing a param from a
Password Procection wi
document.title in same
focus onload 
Counting Wrong from Ri
Help needed on how to 

Related stories:

write to an html file dynamically?
FireFox doesn't recognize history.go(-1)
Changing e.keyCode (e.which)
Clearing a range created by element.createTextRange()
UPDATE: My mouse over pop up question
I am having problem with this script!!!
Creating Handlers
Checkbox to manipulate Form Field

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics