当前位置: 首页>>代码示例>>PHP>>正文


PHP CSRF::getTokenForm方法代码示例

本文整理汇总了PHP中CSRF::getTokenForm方法的典型用法代码示例。如果您正苦于以下问题:PHP CSRF::getTokenForm方法的具体用法?PHP CSRF::getTokenForm怎么用?PHP CSRF::getTokenForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSRF的用法示例。


在下文中一共展示了CSRF::getTokenForm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Display

 public function Display()
 {
     global $config, $lpaths;
     // render header/footer
     $this->outputs['header'] = RenderHTML::LoadHTML('header.php');
     $this->outputs['footer'] = RenderHTML::LoadHTML('footer.php');
     $this->outputs['header'] = str_replace('{AddToHeader}', $this->tempHeader, $this->outputs['header']);
     // insert css
     $this->outputs['css'] = trim($this->outputs['css']);
     if (!empty($this->outputs['css'])) {
         $this->outputs['css'] = "\n" . $this->outputs['css'] . "\n";
     }
     $this->outputs['header'] = str_replace('{css}', $this->outputs['css'], $this->outputs['header']);
     // common tags
     $this->tags['site title'] = $config['site title'];
     $this->tags['page title'] = $config['title'];
     $this->tags['lastpage'] = getLastPage();
     $this->tags['sitepage title'] = $config['site title'] . (empty($config['title']) ? '' : ' - ' . $config['title']);
     $this->tags['token'] = CSRF::getTokenURL();
     $this->tags['token form'] = CSRF::getTokenForm();
     // finish rendering page
     $output = $this->outputs['header'] . "\n" . $this->outputs['body'] . "\n" . $this->outputs['footer'] . "\n";
     RenderHTML::RenderTags($output, $this->tags);
     echo $output;
     unset($output, $this->outputs);
 }
开发者ID:Furt,项目名称:WebAuctionPlus,代码行数:26,代码来源:html.class.php

示例2: RenderPage_auctions_ajax

function RenderPage_auctions_ajax()
{
    global $config, $html;
    //file_put_contents('ajax_get.txt',print_r($_GET,TRUE));
    header('Content-Type: text/plain');
    // list auctions
    $auctions = QueryAuctions::QueryCurrent();
    $TotalDisplaying = QueryAuctions::TotalDisplaying();
    $TotalAllRows = QueryAuctions::TotalAllRows();
    $outputRows = "{\n" . "\t" . '"iTotalDisplayRecords" : ' . $TotalDisplaying . ",\n" . "\t" . '"iTotalRecords" : ' . $TotalAllRows . ",\n" . "\t" . '"sEcho" : ' . (int) getVar('sEcho', 'int') . ",\n" . "\t" . '"aaData" : [' . "\n";
    if ($TotalDisplaying < 1) {
        unset($auctions);
    } else {
        $outputRows .= "\t{\n";
        $count = 0;
        while (TRUE) {
            $auction = $auctions->getNext();
            if (!$auction) {
                break;
            }
            $Item = $auction->getItem();
            if (!$Item) {
                continue;
            }
            if ($count != 0) {
                $outputRows .= "\t},\n\t{\n";
            }
            $count++;
            $data = array('item' => $Item->getDisplay(), 'seller' => '<img src="./?page=mcskin&user=' . $auction->getSeller() . '" width="32" height="32" alt="" /><br />' . $auction->getSeller(), 'price each' => FormatPrice($auction->getPrice()), 'price total' => FormatPrice($auction->getPriceTotal()), 'market percent' => '--', 'qty' => (int) $Item->getItemQty());
            // buy button
            if ($config['user']->hasPerms('canBuy')) {
                $data['canBuy'] = '
          <form action="./" method="post">
          ' . CSRF::getTokenForm() . '
          <input type="hidden" name="page"      value="' . $config['page'] . '" />
          <input type="hidden" name="action"    value="buy" />
          <input type="hidden" name="auctionid" value="' . (int) $auction->getTableRowId() . '" />
          <input type="text" name="qty" value="' . (int) $data['qty'] . '" onkeypress="return numbersonly(this, event);" ' . 'class="input" style="width: 60px; margin-bottom: 5px; text-align: center;" /><br />
          <input type="submit" value="Buy" class="button" />
          </form>
';
            }
            // cancel button
            if ($config['user']->hasPerms('isAdmin')) {
                $data['isAdmin'] = '
          <form action="./" method="post">
          ' . CSRF::getTokenForm() . '
          <input type="hidden" name="page"      value="' . $config['page'] . '" />
          <input type="hidden" name="action"    value="cancel" />
          <input type="hidden" name="auctionid" value="' . (int) $auction->getTableRowId() . '" />
          <input type="submit" value="Cancel" class="button" />
          </form>
';
            }
            // sanitize
            $data = str_replace(array('/', '"', "\r", "\n"), array('\\/', '\\"', '', '\\n'), $data);
            $rowClass = 'gradeU';
            //TODO:
            //gradeA
            //gradeC
            //gradeX
            //gradeU
            $outputRows .= "\t\t" . '"DT_RowClass":"' . $rowClass . '",' . "\n";
            $i = -1;
            foreach ($data as $v) {
                $i++;
                if ($i != 0) {
                    $outputRows .= ",\n";
                }
                $outputRows .= "\t\t" . '"' . $i . '":"' . $v . '"';
            }
            $outputRows .= "\n";
        }
        unset($auctions, $Item);
        $outputRows .= "\t}\n";
    }
    $outputRows .= ']}' . "\n";
    //file_put_contents('ajax_output.txt',$outputRows);
    echo $outputRows;
    exit;
}
开发者ID:Furt,项目名称:WebAuctionPlus,代码行数:81,代码来源:auctions.php

