Avatar billede bullefardk Nybegynder
08. februar 2004 - 20:50 Der er 3 kommentarer og
1 løsning

Galleri Med Kode?

Hej alle sammen.

Jeg har sådan en kode her:

<head>
<title>Galleri 1.0 - Koldy 2001</title>
</head>

<body bgcolor="#C0C0C0">






<h3 align="center">Galleri 1.0</h3>
<hr>


 
<%
'------------------------------------------------
'henter info om siden
'------------------------------------------------
page = trim(Request.QueryString("page"))
start = trim(Request.QueryString("start"))

'------------------------------------------------
'Åbner Filsystem
'------------------------------------------------
strPathInfo = Request.ServerVariables("PATH_INFO")
strPhysicalPath = Server.MapPath(strPathInfo)

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strPhysicalPath)
Set objFolder = objFile.ParentFolder
Set objFolderContents = objFolder.Files

'------------------------------------------------
'grund variabler
'------------------------------------------------
row_count = 0
row = 1
max_row = 3
count = 1
If NOT start <> "" then
Start = 1
End If
%>

<p align=center>

<%
'------------------------------------------------
'Info variabler
'------------------------------------------------

info_page = 0
info_page_count = 0
info_Count = 0

'------------------------------------------------
'Info Script, udregner og udskriver info til siden
'------------------------------------------------
If page <> "" then
response.write "side <a href='index.asp'>1</a> "
else
Response.write "side 1 "
End If

For Each objFileItem in objFolderContents
info_Count = info_Count + 1
info_page = info_page + 1
if info_page = 9 then
info_page_count = info_page_count + 1
info_page = 0
End If
If info_page = 0 then
If trim(info_page_count + 1) = trim(page) then
response.write info_page_count + 1 & " "
Else
response.write "<a href='index.asp?start=" & info_count & "&page=" & info_page_count + 1 & "'>" & info_page_count + 1 & "<a> "
End If
End If
Next
Response.write "<br>Der er ialt <b>" & (info_Count) & "</b> billeder"
if (info_page_count) * 9 = info_count then
Response.write " på <b>" & (info_page_count) & "</b> sider<br>"
Else
Response.write " på <b>" & (info_page_count) + 1 & "</b> sider<br>"
End If
%>
<div align="center">
<table border="0" cellspacing="3" cellpadding="3">
  <tr>

<%
For Each objFileItem in objFolderContents

If objFileItem.Name = "index.asp" then
Else
 
  If CLng(count) < CLng(start) then
  count = count + 1
  Else

  If CLng(row) => CLng(max_row) And row_count = 3 then
  Else
 
 
 
 
  If row_count > 2 then
    response.write "<tr>"
    row_count = 0
    row = row + 1
  End If

 
  Response.write " <td><a href='"
  Response.Write(objFileItem.Name)
  Response.write "'><img border=0 src='" & (objFileItem.Name) & "' alt='" & (objFileItem.Name) & "' width=239 height=180></a>"
  row_count = row_count + 1   
  count = count + 1
End If
End If
End If
Next
%>

    </td>
  </tr>
</table>

<!-- Made by Koldy 2001 - www.koldy.dk - thomas@koldy.dk -->



-------------------------------------------------------

-Kunne godt tænke mig at få en magen til bare hvor man skal indtaste adgangskode for at man kan se billederne. Elller evt. et stykke kode som man kan tilføje den eksisterende kode.

Mvh.

Michael Lindeblad
Avatar billede steen Nybegynder
08. februar 2004 - 21:12 #1
<head>
<title>Galleri 1.0 - Koldy 2001</title>
</head>

<body bgcolor="#C0C0C0">






<h3 align="center">Galleri 1.0</h3>
<hr>


 
<%
'------------------------------------------------
'Tjekker om brugeren er logget ind
'------------------------------------------------
If Session("loggetind") <> True Then
  Response.Redirect("login.asp")
End If

'------------------------------------------------
'henter info om siden
'------------------------------------------------
page = trim(Request.QueryString("page"))
start = trim(Request.QueryString("start"))

'------------------------------------------------
'Åbner Filsystem
'------------------------------------------------
strPathInfo = Request.ServerVariables("PATH_INFO")
strPhysicalPath = Server.MapPath(strPathInfo)

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strPhysicalPath)
Set objFolder = objFile.ParentFolder
Set objFolderContents = objFolder.Files

'------------------------------------------------
'grund variabler
'------------------------------------------------
row_count = 0
row = 1
max_row = 3
count = 1
If NOT start <> "" then
Start = 1
End If
%>

<p align=center>

<%
'------------------------------------------------
'Info variabler
'------------------------------------------------

info_page = 0
info_page_count = 0
info_Count = 0

'------------------------------------------------
'Info Script, udregner og udskriver info til siden
'------------------------------------------------
If page <> "" then
response.write "side <a href='index.asp'>1</a> "
else
Response.write "side 1 "
End If

For Each objFileItem in objFolderContents
info_Count = info_Count + 1
info_page = info_page + 1
if info_page = 9 then
info_page_count = info_page_count + 1
info_page = 0
End If
If info_page = 0 then
If trim(info_page_count + 1) = trim(page) then
response.write info_page_count + 1 & " "
Else
response.write "<a href='index.asp?start=" & info_count & "&page=" & info_page_count + 1 & "'>" & info_page_count + 1 & "<a> "
End If
End If
Next
Response.write "<br>Der er ialt <b>" & (info_Count) & "</b> billeder"
if (info_page_count) * 9 = info_count then
Response.write " på <b>" & (info_page_count) & "</b> sider<br>"
Else
Response.write " på <b>" & (info_page_count) + 1 & "</b> sider<br>"
End If
%>
<div align="center">
<table border="0" cellspacing="3" cellpadding="3">
  <tr>

