---
title: "Förbättra script..."
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/6453-förbättra-script"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "J0han"
published: "2000-08-28T16:44:00.000Z"
updated: "2000-08-29T07:44:00.000Z"
replies: 2
views: 296
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/6453-förbättra-script"
---

# Förbättra script...

## #1 — J0han, 2000-08-28T16:44Z

Hur kan man göra för att se till att folk inte "missbrukar" denna räknare?

```
<html>
<%
Set File = Server.CreateObject("Scripting.FileSystemObject")
Set Edit = File.OpenTextFile(Server.MapPath("counter.txt"), 1)
antal = Edit.ReadLine
Edit.Close
antal = antal + 1
Set Edit = File.OpenTextFile(Server.MapPath("counter.txt"), 2)
Edit.WriteLine antal
Edit.Close
%>
<%=antal%>
</html>
```

Det borde väl gå med sessions eller nåt..?

Permalänk: https://www.webforum.nu/p/6453

## #2 — Ricki, 2000-08-28T17:02Z

Tjena,
Japp, det går att lösa med cookies.

```
<html>
<%
Set File = Server.CreateObject("Scripting.FileSystemObject")
Set Edit = File.OpenTextFile(Server.MapPath("counter.txt"), 1)
antal = Edit.ReadLine
Edit.Close
antal = antal + 1
inget = antal + 0
Set Edit = File.OpenTextFile(Server.MapPath("counter.txt"), 2)

If Request.Cookies("haha") = "1" Then
Edit.WriteLine inget
Else
Edit.WriteLine antal
Response.Cookies("haha") = "1"
Response.Cookies("haha").Expires = "December 1, 2001"

End If
Edit.Close
%>
<%=antal%>
</html>
```

Permalänk: https://www.webforum.nu/p/245897

## #3 — emission, 2000-08-29T07:44Z

Varför skriva något till filen överhuvud taget, när inget ska läggas till?

Permalänk: https://www.webforum.nu/p/245898

---

Tråden på webben: https://www.webforum.nu/amne/asp/6453-förbättra-script
