Posts: 1,830
Threads: 104
Joined: Jan 2011
Reputation:
46
02-02-2012, 14:17
(This post was last modified: 02-02-2012, 14:36 by iAegle.)
In case you feel like everyone is leeching yo shizz:
CSHARP Code
private bool Login( string User, string Password ) { System.Collections.Specialized.NameValueCollection Data = new System.Collections. Specialized. NameValueCollection(); Data.Add( "username", User ); Data.Add( "password", Password ); Data.Add( "submit", "Login" ); Data.Add( "action", "do_login" ); WebClient wb = new WebClient (); byte[] bytes = wb.UploadValues( "http://itsmods.com/forum/member.php", "POST", Data ); if ( System.Text.Encoding.ASCII.GetString( bytes ).Contains( "successfully" ) ) return true; return false; }
just use this and people will have to login first
example:
CSHARP Code
if( !Login( textBox1.Text, textBox2.Text ) ) { System.2012.DestroyTehWorld(); }
Posts: 6,052
Threads: 429
Joined: Oct 2010
Posts: 5,135
Threads: 241
Joined: Nov 2010
Reputation:
100
Does it return something else if the person is already logged in? Because if you use this in a program and it returns false because the user was already logged in it's pretty retarded...
Posts: 5,320
Threads: 300
Joined: Feb 2011
Reputation:
149
Posts: 1,830
Threads: 104
Joined: Jan 2011
Reputation:
46
(02-02-2012, 15:35)Pozzuh Wrote: Does it return something else if the person is already logged in? Because if you use this in a program and it returns false because the user was already logged in it's pretty retarded...
Nope, you can't stay logged in by using this afaik.
Posts: 5,135
Threads: 241
Joined: Nov 2010
Reputation:
100
I meant, what happens if you are already logged in
Posts: 1,830
Threads: 104
Joined: Jan 2011
Reputation:
46
(02-02-2012, 19:31)Pozzuh Wrote: I meant, what happens if you are already logged in
You mean like on the website itsself? It doesn't matter
Posts: 5,135
Threads: 241
Joined: Nov 2010
Reputation:
100
(02-02-2012, 19:58)iAegle Wrote: (02-02-2012, 19:31)Pozzuh Wrote: I meant, what happens if you are already logged in
You mean like on the website itsself? It doesn't matter
I mean what does the function return..
Posts: 1,830
Threads: 104
Joined: Jan 2011
Reputation:
46
02-02-2012, 20:27
(This post was last modified: 02-02-2012, 20:27 by iAegle.)
(02-02-2012, 20:22)Pozzuh Wrote: (02-02-2012, 19:58)iAegle Wrote: (02-02-2012, 19:31)Pozzuh Wrote: I meant, what happens if you are already logged in
You mean like on the website itsself? It doesn't matter
I mean what does the function return..
The HTML code of the "Succesfully logged in" redirect page thing
Posts: 5,135
Threads: 241
Joined: Nov 2010
Reputation:
100
(02-02-2012, 20:27)iAegle Wrote: (02-02-2012, 20:22)Pozzuh Wrote: (02-02-2012, 19:58)iAegle Wrote: (02-02-2012, 19:31)Pozzuh Wrote: I meant, what happens if you are already logged in
You mean like on the website itsself? It doesn't matter
I mean what does the function return..
The HTML code of the "Succesfully logged in" redirect page thing
I mean what does it return if you are already logged in..
God, why does it feel like we always end up in these kind of conversations ...
|