Advertisement
Crecket

Untitled

Aug 13th, 2015
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.03 KB | None | 0 0
  1.    public function checkPaymentParams($uid = NULL, $debug = false){
  2.         if($uid == NULL){
  3.             if(isset($_GET['auctionid'], $_GET['uid'])){
  4.                 $auctionid = $_GET['auctionid'];
  5.                 $auctionauthkey = $this->getSettings($auctionid, 'authkey');
  6.                 if($auctionauthkey != false && $auctionauthkey == $_GET['uid']){
  7.                     $post_title = $this->getSettings($auctionid, 'gettitle');
  8.                     $image1 = $this->get_post_meta($auctionid, 'wdm-image-1', true);
  9.                     $description = $this->getSettings($auctionid, 'getpost2');
  10.                     $getlastbid = $this->db_connection->prepare("SELECT bid, name FROM wp_wdm_bidders WHERE auction_id = :idvar ORDER BY bid DESC");
  11.                     $getlastbid->bindValue(':idvar', $auctionid, PDO::PARAM_INT);
  12.                     $getlastbid->execute();
  13.                     $result = $getlastbid->fetch(PDO::FETCH_ASSOC);
  14.                     if($getlastbid->rowcount() > 0){
  15.                         $formdata = array("title" => $post_title
  16.                             , "auctionid" => $auctionid
  17.                             , "price" => $result['bid']
  18.                             , "image" => $image1
  19.                             , "description" => $description
  20.                             , "username" => $result['name']);
  21.                         return $formdata;                    
  22.                     }else{
  23.                         if($debug == true): echo "<br>\nNo bids"; exit; endif;
  24.                     }
  25.                 }else{
  26.                     if($debug == true): echo "<br>\nUID wrong"; exit; endif;
  27.                 }
  28.             }else{
  29.                  if($debug == true): echo "<br>\nAucid and uid not set"; endif;
  30.             }
  31.             if(isset($_POST['auctionid'], $_POST['uid'])){
  32.                 $auctionid = $_POST['auctionid'];
  33.                 $auctionauthkey = $this->getSettings($auctionid, 'authkey');
  34.                 if($auctionauthkey != false && $auctionauthkey == $_POST['uid']){
  35.                     $getlastbid = $this->db_connection->prepare("SELECT bid, name FROM wp_wdm_bidders WHERE auction_id = :idvar ORDER BY bid DESC");
  36.                     $getlastbid->bindValue(':idvar', $auctionid, PDO::PARAM_INT);
  37.                     $getlastbid->execute();
  38.                     $result = $getlastbid->fetch(PDO::FETCH_ASSOC);
  39.                     if($getlastbid->rowcount() > 0){
  40.                         return $result = array("price" => $result['bid'], "name" => $result['name']);
  41.                     }else{
  42.                         if($debug == true): echo "<br>\No bids2"; exit; endif;
  43.             }
  44.                 }
  45.             }
  46.             if(isset($_GET['uid'], $_GET['prod'])){
  47.                 $auctionid = $_GET['prod'];
  48.                 $auctionauthkey = $this->getSettings($auctionid, 'authkey');
  49.                 if($auctionauthkey != false && $auctionauthkey == $_GET['uid']){
  50.                     $getlastbid = $this->db_connection->prepare("SELECT bid, name FROM wp_wdm_bidders WHERE auction_id = :idvar ORDER BY bid DESC");
  51.                     $getlastbid->bindValue(':idvar', $auctionid, PDO::PARAM_INT);
  52.                     $getlastbid->execute();
  53.                     $result = $getlastbid->fetch(PDO::FETCH_ASSOC);
  54.                     if($getlastbid->rowcount() > 0){
  55.                         $itemname = $this->getSettings($auctionid, 'gettitle');
  56.                         return $result = array("price" => $result['bid'], "name" => $result['name'], 'itemname' => $itemname);
  57.                     }else{
  58.                         if($debug == true): echo "<br>\No bids3"; exit; endif;
  59.                     }
  60.                 }else{
  61.                     if($debug == true): echo "<br>\nUID wrong3"; exit; endif;
  62.                 }
  63.             }
  64.         }else{
  65.             $auctionauthkey = $this->getSettings($uid, 'authkey');
  66.             if($auctionauthkey != false){
  67.                 return "auctionpayment.php?auctionid=".$uid."&uid=".$auctionauthkey;
  68.             }
  69.         }
  70.         return false;
  71.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement