Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script language="javascript" type="text/javascript">
- //CONTADOR PERSONAL
- // by Mauricio Alejandro
- //
- //Este script y otros muchos pueden
- //descarse on-line de forma gratuita
- //en El Código: www.elcodigo.com
- function chequeo() {
- if (!confirm("Hola, este es tu contador personal."))
- history.go(-1);
- return ""
- }
- //establece valor cookie
- function galletita (nombre, valor) {
- var argumentosA = galletita.arguments
- var argumentosB = galletita.arguments.length
- var expires = (argumentosB > 2) ? argumentosA[2] : null
- var control = (argumentosB > 3) ?argumentosA[3] : null
- var dominio = (argumentosB > 4) ? argumentosA[4] : null
- var broche = (argumentosB > 5) ? argumentosA[5] : false
- document.cookie = nombre + "=" + escape (valor) +
- ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
- ((control == null) ? "" : ("; control=" + control)) +
- ((dominio == null) ? "" : ("; dominio=" + dominio)) +
- ((broche == true) ? "; broche" : "")
- }
- //obtencion valor cookie
- function galletavaluada(cepilo) {
- var fin = document.cookie.indexOf (";", cepilo)
- if (fin == -1) fin = document.cookie.length
- return unescape (document.cookie.substring(cepilo, fin))
- }
- function galleta(nombre) {
- var A1 = nombre+"="
- var A2 = A1.length
- var A3 = document.cookie.length
- var i = 0
- while (i < A3) {
- var j = i + A2
- if (document.cookie.substring(i, j) == A1) return galletavaluada(j)
- i = document.cookie.indexOf(" ", i) + 1
- if (i == 0) break
- }
- return null
- }
- //obtencion de datos
- var apodo=galleta("msg1")
- if (apodo== null) {
- document.writeln(chequeo())
- var apodo=prompt('Por favor, escribe tu apodo:','')
- var caducar = new Date ();
- caducar.setTime (caducar.getTime() + (24 * 60 * 60 * 1000 * 365))
- galletita ("msg1", apodo, caducar)
- }
- //contadores
- function contador(contar) {
- var contador=galleta("msg2")
- if (contar==0) { contar=1 }
- else contador++
- var caducar = new Date ()
- caducar.setTime (caducar.getTime() + (24 * 60 * 60 * 1000 * 365))
- galletita ("msg2", contador, caducar)
- return (contador)
- }
- var acceso=contador("contar")
- //escribe niveles de usuario
- function infousuario() {
- if (acceso >= 30) {document.write('Supervisitante') }
- else if (acceso >= 20) {document.write('Adicto') }
- else if (acceso >= 10) {document.write('Experimentado') }
- else if (acceso >= 5) {document.write('Regular') }
- else {document.write('Amateur') }
- }
- function enviar(nombre, contenido, expires) {
- document.cookie = nombre + "=" + escape(contenido) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString()))
- }
- function recibir(nombre) {
- galleta = nombre + "="
- if (document.cookie.length > 0) {
- principio = document.cookie.indexOf(galleta)
- if (principio != -1) {
- principio += galleta.length
- fin = document.cookie.indexOf(";", principio)
- if (fin == -1)
- fin = document.cookie.length
- return unescape(document.cookie.substring(principio, fin))
- }
- }
- }
- //comprueba y escribe fecha ultima visita
- function ultimavisita() {
- fecha = new Date()
- mes = fecha.getMonth() + 1
- fechas = fecha.getDate() + "/" + mes + "/" + fecha.getFullYear()
- expires = new Date(2001, 12, 31)
- ultima = recibir("visita")
- if(!ultima) {
- enviar("visita", fechas, expires)
- document.write("1ª visita")
- }
- else {
- document.write(ultima)
- enviar("visita", fechas, expires)
- }
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement