for a detailed description, copyright and license information. */ /* Section: Files - - - */ /* @package xajax @version $Id: signup.server.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2006 by Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ require_once ("signup.common.php"); function processForm($aFormValues) { if (array_key_exists("username",$aFormValues)) { return processAccountData($aFormValues); } else if (array_key_exists("firstName",$aFormValues)) { return processPersonalData($aFormValues); } } function processAccountData($aFormValues) { $objResponse = new xajaxResponse(); $bError = false; if (trim($aFormValues['username']) == "") { $objResponse->alert("Please enter a username."); $bError = true; } if (trim($aFormValues['newPass1']) == "") { $objResponse->alert("You may not have a blank password."); $bError = true; } if ($aFormValues['newPass1'] != $aFormValues['newPass2']) { $objResponse->alert("Passwords do not match. Try again."); $bError = true; } if (!$bError) { $_SESSION = array(); $_SESSION['newaccount']['username'] = trim($aFormValues['username']); $_SESSION['newaccount']['password'] = trim($aFormValues['newPass1']); $sForm = "
"; $sForm .="
First Name:
"; $sForm .="
Last Name:
"; $sForm .="
Email:
"; $sForm .="
"; $sForm .="
"; $objResponse->assign("formDiv","innerHTML",$sForm); $objResponse->assign("formWrapper","style.backgroundColor", "rgb(67,149,97)"); $objResponse->assign("outputDiv","innerHTML","\$_SESSION:
".var_export($_SESSION,true)."
"); } else { $objResponse->assign("submitButton","value","continue ->"); $objResponse->assign("submitButton","disabled",false); } return $objResponse; } function processPersonalData($aFormValues) { $objResponse = new xajaxResponse(); $bError = false; if (trim($aFormValues['firstName']) == "") { $objResponse->alert("Please enter your first name."); $bError = true; } if (trim($aFormValues['lastName']) == "") { $objResponse->alert("Please enter your last name."); $bError = true; } if (!eregi("^[a-zA-Z0-9]+[_a-zA-Z0-9-]*(\.[_a-z0-9-]+)*@[a-z??????0-9]+(-[a-z??????0-9]+)*(\.[a-z??????0-9-]+)*(\.[a-z]{2,4})$", $aFormValues['email'])) { $objResponse->alert("Please enter a valid email address."); $bError = true; } if (!$bError) { $_SESSION['newaccount']['firstname'] = $aFormValues['firstName']; $_SESSION['newaccount']['lastname'] = $aFormValues['lastName']; $_SESSION['newaccount']['email'] = $aFormValues['email']; $objResponse->assign("formDiv","style.textAlign","center"); $sForm = "Account created.
Thank you."; $objResponse->assign("formDiv","innerHTML",$sForm); $objResponse->assign("formWrapper","style.backgroundColor", "rgb(67,97,149)"); $objResponse->assign("outputDiv","innerHTML","\$_SESSION:
".var_export($_SESSION,true)."
"); } else { $objResponse->assign("submitButton","value","done"); $objResponse->assign("submitButton","disabled",false); } return $objResponse; } $xajax->processRequest(); ?>