Reputation: 1737
I am in a confusion with our application . I am passing username and password in the URL
like
http://mysite.com/login?userid=abc&password=test
this is taking me to the login page ( asks for credentials) and again if I hit the browser with simply using keyboard enter key on the same URL or Contrl+F5 it works fine ( It take me to the welcome page of the user) . So hitting the same URL working fine .
Not sure why the second time it is working fine . But with that what I did was in a simple HTML file I wrote the below two lines ( I just want to automate those two hits )
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://mysite.com/login?userid=abc&password=test">
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://mysite.com/login?userid=abc&password=test">
so this loads the page twice and my assumption was it should take to the user welcome page . since I am loading it twice . But again takes me the login page . Again simple enter and it works fine .
Please advise me how to automate this two step process in a simple HTML or in PHP or in any other programing language .
Thanks for your help
Regards
Kiran
Upvotes: 0
Views: 1579
Reputation: 28218
it sounds like the code that handles auto login is only firing off on post-back. I would investigate what the conditions of this code firing off are.
Upvotes: 1
Reputation: 8996
login.html
<form action="auth.php" method="POST">
<input name="username" value="" />
<input name="password" value="" />
<input type="submit" value="login" />
</form>
auth.php
if($_POST['username] == 'abc' && $_POST['password'] == 'test')
{
//redirect to welcome page
}
of course you should check username and password a little bit more professional than this but i think is enough to understand.
if you just need to request an url twice maybe what you're looking for is curl, php documentation
Upvotes: 1