Jump to content

  •  

  • iBotModz CBox


    Photo

    iBotModz AUTH System Update.


    • This topic is locked This topic is locked
    11 replies to this topic

    #1 iBotPeaches

    iBotPeaches

      General Grade 6

    • Owner

    • 6,570 posts
    • Joined: 29-July 07
    • Gender:Male
    • Location:Kansas

    Posted 30 March 2010 - 04:35 PM

    The authentication system used by various apps has been updated on the server side. It is now 1 query instead of 2, and operates on (Sign in, quick reply, and normal post) for updating your IP, post count, group id, and REP count).


    Thanks for the various users for helping out with the test.

    The source in C#, for anyone.

    You must include these classes.
    using System.Net;
    using System.Collections;
    


    public void authMe()
            {
                /*
                * Allowed User Groups to post, edit this yourself
                * Remove the ones that you DONT want to use your program
                * For this demo, all the groups are there
                * 
                * The ones that are missing are Bots,
                * Guests and some old usergroups that are hidden
                */
                ArrayList aug = new ArrayList();
                // aug.Add(1); //Validating
                aug.Add(3); //Members
                aug.Add(4); //Owner
                // aug.Add(5); //Banned 
                aug.Add(7); //Sub Admins
                aug.Add(<img src='http://www.ibotmodz.net/forum/public/style_emoticons/<#EMO_DIR#>/dirol.gif' class='bbc_emoticon' alt='8)' />; //VIP
                aug.Add(9); //Global Mods
                aug.Add(10); //GFX Team
                aug.Add(12); //Retired Staff
                aug.Add(14); //Members+
                aug.Add(15); //Donors
                aug.Add(16); //Donors+
    
                //These are the the levels of which you want for posts and REP
                int minPosts = 0;
                int minRep = 0;
    
                //The client to download the string, which contains all login info
                WebClient client = new WebClient();
                string info = client.DownloadString("http://www.ibotmodz.net/index.php/prog/api");
                client.Dispose();
    
                //Check if website online or not
                if (String.IsNullOrEmpty(info))
                    MessageBox.Show("iBotModz is offline");
    
                //Gathering the 4 variables
                String user = info.Substring((info.IndexOf("[user]") + 6), ((info.IndexOf("[/user]") - (info.IndexOf("[user]") + 6))));
    
                //Check if guest
                if (String.IsNullOrEmpty(user))
                {
                    MessageBox.Show("Please become a member on iBotModz.net." + Environment.NewLine + Environment.NewLine + "If you are a member....Make a post" + Environment.NewLine + "Without using the quick reply <img src='http://www.ibotmodz.net/forum/public/style_emoticons/<#EMO_DIR#>/smile.gif' class='bbc_emoticon' alt=':)' />");
                    Environment.Exit(0);
                }
                int posts = Convert.ToInt32(info.Substring((info.IndexOf("[posts]") + 7), ((info.IndexOf("[/posts]") - (info.IndexOf("[posts]") + 7)))));
                int rep = Convert.ToInt32(info.Substring((info.IndexOf("[rep]") + 5), ((info.IndexOf("[/rep]") - (info.IndexOf("[rep]") + 5)))));
                int groupID = Convert.ToInt32(info.Substring((info.IndexOf("[groupid]") + 9), ((info.IndexOf("[/groupid]") - (info.IndexOf("[groupid]") + 9)))));
    
                //Check for posts
                if (minPosts > posts)
                {
                    MessageBox.Show("You need more posts to use this program.");
                    this.Close();
                }
                //Check for REP level
                if (minRep > rep)
                {
                    MessageBox.Show("You need more REP to use this program.");
                    this.Close();
                }
                //Check for memberID
                if (groupID == 0)
                    MessageBox.Show("Sorry, you don't have a usergroup.");
    
                int flag = 0; // ((0 = failed)) ((1 = passed))
                //This will go through each allowed ID, so lets hope we are in here
                foreach (int i in aug)
                {
                    if (groupID == i)
                    {
                        //Yes we found it
                        //Debug.WriteLine(groupID + " passed because it was equal to " + i);
                        flag = 1;
                        break;
                    }
                    else
                    {
                        //so far theres nothing, keep going
                        flag = 0;
                        //Debug.WriteLine(groupID + " failed because it was equal to " + i);
                    }
                }
                switch (flag)
                {
                    //Check the flag
                    case 1: 
                        //Login passed
                        break;
                    case 0: 
                        //Login Failed
                        this.Close();
                        break;
                }
            }
    
    

    An example project is attached.
    Attached File  ibmAuth.rar   345.62KB   144 downloads

    #2 iTzoODavidOo

    iTzoODavidOo

      Sergeant Grade 2

    • Members+

    • 353 posts
    • Joined: 03-December 08
    • Gender:Male
    • Location:Manchester England

    Posted 30 March 2010 - 04:40 PM

    Can you post an attachment with all the files in like the last one?

    #3 iBotPeaches

    iBotPeaches

      General Grade 6

    • Owner

    • 6,570 posts
    • Joined: 29-July 07
    • Gender:Male
    • Location:Kansas

    Posted 30 March 2010 - 04:46 PM

    Yeah, I'll remake an updated example.

    Give me 10 minutes.

    #4 iBotPeaches

    iBotPeaches

      General Grade 6

    • Owner

    • 6,570 posts
    • Joined: 29-July 07
    • Gender:Male
    • Location:Kansas

    Posted 30 March 2010 - 05:06 PM

    I have added an updated example project as per request.

    #5 Grape soda

    Grape soda

      Private

    • Members+

    • 34 posts
    • Joined: 27-October 09
    • Gender:Male

    Posted 30 March 2010 - 05:08 PM

    So what does it do? In common english please.

    #6 yungbol

    yungbol

      Firmware Expert

    • Global Mods

    • 1,461 posts
    • Joined: 09-April 08
    • Gender:Male
    • Location:Philly

    Posted 30 March 2010 - 08:24 PM

    You add it to your app your coding to make sure the user is a member on iBotModz. It also can restrict a program for VIP only, quota of rep, or quota of post.

    #7 Rogue Modder

    Rogue Modder

      Class of 2008

    • VIP

    • 1,328 posts
    • Joined: 02-January 09
    • Gender:Male
    • Location:London, UK

    Posted 31 March 2010 - 02:11 PM

    Sexy Improvements, looks a lot more stable :p

    #8 gruntmods

    gruntmods

      Commander Grade 2

    • Donors+

    • 1,889 posts
    • Joined: 26-November 08
    • Gender:Male
    • Location:Unknown World

    Posted 11 April 2010 - 07:57 AM

    How can they not have a user group?

    #9 iBotPeaches

    iBotPeaches

      General Grade 6

    • Owner

    • 6,570 posts
    • Joined: 29-July 07
    • Gender:Male
    • Location:Kansas

    Posted 11 April 2010 - 07:51 PM

    Sometimes a incomplete session caused by a unfinished login might result in the groupID being set as 0 or null, thus failing the ID check.

    Mostly only happens with guests on proxies, or spiders/bots.

    #10 Soviet Pro

    Soviet Pro

      Apprentice Grade 2

    • Donors

    • 21 posts
    • Joined: 03-February 10
    • Gender:Male
    • Location:UK

    Posted 13 April 2010 - 03:13 PM

    For those of you using Visual Basic .NET, here is the converted code:

    Public Sub authMe()
     '
    ' 	* Allowed User Groups to post, edit this yourself
    ' 	* Remove the ones that you DONT want to use your program
    ' 	* For this demo, all the groups are there
    ' 	* 
    ' 	* The ones that are missing are Bots,
    ' 	* Guests and some old usergroups that are hidden
    ' 	
     
     Dim aug As New ArrayList()
     ' aug.Add(1); //Validating
     aug.Add(3)
     'Members
     aug.Add(4)
     'Owner
     ' aug.Add(5); //Banned 
     aug.Add(7)
     'Sub Admins
     aug.Add(<img src='http://www.ibotmodz.net/forum/public/style_emoticons/<#EMO_DIR#>/dirol.gif' class='bbc_emoticon' alt='8)' />
     'VIP
     aug.Add(9)
     'Global Mods
     aug.Add(10)
     'GFX Team
     aug.Add(12)
     'Retired Staff
     aug.Add(14)
     'Members+
     aug.Add(15)
     'Donors
     aug.Add(16)
     'Donors+
     'These are the the levels of which you want for posts and REP
     Dim minPosts As Integer = 0
     Dim minRep As Integer = 0
     
     'The client to download the string, which contains all login info
     Dim client As New WebClient()
     Dim info As String = client.DownloadString("http://www.ibotmodz.net/index.php/prog/api")
     client.Dispose()
     
     'Check if website online or not
     If [String].IsNullOrEmpty(info) Then
     MessageBox.Show("iBotModz is offline")
     End If
     
     'Gathering the 4 variables
     Dim user As [String] = info.Substring((info.IndexOf("[user]") + 6), ((info.IndexOf("[/user]") - (info.IndexOf("[user]") + 6))))
     
     'Check if guest
     If [String].IsNullOrEmpty(user) Then
     MessageBox.Show((("Please become a member on iBotModz.net." & Environment.NewLine) + Environment.NewLine & "If you are a member....Make a post") + Environment.NewLine & "Without using the quick reply <img src='http://www.ibotmodz.net/forum/public/style_emoticons/<#EMO_DIR#>/smile.gif' class='bbc_emoticon' alt=':)' />")
     Environment.[Exit](0)
     End If
     Dim posts As Integer = Convert.ToInt32(info.Substring((info.IndexOf("[posts]") + 7), ((info.IndexOf("[/posts]") - (info.IndexOf("[posts]") + 7)))))
     Dim rep As Integer = Convert.ToInt32(info.Substring((info.IndexOf("[rep]") + 5), ((info.IndexOf("[/rep]") - (info.IndexOf("[rep]") + 5)))))
     Dim groupID As Integer = Convert.ToInt32(info.Substring((info.IndexOf("[groupid]") + 9), ((info.IndexOf("[/groupid]") - (info.IndexOf("[groupid]") + 9)))))
     
     'Check for posts
     If minPosts > posts Then
     MessageBox.Show("You need more posts to use this program.")
     Me.Close()
     End If
     'Check for REP level
     If minRep > rep Then
     MessageBox.Show("You need more REP to use this program.")
     Me.Close()
     End If
     'Check for memberID
     If groupID = 0 Then
     MessageBox.Show("Sorry, you don't have a usergroup.")
     End If
     
     Dim flag As Integer = 0
     ' ((0 = failed)) ((1 = passed))
     'This will go through each allowed ID, so lets hope we are in here
     For Each i As Integer In aug
     If groupID = i Then
     'Yes we found it
     'Debug.WriteLine(groupID + " passed because it was equal to " + i);
     flag = 1
     Exit For
     Else
     'so far theres nothing, keep going
     'Debug.WriteLine(groupID + " failed because it was equal to " + i);
     flag = 0
     End If
     Next
     Select Case flag
     'Check the flag
     Case 1
     'Login passed
     Exit Select
     Case 0
     'Login Failed
     Me.Close()
     Exit Select
     End Select
    End Sub


    #11 iBotPeaches

    iBotPeaches

      General Grade 6

    • Owner

    • 6,570 posts
    • Joined: 29-July 07
    • Gender:Male
    • Location:Kansas

    Posted 13 April 2010 - 06:12 PM

    Seems the code spacing and color coding failed miserably.

    Thanks for the convert though. If you just copy it into VB the spacing will fix itself. Then it will look much cleaner.

    #12 Soviet Pro

    Soviet Pro

      Apprentice Grade 2

    • Donors

    • 21 posts
    • Joined: 03-February 10
    • Gender:Male
    • Location:UK

    Posted 14 April 2010 - 05:30 AM

    Yeah, it is a online convert tool and the colour thing is it's fault :)

    VB wil recognize it though ;)