示例3: RenderPage_servershops_ajax

function RenderPage_servershops_ajax()
{
    global $config, $html;
    //file_put_contents('ajax_get.txt',print_r($_GET,TRUE));
    header('Content-Type: text/plain');
    // list server shops
    $shops = QueryAuctions::QueryShops();
    $TotalDisplaying = QueryAuctions::TotalDisplaying();
    $TotalAllRows = QueryAuctions::TotalAllRows();
    $outputRows = "{\n" . "\t" . '"iTotalDisplayRecords" : ' . $TotalDisplaying . ",\n" . "\t" . '"iTotalRecords" : ' . $TotalAllRows . ",\n" . "\t" . '"sEcho" : ' . (int) getVar('sEcho', 'int') . ",\n" . "\t" . '"aaData" : [' . "\n";
    if ($TotalDisplaying < 1) {
        unset($shops);
    } else {
        $outputRows .= "\t{\n";
        $count = 0;
        while (TRUE) {
            $shop = $shops->getNext();
            if (!$shop) {
                break;
            }
            $Item = $shop->getItem();
            if (!$Item) {
                continue;
            }
            if ($count != 0) {
                $outputRows .= "\t},\n\t{\n";
            }
            $count++;
            $qty = $Item->getItemQty();
            if ($qty == 0) {
                $qty = 'Unlimited';
            }
            $buyAvailable = $shop->getPriceBuy() > 0.0;
            $sellAvailable = $shop->getPriceSell() > 0.0;
            $data = array('item' => $Item->getDisplay(), 'buy price' => $buyAvailable ? FormatPrice($shop->getPriceBuy()) : '---', 'sell price' => $sellAvailable ? FormatPrice($shop->getPriceSell()) : '---', 'qty' => $qty, 'buy/sell' => '');
            // buy/sell button
            if ($config['user']->hasPerms('canBuy') || $config['user']->hasPerms('canSell')) {
                $data['buy/sell'] = '
<form action="./" method="post">
' . CSRF::getTokenForm() . '
<input type="hidden" name="page"      value="' . $config['page'] . '" />
<input type="hidden" name="shopid" value="' . (int) $shop->getTableRowId() . '" />
<input type="text" name="qty" value="' . ($qty < 64 && $qty != 0 ? (int) $qty : 1) . '" onkeypress="return numbersonly(this, event);" ' . 'class="input" style="width: 60px; margin-bottom: 5px; text-align: center;" /><br />' . "\n" . ($config['user']->hasPerms('canBuy') && $buyAvailable ? '<input type="submit" name="action" value="Buy"  class="button" />' . "\n" : '') . ($config['user']->hasPerms('canSell') && $sellAvailable ? '<input type="submit" name="action" value="Sell" class="button" />' . "\n" : '') . '
</form>
';
            }
            // cancel button
            if ($config['user']->hasPerms('isAdmin')) {
                $data['isAdmin'] = '
<form action="./" method="post">
' . CSRF::getTokenForm() . '
<input type="hidden" name="page"      value="' . $config['page'] . '" />
<input type="hidden" name="action"    value="cancel" />
<input type="hidden" name="shopid" value="' . (int) $shop->getTableRowId() . '" />
<input type="submit" value="Cancel" class="button" />
</form>
';
            }
            // sanitize
            $data = str_replace(array('/', '"', "\r", "\n"), array('\\/', '\\"', '', '\\n'), $data);
            $rowClass = 'gradeU';
            $outputRows .= "\t\t" . '"DT_RowClass":"' . $rowClass . '",' . "\n";
            $i = -1;
            foreach ($data as $v) {
                $i++;
                if ($i != 0) {
                    $outputRows .= ",\n";
                }
                $outputRows .= "\t\t" . '"' . $i . '":"' . $v . '"';
            }
            $outputRows .= "\n";
        }
        unset($shops, $Item);
        $outputRows .= "\t}\n";
    }
    $outputRows .= ']}' . "\n";
    //file_put_contents('ajax_output.txt',$outputRows);
    echo $outputRows;
    exit;
}
开发者ID:GRANTSWIM4,项目名称:WebAuctionPlus-1.2,代码行数:80,代码来源:servershops.php


注:本文中的CSRF::getTokenForm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。