View Single Post
  #25  
Old 08-31-2001, 06:26 AM
george_proost george_proost is offline
 
Join Date: Nov 2001
Posts: 69
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm busy on a basic spec. It is not too difficult.
This is NOT a program but a way of specing a program.
Ideally it would become php and integrate passively with
vBulletin.

I am not a programmer so it could take yonks to do this.
A pro-programmer could probably do this in 3-4 hours.

It is NOT a hack as NO vBulletin code would be changed,
no new or altered tables nor new columns in tables.

Code:
// userrips.php
//
// the intention of this program is to calculate the number
// of Referral Index Points or RIPs for short.
//    =====================  
// 
// A RIP allows for the correct allocation of credit when even an  n'th
// generation registration occurs. If the referrer is an ancestor of yours you
// still get credit for registration between date ranges
//
// This task needs to run periodically to keep track of things. (cronjob)
// it will probably be too greedy to run 'real-time'.
// 
// the process described trickles RIP credits to all members 
// for new member registrations within any given period of time  

input parameters from_date, to_date

delete table userrips if it exists

create table userrips columns userid referrerid dateregistered rips 

select userid, referrerid, dateregistered from user descending 
// user table is no longer used in this program
// it will be queried again when the display needs to be shown
// the display can be a modified clone the current refertally program

insert userid, referrerid, dateregistered rips=0 into userrips

// table userrips will now be acted upon by two separate loops
// loop_1 just keeps the current user being analysed and is looped through
// processing only those users with a referrerid. This is a simple step_process loop.


foreach ( referrerid <> 0 AND dateregistered falls within date rangeparms ) //loop1
   // set up start variables for each itteration of user
   points = 1
   luckyuserid = reffererid      
   // now trickle deminishing credit down the table    
   do while luckyuserid <> 0       
      udpate userrips rips with rips+points where userid = luckyuserid
      select referrerid as luckyuserid from userrips userid = luckyuserid 
      points = points / 2
   enddo 
endfor

// end spec
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01476 seconds
  • Memory Usage 1,770KB
  • 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
  • (1)bbcode_code
  • (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