Archive
<maggio 2022>
lunmarmergiovensabdom
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345
News -
I have done an online users application to get online users by a method taken by the old classic ASP.
Step:


  • Create an online table

  • update lastlogin field

  • retrieve users active in the last two minutes(example)by a query



online table

CREATE TABLE online (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
nick VARCHAR( 10 ) ,
lastlogin VARCHAR( 45 ) NOT NULL
);

then

string quo = "INSERT INTO online(nick, lastlogin) VALUES (?nick, ?lastlogin)";
MySqlCommand mcommuo = new MySqlCommand(quo, mc);
mcommuo.Parameters.AddWithValue("?nick", Request.Cookies["ut"].Value);
mcommuo.Parameters.AddWithValue("?lastlogin", Convert.ToString(DateTime.Now));
mcommuo.ExecuteNonQuery();
mc.Close();

string quo1 = "SELECT DISTINCT nick FROM online WHERE lastlogin>'"+Convert.ToString(DateTime.Now.AddMinutes(-2))+"'";
MySqlCommand mcommuo1 = new MySqlCommand(quo1, mc);
//MySqlDataReader mdruo = mcommuo1.ExecuteReader();

In this code I update the users updating lastlogin field, and retrieve them by a query.

Here is the code



onlineusers.txt
Login or Register
Information of Blog
Home
Welcome all!!
Last Posts
Categories
classic ASP (2)
DotNET (3)