Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> CNB Your Account
Author Message
XtraX
Hangin' Around



Joined: Nov 03, 2004
Posts: 43

PostPosted: Thu Mar 17, 2005 7:18 pm Reply with quote

Is there away to modify this as lm not sure how to ... do this but set it to months instaed of years for subscription periods.....

in the modifyusers.php file I found this which l'm sure is what sets the subscription time ..

Code:
if ($Version_Num > 7.0) {

        $yacontent = "";
        $subnum = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_subscriptions WHERE userid='$chng_uid'"));
        if ($subnum == 0) {
            $yacontent .= "<tr><td bgcolor='$bgcolor2'>"._SUBUSERASK.":</td><td><input type='radio' name='subscription' value='1'> "._YES."&nbsp;&nbsp;&nbsp;<input type='radio' name='subscription' value='0' checked> "._NO."</td></tr>";
            $yacontent .= "<tr><td bgcolor='$bgcolor2'>"._SUBPERIOD.":</td><td><select name='subscription_expire'>";
            $yacontent .= "<option value='0' selected>"._NONE."</option>";
            $yacontent .= "<option value='1'>1 "._YEAR."</option>";
            $yacontent .= "<option value='2'>2 "._YEARS."</option>";
            $yacontent .= "<option value='3'>3 "._YEARS."</option>";
            $yacontent .= "<option value='4'>4 "._YEARS."</option>";
            $yacontent .= "<option value='5'>5 "._YEARS."</option>";
            $yacontent .= "<option value='6'>6 "._YEARS."</option>";
            $yacontent .= "<option value='7'>7 "._YEARS."</option>";
            $yacontent .= "<option value='8'>8 "._YEARS."</option>";
            $yacontent .= "<option value='9'>9 "._YEARS."</option>";
            $yacontent .= "<option value='10'>10 "._YEARS."</option>";
            $yacontent .= "</select><input type='hidden' name='reason' value='0'></td></tr>";
        } elseif ($subnum == 1) {
            $yacontent .= "<tr><td bgcolor='$bgcolor2'>"._UNSUBUSER.":</td><td><input type='radio' name='subscription' value='0'> "._YES."&nbsp;&nbsp;&nbsp;<input type='radio' name='subscription' value='1' checked> "._NO."</td></tr>";
            $yacontent .= "<tr><td bgcolor='$bgcolor2'>"._ADDSUBPERIOD.":</td><td><select name='subscription_expire'>";
            $yacontent .= "<option value='0' selected>"._NONE."</option>";
            $yacontent .= "<option value='1'>1 "._YEAR."</option>";
            $yacontent .= "<option value='2'>2 "._YEARS."</option>";
            $yacontent .= "<option value='3'>3 "._YEARS."</option>";
            $yacontent .= "<option value='4'>4 "._YEARS."</option>";
            $yacontent .= "<option value='5'>5 "._YEARS."</option>";
            $yacontent .= "<option value='6'>6 "._YEARS."</option>";
            $yacontent .= "<option value='7'>7 "._YEARS."</option>";
            $yacontent .= "<option value='8'>8 "._YEARS."</option>";
            $yacontent .= "<option value='9'>9 "._YEARS."</option>";
            $yacontent .= "<option value='10'>10 "._YEARS."</option>";
            $yacontent .= "</select></td></tr>";
            $yacontent .= "<tr><td bgcolor='$bgcolor2'>"._ADMSUBEXPIREIN."</td><td>";
            $row = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_subscriptions WHERE userid='$chng_uid'"));
            $diff = $row['subscription_expire']-time();
            $yearDiff = floor($diff/60/60/24/365);
            $diff -= $yearDiff*60*60*24*365;
            if ($yearDiff < 1) {
                $diff = $row['subscription_expire']-time();
            }
            $daysDiff = floor($diff/60/60/24);
            $diff -= $daysDiff*60*60*24;
            $hrsDiff = floor($diff/60/60);
            $diff -= $hrsDiff*60*60;
            $minsDiff = floor($diff/60);
            $diff -= $minsDiff*60;
            $secsDiff = $diff;
            if ($yearDiff < 1) {
                $rest = "$daysDiff "._SBDAYS.", $hrsDiff "._SBHOURS.", $minsDiff "._SBMINUTES.", $secsDiff "._SBSECONDS."";
            } elseif ($yearDiff == 1) {
                $rest = "$yearDiff "._SBYEAR.", $daysDiff "._SBDAYS.", $hrsDiff "._SBHOURS.", $minsDiff "._SBMINUTES.", $secsDiff "._SBSECONDS."";
            } elseif ($yearDiff > 1) {
                $rest = "$yearDiff "._SBYEARS.", $daysDiff "._SBDAYS.", $hrsDiff "._SBHOURS.", $minsDiff "._SBMINUTES.", $secsDiff "._SBSECONDS."";
            }
            $yacontent .= "<font color='#FF0000'>$rest</font></td></tr>";
            $yacontent .= "<tr><td bgcolor='$bgcolor2' valign='top'>"._SUBREASON."</td><td><textarea name='reason' cols='60' rows='10'></textarea></td></tr>";
        }
        echo "$yacontent";
    }


