if ($name == null || $nickname == null || $email == null || $pojusername == null) { echo 'something is null!!! check again!!!'; exit; } if ($uid == null || $uid == '') { $uid = 1024; //add google user } if ($upload == 'update') { $userID = $_SESSION['userid']; } else { if ($upload == 'insert') { if ($uid != 1024) { $tmpResult = get_UserByUid($uid); } else { $tmpResult = get_UserByEmail($email); } if ($tmpResult != null && count($tmpResult) > 0) { echo 'Exist user. Please login directly.'; exit; } } } if ($upload == 'insert') { $userID = add_User($uid, $name, $sex, $nickname, $pojusername, $email, $group); } else { if ($upload == 'update') { update_User($userID, $name, $sex, $nickname, $pojusername, $email, $group); } } if ($userID <= 0) {
header('Location: ' . $openid->authUrl()); } ?> <a href="<?php echo $_SERVER['PHP_SELF'] . "?login"; ?> ">Login with Google</a> <?php } elseif ($openid->mode == 'cancel') { echo 'User has canceled authentication!'; } else { if ($openid->validate()) { $identity = $openid->identity; $attributes = $openid->getAttributes(); $email = $attributes['contact/email']; $user_result = get_UserByEmail($email); if ($user_result != null) { $_SESSION['login'] = 1; $_SESSION['uid'] = $uid; $_SESSION['userid'] = $user_result['id']; $_SESSION['name'] = $user_result['name']; $_SESSION['nickname'] = $user_result['nickname']; $_SESSION['pojname'] = $user_result['POJ_user_name']; $_SESSION['sex'] = $user_result['sex']; $_SESSION['email'] = $user_result['mail']; $_SESSION['week'] = getWeek(); $_SESSION['team'] = $user_result['team']; $_SESSION['photoPath'] = $user_result['photoPath']; header("Location: index.php"); exit; } else {