Fetstil Fetstil Kursiv Understrykning linje färgläggning tabellverk Punktlista Nummerlista Vänster Centrerat högerställt Utfyllt Länk Bild htmlmode
  • Forum & Blog
    • Forum - översikt
      • .Net
        • asp.net generellt
        • c#
        • vb.net
        • f#
        • silverlight
        • microsoft surface
        • visual studio .net
      • databaser
        • sql-server
        • databaser
        • access
        • mysql
      • mjukvara klient
        • datorer och komponenter
        • nätverk, lan/wan
        • operativsystem
        • programvaror
        • säkerhet, inställningar
        • windows server
        • allmänt
        • crystal reports
        • exchange/outlook
        • microsoft office
      • mjukvara server
        • active directory
        • biztalk
        • exchange
        • linux
        • sharepoint
        • webbservers
        • sql server
      • appar (win/mobil)
      • programspråk
        • c++
        • delphi
        • java
        • quick basic
        • visual basic
      • scripting
        • asp 3.0
        • flash actionscript
        • html css
        • javascript
        • php
        • regular expresssion
        • xml
      • spel och grafik
        • DirectX
        • Spel och grafik
      • ledning
        • Arkitektur
        • Systemutveckling
        • krav och test
        • projektledning
        • ledningsfrågor
      • vb-sektioner
        • activeX
        • windows api
        • elektronik
        • internet
        • komponenter
        • nätverk
        • operativsystem
      • övriga forum
        • arbete karriär
        • erbjuda uppdrag och tjänster
        • juridiska frågor
        • köp och sälj
        • matematik och fysik
        • intern information
        • skrivklåda
        • webb-operatörer
    • Posta inlägg i forumet
    • Chatta med andra
  • Konto
    • Medlemssida
    • Byta lösenord
    • Bli bonsumedlem
    • iMail
  • Material
    • Tips & tricks
    • Artiklar
    • Programarkiv
  • JOBB
  • Student
    • Studentlicenser
  • KONTAKT
    • Om pellesoft
    • Grundare
    • Kontakta oss
    • Annonsering
    • Partners
    • Felanmälan
  • Logga in

Hem / Tips & tricks

#966 - LiveCounter med FileSystemObject

Postat 2002-03-05 00:24:12 av Patrik Andersson i Kategori Programmering, C#, Kommandon med 0 Kommentarer

<%
Function hitCounter()
'################################################
'#HitCounter 1.0 2001
'#Author: Patrik Andersson
'#Email: asp_dev@hotmail.com
'##############################################
'Declare some variables
Dim imageFolder
Dim intDigits
Dim counterFile
Dim intCount
Dim intNum
Dim intLen
Dim fs

'ImageFolder:
'Contains the path to where the count.txt file is. If the file that contains this function
'is in the same folder you can leave it blank. If your pics are in another folder you must end the string with a slash (/).

imageFolder = "images/simple/"
'imageFolder = "images/classic/"

'intDigits:
'Here you set the value of how many digits you want. Lets say the value in the counterfile is 123
'but you want it to look like this, 000123, you give intDigits the value 6.
intDigits = 6

'CounterFile: The name of the counter file.
CounterFile = Server.MapPath("count.txt")


'Create the object
Set fs = CreateObject("Scripting.FileSystemObject")
'Check to see if the counterfile exists.
if fs.FileExists(counterFile) = False Then
'The file doesn't exist so create it and write the number 1 to it.
Set f = fs.CreateTextFile (CounterFile, 1, 0)
f.writeLine 1
c = 1

Set f = Nothing
else
'The counterfile exists so read the number from it.
Set a = fs.OpenTextFile(CounterFile, 1, 0, 0)
c = a.Readline
c = c + 1

'Increase the number with 1
set b = fs.CreateTextFile (CounterFile, 1, 0)
'Write back the new value to the counterfile.
b.WriteLine c

'Close everything
Set b = Nothing
Set a = Nothing
Set fs= Nothing

End if

'Now we are gonna see how many zeros (0) we should place infront of the number.
'Fist we take the value from the variable c and place it in a new variable.

intNum = c

'We need to determine how many characters the value has.
'intNum = 78, intLen = 2
'intNum = 456, intLen = 3
intLen = Len(intNum)


'How many Zero infront of the counter value
'intDigits = 6, intLen = 3 (000xxx)
intDigits = 5, intLen = 4 (0xxxx)
intCount = intDigits - cint(intLen)

'Print out the code for showing 0.gif.
For x = 1 To intCount
Response.Write ("")
Next

'Go through every digit and show the correct image for it.
For i = 1 To intLen
Response.Write ""
Next

End Function
%>







<%call hitCounter()%>



Sample:
Size:

Nyligen

  • 09:09 Vill du köpa medicinska tester?
  • 12:47 Vem beviljar assistansen – kommune
  • 14:17 Någon med erfarenhet av hemstädnin
  • 14:14 Bör man använda sig av en båtförme
  • 14:12 Finns det någon intressant hundblo
  • 14:25 Tips på verktyg för att skapa QR-k
  • 14:23 Tips på verktyg för att skapa QR-k
  • 20:52 Fungerer innskuddsbonuser egentlig

Sidor

  • Hem
  • Bli bonusmedlem
  • Läs artiklar
  • Chatta med andra
  • Sök och erbjud jobb
  • Kontakta oss
  • Studentlicenser
  • Skriv en artikel

Statistik

Antal besökare:
Antal medlemmar:
Antal inlägg:
Online:
På chatten:
4 569 153
27 952
271 704
1 206
0

Kontakta oss

Frågor runt konsultation, rådgivning, uppdrag, rekrytering, annonsering och övriga ärenden. Ring: 0730-88 22 24 | pelle@pellesoft.se

© 1986-2013 PelleSoft AB. Last Build 4.1.7169.18070 (2019-08-18 10:02:21) 4.0.30319.42000
  • Om
  • Kontakta
  • Regler
  • Cookies