PDA

View Full Version : New Feature "User Group" Expire


MagNaMan
03-29-2003, 09:03 PM
Hi ALL

What I'm looking for is expire feature.

Two Fields would need to be added to user database
"Expire_Date" and "Expire_to_group"

When setting up new user, set "User Group", Set "Expire_to_date" and "Expire_to_group"

Every time user visits site, expire date is checked against
current date, if current date <= expire date then "User Group" is changed to value of "Expire_to_group"

Anyone up to the task?

MagNaMan

MagNaMan
03-29-2003, 10:36 PM
Does anyone know if something like this already exists?

trafix
03-29-2003, 11:10 PM
hmmm, i wouldnt mind this hack either......i dont know if i can build it but

MagNaMan
03-30-2003, 01:01 AM
well here's sql code to create extra fields

alter table `user`
add column usergroupexpire date not null default '00/00/00' after usergroupid,
add column usergroupexpireid int(5) unsigned not null default 0 after usergroupexire, type=myISAM

MagNaMan
03-31-2003, 01:40 AM
When a person first visits bulletin, where is the best place to put code to check?

And change usergroup, etc before completing login

trafix
03-31-2003, 01:59 AM
I was thinking more along the line of a premium paid usergroup, when the 12 month period has expired then they will be automaticly downgraded to a lower level (admin set) usergroup. that way i dont have to keep checking manually....maybe an auto pm to member and admin informing them of the downgrade would also be an advantage.

MagNaMan
03-31-2003, 02:03 AM
Yep.. Quit reading my mind :)

MagNaMan
04-01-2003, 10:20 PM
So anyone got an idea where I can place code?

I need to know where is a good place to put it. I'm assuming where cookies are read or something like that.

trafix
04-03-2003, 06:57 AM
ive got an idea where to put the code ..... but no idae how to code it.....

trafix
04-06-2003, 04:23 AM
I can start this hack...

Requires a new column in user table called memexpire

When a member is shifted to the nominated premium user group the date of upgrade will be added to this column.....thats the easy part......

However I have no idea how to code the script to automaticly down grade them at the end of a 12 month period and pm'ing both the member and the admin upon this action.

Not sure but would it be better to add date plus 12 months upon upgradeing to the memexpire column.....not sure how this is done either but when i get time i will have a play with some coding.

MagNaMan
04-06-2003, 11:54 PM
Hmm. I would guess the best place to check for auto-expiring would be during the login, where the username and password is entered. Also would need during cookie lookup, if user is using cookies.

ryancooper
04-22-2003, 11:48 PM
03-31-03 at 03:59 PM trafix said this in Post #6 (https://vborg.vbsupport.ru/showthread.php?postid=375765#post375765)
I was thinking more along the line of a premium paid usergroup, when the 12 month period has expired then they will be automaticly downgraded to a lower level (admin set) usergroup. that way i dont have to keep checking manually....maybe an auto pm to member and admin informing them of the downgrade would also be an advantage.



I can use this as well! :banana:

nhlrat
05-02-2003, 02:10 AM
Could use here as well.

trafix
05-02-2003, 02:40 AM
OK OK, I have not had time to look into this any further, however Since i realy need this hack, it look like im going to have to force myself to learn more to build the hack..... give me a week or so as i have other projects to complete

N!ck
05-02-2003, 03:08 AM
I have this running once a month with a cronjob in case you want some inspiration:


<?php
if ($action=="renew") {
header("Location: https://www.paypal.com/xclick/business=lebeldc%40yahoo.com&item_name=V-Driveboat.com+Insider+Renewal+-+1+year+-+".$user."&item_number=01005&amount=15.00&no_note=1&currency_code=USD");
exit;
}
mysql_connect("localhost","******","******");
mysql_select_db("******");
mysql_query("UPDATE user SET usergroupid='2', iexpire='0' WHERE usergroupid='8' AND iexpire < ".time());
$month=time()+2592000;
$renewusers=mysql_query("SELECT * FROM user WHERE usergroupid='8' AND iexpire < $month");
while ($user=mysql_fetch_array($renewusers)) {
$email=stripslashes($user[username]).",\n\n";
$email.="Your V-Driveboat.com Insider subscription is going to expire in approximately one month. To ensure uninterrupted access, please renew your subscription as soon as possible. You can instantly renew with a credit card by going to the following address:\n\n";
$email.="http://www.v-drivebooat.com/imanage.php?action=renew&user=".urlencode(stripslashes($user[username]))."\n\n";
$email.="If you prefer, you are also welcome to mail your $15.00 renewal fee (be sure to include your username) to:\n";
$email.="V-Driveboat.com Insider\n";
$email.="P.O. Box 1576\n";
$email.="Lake Havasu City, AZ 86405-1576\n\n";
$email.="Thank you for your continued support of V-Driveboat.com, the web's first and leading v-drive enthusiast community.\n\n";
$email.="Regards,\n";
$email.="Nick Saunders\n";
$email.="nick@v-driveboat.com";
mail($user[email],"Your subscription is almost expired",$email,"From: \"V-Driveboat.com Insider\" <insider@v-driveboat.com>");
if ($show=="y") {
echo $month."<br>";
echo stripslashes($user[username])."<br>";
}
}
mysql_close();
echo "<br>Done.";
?>


All you need to do is use mktime() in admin/user.php and add 365.26 days (or 31558464 seconds) to the timestamp, then add the iexpire field to the user table.

trafix
05-02-2003, 03:36 AM
Nick, I need all the inspriation that i can get .... lol

looking at the code, Ihis is now an automated process ????

I presume that you have to activate it via a link in the admin panel.

If i added similar code to the admin/user.php, this will check the paid members current status each time they view a page or visit the site. I spost that it would add an extra quriy for paid membeers , this would not be so bad. i would have to add a second column to the user table so when the expired membersship code is activated, it sets the value to "1" that tells the script next time around that the email has already been sent.

Will that work??

trafix
05-02-2003, 03:41 AM
sorry the code would have to go in the admin/functions.php.........right???

N!ck
05-05-2003, 01:46 AM
Actually, mine's just in the root vB folder (doesn't pose a security threat), and it simply runs via a cronjob once per month.

JeffyJoe
08-23-2003, 08:55 AM
any progress on a full hack for this yet?

Neo
08-23-2003, 05:58 PM
there can be security holes in cron jobs, make sure the script has security measures.