<%
For Each objFileItem in objFolderContents

If objFileItem.Name = "index.asp" then
Else
 
  If CLng(count) < CLng(start) then
  count = count + 1
  Else

  If CLng(row) => CLng(max_row) And row_count = 3 then
  Else
 
 
 
 
  If row_count > 2 then
    response.write "<tr>"
    row_count = 0
    row = row + 1
  End If

 
  Response.write " <td><a href='"
  Response.Write(objFileItem.Name)
  Response.write "'><img border=0 src='" & (objFileItem.Name) & "' alt='" & (objFileItem.Name) & "' width=239 height=180></a>"
  row_count = row_count + 1   
  count = count + 1
End If
End If
End If
Next
%>

    </td>
  </tr>
</table>


******************

Dernæst laver du en aspfil der hedder login.asp og smider følgende indhold i:


<%
Dim Login, Pass, Url

'================================
'Skriv her dit login og password
Login = "elefant"
Pass = "manege"
'skriv her, hvilken fil der skal sendes videre til ved korrekt login
Url = "dinside.asp"
'================================


If session("loggetind") = True Then
    If Request.QueryString("action") = "logud" Then
        Session.Abandon
        Response.Redirect("login.asp")
    End If
Else
    If (Request.Form("user") = Login And Request.Form("pass") = Pass) Then
        Session("loggetind") = True
        Response.Redirect(url)
    End If

%>

<Form action=login.asp?action=logind method=post id=form1 name=form1>
    Brugernavn:<input type=text name=user><br>
    Password:<input type=password name=pass>
    <input type=submit>
</form>
<%
End If
%>
Avatar billede ellebaek Nybegynder
08. februar 2004 - 21:14 #2
<% if session("login") <> "" then %>

<head>
<title>Galleri 1.0 - Koldy 2001</title>
</head>

<body bgcolor="#C0C0C0">






<h3 align="center">Galleri 1.0</h3>
<hr>


 
<%
'------------------------------------------------
'henter info om siden
'------------------------------------------------
page = trim(Request.QueryString("page"))
start = trim(Request.QueryString("start"))

'------------------------------------------------
'Åbner Filsystem
'------------------------------------------------
strPathInfo = Request.ServerVariables("PATH_INFO")
strPhysicalPath = Server.MapPath(strPathInfo)

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strPhysicalPath)
Set objFolder = objFile.ParentFolder
Set objFolderContents = objFolder.Files

'------------------------------------------------
'grund variabler
'------------------------------------------------
row_count = 0
row = 1
max_row = 3
count = 1
If NOT start <> "" then
Start = 1
End If
%>

<p align=center>

<%
'------------------------------------------------
'Info variabler
'------------------------------------------------

info_page = 0
info_page_count = 0
info_Count = 0

'------------------------------------------------
'Info Script, udregner og udskriver info til siden
'------------------------------------------------
If page <> "" then
response.write "side <a href='index.asp'>1</a> "
else
Response.write "side 1 "
End If

For Each objFileItem in objFolderContents
info_Count = info_Count + 1
info_page = info_page + 1
if info_page = 9 then
info_page_count = info_page_count + 1
info_page = 0
End If
If info_page = 0 then
If trim(info_page_count + 1) = trim(page) then
response.write info_page_count + 1 & " "
Else
response.write "<a href='index.asp?start=" & info_count & "&page=" & info_page_count + 1 & "'>" & info_page_count + 1 & "<a> "
End If
End If
Next
Response.write "<br>Der er ialt <b>" & (info_Count) & "</b> billeder"
if (info_page_count) * 9 = info_count then
Response.write " på <b>" & (info_page_count) & "</b> sider<br>"
Else
Response.write " på <b>" & (info_page_count) + 1 & "</b> sider<br>"
End If
%>
<div align="center">
<table border="0" cellspacing="3" cellpadding="3">
  <tr>

<%
For Each objFileItem in objFolderContents

If objFileItem.Name = "index.asp" then
Else
 
  If CLng(count) < CLng(start) then
  count = count + 1
  Else

  If CLng(row) => CLng(max_row) And row_count = 3 then
  Else
 
 
 
 
  If row_count > 2 then
    response.write "<tr>"
    row_count = 0
    row = row + 1
  End If

 
  Response.write " <td><a href='"
  Response.Write(objFileItem.Name)
  Response.write "'><img border=0 src='" & (objFileItem.Name) & "' alt='" & (objFileItem.Name) & "' width=239 height=180></a>"
  row_count = row_count + 1   
  count = count + 1
End If
End If
End If
Next
%>

    </td>
  </tr>
</table>

<!-- Made by Koldy 2001 - www.koldy.dk - thomas@koldy.dk -->

<% else
if request.form("send") <> "" then
if request.form("brugernavn") = "ditnavn" then
if request.form("pass") = "pass" then
session("login") = "true"
response.redirect("sidenavn.asp")
else
response.write "forkert password"
end if
else
response.write "forkert brugernavn"
end if

%>

<form method="post" action="sidenavn.asp">
brugernavn:<br><input type="text" name="brugernavn">
<br><br>Password:<br><input type="password" name="pass">
<br><br><input type="submit" name="send">
<% end if %>

Så skal du rette sidenavn.asp til navnet på din side, og så kan du ændre dit password og brugernavn i linierne hvor det testet om de er rigtige
Avatar billede bullefardk Nybegynder
08. februar 2004 - 21:25 #3
Takker mange gange begge. Men desværre var Steen først, og den virkede :D
Avatar billede ellebaek Nybegynder
08. februar 2004 - 21:31 #4
Ja, jeg kan bare lære at være lidt hurtigere ;-)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester