M
malborg
I have simple form in PHP with two input types as text to input login
name and password.PS: They use POST method. (index.php)
The other script(logowanie.php) checks if login and password is correct
and displays: "You are loged in." or "Your password or login name is
incorrect."
I'm trying to login using IdHTTP from Indy components. But in response
from script I have everything what contains "index.php" but no values
for login name and no values for password.
What I'm doing wrong ??
I think that "index.php" does not receive any data from method
IdHTTP->Post();
Please help
#include <vcl.h>
#include<iostream.h>
#include<fstream.h>
#pragma hdrstop
#include <string.h>
#include "Unit1.h"
//#include "Unit3.h"
#include "Unit2.h"
#include "Unit3.h"
#include <Clipbrd.hpp>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "SHDocVw_OCX"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
AnsiString s="http://something.com/arthur/web/" ;
TMemoryStream *Receive = new TMemoryStream() ;
AnsiString rtf;
TStringStream * Send = new TStringStream(rtf) ;
IdHTTP1->Request->Accept="*/*";
IdHTTP1->Request->Referer="http://something.com";
IdHTTP1->Request->ContentType="application/x-www-form-urlencoded";
Send->WriteString("?log=a&pass=a");
IdHTTP1->Post("http://something.com/arthur/web/index.php?log=a&pass=a",Send,Receive);
Receive->SaveToFile("Response.txt");
CppWebBrowser1->Navigate(WideString(s));
This is index.php
<HTML>
<BODY align=center>
<form method="POST" action="logowanie.php">
<center>
<?
echo
"LOGIN:
";
?>
<input type="text" name=log value="">
<br><br>
<?
echo
"PASSWORD:
";
?>
<input type="password" name=pass value="">
<input type="hidden" name=drhide>
<br><br>
<input type="submit" value="Login">
<input type="button" value="BUTTON">
</center>
</form>
</BODY>
</HTML>
This is logowanie.php
<?
$login = 'a';
$password = 'a';
if ( ($login == $_POST['log']) && ($password == $_POST['pass']) )
{
echo "You are loged";
}
else
{
echo 'ACCESS DENIED ';
}
?>
name and password.PS: They use POST method. (index.php)
The other script(logowanie.php) checks if login and password is correct
and displays: "You are loged in." or "Your password or login name is
incorrect."
I'm trying to login using IdHTTP from Indy components. But in response
from script I have everything what contains "index.php" but no values
for login name and no values for password.
What I'm doing wrong ??
I think that "index.php" does not receive any data from method
IdHTTP->Post();
Please help
#include <vcl.h>
#include<iostream.h>
#include<fstream.h>
#pragma hdrstop
#include <string.h>
#include "Unit1.h"
//#include "Unit3.h"
#include "Unit2.h"
#include "Unit3.h"
#include <Clipbrd.hpp>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "SHDocVw_OCX"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
AnsiString s="http://something.com/arthur/web/" ;
TMemoryStream *Receive = new TMemoryStream() ;
AnsiString rtf;
TStringStream * Send = new TStringStream(rtf) ;
IdHTTP1->Request->Accept="*/*";
IdHTTP1->Request->Referer="http://something.com";
IdHTTP1->Request->ContentType="application/x-www-form-urlencoded";
Send->WriteString("?log=a&pass=a");
IdHTTP1->Post("http://something.com/arthur/web/index.php?log=a&pass=a",Send,Receive);
Receive->SaveToFile("Response.txt");
CppWebBrowser1->Navigate(WideString(s));
This is index.php
<HTML>
<BODY align=center>
<form method="POST" action="logowanie.php">
<center>
<?
echo
"LOGIN:
";
?>
<input type="text" name=log value="">
<br><br>
<?
echo
"PASSWORD:
";
?>
<input type="password" name=pass value="">
<input type="hidden" name=drhide>
<br><br>
<input type="submit" value="Login">
<input type="button" value="BUTTON">
</center>
</form>
</BODY>
</HTML>
This is logowanie.php
<?
$login = 'a';
$password = 'a';
if ( ($login == $_POST['log']) && ($password == $_POST['pass']) )
{
echo "You are loged";
}
else
{
echo 'ACCESS DENIED ';
}
?>