//create session
session_start();
//extract $_POST
extract ($_POST);
//connect to database______________________________________________________________________
require ("*****");
$dbh = mysql_connect (*****) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db (*****);
//check if user exists and grab all info for customer
$exist = "true";
$sqlCustomer = "SELECT * FROM Customer WHERE username=\"$username\" AND password=\"$password\"";
if($temp1 = mysql_query($sqlCustomer, $dbh))
{
//user exists--
list($_SESSION['clientID'],$_SESSION['companyID'],$_SESSION['first'],$_SESSION['middle'],$_SESSION['last'],$_SESSION['title'],$_SESSION['mobile'],$_SESSION['email'],$_SESSION['photo'],$_SESSION['personal'],$_SESSION['program'],$_SESSION['username'],$_SESSION['password'],$_SESSION['product'],$_SESSION['version'],$_SESSION['trialLength'],$_SESSION['expiryDate'],$_SESSION['subDirectory'],$_SESSION['primary']) = mysql_fetch_row($temp1);
if($primary==1)
{
//grab all info for company
$sqlCompany = "SELECT * FROM Company WHERE companyID=\"$companyID\"";
if($temp = mysql_query($sqlCompany, $dbh))
{
list($_SESSION['companyID'],$_SESSION['companyName'],$_SESSION['address1'],$_SESSION['address2'],$_SESSION['city'],$_SESSION['province'],$_SESSION['country'],$_SESSION['postalCode'],$_SESSION['telephone'],$_SESSION['tollFree'],$_SESSION['fax'],$_SESSION['website1'],$_SESSION['website2'],$_SESSION['link1'],$_SESSION['link2'],$_SESSION['users'],$_SESSION['logo1'],$_SESSION['logo2'],$_SESSION['image1'],$_SESSION['image2'],$_SESSION['details'],$_SESSION['enabledFields'],$_SESSION['payment']) = mysql_fetch_row($temp);
}
}
}
else
{
//user does not exist--
$exist = "false";
}