/*Login using the credentials passed in returns userId if successful, -0- otherwise*/ $rc = goUserSettings::login($userName, $password); if ($rc == 0) { header("Location:" . $_SERVER['PHP_SELF'] . "?errormessage=" . urlencode("Invalid user name or password")); exit; } $userSettings = new goUserSettings(); $rc = $userSettings->getUserSettings($userName, 'Yes'); /* TODO - add code to determine if the retrieval failed due to error or because the userid or username not defined. For now assume error */ if (!rc) { // Server error mydie("Error connecting to Database"); } $userID = $userSettings->getuserID(); setcookie('userid', $userID); setcookie('username', $userSettings->getUserName()); header("Location: " . Config::getRootDomain()); } else { if ($operation == "register") { // make sure we have the minimum necessary populated fields if (empty($newUserName) || empty($newPassword)) { } /* first take care of inserting new user into go_user table */ $rc = insertNewUser($params); if (!$rc) { header("Location:" . $_SERVER['PHP_SELF'] . "?errormessage=" . urlencode("User name {$userName} not available")); exit; } // if //the insert succeeded and the return is the newUserID $newUserID = $rc;
require_once 'go_usersettings.class.php'; /* Author:Julio Hernandez-Miyares date: May 11,2010 Purpose: view user's profile (go_user/go_userSettings) TODO - enable security to only allow editing by the authenticated user */ include 'gohtmlhead.php'; include 'goheader.php'; $userID = $_REQUEST['userid']; $operation = strtolower($_REQUEST['bsupdateuser']); /* updating user profile */ if ($operation == 'update') { } if (!empty($userID)) { $userSettings = new goUserSettings($userID); $userName = $userSettings->getUserName(); } else { header("location: " . Config::getErrorPage() . "/" . "user_not_found"); exit; } echo '<form name="input" action="' . $_SERVER['PHP_SELF'] . '" method="POST">'; echo '<div id="personal">'; echo "<h2>User {$userName} - you have ID of {$userID}</h2>"; echo 'First Name: <input type="textbox" name="bsfirstname" value="' . $userSettings->getFirstName() . '" />'; echo 'Last Name: <input type="textbox" name="bslastname" value="' . $userSettings->getLastName() . '" />'; echo 'Email: <input type="textbox" name="bsemail" value="' . $userSettings->getEmail() . '" />'; echo '<input type="submit" name="bsupdateuser" value="Update" />'; echo "</div></br>"; echo "</form>"; echo '<div id="socialnetwork">'; echo "<h3>Facebook:";
if (empty($expirationDateTime)) { $expirationDateTime = $subscriptionClose; } } //if if (empty($teamID)) { //get TeamID by teamName $teamID = Utility::getTeamIDbyTeamName($teamName); } } else { $publicGameID = 0; } $title = !empty($title) ? $title : $eventName; $userSettings = new goUserSettings($createdByUserID); //grab user who created this wager - will need properties for syndication including oauth credentials $createdByUserName = $userSettings->getUserName(); /* general verification have enough to continue - set defaults for missing parameters as long as they are not */ $message = null; if (!isset($createdByUserName, $createdByUserID, $title, $wagerType, $type, $typeName)) { $message .= empty($createdByUserName) ? " createdByUser" : null; $message .= !isset($createdByUserID) ? " createdByUserID" : null; $message .= !isset($title) ? " title" : null; $message .= !isset($wagerType) ? " wagerType" : null; $message .= !isset($type) ? " Type" : null; $message .= !isset($typeName) ? " TypeName" : null; } if ($typeName == 'Team' && !isset($teamID)) { $message .= " TeamID"; } if (!empty($message)) {