rajccs
asked on
curl, login and session maintainig
i have a form to which need to login and maintain session for subequent url, below is the sample form
<form name="login_form" action="https://www.domain.com/login.php" method="post">
<input name="username" value="Username" onblur="javascript: if(this.value=='') { this.value='Username';}" onfocus="javascript: if(this.value=='Username') {this.value='';};" />
<input type="password" name="passwd" value="Password" onfocus="javascript: if(this.value=='Password') {this.value='';};" />
<p></p>
<input type="submit" value="Login"/>
</form>
In https://www.domain.com/login.php simply put at the top:
<?php
if (isset($_POST['submit'])){
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
//validate username and passowrd here
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
}
?>
Cheers
<?php
if (isset($_POST['submit'])){
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
//validate username and passowrd here
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
}
?>
Cheers
marqusG:
I believe that rajccs wants their page to perform a login to another page, then maintain the logged-in session for that other page. Not to allow other to login to their page.
I believe that rajccs wants their page to perform a login to another page, then maintain the logged-in session for that other page. Not to allow other to login to their page.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.knowledgesutra.com/forums/topic/38162-automatic-login-using-curl/