예제 #1
0
파일: register.php 프로젝트: xukmin/aladdin
function register()
{
    if ($_SERVER['REQUEST_METHOD'] != 'POST') {
        return false;
    }
    if (!validateRegistration()) {
        return false;
    }
    $query = composeQuery();
    $connection = connect();
    $result = mysql_query($query, $connection);
    if (!$result) {
        echo "<p class='center'>Registration is failed. Please try again.</p>";
        mysql_close($connection);
        return false;
    }
    $customer_id = mysql_insert_id($connection);
    echo "\n      <p class='center'>\n      Congratulations! You have been registered successfully.\n      </p>";
    showCustomer($connection, $customer_id);
    echo "<h3>Go to <a href='/'>Login Page</a></h3>";
    mysql_close($connection);
    return true;
}
예제 #2
0
/**
	Page that handles the registration process.
	
	@author Joseph Fehrman
*/
include_once "../db/connection.php";
// Collection of post variables
$firstName = $_POST['first_name'];
$lastName = $_POST['last_name'];
$username = $_POST['username'];
$password = $_POST['password'];
$passwordConfirmation = $_POST['re_password'];
$email = $_POST['email'];
// Validation function
$validation = validateRegistration($username, $password, $passwordConfirmation, $email, $conn);
if ($validation == "success") {
    // If content is valid
    processRegistration($firstName, $lastName, $username, $password, $email, $conn);
}
/**
	Function that validates user input on registration page.
	
	@param $user - requested username
	@param $pass - requested password
	@param $repass - password confirmation
	@param $email - requested email
	@param $connection - database connection
*/
function validateRegistration($user, $pass, $rePass, $email, $connection)
{
예제 #3
0
<?php

session_start();
require 'db_connect.php';
// creates mysqli in $conn
require 'paypal.php';
// Provides paypal transaction
require 'validation.php';
// Provides form validation+
require 'sendemail.php';
// Provides Summit email templates
require 'verifyteammate.php';
// Checks doubles partnerships for sending confirmation emails etc
if (isset($_POST['gamertag'])) {
    if (!validateRegistration($conn, $_POST)) {
        // TODO: Registration validation error page
        header('Location: /');
        exit;
    }
    $_SESSION['registration_form'] = $_POST;
    $brackets = (is_null($_POST['melee_singles']) ? 0 : 1) + (is_null($_POST['melee_doubles']) ? 0 : 1) + (is_null($_POST['pm_singles']) ? 0 : 1) + (is_null($_POST['pm_doubles']) ? 0 : 1) + (is_null($_POST['smash4_singles']) ? 0 : 1);
    $_SESSION['credits'] = $brackets;
    $itemCost = 25 + 10 * $brackets;
    $itemName = "Summit Tournament Registration: " . ($brackets > 0 ? $brackets . ($brackets > 1 ? " brackets" : " bracket") : "Spectator");
    $returnurl = 'http://smashsummit.ca/php/register.php?confirm';
    $cancelurl = 'http://smashsummit.ca/?register';
    $paypal_response = BeginTransaction($itemName, $itemCost, $returnurl, $cancelurl);
    // TODO - handle success with errors
    if (strpos($paypal_response['ACK'], 'Success') !== FALSE) {
        $_SESSION['itemName'] = $itemName;
        $_SESSION['itemCost'] = $itemCost;