$therapist_directory = new therapist_directory();
if ($therapist_directory->isPaidTherapist($_SESSION['userid'])) {
header('Location:home.php?msg='.urlencode('You are already registered as a Paid Therapist'));
$checks="home.php?msg=".urlencode('You are already registered as a Paid Therapist');
echo ("");
exit();
} elseif ($therapist_directory->isRegisteredTherapist($_SESSION['userid'])) {
echo ("");
//header('Location:therapist_editdetails.php');
exit();
}
$DataOk = '0';
$registered = false;
if ($_GET['mode']=='auto_register') {
// will register the Therapist using the details recently filled in on signup form
}
if ( isset($_POST['register']))
{
if ( strlen ($_POST['name'] ) == 0 )
{
$DataOk = '1';
$nameMissing = true;
}
if (!strlen(trim($_POST['company']))) {
$DataOk = '1';
$companyMissing = true;
}
if (!is_numeric($_POST['categoryID'])) {
$DataOk = '1';
$categoryMissing = true;
}
if ( strlen (trim($_POST['email']) ) == 0 )
{
$emailMissing = true;
$DataOk = '1';
}
else {
if ( strlen ($_POST['email'] ) < 5 )
{
$DataOk = '1';
$emailToShort = true;
}
else
{
if ( !strpos ($_POST['email'],'@') )
{
$DataOk = '1';
$emailWrongFormat = true;
}
if ( !strpos ($_POST['email'],'.') )
{
$DataOk = '1';
$emailWrongFormat = true;
}
}
$sql = "SELECT * FROM therapist_directory WHERE email='".$_POST['email']."'";
$query= mysqli_query($conn,$sql);
if ( mysqli_num_rows($query) > 0 )
{
$emailNotUnique = true;
$DataOk = '1';
}
}
if ( strlen ($_POST['address_1'] ) == 0 )
{
$DataOk = '1';
$line1Missing = true;
}
if ( $_POST['country'] == '0' ){
$DataOk = '1';
$countryMissing=true;
} elseif (($_POST['country']>0) && ($_POST['country']<=6)) { // for initial 6 countries
if ( strlen ($_POST['state'] ) == 0 )
{
$DataOk = '1';
$countyMissing = true;
} elseif (strlen ($_POST['city'] ) == 0 )
{
$DataOk = '1';
$townMissing = true;
}
} else { // for rest of the countries
if (!strlen(trim($_POST['state_other']))) {
$DataOk = '1';
$countyMissing=true;
} elseif (strlen ($_POST['city'] ) == 0) {
$DataOk = '1';
$townMissing = true;
}
}
if ( strlen ($_POST['postcode'] ) == 0 )
{
$DataOk = '1';
$postcodeMissing = true;
}
} else {
$sql = "SELECT * from user where id='".$_SESSION['userid']."' LIMIT 1";
$query = mysqli_query($conn,$sql);
$result = mysqli_fetch_array($query);
}
if ( $DataOk == '0' && isset($_POST['register'])) {
$therapist_directory->addTherapist($_POST);
$registered = true;
}
?>
include ('includes/quicklogin.php');
?>
| include('includes/bottom.php');?>
|