<?php
/*
$Header: /cvs/hol/src/user/qryRegister.php,v 1.1.1.1 2005/02/08 08:45:32 hol Exp $
<fusedoc fuse="qryRegister.php">
<responsibilities>
Inserts user registration data in DB
It saves data in the DB setting 'confirmed' flag to FALSE. This flag will be explicitely activated by the user after a proper link is mailed.
</responsibilities>
<properties>
<history author="" date="2003 September 29" email="" type="create" />
<note>
Data Rules: registrationData - (None)
Data Rules: resultSet - (None)
Data Rules: confirmationCode - MD5 hash;
</note>
</properties>
<io>
<in>
<string name="self" optional="false" />
<structure name="registrationData" scope="session" optional="false" comment="User registration data form fields" />
</in>
<out>
<structure name="resultSet" scope="request" optional="true" comment="Generic result set - ADOdb execute returns it implicitely" />
<string name="confirmationCode" scope="request" optional="true" comment="" />
</out>
<passthrough>
</passthrough>
</io>
</fusedoc>
*/
# Select an empty record from the database
$query = "SELECT * FROM ".$GLOBALS['CONFIG']['DBPREFIX']."users WHERE id = -1";
# Execute the query and get the empty recordset
$rs = $conn->Execute($query);
# Initialize an array to hold the record data to insert
$record = $_SESSION['regData'];
# Format date field -- Eg.2003-12-09
$record['birthdate'] = $conn->DBDate($_SESSION['regData']['y_birth'].'-'.$_SESSION['regData']['m_birth'].'-'.$_SESSION['regData']['d_birth']);
# Create registration code
$record['confirmcode'] = md5(serialize($record));
# Pass the empty recordset and the array containing the data to insert
# into the GetInsertSQL function. The function will process the data and return
# a fully formatted insert sql statement.
$query = $conn->GetInsertSQL($rs, $record);
#################
### Query snapshot ###
// die($query);
#################
# Insert the record into the database
if (!$conn->Execute($query))
$fuseFailure = true;
?>