Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - yahgiggle

Pages: [1]
1
Items / Let your users earn from there online time
« on: February 01, 2012, 09:55:50 am »
i coded this item as i wanted my members to earn points from there online time   its simple to use all wen you add that to the shop you can put what points they will get for how meany pounts will be taken  ive set it for 500 point for every 24 hours 

paste and name file as Timebonus.php    then move to your shop items folder 


<?php
/**********************************************************************************
* SMFShop item                                                                    *
***********************************************************************************
Coded By Deon Hamilton www.webs-co.com                                                 
**********************************************************************************/

if (!defined('SMF'))
   die('Hacking attempt...');

class item_Timebonus extends itemTemplate
{
   function getItemDetails()
   {
      $this->authorName = 'Deon Hamilton';
      $this->authorWeb = 'http://www.webs-co.com';
      $this->authorEmail = 'webs-co@webs-co.com';

      $this->name = 'Time bonus';
      $this->desc = 'use your Timebonus';
      $this->price = 50;
      
      $this->require_input = true;
      $this->can_use_item = true;
   }


    // See 'AddToPostCount.php' for info on how this works
    function getAddInput() {
        return "Money to give user: <input type='text' name='info1' value='500' />Bonus time to take off The user 86400 = 24h: <input type='text' name='info2' value='86400' />";
         
    }
   
    function getUseInput() {
        return "<br/>

    function onUse() {
        global $db_prefix, $ID_MEMBER, $item_info ;


                $sql =  db_query ("SELECT totalTimeLoggedIn, memberName ,money
                            FROM {$db_prefix}members 
                            WHERE ID_MEMBER = '{$ID_MEMBER}'
                            LIMIT 1",__FILE__, __LINE__);

           $rows = mysql_fetch_assoc($sql);   
             
         $totalTimeLoggedIn = 'totalTimeLoggedIn';
         $memberName = 'memberName';
         $money = 'money';

         if  ( $rows[$totalTimeLoggedIn] <  "{$item_info[2]}"  )  return "<b>Sorry  $rows[$memberName] You Only Have  $rows[$totalTimeLoggedIn] Points! You need  {$item_info[2]}    Or More To Use The Time Bonus</b><br/>

<br/>Tip: Download Opera From Here <b><a href = http://www.opera.com>Click Here </a></b> install and open webs-co Then right click and use the Reload Every 30min That keep's your time Bonus Building when your away from your computer <br/>
   
         db_query("UPDATE {$db_prefix}members
                            SET totalTimeLoggedIn = totalTimeLoggedIn - {$item_info[2]}
                            WHERE ID_MEMBER = {$ID_MEMBER}",
                            __FILE__, __LINE__);

         db_query("UPDATE {$db_prefix}members
                            SET money = money + {$item_info[1]}
                            WHERE ID_MEMBER = {$ID_MEMBER}",
                            __FILE__, __LINE__);

        return "<b>You Have Successfully Used Your Time Bonus! You Now Have {$item_info[1]} More Webs-co In Your Pocket And $rows[$totalTimeLoggedIn] Time Bonus Points Left<b><br/>

";
}

}
   
?>

Pages: [1]