Link to home
Start Free TrialLog in
Avatar of rajccs
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>

Open in new window

Avatar of Romi Kuntsman
Romi Kuntsman
Flag of Israel image

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
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.
ASKER CERTIFIED SOLUTION
Avatar of dsmile
dsmile
Flag of Viet Nam image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial