i am using same toolkit code of sample folder -> login.php
PHP Code:
require_once ('../soapclient/SforcePartnerClient.php');
include ('header.inc');
$errors = null;
session_start();
function login($username, $password) {
$wsdl = 'partner.wsdl.xml';
$loginResult = null;
try {
$mySforceConnection = new SforcePartnerClient();
$mySforceConnection->createConnection($wsdl);
$loginResult = $mySforceConnection->login($username, $password);
$_SESSION['location'] = $mySforceConnection->getLocation();
$_SESSION['sessionId'] = $mySforceConnection->getSessionId();
$_SESSION['wsdl'] = $wsdl;
} catch (Exception $e) {
echo $mySforceConnection->getLastRequest();
echo $mySforceConnection->getLastRequestHeaders();
global $errors;
$errors = $e->faultstring;
}
return $loginResult;
}
/**
* Checks to see if the user has submitted his
* username and password through the login form,
*/
if (isset ($_POST['loginClick'])) {
/* Check that all fields were typed in */
if (!$_POST['user'] || !$_POST['pass']) {
global $errors;
$errors = ('Please fill in both username and password.');
} else {
/* Spruce up username, check length */
$_POST['user'] = trim($_POST['user']);
try {
/* Checks that username and password are correct */
$result = login($_POST['user'], $_POST['pass']);
if (isset($result)) {
session_write_close();
header('Location: welcome.php');
exit();
}
} catch (Exception $e) {
print_r($e);
}
}
}
?>
<br><br>
<div style="font-family: verdana; font-size: 14px; font-weight: bold; color: rgb(102, 102, 102);">Login</div><br>
<div style="color: rgb(102, 102, 102);">
If you are already a member of the AppExchange developer community, please login.
</div><br>
<?php
global $errors;
if (isset($errors)) {
echo '<p><span style=\"color:#FF0000\">$errors</span></p>';
}
?>
<form action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td><strong>User Name:</strong></td><td><input type="text" name="user" maxlength="30"></td></tr>
<tr><td><strong>Password:</strong></td><td><input type="password" name="pass" maxlength="30"></td></tr>
<tr>
<td colspan="2" align="right">
<input type="submit" name="loginClick" value="Login">
</td>
</tr>
</table>
</form>
<?php
include ('footer.inc');
?>
when i am login with developer salesforce account details
Thank you
mubbu
Bookmarks