View Single Post
  #5  
Old 05-29-2009, 03:47 PM
ageurtse ageurtse is offline
 
Join Date: Apr 2009
Location: almelo
Posts: 275
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i tryed somthings but i can't get it to work

this is the code
Code:
function updateThread($id, $ut){
	
	$db->query_write("UPDATE vb3_thread SET sortdateline = maildateline, mailed = '0', open = '1' WHERE threadid = '$id' AND maildateline = '$ut' AND forumid = '46' ");
	return (mysql_affected_rows() == 1);
}
this is the error
Quote:
Fatal error: Call to a member function on a non-object in /var/www/vhosts/zeewaterforum.info/httpdocs/forums/verkoopfunctions.php on line 103
when i put $vbulletin-> in front of the line of code that also isn't working


this is a php file which is called from a link send by email.

bellow a bit of code from the email
Quote:
Heeft u uw artikelen nog niet verkocht, dan kunt u met onderstaande url uw advertentie '3 dagen' naar voren plaatsen:
http://www.zeewaterforum.info/forums...&ut=1242763003



this is the php file verplaats.php
Code:
<?php

require_once('./global.php');
require_once('./verkoopfunctions.php');
	if(isset($_GET['id'])&&isset($_GET['ut'])){

		if(updateThread($_GET['id'], $_GET['ut'])){
			standard_error('Uw bericht is naar voren verplaatst','',0);
		}
		else{
			standard_error('Er is niets gewijzigd, u heeft uw bericht waarschijnlijk al eerder verplaatst.','',0);
		}
	}
	else{
		standard_error('Er klopt iets niet met de URL, verzeker u dat de volledige URL is gekopieerd','',0);
	}


?>

this is the whole php file verkoopfunctions.php
Code:
<?php

require_once('htmlMimeMail.php');

function doall(){

  setSortDateLine();
	closeOldThreads();
	setThreads();
	$result = getThreads();
	while(($row = mysql_fetch_array($result))==true){
	//	echo 'postuserid '.$row['postuserid'].'  MAILDATELINE'.$row['maildateline'].'<BR>';
		sendmail($row['postuserid'],$row['threadid'],$row['maildateline'],$row['title']);
        //sendpm($row['postuserid'],$row['threadid'],$row['maildateline'],$row['title']);
        //setsend($row['threadid']);
	}
}

function sendmail($userid, $threadid, $ut, $threadtitle){
	global $mail;

	$user = $db->query("SELECT username, email FROM vb3_user WHERE userid = '$userid'");
	$user = $db->fetch_array($user);
	//$headers = "MIME-Version: 1.0\n";
	//$headers .= "From: administratie@zeewaterforum.info\n";
	$name = $user['username'];
	$email = 'test@steinor.nl'; //$user['email'];
	$subject = "Actualiseren aanbieding";
	$message = "Hallo ".$name. ",<br/><br/>";
	$message .= "\n\nOp zeewaterforum.info heeft u de advertentie \"".$threadtitle."\" geplaatst in het forumdeel \"Particulieren bieden aan\".<br/>\n";
	$message .= "Het is nu 3 dagen geleden dat u deze advertentie (voor het laatst naar voren) heeft geplaatst.<br/>\n<br/>\n";
	$message .= "Heeft u uw artikelen nog niet verkocht, dan kunt u met onderstaande url uw advertentie '3 dagen' naar voren plaatsen:<br/>\n";
	$message .= "<a href =\"http://www.zeewaterforum.info/forums/verplaats.php?id=$threadid&ut=$ut\">http://www.zeewaterforum.info/forums/verplaats.php?id=$threadid&ut=$ut</a><br/>\n<br/>\n";
	$message .= "Mocht u uw artikelen reeds hebben verkocht dan kunt u met onderstaande url uw advertentie op slot zetten en naar achter plaatsen:<br/>\n";
	$message .= "<a href =\"http://www.zeewaterforum.info/forums/sluit.php?id=$threadid&ut=$ut\">http://www.zeewaterforum.info/forums/sluit.php?id=$threadid&ut=$ut</a><br/>\n<br/>\n";
	$message .= "Reageert u niet, dan wordt uw advertentie over twee dagen automatisch op slot gezet.\nU kunt dan alsnog reageren, uw advertentie wordt dan weer van het slot gehaald.<br/>\n<br/>\n";
	$message .= "Met vriendelijke groet,<br/>\n<br/>\nHet zeewaterforum.info team";


	$mail = new htmlMimeMail();
	$mail->setFrom('zeewaterforum.info <noreply@zeewaterforum.info>');
	$mail->setSubject($subject);

    $mail->setHTML($message);
	$mail->setBcc('l.k.h.kwakman@orange.nl');
  $mail->send(array($email));
}

