Cyber Renegade asked:
Hello,
Hello,
I found this code that can display a visitor’s name. However, there is an extra bit I don’t want, the last visit date of the visitor, can someone tidy this up a bit?
NewCode:
this code is rather long can someone tidy it up a bit? I do not want the last visit time, just the name and the option to change the name.
thanks
Please get read of parts that is not needed e.g the author.
Thanks!







Hello,
This code is a great example of inefficient and stupidity. JavaScript is client-based which means if the client does not have JavaScript enabled it will not work for them. That’s a big problem!
Never should any cookies be handled by JavaScript because it’s easy to inject queries into the browser URL. E.g (javascript:alert(‘hello’);).
Your best bet would be to integrate PHP and MySQL, you can handle users and much more. PHP is ran at server level where it is compiled and sent to browser as HTML. The code is dynamic and can feature content that is changeable with the use of MySQL!
I hope this helps a little, sorry if it’s a bit of a shocker to you.
I think, you just do not need to return time? Try change this part (When function) like this..
function When(info){
// When
var rightNow = new Date()
var WWHTime = 0;
WWHTime = GetCookie(‘WWhenH’)
WWHTime = WWHTime * 1
/*This part is written by
Cut & Paste JavaScript
Copyright 1996, IMA STUDIOS, Inc.
This code may not be resold.
This Copyright notice must be included
on every document that contains this code.
A link to should
be included somewhere on your document.
*/
var lastHereFormatting = new Date(WWHTime); // Date-i-fy that number
var intLastVisit = (lastHereFormatting.getYear() * 10000)+(lastHereFormatting.getMonth() * 100) + lastHereFormatting.getDate()
var lastHereInDateFormat = “” + lastHereFormatting; // Gotta use substring functions
var dayOfWeek = lastHereInDateFormat.substring(0,3)
var dateMonth = lastHereInDateFormat.substring(4,11)
var timeOfDay = lastHereInDateFormat.substring(11,16)
var year = lastHereInDateFormat.substring(23,25)
var WWHText = dayOfWeek + “, ” + dateMonth + ” at ” + timeOfDay // display
SetCookie (“WWhenH”, rightNow.getTime(), exp)
//return WWHText;
return;
}