Author Topic: MS Access  (Read 1790 times)

0 Members and 1 Guest are viewing this topic.

Offline NeiSep

  • Member
  • ***
  • Posts: 27
  • Karma: +1/-0
MS Access
« on: 11 January, 2004, 16:07:32 »
Is there some one know how to do a script in PtokaX witch can read the register users??
and then put it in a Ms Access i want to know if there is anyway to do this??
<@Localhost Bust your ASS@>

PtokaX forum

MS Access
« on: 11 January, 2004, 16:07:32 »

Offline xfernal

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
(No subject)
« Reply #1 on: 11 January, 2004, 17:11:06 »
I am looking for a similar solution.
See this thread:

You might be better off parsing the RegisteredUsers.dat file and importing the data in via a VB Script rather than using LUA. You could even setup a scheduled task to run however often you need to get new users into your database.

Offline xfernal

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
(No subject)
« Reply #2 on: 11 January, 2004, 17:33:15 »
Here is a VB Script that should work for importing that file into your Acccess database. Make sure you read the comments and change as neccessary. Then schedule you a task to import them into your database. I haven't tested this script but it should work.

Here ya go:

Dim ObjConn, varTextPath, varLine, varUser, varPassword, varTypeUser, varDB
'path to your registeredusers.dat
varTextPath = "d:\whereever\"
'path and name of your database
varDB = "D:\whereever\yourdb.mdb"

Set fs=CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile(varTextPath & "RegisteredUsers.dat"), 1)
'we have opened the file, now we loop through the entire file, line by line
do while f.AtEndOfStream = false
varLine = f.ReadLine
arrLine = Split(varLine, "|")
If UBound(arrLine) = 2 Then
   'if I remember correctly, the first value is the username, second is password, followed by type of user(OP, reg, etc.)
   varUser = arrLine(0)
   'i will not use the 2 values below for this script but you could simply use the values below in your own SQL statement
   varPassword = arrLine(1)
   varTypeUser = arrLine(2)
   'here we are going to make a connection to the db
   SET ObjConn = CreateObject("ADODB.Connection")
   strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & & ";Persist Security Info=False"
   ObjConn.Open  strConnString
   'make sure you rename your table and columns
   strSQLExist = "Select YourColumnNameForUsers FROM YourTable WHERE YourColumnNameForUsers = '" & varUser & "'"
   Set rsUser = ObjConn.Execute(strSQLExist)
   'if the user is NOT already in the databse then we will add it.
   If rsUser.EOF Then
      strSQL = "Insert Into YourTable (YourColumnNameForUsers) VALUES ('" & varUser & "')
   End IF
   Set ObjConn = Nothing
End If
Set f=Nothing
Set fs=Nothing
« Last Edit: 11 January, 2004, 17:54:25 by xfernal »

PtokaX forum

(No subject)
« Reply #2 on: 11 January, 2004, 17:33:15 »