If someone could help me with this it would be so appreciated..!

As having it set to years is really not reasonable as most members or visitors considering subscribing would be monthly...

XTRAX
 
View user's profile Send private message
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6433

PostPosted: Thu Mar 17, 2005 10:34 pm Reply with quote

Replace all instances of 365 with 30, the average number of days per month.

Change the text in your language file for _YEAR and _YEARS to be Month and Months (or define new _MONTH and _MONTHS language terms) and replace those here.

Look for additional references to subscription_expire for necessary logic changes.

_________________
I search, therefore I exist...
nukeSEO - nukeFEED - nukePIE - nukeSPAM - nukeWYSIWYG
 
View user's profile Send private message
XtraX







PostPosted: Thu Mar 17, 2005 10:41 pm Reply with quote

I thank you for the quick response looking at the code i figured that out with the 365 days in a year but wasnt sure if l needed to make any additional changes...

Thank you for your time

Smile
Xtrax
 
XtraX







PostPosted: Thu Mar 17, 2005 11:09 pm Reply with quote

Ok I changed it and everything seems to be ok but I still have one problem..

When viewing my account it shows this

Your subscription will expire in:
48 years, 364 days, 19 hours, 13 minutes, 35 seconds

Now were do l find this to make the changes so when a user is viewing there profile/Your account it displays correctly...

I thank you for your time.. and patients as lm still figuring this all out..

Xtrax Smile
 
XtraX







PostPosted: Thu Mar 17, 2005 11:18 pm Reply with quote

Ok l found the last thing I posted, in the following section in the includes subscription.php and changed all the 365 to 30 but its not working properly ...

this is what its displaying

681 years, 9 days, 19 hours, 2 minutes, 44 seconds

and thats set to 7 months ...

Any idea what l need to change...

Xtrax
 
XtraX







PostPosted: Fri Mar 18, 2005 10:41 am Reply with quote

Help Anyone know what needs to be changed...?

Xtrax
 
sixonetonoffun
Spouse Contemplates Divorce



Joined: Jan 02, 2003
Posts: 2496

PostPosted: Fri Mar 18, 2005 1:07 pm Reply with quote

You basically have to rewrite the whole thing. The time caclulation is going to have to be rewritten to be based on your new suscription period. How you want to do that doesn't really matter you can count it off in days/hours/minutes/seconds I think its more complicated in its present form then you'll need.

Look at php.net page for time() that should give you much of the info needed to calculate the remaining time.

_________________
[b][size=5]openSUSE 11.4-x86 | Linux 2.6.37.1-1.2desktop i686 | KDE: 4.6.41>=4.7 | XFCE 4.8 | AMD Athlon(tm) XP 3000+ | MSI K7N2 Delta-L | 3GB Black Diamond DDR
| GeForce 6200@433Mhz 512MB | Xorg 1.9.3 | NVIDIA 270.30[/size:2b8 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> CNB Your Account

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©