Page 2 of 3
Re: Frontend Users not expiring
Posted: Fri Dec 08, 2006 11:49 pm
by mahjong
Solved the Expiring Time not saving issue:
Code: Select all
<p class="pageinput">{html_select_date|utf8_encode prefix=$expires_dateprefix time=$expiresdate start_year=2000 end_year=2040} {html_select_time|utf8_encode prefix=$expires_dateprefix time=$expiresdate}</p>
The second $prefix was missing an underscore.
Re: Frontend Users not expiring
Posted: Fri Dec 08, 2006 11:57 pm
by Dee
Re: Frontend Users not expiring
Posted: Sat Dec 09, 2006 12:11 am
by mahjong
Code: Select all
$dbresult = $db->Execute( $q, array( $uid, $name, md5($password),
$db->DbTimeStamp(time()."'"),
$db->DbTimeStamp($expires,"'") ) );
This part doesn't make sense to me.
How come the first DbTimeStamp is with a dot (.) and not a coma (,) ? It's either or the other but not the two at the same time.
Re: Frontend Users not expiring
Posted: Sat Dec 09, 2006 12:29 am
by mahjong
I fail to see the logic behind :
Code: Select all
function DBTimeStamp($timestamp)
{
if (empty($timestamp) && $timestamp !== 0)
return 'null';
# strlen(14) allows YYYYMMDDHHMMSS format
if (!is_string($timestamp) || (is_numeric($timestamp) && strlen($timestamp)<14))
return adodb_date($this->fmtTimeStamp, $timestamp);
if ($timestamp === 'null')
return $timestamp;
if ($this->isoDates && strlen($timestamp) !== 14)
return "'$timestamp'";
return adodb_date($this->fmtTimeStamp, $this->UnixTimeStamp($timestamp));
}
Re: Frontend Users not expiring
Posted: Sat Dec 09, 2006 12:41 am
by mahjong
THIS FUNCTION ALWAYS RETURN FALSE
Code: Select all
function IsAccountExpired( $uid )
{
$db =& $this->GetDb();
$q = "SELECT * FROM ".cms_db_prefix()."module_feusers_users
WHERE id = ? AND expires > ?";
$dbresult = $db->Execute( $q, array( $uid,
$db->DbTimeStamp(time()) ) );
if( $dbresult && $dbresult->RecordCount() == 1 )
{
return false;
}
return true;
}
Re: Frontend Users not expiring
Posted: Sat Dec 09, 2006 1:28 am
by jmcgin51
THANK YOU FOR THE TIMESTAMP FIX, MAHJONG!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I also saw the dot and comma issue, and didn't understand it. Calguy? Was this a typo or is there a reason one is a comma and one is a dot?
I can't help you with the function IsAccountExpired and DBTimeStamp code questions. I know just a little less than nothing about PHP...
THANK YOU AGAIN for the timestamp fix - this really saved my site!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Re: Frontend Users not expiring
Posted: Sat Dec 09, 2006 1:31 am
by calguy1000
The dot issue was a typo..... thanks, I would never have seen that.
Re: Frontend Users not expiring
Posted: Sat Dec 09, 2006 1:43 am
by mahjong
The change in SVN still doesn't work and it doesn't make sense.
The DbTimeStamp function doesn't take 2 parameters. Can't be a coma.
Re: Frontend Users not expiring
Posted: Sat Dec 09, 2006 2:28 am
by jmcgin51
It's working for me - I'm using a comma in both locations, as follows
$dbresult = $db->Execute( $q, array( $uid, $name, md5($password),
$db->DbTimeStamp(time(),"'"),
$db->DbTimeStamp($expires,"'") ) );
Re: Frontend Users not expiring
Posted: Sat Dec 09, 2006 2:36 am
by mahjong
When you say "It's working for me", do you mean expired users are forbidden to log in?
Re: Frontend Users not expiring
Posted: Sat Dec 09, 2006 3:34 am
by jmcgin51
That's right. Expired users are now forbidden to log on - kind of. They can't view any protected content, but if I send them to a page that displays only the {cms_module module=FrontEndUsers} smarty tag, that page shows the "Change My Settings or Sign Off" links. So the system is still recognizing that they are logged in and that their username exists, but it at least is preventing access to the restricted content. I'm trying to figure out a workaround right now, since I'm too much of a PHP dunce to actually fix the module.
I'm thinking of something like
<?php
if ( loggedin != true {
echo ("{cms_module module=FrontEndUsers form=login}")
}
I don't know if this is the right php syntax, but I'm going to give it a try right now.
Re: Frontend Users not expiring
Posted: Sat Dec 09, 2006 4:09 am
by jmcgin51
well, I couldn't get that code to work, so I just rewrote my login page as follows
{cms_module module=CustomContent}
{cms_module module=FrontEndUsers}
{cms_selflink page='15' text='Home' title='Home'}
{cms_module module=FrontEndUsers form=login}
Now, as far as I can tell, everything works as I want...
Re: Frontend Users not expiring
Posted: Sat Dec 09, 2006 5:01 pm
by mahjong
You are saying expired user still can log in. They never receive the message "Account expired". You can only filter them afterwards, with another module. In other words, it doesn't work.
Re: Frontend Users not expiring
Posted: Sat Dec 09, 2006 5:28 pm
by jmcgin51
Yes, that is correct. I wasn't aware that they were supposed to see an "Account Expired" message. I can't find that anywhere in the documentation, but it makes sense. That would be great if it worked.
Re: Frontend Users not expiring
Posted: Sat Dec 09, 2006 6:26 pm
by mahjong
Strangely, if I strip the quotes around the output of DbTimeStamp it works.
I rewrote this function inside FrontEndUsers.api.php :
Code: Select all
function IsAccountExpired( $uid )
{
$db =& $this->GetDb();
$q = "SELECT * FROM ".cms_db_prefix()."module_feusers_users WHERE id = ? AND expires > ?";
$dbresult = $db->Execute( $q, array( $uid, str_replace("'",'', $db->DbTimeStamp( time() ) )) );
if( $dbresult && $dbresult->RecordCount() )
{
return false;
}
return true;
}