You need to sign in to do that
Don't have an account?
AuraDev
Login Script
Hi Guys, I need to write a PHP script and dont want to start from scratch.
What I'm looking for is a script that takes a username and password (that is entered on a form), and checks to see if that user/pass exists in our SalesForce customer database, but also checks a third field which defines whether or not they are a subscriber.
So:
<Connect to salesforce>
<Select Customer where user = x>
If {user doesnt exist -> return to login and show error: user does not exist}
If {user.pass doesnt = y -> return to login and show error: invalid password}
// Check subscription status
If {customer.subscription_status = inactive -> return to login and show error: Subscription Inactive}
else { Set session var for username and log the customer into the website}
Anyone have something like this sitting around?
Thanks,
Chris
What I'm looking for is a script that takes a username and password (that is entered on a form), and checks to see if that user/pass exists in our SalesForce customer database, but also checks a third field which defines whether or not they are a subscriber.
So:
<Connect to salesforce>
<Select Customer where user = x>
If {user doesnt exist -> return to login and show error: user does not exist}
If {user.pass doesnt = y -> return to login and show error: invalid password}
// Check subscription status
If {customer.subscription_status = inactive -> return to login and show error: Subscription Inactive}
else { Set session var for username and log the customer into the website}
Anyone have something like this sitting around?
Thanks,
Chris
require_once ('SforcePartnerClient.php');
require_once ('SforceHeaderOptions.php');
$mySforceConnection = new SforcePartnerClient();
$mySforceConnection->createConnection('path/to/partner.wsdl.xml');
$loginResult = $mySforceConnection->login("username", "password");
$queryResult = $sfdc->query("select Id from contact where email='$user_email' and Password__c='$user_password' ands third_field__c='$somevalue'");
if($queryResult->records[0]->Id[0]){
//logged in!
}
else{
//login failed!
}