Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-01-2003, 02:02 AM
Sylvus Sylvus is offline
 
Join Date: Apr 2003
Location: Toronto
Posts: 156
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Point me in the right direction...

Here's what I have.

A member receives 100 points for every day they're registered.

A member receives 1 point for every post they make.

Days registered + total posts = Total Points.

I want to write something that will give a member MONEY if they have a certain number of Total Points.

So if they have between 1000 and 1200 Total Points, they receive $200 dollars.

Now I was able to do this and have it written but this is where I get into a problem and I can't figure out how to go about solving it.

A member would receive that $200 dollars ONLY if they're ONLINE and while they were online, reached 1000 Total Points.

Since a member receives 100 points every day they're registered, if they're not ONLINE on the day they have 1000 Total Points, they don't get that $200.

How can I make it check to see if a member has the required Total Points and give them the associated MONEY if they're not online?

It works great when they're online. Use the DB function and write it to the database.

If they're not online, it obviously cannot know who and when to update in the database.

I was using the code I wrote in functions.php and then I realized members who are not logged in when they reach a certain # of Total Points will not be able to receive their MONEY. They must be logged in.

How can I get around this? I'd like to write a routine that goes through the entire user database and checks their Total Points and if it falls between amount 1 and amount 2, give them x amount of money BUT ONLY ONCE say, at midnight of every day.

Possible? If so, what direction do I need to go to make it happen.

Syl...
Reply With Quote
  #2  
Old 09-01-2003, 04:34 AM
SmEdD's Avatar
SmEdD SmEdD is offline
 
Join Date: Mar 2003
Location: Ontario, Canada
Posts: 381
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Could you show us the code?
Reply With Quote
  #3  
Old 09-01-2003, 05:46 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 01:02 PM Sylvus said this in Post #1
Here's what I have.

A member receives 100 points for every day they're registered.
...
...
...
... How can I get around this? I'd like to write a routine that goes through the entire user database and checks their Total Points and if it falls between amount 1 and amount 2, give them x amount of money BUT ONLY ONCE say, at midnight of every day.
What a great idea! Giving points for everyday they are online. What you want to do is easy to achieve in vB3 using cron.php (vB3's own virtual cron).

However, if you have access to your server's cron jobs, you can create a new PHP with the relevant code and queries and make your cron job run that PHP file once each day to update users. That would be the best way to do it.
Reply With Quote
  #4  
Old 09-01-2003, 03:55 PM
Sylvus Sylvus is offline
 
Join Date: Apr 2003
Location: Toronto
Posts: 156
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Cron what?!

I'm getting over my head on this aren't I? I'm not familiar with the terminology but I guess what you're saying is that it would be impossible to write this into an existing VB php file?

Is a cron job like a system event or something?

Anyhow, here's the code if anyone wants to pick it apart or use some of it. As I mention in the code and in my posts, it's pretty useless when a member gains enough Total Points to get money but are not online that day when it happens.

As you can see with this:

Code:
You may not view this code unless Sylvus provided you with the password to unlock it.
Syl...
Reply With Quote
  #5  
Old 09-01-2003, 03:58 PM
assassingod's Avatar
assassingod assassingod is offline
 
Join Date: Jul 2002
Posts: 3,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

A cron job is a scheduled task
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:26 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04389 seconds
  • Memory Usage 2,202KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete