Advertisement
Crecket

Untitled

Aug 2nd, 2015
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.97 KB | None | 0 0
  1. customscript page:
  2.  
  3. at the top of the class add: private $db_connectionSecond = null;
  4. like this:
  5.  
  6. class customList {
  7.  
  8. private $db_connection = null;
  9. private $db_connectionSecond = null;
  10.  
  11. public $auctionmessages = array();
  12.  
  13.  
  14. ======================================
  15.  
  16.  
  17. add this function at line 60 after the first connection function
  18.  
  19. private function databaseConnectionSecond(){ //database connection
  20. if ($this->db_connectionSecond != null) {
  21. return true;
  22. } else {
  23. try {
  24. $this->db_connectionSecond = new PDO('mysql:host='. DB_HOST2 .';dbname='. DB_NAME2 . ';charset=utf8', DB_USER2, DB_PASSWORD2);
  25. if($this->debugging == 1){
  26. $this->db_connectionSecond->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  27. $this->db_connectionSecond->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); //debugging
  28. }
  29. return true;
  30. } catch (PDOException $e) {
  31. $this->auctionmessages[] = $e->getMessage();
  32. }
  33. }
  34. return false;
  35. }
  36.  
  37.  
  38. ========================
  39.  
  40. at line 360
  41. replace checkPaymentParams function with this updated version:
  42.  
  43. public function checkPaymentParams($uid = NULL){
  44. if($uid == NULL){
  45. if(isset($_GET['auctionid'], $_GET['uid'])){
  46. $auctionid = $_GET['auctionid'];
  47. $auctionauthkey = $this->getSettings($auctionid, 'authkey');
  48. if($auctionauthkey != false && $auctionauthkey == $_GET['uid']){
  49. $post_title = $this->getSettings($auctionid, 'gettitle');
  50. $image1 = $this->get_post_meta($auctionid, 'wdm-image-1', true);
  51. $description = $this->getSettings($auctionid, 'getpost2');
  52.  
  53. $getlastbid = $this->db_connection->prepare("SELECT bid, name FROM wp_wdm_bidders WHERE auction_id = :idvar ORDER BY bid DESC");
  54. $getlastbid->bindValue(':idvar', $auctionid, PDO::PARAM_INT);
  55. $getlastbid->execute();
  56. $result = $getlastbid->fetch(PDO::FETCH_ASSOC);
  57. if($getlastbid->rowcount() == 1){
  58. $formdata = array("title" => $post_title
  59. , "auctionid" => $auctionid
  60. , "price" => $result['bid']
  61. , "image" => $image1
  62. , "description" => $description
  63. , "username" => $result['name']);
  64. return $formdata;
  65. }
  66. }
  67. }
  68. if(isset($_POST['auctionid'], $_POST['uid'])){
  69. $auctionid = $_POST['auctionid'];
  70. $auctionauthkey = $this->getSettings($auctionid, 'authkey');
  71. if($auctionauthkey != false && $auctionauthkey == $_POST['uid']){
  72. $getlastbid = $this->db_connection->prepare("SELECT bid, name FROM wp_wdm_bidders WHERE auction_id = :idvar ORDER BY bid DESC");
  73. $getlastbid->bindValue(':idvar', $auctionid, PDO::PARAM_INT);
  74. $getlastbid->execute();
  75. $result = $getlastbid->fetch(PDO::FETCH_ASSOC);
  76. if($getlastbid->rowcount() == 1){
  77. return $result = array("price" => $result['bid'], "name" => $result['name']);
  78. }
  79. }
  80. }
  81. if(isset($_GET['uid'], $_GET['prod'])){
  82. $auctionid = $_GET['prod'];
  83. $auctionauthkey = $this->getSettings($auctionid, 'authkey');
  84. if($auctionauthkey != false && $auctionauthkey == $_GET['uid']){
  85. $getlastbid = $this->db_connection->prepare("SELECT bid, name FROM wp_wdm_bidders WHERE auction_id = :idvar ORDER BY bid DESC");
  86. $getlastbid->bindValue(':idvar', $auctionid, PDO::PARAM_INT);
  87. $getlastbid->execute();
  88. $result = $getlastbid->fetch(PDO::FETCH_ASSOC);
  89. if($getlastbid->rowcount() == 1){
  90. $itemname = $this->getSettings($auctionid, 'gettitle');
  91. return $result = array("price" => $result['bid'], "name" => $result['name'], 'itemname' => $itemname);
  92. }
  93. }
  94. }
  95. }else{
  96. $auctionauthkey = $this->getSettings($uid, 'authkey');
  97. if($auctionauthkey != false){
  98. return "auctionpayment.php?auctionid=".$uid."&uid=".$auctionauthkey;
  99. }
  100. }
  101. return false;
  102. }
  103.  
  104.  
  105.  
  106. ================================
  107.  
  108. on line 128 (the only thing that changes is the word $this->db_connection to $this->db_connectionSecond)
  109. change this:
  110.  
  111. $set_new_donation = $this->db_connection->prepare("INSERT INTO
  112.  
  113. to this:
  114.  
  115. $set_new_donation = $this->db_connectionSecond->prepare("INSERT INTO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement