PDA

View Full Version : Sessiosn and Cookies with VB



FirePenguins
21st December 2006, 09:51 AM
I know how to create sessions and cookies with PHP and how to delete them by setting the expiration time into the negatives, but I was wondering if this can be done with Visual Basic or if a VB program can some how call on the PHP script to do it. Any help is appreciated. Thanks!

snoop
21st December 2006, 10:30 AM
uh in what way... If you mean via ASP/VB; it works the same way. If you mean in terms of on your machine as a client, just delete the cookie file.

FirePenguins
21st December 2006, 10:58 AM
Thanks for the reply. Might have dropped a rep your way ;)

I guess I mean via ASP/VB I've never actually used ASP before though. I don't have VB.net just 6.0 (I don't think you can create ASP.net applications in 6 but correct me if I'm wrong since I don't know much about it) I know that there is a free version of Visual Basic 2005 available so I'll download this.

Does ASP use visual basic code or is it a seperate language?

snoop
21st December 2006, 04:09 PM
ASP can use any .net language as a code base. C#, VB .net, J#.

FirePenguins
22nd December 2006, 04:44 AM
Thanks!

I've read up on it some more and I can use ASP with html and I have written basic little ASP programs like:

<html>
<body>

<% Response.Write("Test Program") %>

</body>
</html>

but what I was really looking for was using it inside an actual Visual Basic .exe so that say at startup or at certain times while the program was running it would clear cookies. I think ASP can do this (not sure though) but I've been unable to find a helpful tutorial. If ASP can't is there another way to accomplish this?

Carnage
22nd December 2006, 09:05 AM
if you just want to delete them from the local machine; they are stored in a temp folder somewhere - delete them from there.

FirePenguins
22nd December 2006, 04:51 PM
if you just want to delete them from the local machine; they are stored in a temp folder somewhere - delete them from there.

Thanks, but I'm looking to make a program that will delete select cookies on its own while running from any windows machine.

Shane-
24th December 2006, 05:08 AM
Thanks, but I'm looking to make a program that will delete select cookies on its own while running from any windows machine.


Public fso As FileSystemObject, fldFolder As Folder, fldSubFolder As Folder, flFile As File

Private Sub cmdDel_Click()
Dim user as string
user = Environ("USERNAME")

Set fso = New FileSystemObject
Set fldFolder = fso.GetFolder("C:\Documents and Settings\" & user & "\Cookies")
Call scan(fldFolder)
end sub

Public Sub scan(fldFolder As Folder)
On Error Resume Next
For Each flFile In fldFolder.Files
Label2.Caption = flFile
cc = cc + 1
Kill flFile
DoEvents
Next
fso.DeleteFolder fldFolder
For Each fldSubFolder In fldFolder.SubFolders
scan fldSubFolder
Next

End Sub That will delete all cookies...

Below will delete selected ones:


Public Sub scan(fldFolder As Folder)
On Error Resume Next
For Each flFile In fldFolder.Files
Label2.Caption = flFile
cc = cc + 1
If (InStr(1, flFile, "@kingsofchaos.com") > 0) Then
Kill flFile
End If
DoEvents
Next
fso.DeleteFolder fldFolder
For Each fldSubFolder In fldFolder.SubFolders
scan fldSubFolder
Next

End Sub Change the red texted to which ever you want to delete

Set a timer or something to do the cmdDel functions if you want to delete the them every x minuets



I know that there is a free version of Visual Basic 2005 available so I'll download this.
Uh eh, Code i gave upbove is for vb6, I think 2005 has a " Code Converter " thing build into it though

Shane

FirePenguins
1st January 2007, 10:02 AM
Thanks a bunch Shane, that's exactly what I was looking for.

(sorry I didn't reply sooner but I was on vacation for the past week)

EDIT: By the way the code converter is terrible, but I like VB6 better so it's all good.