close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

problem with showing online users

Thread began 1/27/2014 2:35 pm by khon_lao435659 | Last modified 1/29/2014 2:35 pm by khon_lao435659 | 2931 views | 10 replies |

khon_lao435659

problem with showing online users

i have a couple of problems. first one is i get this error testing my whoischeck.php

2014-01-22 15:41:42No database selectedNo database selectedNo database selected
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/webim028/public_html/SolaDB/whoischeck.php on line 32

second problem:
there was no session for my user email. so i created $_SESSION['SecurityAssist_UserEmail'];
with security assist i added the update records for both login and logout using the new session i made, but everytime i log in it does not update my table.

code for the whoischeck.php

<?php require_once('Connections/announcement.php'); ?>
<?php require_once('webassist/security_assist/helper_php.php'); ?>
<?php


////// To update session status for user table to get who is online ////////
if(WA_Auth_RulePasses("Logged in to pcms2_users")){ // Begin Show Region
$tm=date("Y-m-d H:i:s");
$xses=$_SESSION['SecurityAssist_UserEmail'];
$q=mysql_query("update pcms2_users set connected_usr='Y', tm_usr='$tm' where UserEmail='$xses'");
echo $tm;
echo mysql_error();}
else{

}

///// ////////////// End of updating login status for who is online ///////

// Find out who is online /////////
$gap=10; // change this to change the time in minutes, This is the time for which active users are collected.
$tm=date ("Y-m-d H:i:s", mktime (date("H"),date("i")-$gap,date("s"),date("m"),date("d"),date("Y")));
//// Let us update the table and set the status to OFF
////for the users who have not interacted with
////pages in last 10 minutes ( set by $gap variable above ) ///

$ut=mysql_query("update pcms2_users set connected_usr='N' where tm_usr < '$tm'");
echo mysql_error();
/// Now let us collect the userEmail from table who are online ////////
$qt=mysql_query("select UserEmail from pcms2_users where tm_usr > '$tm' and connected_usr='Y'");
echo mysql_error();

while($nt=mysql_fetch_array($qt)){
}

?>

Sign in to reply to this post

Jason ByrnesWebAssist

problem 2 is related to problem 1.


problem 1 means that there is a problem with the connection details. double the mysql host, username, password and database name to make sure they are correct.

the error indicates they are not. if you think they should be and are still getting the error, check with the host.

Sign in to reply to this post

Miguel

add to the querys this on top of them

mysql_select_db($database_dbname, $dbname);

Change dbname with the one you have

place it above this code

$q=mysql_query("update pcms2_users set connected_usr='Y', tm_usr='$tm' where UserEmail='$xses'");

Sign in to reply to this post

khon_lao435659

Miguel i tried using the mysql_select_db at an earlier time but didnt work. i'll send over the files

Sign in to reply to this post

Miguel

Did not get the files did you send them?

Sign in to reply to this post

khon_lao435659

i attached them privately. i will attach them publicly

-----------

Sign in to reply to this post

Miguel

Ok try this one out, what is new is the mysql_select_db($database_announcement, $announcement); you had an incorrect one on the file, let me know if its updating or not remeber this should be included on every page of your site and on the login page you can add an update of the user status with data assist in an easy way if the user gets logged also

Attached Files
whoischeck.zip
Sign in to reply to this post

khon_lao435659

the new file sent over causes the following problems.

Warning: mysql_select_db(): 6 is not a valid MySQL-Link resource in /home/webim028/public_html/SolaDB/whoischeck.php on line 10

Warning: mysql_select_db(): 6 is not a valid MySQL-Link resource in /home/webim028/public_html/SolaDB/whoischeck.php on line 27

Warning: mysql_select_db(): 6 is not a valid MySQL-Link resource in /home/webim028/public_html/SolaDB/whoischeck.php on line 32

Sign in to reply to this post

Miguel

Ok try this one then

Attached Files
whoischeck.zip
Sign in to reply to this post

khon_lao435659

still fails,
Will it matter if the site is hosted on a sub domain?
Also in the server behaviors in the whoischeck.php there is a red exclaimation mark next too the SecurityAssist Show Region (Logged into ****) (Prior version) when i go to update the rule, it says error executing.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...