CnS Login & Account Info
This is a seperate project based on the sidebar from CnS Desktop. Its standalone and any sidebar addins made for desktop will also function in this sidebar.
Hello,
This is a short guide on how you can use your apps to login to Codenstuff.com and retreive some information from the users account to display in your apps.
Ok to do this you will need to use the basic "API" ive made and the following code. First you will need to add a webbrowser to your form and change its URL propertie to:
Now when your browser goes to this page if your not logged in you can use the following code to login, using 2 textboxs with your username/password:
Now to read your account information from that page and place it into your application in labels/textboxs or whatever you can use this quick code.
First add this small function anywhere you want within your app code:
This is a short guide on how you can use your apps to login to Codenstuff.com and retreive some information from the users account to display in your apps.
Ok to do this you will need to use the basic "API" ive made and the following code. First you will need to add a webbrowser to your form and change its URL propertie to:
Code: Select all
Thats a page that contains some information from your account.http://www.codenstuff.com/forum/Cnsapiohmy.php
Now when your browser goes to this page if your not logged in you can use the following code to login, using 2 textboxs with your username/password:
Code: Select all
That will log you in and keep you logged in.WebBrowser1.Document.GetElementById("prime_login_password").SetAttribute("value", TextBox2.Text)
WebBrowser1.Document.GetElementById("prime_login_username").SetAttribute("value", TextBox1.Text)
WebBrowser1.Document.GetElementById("prime_login_auto").InvokeMember("click")
WebBrowser1.Document.GetElementById("Login").InvokeMember("click")
Now to read your account information from that page and place it into your application in labels/textboxs or whatever you can use this quick code.
First add this small function anywhere you want within your app code:
Code: Select all
Now to use that code you would do the following, im going to make your username appear in a message box:Public Function GetProfileInfo(ByVal DocToSearch As String, ByVal GetThis As String) As String
Return System.Text.RegularExpressions.Regex.Match(DocToSearch, "<li><span>" & GetThis & "</span>(.*?)</li>", System.Text.RegularExpressions.RegexOptions.Multiline).Groups(1).Value
End Function
Code: Select all
The first value in that code is "WebBrowser1.DocumentText" because that is where you will be reading the information from. The second part "NAME" is what information you want from the page. If you wanted to get the amount of credits you have you would use:MsgBox(GetProfileInfo(WebBrowser1.DocumentText, "NAME"))
Code: Select all
If you wanted to get your email address you would use:GetProfileInfo(WebBrowser1.DocumentText, "CREDITS")
Code: Select all
To place it into a label or textbox or something just use it like:GetProfileInfo(WebBrowser1.DocumentText, "EMAIL")
Code: Select all
So thats a really quick way to do it with a small amount of code cooll;Label1.Text = GetProfileInfo(WebBrowser1.DocumentText, "NAME")
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
WOW finally dude this is nice why didn't you think about this before???
It's fantastic!
It works fantastic!
It's fantastic!
It works fantastic!
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
Hello
I had the first part done, the login part (if u can remember my "CodenStuff Login", but i never tried retrieving the credits and stuff about the account.
Thanks ;)
I had the first part done, the login part (if u can remember my "CodenStuff Login", but i never tried retrieving the credits and stuff about the account.
Thanks ;)
We shall let the revolution begin.. the revolution for freedom, freedom against censorship. We shall fight in the fields and in the streets, we shall fight in the hills; we shall never surrender
is there a way to see if the username and/or the password is incorrect?
Hello,
Hmm you could just check the page for the incorrect message. In the "WebBrowser1_DocumentCompleted" event put this code:
Hmm you could just check the page for the incorrect message. In the "WebBrowser1_DocumentCompleted" event put this code:
Code: Select all
If you enter a wrong username or password it will show the incorrect details page and that code just checks for the incorrect login message and shows a messagebox is its wrong but you could make a login form popup or something.If WebBrowser1.DocumentText.Contains("You have specified an incorrect") Then
MsgBox("Login details incorrect please check and try again!")
End If
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
Copyright Information
Copyright © Codenstuff.com 2020 - 2023