Delphino
FOL-Client
Der Quellcode der Einlog-Funkion :
Erklärung :
Button1 : Einlogbutton
Edit1 : SessionID
Edit2 : Name
Edit3 : Passwort
void __fastcall TWebMain::Button1Click(TObject *Sender)
{
if (Label1->Visible) {
//Abbrechenfunktion
Button1->Caption = "Log&in";
Button4Click(WebMain);
return;
}
Label1->Visible = true;
Button1->Caption = "A&bbrechen";
Edit2->ReadOnly = true;
Edit2->Color = clBtnFace;
Edit3->ReadOnly = true;
Edit3->Color = clBtnFace;
Label1->Refresh();
Edit2->Refresh();
Edit3->Refresh();
Edit1->Text = "";
AnsiString url = "http://www.funonline.de/FunOnline/NetCommunity?service=login&nh=0&nick="+Edit2->Text+"&password="+Edit3->Text+"&submit=Check-In";
int size = url.WideCharBufSize();
wchar_t *buffer = new wchar_t[size];
url.WideChar(buffer, size);
HTML->Navigate(buffer);
delete[] buffer;
Timer1->Enabled = true;
}
// ---------------------------------------------------------------------------------------
void __fastcall TWebMain::Timer1Timer(TObject *Sender)
{
try {
String Text = HTML->LocationURL;
Edit4->Text = Text;
if (SessionIDVorhanden(Text)) TimerKeineSessionID->Enabled = false;
String Suchtext = "&sessionid=";
for (int c=1;c < Text.Length()-Suchtext.Length(); c++) {
String TeilText = Text.SubString(c,Suchtext.Length());
if (TeilText == Suchtext) {
if ((Text.SubString(c+Suchtext.Length(),4) == "=&nh")||(NHvorhanden(Text.SubString(c+Suchtext.Length(),19))))
{
Edit4->Text = "";
}
else {
Edit1->Text = Text.SubString(c+Suchtext.Length(),19);
Timer1->Enabled = false;
return;
}
}
}
}
catch (Exception &exception) {
}
}
//---------------------------------------------------------------------------
void __fastcall TWebMain::Timer2Timer(TObject *Sender)
{
if (Edit1->Text == "") {
if (Label1->Visible) return; //Einlogvorgang
if (!(Button1->Enabled)) Button1->Enabled = true;
if (Button4->Enabled) Button4->Enabled = false;
if (Button5->Enabled) Button5->Enabled = false;
if (Button6->Enabled) Button6->Enabled = false;
if (Button7->Enabled) Button7->Enabled = false;
if (CheckBox1->Enabled) {
CheckBox1->Enabled = false;
Label8->Font->Color = clGray;
}
if (Button8->Enabled) Button8->Enabled = false;
if (Edit2->ReadOnly) {
Edit2->Color = clWindow;
Edit2->ReadOnly = false;
}
if (Edit3->ReadOnly) {
Edit3->Color = clWindow;
Edit3->ReadOnly = false;
}
}
else {
Edit1->Text = FilterSID(Edit1->Text);
Edit3->Text = ""; //HIER
WIRD DAS PASSWORT GELÖSCHT
if (Label1->Visible) Label1->Visible = false;
if (Button1->Caption == "A&bbrechen") Button1->Caption = "Login";
if (Button1->Enabled) Button1->Enabled = false;
if (!(Button4->Enabled)) Button4->Enabled = true;
if ((!(Button5->Enabled))&&(!(Form3->Visible))) Button5->Enabled = true;
if (!(Button6->Enabled)) Button6->Enabled = true;
if (!(Button7->Enabled)) Button7->Enabled = true;
if ((!(CheckBox1->Enabled))&&(!(Form3->Visible))) {
CheckBox1->Enabled = true;
Label8->Font->Color = clBlack;
}
if (!(Button8->Enabled)) Button8->Enabled = true;
if (!(Edit2->ReadOnly)) {
Edit2->Color = clBtnFace;
Edit2->ReadOnly = true;
}
if (!(Edit3->ReadOnly)) {
Edit3->Color = clBtnFace;
Edit3->ReadOnly = true;
}
}
}
|