vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   uCash & uShop (https://vborg.vbsupport.ru/forumdisplay.php?f=100)
-   -   i need a quick and dirty way of doing something (https://vborg.vbsupport.ru/showthread.php?t=78548)

elastomaniac 03-22-2005 08:17 AM

i need a quick and dirty way of doing something
 
I need a quick and dirty way of adding (say) 50 points to a certain user ID each day. So, something really quick and dirty in a PHP script which i could then run as a CRON job would be perfect.

Something like:

>> Connects to my MySQL database (i dont mind hardcoding the info)
>> Reads the point count of a user id which i will hardcode into the script
>> Adds 50 points to that user IDs point count
>> Closes connection

It doesnt need any sort of frills or ease of use. Im trying to do this atm but im getting stuck because im not really good at MySQL. PLEASE PLEASE PLEASE help!

hate 03-22-2005 08:42 AM

I would just open includes/cron/birthday.php due to it is ran once a day and find

Code:

$today = date('m-d', TIMENOW);
and above that add

Code:

$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET uttpoints = uttpoints + 50 WHERE userid = 1");
Remeber to change the userid

There you have it , fast :) , you can toss it in the mud if ya need it dirty.

elastomaniac 03-22-2005 10:40 AM

lol thanks man, i will try it now :)

Quote:

Originally Posted by hate
I would just open includes/cron/birthday.php due to it is ran once a day and find

Code:

$today = date('m-d', TIMENOW);
and above that add

Code:

$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET uttpoints = uttpoints + 50 WHERE userid = 1");
Remeber to change the userid

There you have it , fast :) , you can toss it in the mud if ya need it dirty.

Ok it works perfectly. If I wanted to make it add say 50 to each member of a usergroup i guess this would do it:

Code:

$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET uttpoints = uttpoints + 50 WHERE usergroupid = #");

Reeve of shinra 03-22-2005 01:16 PM

Doesn't the latest version have a paycheck feature?

Link14716 03-22-2005 06:59 PM

Not the current released version, however it is already working on area51.geekydesigns.com and usergroup based.

elastomaniac 03-23-2005 03:43 AM

Link14716, i will eagerly await the next release, however for now this little technique will work. I think i might put it into a seperate php file and neaten it up a little and then release it as a small hack if 'hate' doesnt have a problem with it :)

I know lots of people would like this feature but they may not see this thread and just go straight to the hacks area.

hate 03-23-2005 03:53 AM

I have no problem with it at all :)

elastomaniac 03-23-2005 06:46 AM

Thanks hate :)


All times are GMT. The time now is 11:17 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01022 seconds
  • Memory Usage 1,726KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete