コード例 #1
0
ファイル: functions.php プロジェクト: elecnix/famesy
function handler_adhesion()
{
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        $vars = array("email", "city", "province", "fingerprint", "phone", "address", "postal_code", "organization_id", "name", "member_type", "first_name", "last_name", "membership_type_id", "password", "password_repeat");
        $member = array();
        foreach ($vars as $v) {
            ${$v} = $_REQUEST[$v];
            $member[$v] = ${$v};
        }
        $errors = array();
        if (!$email) {
            array_push($errors, "Veuillez fournir votre addresse de courrier électronique.");
        } else {
            $existing_member = get_member(null, $email);
            if ($existing_member) {
                array_push($errors, "L'addresse de courrier électronique fournise est déjà utilisée par une autre personne. Veuillez utiliser une addresse différente.");
            }
        }
        if ($member_type == 'individual') {
            if (!$first_name) {
                array_push($errors, "Veuillez fournir votre prénom.");
            }
            if (!$last_name) {
                array_push($errors, "Veuillez fournir votre nom de famille.");
            }
        } elseif ($member_type == 'organization') {
            if (!$name) {
                array_push($errors, "Veuillez fournir le nom de votre organisation.");
            }
        } else {
            array_push($errors, "Invalid member type: '" . $member_type . "'.");
        }
        if (!$password) {
            array_push($errors, "Veuillez entrer un mot de passe.");
        } elseif ($password != $password_repeat) {
            array_push($errors, "Les mots de passe ne sont pas identiques. Veuillez l'entrer à nouveau.");
        }
        if ($member['membership_type_id'] == '') {
            array_push($errors, "Veuillez spécifier le type d'adhésion");
        }
        if (count($errors) == 0) {
            if ($member_type == 'individual') {
                $member = create_individual($member);
            } else {
                $member = create_organization($member);
            }
            $invoice = create_invoice($member);
            send_welcome_email($member, $invoice);
            // TODO: send_notification_email();
            header("Location: ../merci/?m=" . $member['id']);
            return false;
        } else {
            return $errors;
        }
    } else {
        return false;
    }
}
コード例 #2
0
ファイル: index.php プロジェクト: elecnix/famesy
require_once '../membre/functions.php';
// functions for member section only
session_start();
$err = array();
$msg = array();
function login_necessaire($msg)
{
    $_SESSION['flash'] = $msg;
    $_SESSION['after_login'] = $_SERVER['REQUEST_URI'];
    #."?".$_SERVER['QUERY_STRING'];
    header("Location: http://facil.qc.ca/membership/membre/");
    exit;
}
if (!isset($_SESSION['loginID'])) {
    login_necessaire("Votre session a expir�. Veuillez vous identifier.");
} else {
    $member = get_member($_SESSION['loginID']);
    if (!$member) {
        login_necessaire("Veuillez vous identifier.");
    }
    // Create invoice
    $invoice = create_invoice($member);
    if (!$invoice) {
        die("Invoice not found");
    }
    send_welcome_email($member, $invoice);
    // TODO: send_admin_notification_email();
    //header("Location: ../adhesion/merci/?m=".$member['id']);
    $_SESSION['flash'] = "Un avis de renouvellement vous a �t� envoy� par courriel.";
    header("Location: http://facil.qc.ca/membership/membre/");
}
コード例 #3
0
ファイル: step_3.php プロジェクト: hasanmoha/Open-Blog
            mysql_connect($database['hostname'], $database['username'], $database['password']) or die(mysql_error());
            mysql_select_db($database['name']) or die(mysql_error());
            // create tables
            create_tables($database['prefix']);
            insert_blog_data($database['prefix'], $blog['title'], $blog['description'], $blog['admin_email'], $blog['meta_keywords'], $blog['allow_registrations'], $blog['posts_per_site'], $blog['links_per_box'], $blog['months_per_archive']);
            if (empty($administrator['display_name'])) {
                insert_admin_data($database['prefix'], $administrator['username'], $administrator['password'], $administrator['email']);
            } else {
                insert_admin_data($database['prefix'], $administrator['username'], $administrator['password'], $administrator['email'], $administrator['display_name']);
            }
            mysql_close();
            // write main config file
            if ($blog['enable_seo_urls'] == TRUE) {
                write_main_config($blog['url'], TRUE);
            } else {
                write_main_config($blog['url'], FALSE);
                // delete the .htaccess file
                unlink('../.htaccess');
            }
            // write database config file
            write_database_config($database['hostname'], $database['username'], $database['password'], $database['name'], $database['prefix']);
            // send welcome email
            send_welcome_email($administrator['email'], $blog['url'], $administrator['username'], $administrator['password']);
            echo 'Open Blog has been successfully installed.<br /><br />
			Before you can start using your blog, you must delete the <strong>install/</strong> directory.<br /><br />
			When you are done, go to your <a href="' . $blog['url'] . '" target="_blank">blog home page</a>.';
        }
    }
} else {
    header("Location: index.php");
}