Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.3 RN Issues
Author Message
mrix
Client



Joined: Dec 04, 2004
Posts: 757

PostPosted: Wed Jul 29, 2009 7:27 am Reply with quote

Hi there, on my site even though I have set the " Temp accounts to expire after 2 "
The registrations still stay?
Any idea`s on a fix please.
Cheers all
mrix
 
View user's profile Send private message Visit poster's website
fkelly
Former Moderator in Good Standing



Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Wed Jul 29, 2009 9:10 am Reply with quote

I have the same problem. Just delete 'em manually for now. There are a number of issues with waiting user behavior and deactivating/ deleting users that didn't make the cut for RN 2.4 and will have to wait for 2.5.
 
View user's profile Send private message Visit poster's website
mrix







PostPosted: Wed Jul 29, 2009 9:49 am Reply with quote

I have another website where the expire works great and its hosted on the same server.
So it appears to work fine at times.
If there is no fix I guess I`ll have to start deleting 80+ applications Sad
thanks anyway
mrix
 
draxx
Involved
Involved



Joined: Nov 19, 2003
Posts: 282

PostPosted: Sun Aug 02, 2009 12:05 pm Reply with quote

I noticed this on my site also - it only seems to happen when I edit users. Now I havent narrowed down what part of the edit users is doing it .... but If I dont edit any waiting users - it works fine.

I think it has something to do with resending someones activation email.

Also - It seems that it fixes itself as soon as someone creates an account AND activates.
 
View user's profile Send private message
fkelly







PostPosted: Mon Aug 03, 2009 4:14 pm Reply with quote

Quote:
Also - It seems that it fixes itself as soon as someone creates an account AND activates.


Once they activate they should be (are) deleted from the users_temp table. And once that happens they are not considered a "waiting user". The problem, as far as I can tell is that under some undetermined set of circumstances temp accounts are not deleted when the expiration time has passed. There are other problems with waiting users also. For instance, once an approval email has been sent by the admin there should be some sort of flag to remind the admin that he/she has already approved that applicant. There isn't now and this probably will require a change to the temp_users table. All this "stuff" didn't make the "cut" for 2.4 and we will probably have to live with it as a minor inconvenience until 2.5 comes along.
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Mon Aug 03, 2009 5:59 pm Reply with quote

The way I thought it worked was the check is only done once someone else attempts to create a new account? It may be at that time where the check occurs to see if there are older temp users which need deleting? (Sorry, don't have the code in front of me atm.

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
fkelly







PostPosted: Fri Aug 07, 2009 2:11 pm Reply with quote

This has been bugging me. Don't have time to fix it now but I couldn't help looking. I'm pretty sure the problem is that the only place that we delete an expired user is in the activate.php program in the your_account/public directory. This accounts for the sporadic nature of the "problem". The activate program does this right at the top:
Code:


if ($ya_config['expiring'] != 0) {
   $past = time() - $ya_config['expiring'];
   $res = $db->sql_query('SELECT user_id FROM ' . $user_prefix . '_users_temp WHERE time < \'' . $past . '\'');
   while (list($uid) = $db->sql_fetchrow($res)) {
      $uid = intval($uid);
      $db->sql_query('DELETE FROM ' . $user_prefix . '_users_temp WHERE user_id = \'' . $uid . '\'');
      $db->sql_query('DELETE FROM ' . $user_prefix . '_users_temp_field_values WHERE uid = \'' . $uid . '\'');
   }
   $db->sql_query('OPTIMIZE TABLE ' . $user_prefix . '_users_temp_field_values');
   $db->sql_query('OPTIMIZE TABLE ' . $user_prefix . '_users_temp');
}


Problem is that if you don't go in as an admin and activate users or possibly if the activate program is not "kicked off" by a user responding to an activation email the "expired" users will just sit there. I haven't confirmed that the response to an activation email kicks this off but probably it does.

Not sure of the appropriate solution either. It could go in mainfile as a check every time a page loads but that could be overkill. Or maybe in admin.php so that everytime the ACP loads the check would be done. Or at a minimum in ya/admin/index.php so that anytime RNYA is loaded administratively expired users would get cleared out.
 
montego







PostPosted: Tue Aug 11, 2009 6:27 am Reply with quote

I actually wouldn't be apposed to this being in mainfile.php. It is an "expiration" type thing and so having it checked more often could be a good thing, kind of like ad expirations.
 
fkelly







PostPosted: Tue Aug 11, 2009 12:56 pm Reply with quote

Unfortunately, the code to check on expiration relies on functions.php in the YA/includes directory having been included prior to checking expiration. Both YA/index.php and YA/admin/index.php do this including. The specific function that is required is named "ya_get_configs()". We could include this function in mainfile or we could alter it to lower overhead a little by not getting all the configuration values but instead just getting the value for 'expiring'. Or perhaps it would be better to just duplicate the SQL to get the config value for 'expiring" right in mainfile and not incur the overhead of including the whole of ya/includes/functions.php.

Still, relatively speaking it is a lot of overhead to be running this for every user on every page load. Looking further, down in mainfile there is a function "adminblock". This returns, among other things, the number of waiting users. Perhaps this should be refined to first delete any expired temp users and then return the non-expired number. Overhead would be reduced because this section of code is only executed when the user is an admin.
 
fkelly







PostPosted: Wed Aug 12, 2009 8:34 am Reply with quote

Hammering away on this making many "rookie" mistakes but here is some code that could go in the adminblock function of mainfile. I think it would do the trick. Find the part of adminblock that tests for RNYA and modify it to do this:

Code:


      // RNYA - http://www.ravennuke/admin.php?op=yaUsers
      if (file_exists('modules/Your_Account/credits.html'))
      {
      $ya_expire = 0;
      $past = 0;
      $configresult = $db->sql_query('SELECT `config_name` , `config_value` FROM `' . $user_prefix . '_users_config` WHERE `config_name`=\'expiring\'');
      $ya_config = $db->sql_fetchrow($configresult);
      $ya_expire = $ya_config['config_value'];
      if ($ya_expire != 0) {
         $past = time() - $ya_expire;
         $res = $db->sql_query('SELECT user_id FROM ' . $user_prefix . '_users_temp WHERE time < \'' . $past . '\'');
         while (list($uid) = $db->sql_fetchrow($res)) {
            $uid = intval($uid);
            $db->sql_query('DELETE FROM ' . $user_prefix . '_users_temp WHERE user_id = \'' . $uid . '\'');
            $db->sql_query('DELETE FROM ' . $user_prefix . '_users_temp_field_values WHERE uid = \'' . $uid . '\'');
         }
      }
         $result = $db->sql_query('SELECT COUNT(*) FROM '.$user_prefix.'_users_temp');
         $row = $db->sql_fetchrow($result);
         $num = $row[0];
         if ($num > 0) $content .= '<strong><big>&middot;</big></strong>&nbsp;<a href="'.$admin_file.'.php?op=yaUsers">'._USERS.'</a>: '.$row[0].'<br />';


Note, the standard activate.php optimizes the tables after the delete. I really think that's a waste of time. I have this running on a test site and I'll check to see that it deletes the user after the expiration time passes. I don't feel like hacking at timestamps to force it to happen.

Since RNYA is standard with the last distributions I wonder if we still need the test for credits.html also.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.3 RN Issues

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 ©