phpbb require logged in user or redirect to login

59 views
Skip to first unread message

Dan-Kelley Young

unread,
Jan 5, 2016, 2:45:19 AM1/5/16
to AJAX-chat
Where can I locate either the setting variable or a php file where I can put a session-checking redirect command.  I have the chat installed on as an extension on phpbb 3.1 and I cannot find any configuration files in /ext/spaceace/ajaxchat or other areas of my phpbb3 installation so I am bit lost.

Stephen Gemme

unread,
Feb 2, 2016, 8:28:16 AM2/2/16
to AJAX-chat
Session-checking redirect in what sense? You have a few options since you're linked to your database. The database contains a tree with a list of all logged in users that can be accessed from anywhere on your website.

Beyond that, the chat regularly checks for users who have not posted in (x) amount of time. 

Take a look at these functions in AjaxChat.php:


 
function checkAndRemoveInactive() {
 
// Remove inactive users every inactiveCheckInterval:
 
if(!$this->getInactiveCheckTimeStamp() || ((time() - $this->getInactiveCheckTimeStamp()) > $this->getConfig('inactiveCheckInterval')*60)) {
 $this
->removeInactive();
 $this
->setInactiveCheckTimeStamp(time());
 
}
 
}

 function removeInactive() {
 $sql
= 'SELECT
 userID,
 userName,
 channel
 FROM
 '
.$this->getDataBaseTable('online').'
 WHERE
 NOW() > DATE_ADD(dateTime, interval '
.$this->getConfig('inactiveTimeout').' MINUTE);';
 
 
// Create a new SQL query:
 $result
= $this->db->sqlQuery($sql);
 
 
// Stop if an error occurs:
 
if($result->error()) {
 echo $result
->getError();
 
die();
 
}
 
 
if($result->numRows() > 0) {
 $condition
= '';
 
while($row = $result->fetch()) {
 
if(!empty($condition))
 $condition
.= ' OR ';
 
// Add userID to condition for removal:
 $condition
.= 'userID='.$this->db->makeSafe($row['userID']);


 
// Update the socket server authentication for the kicked user:
 
if($this->getConfig('socketServerEnabled')) {
 $this
->updateSocketAuthentication($row['userID']);
 
}


 $this
->removeUserFromOnlineUsersData($row['userID']);
 
 
// Insert logout timeout message:
 $text
= '/logout '.$row['userName'].' Timeout';
 $this
->insertChatBotMessage(
 $row
['channel'],
 $text
,
 
null,
 
1
 
);
 
}
 
 $result
->free();
 
 $sql
= 'DELETE FROM
 '
.$this->getDataBaseTable('online').'
 WHERE
 '
.$condition.';';
 
 
// Create a new SQL query:
 $result
= $this->db->sqlQuery($sql);
 
 
// Stop if an error occurs:
 
if($result->error()) {
 echo $result
->getError();
 
die();
 
}
 
}
 
}

You could have either of these make a call to the user so that they are warned before they are removed (if that's what you're looking to have done). 

Bobby Russ

unread,
Feb 2, 2016, 2:50:27 PM2/2/16
to Stephen Gemme, AJAX-chat

To my knowledge no one has gotten phpbb 3.1.x fully working with no errors.  Session problems still exist and not likely to be fixed anytime soon.  Frug, who has been developing it, hasn't been answering mails for a while now.

--
You received this message because you are subscribed to the Google Groups "AJAX-chat" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ajax-chat+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages