function getListOfUsers() { $conn = mysql_connect("localhost", "cc"); if (!$conn) { die('Could not connect: ' . mysql_error()); } mysql_select_db("paypertweet", $conn); $queryString = ""; // Get list of all current users $queryString = "SELECT * FROM paypertweet.authed_users"; $result = mysql_query($queryString) or die(mysql_error()); while ($array = mysql_fetch_assoc($result)) { $nextUserID = $array['id']; $nextUserScreenName = $array['screen_name']; $nextUserOauthToken = $array['oauth_token']; $nextUserOauthTokenSecret = $array['oauth_token_secret']; $nextUserOauthTokens = getOauthToken($nextUser); $nextUsersFollowRequests = getFollowers($nextUserOauthTokens['oauth_token'], $nextUserOauthTokens['oauth_token_secret']); print "<nextuser>"; print "<id>"; print $nextUserID; print "</id>"; print "<screen_name>"; print $nextUserScreenName; print "</screen_name>"; print "<oauth_token>"; print $nextUserOauthToken; print "</oauth_token>"; print "<oauth_token_secret>"; print $nextUserOauthTokenSecret; print "</oauth_token_secret>"; print "</nextuser>"; // TODO - print this array out properly to show all the follow requests //print($nextUsersFollowRequests."\n"); } if (isset($conn) && is_resource($conn)) { mysql_close($conn); } }
include 'view/favorite.html.php'; exit; } if (isset($_GET['linkKf'])) { include_once $GLOBALS['mypath'] . '/wechat/serveManager.php'; $respon = sendKFMessage($_SESSION['customerId'], '您好' . $_SESSION['userInf']['nickname'] . ',有什么可以帮助你?'); header('location:index.php?rand=' . $_SESSION['rand']); exit; } } //以下功能不需登录,不需判断$_SESSION['customerId'] if (isset($_GET['oauth'])) { include_once $GLOBALS['mypath'] . '/wechat/serveManager.php'; if ($_GET['code']) { // mylog('getCode'); $userId = getOauthToken($_GET['code']); // mylog('getOpenId'.$userId['openid']); $_SESSION['customerId'] = $userId['openid']; $_SESSION['userInf'] = getUnionId($userId['openid']); } else { mylog('cannot get Code'); } $rand = rand(1000, 9999); $_SESSION['rand'] = $rand; header('location:index.php?rand=' . $rand); if (isset($_SESSION['userInf'])) { foreach ($_SESSION['userInf'] as $k => $v) { if ('subscribe_time' == $k) { $v = date('Y-m-d H:i:s', $v); } $data[$k] = addslashes($v);