Jump to content

Array Use


 Share

Recommended Posts

Okay this might be simple for some of you but im just kind of confused about how to set this up..

#include<misc.au3>
#include <ScreenCapture.au3>
#Include<file.au3>
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>

$Login = @UserName;this is going be how we determ if they are registered user

if $login = "AH1320" Then
    msgbox (0, "Account Disabled", "Sorry  but the adminstrator has disabled your account.");
endif

if $login = "TE28544" Then
    msgbox (0, "Account Disabled", "Sorry you know who you need to talk to. If you want this account re activated.");
EndIf



else
    msgbox (0, "Welcome", "Welcome to full access.");opens the gui here in a minute.
    
EndIf

elseif ;opens gui for non members
;gui
endif

What i want to do is make a massive array so I can say

these people are members

to123299

fe293811

fo489824

fd912839

these people get a msgbox message

fo123983

oi491284

ox139485

and these people get a different gui complete

can you please help

Link to comment
Share on other sites

If mutliple arrays and SQLite are out of the questions I can think of two practical ways to do this:

First way is to make the array 2d and use a column for the usernames and one for a state identifier:

If the identifier is 0, the account has never been activated.

If the identifier is 1, the account has been banned.

If the identifier is 2, the account is suspended.

If the identifier is 3, the account is activated.

If the identifier is ,,,, etc

As you can see it'll be easy to accomodate for different account states this way.

The other way would use the same system, but instead of using a 2D array you concatenate the username to the the account state like this: "3to123299" -> "3" and "to123299" -> account "to123299" is active.

this has the benefit of using a 1D array, which works a little better with some of the _Array functions, but it's down to preference.

It does seem like SQLite would be the ideal solution though, as you can basically ask for the account state for user to123299, but also request all users with account state 3 etc and it will be much easier to add information to accounts without needing to rewrite allot of code. Like if you want to add reasons as to why someone got suspended etc.

Link to comment
Share on other sites

Hi Medic873,

maybe you want to tell us how you maintain the list of users that are full-members, banned or locked.

Do you work in a local environment or just distribute the exe?

If you'd have all values in an array you could use _ArraySearch() to for the username.

If you look at its options in the help you can define a partial search.

And if you've got the position in the array, read the element and see if there's a "-1" or "-3" at the end!

Regards,

Hannes

:)

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

Hi Medic873,

I guess/suggest you use InetGet() to retrieve the file.

Then you can translate the html file with string operations until you have a list of usernames you could maintain in an array.

That should do the trick.

Regards,

Hannes

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

Hi Medic873,

let's say you started the list in the internet by <userstart> and end it with <userend>

<userstart>

user1-0

user2-1

user3-0

...

<userend>

#include <file.au3>

dim $aHTML, $sTempFile
dim $j = 0

$sTempFile = _TempFile()

InetGet("http://freetexthost.com/hsnfi4iztv",$sTempfile,1)

_FileReadToArray($sTempFile,$aHTML)

FileDelete($sTempFile)

Dim $aList[$aHTML[0]]

For $i=1 To $aHTML[0]

  If StringInStr("<userstart>", $aHTML[$i]) Then $bUserlist = True

  If StringInStr("<usersend>", $aHTML[$i]) Then $bUserlist = False

  If $bUserlist Then 
    $j += 1
    $aList[0] = $j
    $aList[$j] = $aHTML
  EndIf

Next

This comes without any guarantee. ;-)

Regards,

Hannes

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...