function setsend($threadid){
    $db->query("UPDATE vb3_thread SET mailed = '1' WHERE threadid = '$threadid'");
}

function sendpm($userid, $threadid, $ut, $threadtitle){

    $user = $db->query("SELECT username, email FROM vb3_user WHERE userid = '$userid'");
    $user = $db->fetch_array($user);
    $username = $user['username'];

    $title = "Actualiseren aanbieding";
    $message = "Hallo ".$name. ",";
    $message .= "\n\nOp zeewaterforum.info heeft u de advertentie \"".$threadtitle."\" geplaatst in het forumdeel \"Particulieren bieden aan\".\n";
    $message .= "Het is nu 3 dagen geleden dat u deze advertentie (voor het laatst naar voren) heeft geplaatst.\n\n";
    $message .= "Heeft u uw artikelen nog niet verkocht, dan kunt u met onderstaande url uw advertentie '3 dagen' naar voren plaatsen:\n";
    $message .= "http://www.zeewaterforum.info/forums...adid}&ut={$ut}\n\n";
    $message .= "Mocht u uw artikelen reeds hebben verkocht dan kunt u met onderstaande url uw advertentie op slot zetten en naar achter plaatsen:\n";
    $message .= "http://www.zeewaterforum.info/forums...adid}&ut={$ut}\n\n";
    $message .= "Reageert u niet, dan wordt uw advertentie over twee dagen automatisch op slot gezet.\nU kunt dan alsnog reageren, uw advertentie wordt dan weer van het slot gehaald.\n\n";
    $message .= "Met vriendelijke groet,\n\nHet zeewaterforum.info team";

    $tostring = array();
    $tostring["$userid"] = $username;

    $fusername = "forumbeheer";
    $fuserid = "47";
                    // insert private message text
    $db->query("INSERT INTO vb3_pmtext(fromuserid, fromusername, title, message, touserarray, iconid, dateline, showsignature, allowsmilie) VALUES ($fuserid, '$fusername', '$title', '" . addslashes($message) . "', '" . addslashes(serialize($tostring)) . "', 0, " . TIMENOW . ", 0, 0)");
    echo mysql_error();
    // get the inserted private message id
    $pmtextid = mysql_insert_id();


    $db->query("INSERT INTO vb3_pm (pmtextid, userid) VALUES ($pmtextid, $userid)");

    // update recipient pm totals (with pm-popup)

    $db->query("UPDATE vb3_user SET pmtotal=pmtotal+1, pmunread=pmunread+1, pmpopup=2 WHERE userid = '$userid'");


}

function closeThread($id, $ut){
	$db->query("UPDATE vb3_thread SET open = '0' WHERE threadid = '$id' AND forumid = '46' AND maildateline = '$ut'");
	return (mysql_affected_rows() == 1);
}

function closeOldThreads(){
	$db->query("UPDATE vb3_thread SET open = '0', mailed = '0' WHERE open = '1' AND forumid = '46' AND TIMESTAMP(FROM_UNIXTIME( maildateline ) , '48:00:00') < NOW() AND mailed = '1'");
}

function updateThread($id, $ut){
	
	$vbulletin->$db->query_write("UPDATE vb3_thread SET sortdateline = maildateline, mailed = '0', open = '1' WHERE threadid = '$id' AND maildateline = '$ut' AND forumid = '46' ");
	return (mysql_affected_rows() == 1);
}

function getThreads(){
	return $db->query("SELECT * FROM vb3_thread LEFT JOIN vb3_deletionlog AS deletionlog ON(vb3_thread.threadid = deletionlog.primaryid AND type = 'thread') WHERE maildateline <> sortdateline AND mailed = '0' AND open = '1' AND forumid = 46 AND ISNULL(deletionlog.primaryid) ORDER BY maildateline DESC LIMIT 50");
}

function setThreads(){
	$db->query("UPDATE vb3_thread SET maildateline = UNIX_TIMESTAMP(TIMESTAMP( FROM_UNIXTIME( sortdateline ) , '72:00:00')) WHERE sortdateline = maildateline AND TIMESTAMP(FROM_UNIXTIME( sortdateline ) , '72:00:00') < NOW() AND open = '1' AND forumid = 46");
}

function setSortDateLine(){
	$db->query("UPDATE vb3_thread SET sortdateline = dateline, maildateline = dateline WHERE sortdateline = '0' AND open = '1' AND forumid = '46'");
}

?>
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01233 seconds
  • Memory Usage 1,812KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete