vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   php script for usergroup promotion = users gets banned !!! (https://vborg.vbsupport.ru/showthread.php?t=301392)

NeXuM 08-19-2013 06:08 PM

php script for usergroup promotion = users gets banned !!!
 
The cron jobs stopped working since a long time on my vbulletin 3.6.4 forum for an unknown reason, so i wrote my own script to promote the users to specific usergroups depending on their post number

Quote:

<?php
include("../db.php");
$current = time();
$unmois = 2629743;
$abc = $current - $unmois;
// membres actifs
$query = "UPDATE vb_user SET usergroupid=9 WHERE posts BETWEEN 14 AND 150 AND usergroupid != 8";
$res = mysql_query($query) or die(mysql_error());
// comit? autogestion
$query = "UPDATE vb_user SET usergroupid=13 WHERE posts > 99 AND joindate < $abc AND usergroupid != 8";
$res = mysql_query($query) or die(mysql_error());
?>
Problem is that all the users gets banned after being promoted !!!

So:

1) What's wrong with my script and why does the users gets banned ?

2) How can i unban all users that were banned for no reason ?
- In ModCP it doesn't show any information about the bans : ban date not available, "banned by" not available, lift date not available
- In vb_userban table, only the users banned by my moderators are shown. The users that got banned automatically after being promoted by my php script are NOT displayed in this table.

--------------- Added [DATE]1377018829[/DATE] at [TIME]1377018829[/TIME] ---------------

Apparently lots of my users are saying that they are on the banlist but they can still post on the forum so i'm not sure what's happenning...

Anyway, how can i promote users to a new group through a php script without putting the users on the banlist ?

NeXuM 08-21-2013 01:55 PM

I think it would be better suited for the "coding forum" can a moderator move it to this forum ?

Max Taxable 08-21-2013 02:10 PM

Quote:

Originally Posted by NeXuM (Post 2439804)
The cron jobs stopped working since a long time on my vbulletin 3.6.4 forum for an unknown reason,

I bet'cha this is because for some reason, you might have inadvertently removed the cronimage from the footer. That will make cron stop working, every time.

Zachery 08-21-2013 03:40 PM

Why wouldn't you fix the scheduled tasks instead of writing a custom script to only do one of the many things they do?

NeXuM 08-21-2013 04:48 PM

Quote:

Originally Posted by Max Taxable (Post 2440132)
I bet'cha this is because for some reason, you might have inadvertently removed the cronimage from the footer. That will make cron stop working, every time.

No.

Quote:

Why wouldn't you fix the scheduled tasks instead of writing a custom script to only do one of the many things they do?
I tried...

https://vborg.vbsupport.ru/showthread.php?t=299778

Max Taxable 08-21-2013 05:36 PM

Quote:

Originally Posted by NeXuM (Post 2440192)
No.

I looked at your source code, didn't see the cronimage.

NeXuM 08-21-2013 06:47 PM

Quote:

Originally Posted by Max Taxable (Post 2440202)
I looked at your source code, didn't see the cronimage.

It's here. http://www.pirate-punk.net/index.php
Code:

<img src="http://www.pirate-punk.net/cron.php?&amp;rand=920528" alt="" width="1" height="1" border="0" />
Even if i reset the skin to default, cron jobs still aren't working. http://www.pirate-punk.net/index.php?styleid=5

This is the first thing i tried when i had problems with crons. I gave up and i wrote my own scripts. Just need to figure why the users end up being banned (and how to remove the users that were mass banned because of this script)

I'm sure there is a vbulletin file i can include in my php script to use a vb function to promote my users to a new group without having them end up on the banlist.

Max Taxable 08-21-2013 07:06 PM

cron.php?&amp;rand=920528" alt="" width="1" height="1" border="0"

In the code, the bolded should not be there. This breaks the string.

And what you should actually have is a hook called, like this:

HTML Code:

<!-- Do not remove $cronimage or your scheduled tasks will cease to function -->
        $cronimage
        <!-- Do not remove $cronimage or your scheduled tasks will cease to function -->


NeXuM 08-21-2013 07:24 PM

The code in my footer is
Code:

$cronimage
i don't control how vbulletin outputs it.

snakes1100 08-21-2013 07:42 PM

What kind of trouble shooting have you done so far to see why the cron isnt running?

Is this a dedicate/vps server?

NeXuM 08-21-2013 07:54 PM

Quote:

Originally Posted by snakes1100 (Post 2440221)
What kind of trouble shooting have you done so far to see why the cron isnt running?

Is this a dedicate/vps server?

I have tried reseting the skin to default. I don't understand why it wouldn't be working with the default settings.

Crons are working if i launch them manually so its only a problem with the trigger / task sheduler

It is a dedicated server.

Zachery 08-21-2013 08:29 PM

Can you upgrade to 3.8.7?

snakes1100 08-21-2013 09:29 PM

Quote:

Originally Posted by NeXuM (Post 2440224)
I have tried reseting the skin to default. I don't understand why it wouldn't be working with the default settings.

Crons are working if i launch them manually so its only a problem with the trigger / task sheduler

It is a dedicated server.

What is the "Next Time" of the User Promotions cron before you trigger it manually?

Max Taxable 08-21-2013 09:35 PM

Quote:

Originally Posted by NeXuM (Post 2440219)
The code in my footer is
Code:

$cronimage

It is now? The hook wasn't there when I looked. I specifically searched for it. Am I looking at the right site?

snakes1100 08-21-2013 09:56 PM

Quote:

Originally Posted by Max Taxable (Post 2440232)
It is now? The hook wasn't there when I looked. I specifically searched for it. Am I looking at the right site?

That shouldnt show anyways.

The comments around it should, but not the actual $cronimage text

NeXuM 08-21-2013 10:03 PM

Quote:

Can you upgrade to 3.8.7?
No, impossible for many reasons. My forum is based on custom mods and outdated mods.

Quote:

What is the "Next Time" of the User Promotions cron before you trigger it manually?
http://www.ni-dieu-ni-maitre.com/_uploads/vb.jpg

snakes1100 08-21-2013 10:11 PM

Just as i figured, the dates are screwed, thats why they arent running, a date of 2008, they will never run.

Would require some server adjustments to fix that, but without knowing your server setup, hard to tell what is messing them up at this point.

Max Taxable 08-21-2013 10:15 PM

Quote:

Originally Posted by snakes1100 (Post 2440233)
That shouldnt show anyways.

The comments around it should, but not the actual $cronimage text

Right you are. I stand improved!

NeXuM 08-21-2013 10:46 PM

Quote:

Originally Posted by snakes1100 (Post 2440239)
Just as i figured, the dates are screwed, thats why they arent running, a date of 2008, they will never run.

Would require some server adjustments to fix that, but without knowing your server setup, hard to tell what is messing them up at this point.

Maybe it is. For example, i just launched the user promotion cron job and it updated the next sheduled date. The next run is scheduled for 04/07/2013

http://www.ni-dieu-ni-maitre.com/_uploads/vb2.jpg

I don't think it is server problem - i am running 2 other vBulletin forums on the same dedicated server and i don't have any problems with the cron jobs. Also, all other dates are working fine in the forum (post dates, PM, etc)

snakes1100 08-21-2013 10:48 PM

Ok, recheck that after a while & report what the Next Time is after another hour passes by, if they revert back to 2008, its a server issue.

Regardless of the other sites on the same server, this site is effected & yes i've corrected this issue previously, thats why i asked for the times.

Zachery 08-21-2013 11:00 PM

Edit and save each of them, and the difference between 3.6.8 and 3.8.x is pretty minor, I can't think of a good reason why'd they break between those versions.

Resaving each should trigger it to get a current rundate.

snakes1100 08-21-2013 11:04 PM

Not entirely true Zachery, reason being once you manually run it, the date will change to the correct one, i've fixed this a few times in the past its not vbulletin, its the server & its setup, editing them will not fix the issue, they should go back to 2008 if its what i think it is, but again im not going to speculate on it as i dont know his setup.

NeXuM 08-22-2013 01:57 AM

I just ran the promotions cron job again and the next scheduled run is still "04/07/2013
03h01"

hmmm weird..

snakes1100 08-22-2013 02:07 AM

Yea, its screwed, im guessing at this point if you leave it alone for a while, it will either resort back to 2008 or stay stuck there.

Unfortunately not knowing your server setup, i dont want to put you on a wild goose chase, but do this for now.

As you have another forum setup, delete the user cron from the cron jobs, then add it back manually, get the settings from your other site or copy them.

Then retest, see if it runs by itself or if it doesnt, report back the date/time its now stuck on.

Zachery 08-22-2013 03:50 AM

Quote:

Originally Posted by snakes1100 (Post 2440252)
Not entirely true Zachery, reason being once you manually run it, the date will change to the correct one, i've fixed this a few times in the past its not vbulletin, its the server & its setup, editing them will not fix the issue, they should go back to 2008 if its what i think it is, but again im not going to speculate on it as i dont know his setup.

Given my experience, in troubleshooting this explicit issue, running then generally won't fix it. The edit and save will. But what do I know? :rolleyes:

NeXuM 08-22-2013 04:04 AM

Quote:

Originally Posted by snakes1100 (Post 2440272)
Yea, its screwed, im guessing at this point if you leave it alone for a while, it will either resort back to 2008 or stay stuck there.

Unfortunately not knowing your server setup, i dont want to put you on a wild goose chase, but do this for now.

As you have another forum setup, delete the user cron from the cron jobs, then add it back manually, get the settings from your other site or copy them.

Then retest, see if it runs by itself or if it doesnt, report back the date/time its now stuck on.

i've already tryed that and it didnt help :(

i can give you access to my server if you want to check, but i moved to a new dedicated server a few months ago and the old server had the same problem...

Max Taxable 08-22-2013 09:53 PM

To the original complaint of users who get promoted finding themselves banned - did I miss something or did anyone ask about usergroup settings for the new usergroup?

Settings like, "Is this a banned group? (Yes) (No)" It is under "Usergroup Options" in Usergroup manager, on the page where you adjust the settings. About 3/4 of the way down the page. It actually says:

This Usergroup is not a 'Banned' Group (Setting this to no will cause the group to be treated as a banned group, this will prevent the sending of email notifications, show a banned error message on the permission error pages and other unspecified behaviors.) Yes No

Do these users actually get promoted to the new group? Or do they stay in the same group they were in and are just banned?

NeXuM 08-22-2013 10:29 PM

Quote:

Originally Posted by Max Taxable (Post 2440438)
To the original complaint of users who get promoted finding themselves banned - did I miss something or did anyone ask about usergroup settings for the new usergroup?

Settings like, "Is this a banned group? (Yes) (No)" It is under "Usergroup Options" in Usergroup manager, on the page where you adjust the settings. About 3/4 of the way down the page. It actually says:

This Usergroup is not a 'Banned' Group (Setting this to no will cause the group to be treated as a banned group, this will prevent the sending of email notifications, show a banned error message on the permission error pages and other unspecified behaviors.) Yes No

Do these users actually get promoted to the new group? Or do they stay in the same group they were in and are just banned?

Damn i had totally forgotten about this setting and i think it actually fixed my problem LOL

Anyway i would still like to fix the cron job problem as it creates various other issues. For example VB doesn't do the regular "cleaning" anymore so sometimes my users can't connect to the forum because the table vb_session is full... I had to manually create a php cron job to periodically clear the table vb_session

Max Taxable 08-22-2013 10:55 PM

Quote:

Originally Posted by NeXuM (Post 2440440)
Damn i had totally forgotten about this setting and i think it actually fixed my problem LOL

Ha! Glad to have helped somewhat! As far as unbanning those users en masse, I think fixing this setting does that for you automatically.

Quote:

Anyway i would still like to fix the cron job problem as it creates various other issues. For example VB doesn't do the regular "cleaning" anymore so sometimes my users can't connect to the forum because the table vb_session is full... I had to manually create a php cron job to periodically clear the table vb_session
Yes I agree, this is why I originally focused on the cron not running. That's a big problem that can cause a myriad of varied issues.


All times are GMT. The time now is 07:12 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.01398 seconds
  • Memory Usage 1,817KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_html_printable
  • (19)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (29)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