Aqui voy poniendo todos los scripts que tengo utiles de asp, para que los empleis y demás
<%
'definimos los arrays
dim elinks(20,2), ordenado(20), seccion(4), cont, intermedia(2)
cont = 0
'nombre de las bases de las tablas que se van a abrir
seccion(0) = "tv"
seccion(1) = "games"
seccion(2) = "nose"
seccion(3) = "otro_mas"
for x=0 to 3 Step 1
strsql = "SELECT titulo, fecha FROM "& seccion(x) &" ORDER BY fecha DESC "
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="&Server.MapPath("\base.mdb")
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open strSQL, oConn,3,1
for y=0 to 4 Step 1
elinks(cont,1) = rs("titulo")
elinks(cont,2) = rs("fecha")
cont = cont + 1
RS.MoveNext
Next
Next
'limpiamos todo
RS.Close
Set RS = Nothing
oConn.Close
Set oConn = Nothing
'ordenamos el array bidimensional elinks
for x=0 to 19 Step 1
for y=x+1 to 19 Step 1
if elinks(x,2) < elinks(y,2) then
*intermedia(1) = elinks(x,1)
*intermedia(2) = elinks(x,2)
*elinks(x,2) = elinks(y,2)
*elinks(x,1) = elinks(y,1)
*elinks(y,1) = intermedia(1)
*elinks(y,2) = intermedia(2) *
End if
Next
Next
'mostramos los 6 primeros resultados, que serían los 6 mas nuevos
for x=0 to 5 Step 1
response.write "
"& x &" "& elinks(x,2) &" "& elinks(x,1) &"
"
Next
%>
<script language=vbscript runat=server>
Sub Application_OnStart
Application("Activos") = 0
set fso = createobject("scripting.filesystemobject")
set act = fso.opentextfile(server.mappath("contador.txt"))
Application("contador") = clng(act.readline)
act.Close
End Sub
Sub Application_OnEnd
End Sub
Sub Session_OnStart
If Request.Cookies ("contador") <> "" Then
Else
Application.Lock
set fso = createobject("scripting.filesystemobject")
set act = fso.opentextfile(server.mappath("contador.txt"))
Application("contador") = Application("contador") + 1
Set act = fso.CreateTextFile(server.mappath("contador.txt"), true)
act.WriteLine(Application("contador"))
act.Close
Application.Unlock
Response.Cookies("contador")="visitado"
Response.Cookies("contador").Expires = now() + 5
End If
End Sub
Sub Session_OnEnd
End Sub
</script>
<%
dim n
dim m
dim c(20)
for n=1 To len(Application("contador")) Step 1
c(n-1)=(mid(Application("contador"),n,1))
Next
for m=0 To n-2 Step 1
response.write ("<img src=/numeros/pekeños/"& c(m) &".gif hspace=0 width=13 height=19>")
Next
%>
<img src=/numeros/pekeños/1.gif hspace=0 width=13 height=19>
<img src=/numeros/pekeños/2.gif hspace=0 width=13 height=19>
<img src=/numeros/pekeños/3.gif hspace=0 width=13 height=19>
<script language=vbscript runat=server>
Sub Application_OnStart
End Sub
Sub Application_OnEnd
End Sub
Sub Session_OnStart
Application.Lock
Application("Activos") = Application("Activos") + 1
Application.Unlock
End Sub
Sub Session_OnEnd
Application.Lock
Application("Activos") = Application("Activos") - 1
Application.Unlock
End Sub
</script>
<%
dim a
dim b
dim d(20)
for b=1 To len(Application("Activos")) Step 1
d(b-1)=(mid(Application("Activos"),b,1))
Next
for a=0 To b-2 Step 1
response.write ("<img src=/numeros/pekeños/"& d(a) &".gif hspace=0 width=13 height=19>")
Next
%>
<%
Const adOpenKeyset = 1
Const adLockOptimistic = 3
destino = Trim(Request.Form("destino"))
'si no se ha rellenado el campo
if destino = "" then
%>
<html>
<head>
<title>SUBSCRIPCION AL BOLETIN</title>
</head>
<body>
<form method=post action=inscribirte.asp>
Correo: <input type="text" name="destino" size="40">
<input type="submit" value="Enviar" name="B1"><input type="reset" value="Restablecer" name="B2"></p>
</form>
</body>
</html>
<%
else
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\boletin.mdb"))
set rs=createobject("ADODB.Recordset")
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.open "usuarios",conn
rs.addnew
rs("destino")=destino
rs.update
rs.close
response.write "<center><font color=#000000 size=2>Usuario añadido</font></center>"
End if
%>
<html>
<body>
<form method=post action=send.asp>
Mensaje: <textarea rows="20" name="Mensaje" cols="70"></textarea>
<input type="submit" value="Enviar" name="B1"><input type="reset" value="Restablecer" name="B2"></p>
</form>
</body>
</html>
<%
'origen del mensaje
Origen = "boletin@tudireccion.org"
'asunto del mensaje
Asunto = "Boletin de tudireccion.org"
Mensaje = request.form("mensaje")
dim array(200)
dim x
dim total
x = 0
strsql = "SELECT * FROM usuarios"
'la ruta y el nombre de la base de datos
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="&Server.MapPath("\boletin.mdb")
Set RS = Server.CreateObject("ADODB.Recordset")
'la abrimos
RS.Open strsql, oConn,3,1
Do while not RS.eof
array(x) = RS("destino")
x = x + 1
RS.MoveNext
Loop
total = x-1
RS.Close
oConn.Close
Set RS = nothing
Set oConn = nothing *
for x=0 to total Step 1
'Creamos una instancia del objeto CDO
Set ObjetoCDO = Server.CreateObject("CDONTS.NewMail")
'Asignamos las propiedades al objeto
ObjetoCDO.From = Origen
ObjetoCDO.To = array(x)
ObjetoCDO.Subject = Asunto
ObjetoCDO.Body = Mensaje
'Enviamos el e-mail
ObjetoCDO.Send
'Destruimos el objeto
Set ObjetoCDO = Nothing
'nos movemos al proximo registro
Next
%>
<%="el email a sido enviado con exito"%>
<%
noticia = rs("noticia")
palabras = 0
espacio = 0
if len(noticia) > 350 then
* *contenido = mid(noticia,1,300)
* *response.write contenido&"..."
for x = 0 to len(noticia) Step 1
espacio = mid(noticia,x+1,1)
*if espacio = " " then
* palabras = palabras + 1
*end if
next
else
response.write noticia
end if
%>
<%if len(noticia) > 350 then%>
<%="Leer mas...("& palabras &" palabras)"%>
<%end if%>
<%
Dim edk, mb, mb2, elink
elink = "ed2k://|file|dev-ut45.X-Gamers.www!OSIOLEK!com.bin|764868048|909EB1BA30E06B9FF4D129D4CA52F6DE|/"
edk = Split(elink,"|",5)
%>
<%
mb = edk(3)/1048576
mb2 = Split(mb,",")
elink = mb2(1)
elink = mid(elink,1,2)
response.write "
Tamaño del archivo: "&mb2(0)&","&elink&" MB"
%>
<%
Dim edk, mb, mb2, elink
elink = rs("ed2k")
edk = Split(elink,"|",5)
mb = edk(3)/1048576
mb2 = Split(mb,",")
elink = mb2(1)
elink = mid(elink,1,2)
response.write "
Tamaño del archivo: "&mb2(0)&","&elink&" MB"
%>