Jump to content


The iBotModz AUTH system.


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

#1 iBotPeaches

iBotPeaches

    General Grade 6

  • Owner

  • 6,353 posts

Posted 16 August 2009 - 03:15 PM

For awhile I've wanted to implement a system that forces users to login to programs released on iBotModz. Entering actual login info seemed to risky to code for the database info would have been attached to every program. I then saw the system used on TheBotNet. You don't ever have to login to any program, but it somehow knows who you are.

That system is now on iBotModz. This system logs your username, post count, rep and group ID. Program makers then can use this to limit their applications to only VIP or only to users above 10 REP and 100 posts. The possibilities are endless. The system takes your IP and uses it to match towards an account which then is sent back to your program. So you can create dynamic programs sayings "Hello $username. If anyone decides to use this they can implement it via a button click, or forced on form load. This example gives an intro with no post count requirement.

Attached File  pre.png   25.41K   0 downloadsAttached File  post.png   25.8K   1 downloads

This is before you do anything. On a real example, it might say "200 Posts and 10 Rep needed" Then you click "Authorize" and wait a few seconds. Now it has grabbed my post count, username and rep. Now you can do simple if statements to determine if that user is allowed to your program.

Now for some source code.

			/*
			 * 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(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 :)");
					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 becuase it was equal to " + i);
						flag = 1;
						break;
					}
					else
					{
						//so far theres nothing, keep going
						flag = 0;
						//Debug.WriteLine(groupID + " failed becuase it was equal to " + i);
					}
				}
			//Check if passed or not
			switch (flag)
			{
				case 1: //Login passed
					break;
				case 0: //Login Failed
					this.Close();
					break;
			}

Its commented, so I'm not going to explain it.

You may download the full source
Attached File  ibmAuthSource.rar   210.43K   16 downloads

The example program.
Attached File  ibmAuth.exe   111K   17 downloads

Or the AUTH image.
Attached File  ibmAUTH.png   16.63K   1 downloads

If you need to post to generate your record, and don't want to spam some random topic, use this topic. Otherwise post normally. http://www.ibotmodz....20

Edited by iBotPeaches, 22 August 2009 - 04:11 PM.
Updated on August 21, 2009


#2 TheEazyB

TheEazyB

    Corporal Grade 1

  • Donors+

  • 333 posts

Posted 16 August 2009 - 03:50 PM

Lol it could also be used to keep IBM out of an app in case of a leak.

#3 Xerax

Xerax

    Depressive Emonic Faggot

  • VIP

  • 1,289 posts

Posted 16 August 2009 - 05:36 PM

Looks good, i will play with the code later.

#4 PREPPY DIABLO

PREPPY DIABLO

    Gunnery Sergeant Grade 1

  • Members+

  • 625 posts

Posted 16 August 2009 - 06:27 PM

now i cant get programs from vip from lostmodz26. :p JK

#5 Dark Slipstream

Dark Slipstream

    Blue Shadowz Owner

  • Members+

  • 2,829 posts

Posted 16 August 2009 - 06:43 PM

Does it use the built in API Users system in IP.Board??

Because API Users supports exactly what you are talking about, but I'm not sure on how to use that stuff lol..

#6 iBotPeaches

iBotPeaches

    General Grade 6

  • Owner

  • 6,353 posts

Posted 16 August 2009 - 07:23 PM

It uses my custom made hook :)
Non of that RPC-API junk, thats too confusing.

#7 Dark Slipstream

Dark Slipstream

    Blue Shadowz Owner

  • Members+

  • 2,829 posts

Posted 16 August 2009 - 09:49 PM

May I see it?

#8 yungbol

yungbol

    Firmware Expert

  • Global Mods

  • 1,459 posts

Posted 17 August 2009 - 11:52 AM

Wow very nice. Great addition now I'm finally back on my home PC after 2 months of on the laptop. Back to my old hardware and looking to code some new things will be sure to implement this :)

#9 Xerax

Xerax

    Depressive Emonic Faggot

  • VIP

  • 1,289 posts

Posted 17 August 2009 - 02:19 PM

Working on something Peaches.

#10 BL4CKXHAWK

BL4CKXHAWK

    Private Grade 2

  • Members+

  • 80 posts

Posted 17 August 2009 - 06:55 PM

I just tried to use it and it gave me this error...
Posted Image
Apparently the input String is not in the correct format.

Is it because i need to login to the site first or what?

Edited by BL4CKXHAWK, 17 August 2009 - 06:57 PM.


#11 iBotPeaches

iBotPeaches

    General Grade 6

  • Owner

  • 6,353 posts

Posted 17 August 2009 - 07:02 PM

I'll destroy my login info, and then try that.

I must have missed a check somewhere then.

#12 Xerax

Xerax

    Depressive Emonic Faggot

  • VIP

  • 1,289 posts

Posted 17 August 2009 - 07:16 PM

Peaches can you send the the .PSD file for:
Posted Image

#13 iBotPeaches

iBotPeaches

    General Grade 6

  • Owner

  • 6,353 posts

Posted 17 August 2009 - 07:39 PM

I'm re-coding my side of the application to display something different if they aren't signed in or haven't registered. Updates to follow.


@Dakote.

Attached File  ibmAUTH.rar   48.2K   10 downloads

#14 BL4CKXHAWK

BL4CKXHAWK

    Private Grade 2

  • Members+

  • 80 posts

Posted 17 August 2009 - 07:46 PM

Thanks Peaches!

#15 Xerax

Xerax

    Depressive Emonic Faggot

  • VIP

  • 1,289 posts

Posted 17 August 2009 - 07:55 PM

Thanks Peaches.

#16 BL4CKXHAWK

BL4CKXHAWK

    Private Grade 2

  • Members+

  • 80 posts

Posted 17 August 2009 - 08:11 PM

Hey it Works Now! Thanks Peaches!

Posted Image

EDIT: Peaches, You need to program the window to be fixed and nonresizable because it looks like this when you first open it up. The bottom one needs to look like the top one.

Posted Image

Edited by BL4CKXHAWK, 17 August 2009 - 08:15 PM.


#17 iBotPeaches

iBotPeaches

    General Grade 6

  • Owner

  • 6,353 posts

Posted 17 August 2009 - 08:33 PM

Yeah that stupid example program. I just wanted people to get an idea from the screenshots and source code then implement their own idea. That example app was merely an example, however I will be fixing the numerous bugs with it in the next day or two and update the main download.

#18 BL4CKXHAWK

BL4CKXHAWK

    Private Grade 2

  • Members+

  • 80 posts

Posted 17 August 2009 - 08:46 PM

Ok cool. looking forward to it. BTW Well Done. Is this done in C#, C++, or Visual Basic?

Edited by BL4CKXHAWK, 17 August 2009 - 08:46 PM.


#19 yungbol

yungbol

    Firmware Expert

  • Global Mods

  • 1,459 posts

Posted 17 August 2009 - 10:03 PM

C#.

#20 Entanio

Entanio

    Recruit

  • Members+

  • 4 posts

Posted 18 August 2009 - 06:45 AM

Nicely done. A great piece of work.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users