本文整理汇总了PHP中getToken函数的典型用法代码示例。如果您正苦于以下问题:PHP getToken函数的具体用法?PHP getToken怎么用?PHP getToken使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getToken函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GamePage
function GamePage()
{
global $base_uri;
$uid = params('user');
if (!isset($_SESSION['uid'])) {
return 0;
} else {
createToken($_SESSION['uid']);
}
$reg = 0;
$shit = 0;
if (!isset($uid) || $uid == "") {
$uid = $_SESSION['uid'];
} else {
if (!check_registration($uid)) {
$reg = 1;
}
$shit = 1;
}
$user = getUserInfo($_SESSION['access_token'], $uid, 'photo_max');
if ($reg) {
register($uid, $user['first_name'], $user['last_name']);
}
echo $user['first_name'] . " " . $user['last_name'];
echo "<img src=\"" . $user['photo_max'] . "\" /><br><br>";
if ($shit) {
echo "<a href=\"/shit/" . $_SESSION['uid'] . "/" . $uid . "/" . getToken($_SESSION['uid']) . "\">shit</a><br>";
}
$friends = getUserFriends($_SESSION['access_token'], $uid);
foreach ($friends as $friend) {
echo $friend["first_name"] . " " . $friend["last_name"] . "<br>";
echo "<a href=\"{$base_uri}/game/" . $friend['uid'] . "\"><img src=\"" . $friend["photo_50"] . "\" /></a><hr>";
}
}
示例2: testAddTorrentRequest
public function testAddTorrentRequest()
{
$request = new AddTorrentRequest(new Token(getToken()), 'C:/fakepath');
$this->assertEquals(RequestType::PUT, $request->getRequestType());
$this->assertEquals('torrents/addTorrent', $request->getUri());
$this->assertEquals('C:/fakepath', $request->getFilePath());
}
示例3: getProducts
function getProducts($conn)
{
$token = getToken();
$sql = 'SELECT p.name, p.price, p.image, p.description, p.address, op.id FROM users u LEFT JOIN orders o ON u.id = o.users_id AND o.status = "new" LEFT JOIN orders_products op ON o.id = op.orders_id LEFT JOIN products p ON op.products_id = p.id WHERE u.token = ?';
$stmt = $conn->prepare($sql);
if ($stmt->execute(array($token))) {
while ($row = $stmt->fetch()) {
if ($counter == 3) {
$counter = 0;
$products .= '<tr>';
}
$products .= '
<td><img src="' . $row['image'] . '" height="300px" width="300px">
<p>' . $row['name'] . '</p>
<p>' . $row['description'] . '</p>
<p>' . $row['address'] . '</p>
<p>$' . $row['price'] . '</p>
<form method="post" action="shoppingCart.php">
<input type="hidden" name="id" value="' . $row['id'] . '"/>
<input type="submit" name="delete" value="DELETE"/>
</form></td>
';
$counter++;
if ($counter == 3) {
$products .= '</tr>';
}
}
echo $products;
}
}
示例4: createAndSend
/**
* Creates an embedded signing experience.
*/
function createAndSend()
{
global $_oneSigner;
$status = "";
// Construct basic envelope
$env = new Envelope();
$env->Subject = "DocuSign API SDK Sample";
$env->EmailBlurb = "This envelope demonstrates embedded signing";
$env->AccountId = $_SESSION["AccountID"];
$env->Recipients = constructRecipients($_oneSigner);
$doc = new Document();
$doc->PDFBytes = file_get_contents("resources/Docusign_Demo_11.pdf");
$doc->Name = "Demo Document";
$doc->ID = "1";
$doc->FileExtension = "pdf";
$env->Documents = array($doc);
$env->Tabs = addTabs(count($env->Recipients));
$api = getAPI();
try {
$csParams = new CreateAndSendEnvelope();
$csParams->Envelope = $env;
$status = $api->CreateAndSendEnvelope($csParams)->CreateAndSendEnvelopeResult;
addEnvelopeID($status->EnvelopeID);
getToken($status, 1);
} catch (SoapFault $e) {
$_SESSION["errorMessage"] = $e;
header("Location: error.php");
}
}
示例5: testContainerLinkRequest
function testContainerLinkRequest()
{
$request = new ContainerLinkRequest(new Token(getToken()), 'https://hoster.com/ABCDEFG');
$this->assertEquals(RequestType::POST, $request->getRequestType());
$this->assertEquals('unrestrict/containerLink', $request->getUri());
$this->assertEquals('https://hoster.com/ABCDEFG', $request->getBody()->get('link'));
}
示例6: saveCache
function saveCache($appid, $appsecrect)
{
$gettime = time();
$GLOBALS["atoken"] = getToken($appid, $appsecrect);
$GLOBALS["aticket"] = getTicket($GLOBALS["atoken"]);
if ($GLOBALS["aticket"] == -1) {
$GLOBALS["atoken"] = getToken($appid, $appsecrect);
$GLOBALS["aticket"] = getTicket($GLOBALS["atoken"]);
}
if ($GLOBALS["aticket"] == -1) {
$GLOBALS["atoken"] = getToken($appid, $appsecrect);
$GLOBALS["aticket"] = getTicket($GLOBALS["atoken"]);
}
$arr = array("token" => $GLOBALS["atoken"], "ticket" => $GLOBALS["aticket"], "time" => $gettime);
$ss = serialize($arr);
$fp = fopen($GLOBALS["file"], "w");
fputs($fp, $ss);
fclose($fp);
$logf = file_get_contents($GLOBALS["file"] . "log");
$logf .= "\n";
$logf .= json_encode($arr);
$fp = fopen($GLOBALS["file"] . "log", "w");
fputs($fp, $logf);
fclose($fp);
}
示例7: getProducts
function getProducts($conn)
{
$token = getToken();
$sql = 'SELECT p.name, p.price, p.preview, op.id FROM users u LEFT JOIN orders o ON u.id = o.users_id AND o.status = "new" LEFT JOIN orders_products op ON o.id = op.orders_id LEFT JOIN products p ON op.products_id = p.id WHERE u.token = ?';
$stmt = $conn->prepare($sql);
if ($stmt->execute(array($token))) {
while ($row = $stmt->fetch()) {
if ($row['id'] != null) {
echo '<div>
<div class="col-sm-4 col-lg-4 col-md-4" >
<div class="thumbnail" style="height:550px;" >
<img src="' . $row["preview"] . '">
Name: ' . $row['name'] . '<br>
Price: $' . $row['price'] . '<br>
<form method="post" action="cart.php">
<input type="hidden" name="id" value="' . $row['id'] . '"/>
<input type="submit" name="delete" value="DELETE"/> Delete
</form>
</div></div>
</div>';
}
}
}
}
示例8: testContainerFileRequest
function testContainerFileRequest()
{
$request = new ContainerFileRequest(new Token(getToken()), 'C:/fakepath/container.rsdf');
$this->assertEquals(RequestType::PUT, $request->getRequestType());
$this->assertEquals('unrestrict/containerFile', $request->getUri());
$this->assertEquals('C:/fakepath/container.rsdf', $request->getFilePath());
}
示例9: testOffset
public function testOffset()
{
$request = new DownloadsRequest(new Token(getToken()), null, 50, 5);
$this->assertEquals(RequestType::GET, $request->getRequestType());
$this->assertEquals('downloads', $request->getUri());
$this->assertEquals('downloads?limit=50&offset=5', $request->getUrl());
}
示例10: testOffset
public function testOffset()
{
$request = new TorrentsRequest(new Token(getToken()), false, null, 50, 5);
$this->assertEquals(RequestType::GET, $request->getRequestType());
$this->assertEquals('torrents', $request->getUri());
$this->assertEquals('torrents?limit=50&offset=5', $request->getUrl());
}
示例11: testDeleteRequest
public function testDeleteRequest()
{
$request = new DeleteRequest(new Token(getToken()), 'TORRENT_ID');
$this->assertEquals(RequestType::DELETE, $request->getRequestType());
$this->assertEquals('TORRENT_ID', $request->getId());
$this->assertEquals('torrents/delete/:id', $request->getUri());
$this->assertEquals('torrents/delete/TORRENT_ID', $request->getUrl());
}
示例12: testOffset
public function testOffset()
{
$request = new TopicsRequest(new Token(getToken()), 4, true, null, 50, 5);
$this->assertEquals(RequestType::GET, $request->getRequestType());
$this->assertEquals(4, $request->getId());
$this->assertEquals('forum/:id', $request->getUri());
$this->assertEquals('forum/4?meta=1&limit=50&offset=5', $request->getUrl());
}
示例13: testDeleteRequest
public function testDeleteRequest()
{
$request = new DeleteRequest(new Token(getToken()), 1);
$this->assertEquals(RequestType::DELETE, $request->getRequestType());
$this->assertEquals(1, $request->getId());
$this->assertEquals('downloads/delete/:id', $request->getUri());
$this->assertEquals('downloads/delete/1', $request->getUrl());
}
示例14: createNewOrder
function createNewOrder($conn)
{
$token = getToken();
$sql = 'INSERT INTO orders (users_id, status) (SELECT u.id, "new" FROM users u WHERE u.token = ?)';
$stmt = $conn->prepare($sql);
if ($stmt->execute(array($token))) {
}
}
示例15: testInfoRequest
public function testInfoRequest()
{
$request = new InfoRequest(new Token(getToken()), 'TORRENT_ID');
$this->assertEquals(RequestType::GET, $request->getRequestType());
$this->assertEquals('TORRENT_ID', $request->getId());
$this->assertEquals('torrents/info/:id', $request->getUri());
$this->assertEquals('torrents/info/TORRENT_ID', $request->getUrl());
}