//create_new_hybridauth_user($link, $email, $firstname, $lastname, $provider, $provider_user_id);
                    $form_register = formRegister($provider, $nickname, $firstname, $lastname, $email, $provider_user_id);
                }
            } else {
                $form_login = formLogin();
            }
        }
        break;
    case "register":
        $form_register = formRegister($provider, $nickname, $firstname, $lastname, $email, $provider_user_id);
        break;
    case "save-register":
        $link = linkDatabase() or die("Connection error!");
        $ok = create_new_user($link, $nickname, $firstname, $lastname, $email, $password);
        if (!$ok) {
            $form_register = formRegister($provider, $nickname, $firstname, $lastname, $email, $provider_user_id);
        } else {
            header("Location: http://www.threescript.com");
        }
        break;
    default:
        $form_login = formLogin();
        break;
}
function linkDatabase_()
{
    $link = mysql_connect("localhost", "user_name", "user_password");
    mysql_select_db('db_name', $link);
    return $link;
}
function formField($field_title, $field_type, $field_id, $field_name, $field_value)
                    $_SESSION["FIRSTNAME"] = $user["firstname"];
                    header("Location: http://www.studddio.com/index.php");
                } else {
                    $firstname = $user_profile->firstName;
                    $last_name = $user_profile->lastName;
                    $provider_user_id = $user_profile->identifier;
                    //create_new_hybridauth_user($link, $email, $firstname, $last_name, $provider, $provider_user_id);
                    $form_register = formRegister($provider, "", $firstname, $last_name, $email, $provider_user_id);
                }
            } else {
                $form_login = formLogin();
            }
        }
        break;
    case "register":
        $form_register = formRegister($provider, $firstname, $last_name, $provider_user_id);
        break;
    case "save-register":
        die("SAVE!");
        break;
}
function linkDatabase_()
{
    $link = mysql_connect("localhost", "user_name", "user_password");
    mysql_select_db('db_name', $link);
    return $link;
}
function formField($field_title, $field_type, $field_id, $field_name, $field_value)
{
    $str = "<div class='pr form-field'>";
    $str .= "<div class='pr fl form-field-label-div'>{$field_title}</div>";