Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- customscript page:
- at the top of the class add: private $db_connectionSecond = null;
- like this:
- class customList {
- private $db_connection = null;
- private $db_connectionSecond = null;
- public $auctionmessages = array();
- ======================================
- add this function at line 60 after the first connection function
- private function databaseConnectionSecond(){ //database connection
- if ($this->db_connectionSecond != null) {
- return true;
- } else {
- try {
- $this->db_connectionSecond = new PDO('mysql:host='. DB_HOST2 .';dbname='. DB_NAME2 . ';charset=utf8', DB_USER2, DB_PASSWORD2);
- if($this->debugging == 1){
- $this->db_connectionSecond->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $this->db_connectionSecond->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); //debugging
- }
- return true;
- } catch (PDOException $e) {
- $this->auctionmessages[] = $e->getMessage();
- }
- }
- return false;
- }
- ========================
- at line 360
- replace checkPaymentParams function with this updated version:
- public function checkPaymentParams($uid = NULL){
- if($uid == NULL){
- if(isset($_GET['auctionid'], $_GET['uid'])){
- $auctionid = $_GET['auctionid'];
- $auctionauthkey = $this->getSettings($auctionid, 'authkey');
- if($auctionauthkey != false && $auctionauthkey == $_GET['uid']){
- $post_title = $this->getSettings($auctionid, 'gettitle');
- $image1 = $this->get_post_meta($auctionid, 'wdm-image-1', true);
- $description = $this->getSettings($auctionid, 'getpost2');
- $getlastbid = $this->db_connection->prepare("SELECT bid, name FROM wp_wdm_bidders WHERE auction_id = :idvar ORDER BY bid DESC");
- $getlastbid->bindValue(':idvar', $auctionid, PDO::PARAM_INT);
- $getlastbid->execute();
- $result = $getlastbid->fetch(PDO::FETCH_ASSOC);
- if($getlastbid->rowcount() == 1){
- $formdata = array("title" => $post_title
- , "auctionid" => $auctionid
- , "price" => $result['bid']
- , "image" => $image1
- , "description" => $description
- , "username" => $result['name']);
- return $formdata;
- }
- }
- }
- if(isset($_POST['auctionid'], $_POST['uid'])){
- $auctionid = $_POST['auctionid'];
- $auctionauthkey = $this->getSettings($auctionid, 'authkey');
- if($auctionauthkey != false && $auctionauthkey == $_POST['uid']){
- $getlastbid = $this->db_connection->prepare("SELECT bid, name FROM wp_wdm_bidders WHERE auction_id = :idvar ORDER BY bid DESC");
- $getlastbid->bindValue(':idvar', $auctionid, PDO::PARAM_INT);
- $getlastbid->execute();
- $result = $getlastbid->fetch(PDO::FETCH_ASSOC);
- if($getlastbid->rowcount() == 1){
- return $result = array("price" => $result['bid'], "name" => $result['name']);
- }
- }
- }
- if(isset($_GET['uid'], $_GET['prod'])){
- $auctionid = $_GET['prod'];
- $auctionauthkey = $this->getSettings($auctionid, 'authkey');
- if($auctionauthkey != false && $auctionauthkey == $_GET['uid']){
- $getlastbid = $this->db_connection->prepare("SELECT bid, name FROM wp_wdm_bidders WHERE auction_id = :idvar ORDER BY bid DESC");
- $getlastbid->bindValue(':idvar', $auctionid, PDO::PARAM_INT);
- $getlastbid->execute();
- $result = $getlastbid->fetch(PDO::FETCH_ASSOC);
- if($getlastbid->rowcount() == 1){
- $itemname = $this->getSettings($auctionid, 'gettitle');
- return $result = array("price" => $result['bid'], "name" => $result['name'], 'itemname' => $itemname);
- }
- }
- }
- }else{
- $auctionauthkey = $this->getSettings($uid, 'authkey');
- if($auctionauthkey != false){
- return "auctionpayment.php?auctionid=".$uid."&uid=".$auctionauthkey;
- }
- }
- return false;
- }
- ================================
- on line 128 (the only thing that changes is the word $this->db_connection to $this->db_connectionSecond)
- change this:
- $set_new_donation = $this->db_connection->prepare("INSERT INTO
- to this:
- $set_new_donation = $this->db_connectionSecond->prepare("INSERT INTO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement