473,396 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

rmysql - cron facility

Hi,

Anybody could tell me how a mysql script could be run on mysql on some
interval like cron facility in Linux system?. I am using Windows 2K
machine.

Actually I am developing a PHP application by which if any user logged
in but idle for 10 minutes then the user will be forced logged out. To
implement it I am saving timestamp of the user's login time on mysql
database. The daemon/service script will identify this type logged
user's and delete its timestamp records from database. How this could
be done?

Thanks
Manik
Jul 19 '05 #1
3 3307
BDR
That's not really a great idea... You're better off running the whole
security bit from your own program. Just run this query (with your own
tablename, timestampcolumn name), whenever the script is accessed by
anyone, and put it prior to validation of the rest of the user's
credentials:

update tablename set `timestampcolumn` = '00-00-00' where
date_sub(now(), interval 10 minute) > `timestampcolumn`

The above query will eliminate ALL login values (ie, ALL users) in your
table that haven't been accessed within 10 minutes - assuming you're
letting timestamp update the column during normal accesses.

You can make login time success easier to manage by having a logged in
field, and update and check that....

update tablename set `timestampcolumn` = '00-00-00', `loggedin`='N'
where date_sub(now(), interval 10 minute) > `timestampcolumn`

Now validate user credentials easily with:

select loggedin from tablename where `sessionid`='$sessionid'
if ($loggedin eq 'N') blah blah..

Then do your logical if then else whatever (I do perl, but not php sorry )
just my 2 cents anyway.
Good luck.
AR John wrote:
Hi,

Anybody could tell me how a mysql script could be run on mysql on some
interval like cron facility in Linux system?. I am using Windows 2K
machine.

Actually I am developing a PHP application by which if any user logged
in but idle for 10 minutes then the user will be forced logged out. To
implement it I am saving timestamp of the user's login time on mysql
database. The daemon/service script will identify this type logged
user's and delete its timestamp records from database. How this could
be done?

Thanks
Manik
AR John wrote:
Hi,

Anybody could tell me how a mysql script could be run on mysql on some
interval like cron facility in Linux system?. I am using Windows 2K
machine.

Actually I am developing a PHP application by which if any user logged
in but idle for 10 minutes then the user will be forced logged out. To
implement it I am saving timestamp of the user's login time on mysql
database. The daemon/service script will identify this type logged
user's and delete its timestamp records from database. How this could
be done?

Thanks
Manik


Jul 19 '05 #2
BDR
That's not really a great idea... You're better off running the whole
security bit from your own program. Just run this query (with your own
tablename, timestampcolumn name), whenever the script is accessed by
anyone, and put it prior to validation of the rest of the user's
credentials:

update tablename set `timestampcolumn` = '00-00-00' where
date_sub(now(), interval 10 minutes) > `timestampcolumn`

The above query will eliminate ALL login values (ie, ALL users) in your
table that haven't been accessed within 10 minutes - assuming you're
letting timestamp update the column during normal accesses.

You can make login time success easier to manage by having a logged in
field, and update and check that....

update tablename set `timestampcolumn` = '00-00-00', `loggedin`='N'
where date_sub(now(), interval 10 minutes) > `timestampcolumn`

Now validate user credentials easily with:

select loggedin from tablename where `sessionid`='$sessionid'
if ($loggedin eq 'N') blah blah..

Then do your logical if then else whatever (I do perl, but not php sorry )
just my 2 cents anyway.
Good luck.
AR John wrote:
Hi,

Anybody could tell me how a mysql script could be run on mysql on some
interval like cron facility in Linux system?. I am using Windows 2K
machine.

Actually I am developing a PHP application by which if any user logged
in but idle for 10 minutes then the user will be forced logged out. To
implement it I am saving timestamp of the user's login time on mysql
database. The daemon/service script will identify this type logged
user's and delete its timestamp records from database. How this could
be done?

Thanks
Manik


Jul 19 '05 #3
BDR
That's not really a great idea... You're better off running the whole
security bit from your own program. Just run this query (with your own
tablename, timestampcolumn name), whenever the script is accessed by
anyone, and put it prior to validation of the rest of the user's
credentials:

update tablename set `timestampcolumn` = '00-00-00' where
date_sub(now(), interval 10 minute) > `timestampcolumn`

The above query will eliminate ALL login values (ie, ALL users) in your
table that haven't been accessed within 10 minutes - assuming you're
letting timestamp update the column during normal accesses.

You can make login time success easier to manage by having a logged in
field, and update and check that....

update tablename set `timestampcolumn` = '00-00-00', `loggedin`='N'
where date_sub(now(), interval 10 minute) > `timestampcolumn`

Now validate user credentials easily with:

select loggedin from tablename where `sessionid`='$sessionid'
if ($loggedin eq 'N') blah blah..

Then do your logical if then else whatever (I do perl, but not php sorry )
just my 2 cents anyway.
Good luck.
AR John wrote:
Hi,

Anybody could tell me how a mysql script could be run on mysql on some
interval like cron facility in Linux system?. I am using Windows 2K
machine.

Actually I am developing a PHP application by which if any user logged
in but idle for 10 minutes then the user will be forced logged out. To
implement it I am saving timestamp of the user's login time on mysql
database. The daemon/service script will identify this type logged
user's and delete its timestamp records from database. How this could
be done?

Thanks
Manik
AR John wrote:
Hi,

Anybody could tell me how a mysql script could be run on mysql on some
interval like cron facility in Linux system?. I am using Windows 2K
machine.

Actually I am developing a PHP application by which if any user logged
in but idle for 10 minutes then the user will be forced logged out. To
implement it I am saving timestamp of the user's login time on mysql
database. The daemon/service script will identify this type logged
user's and delete its timestamp records from database. How this could
be done?

Thanks
Manik


Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: AR John | last post by:
Hi, Anybody could tell me how a mysql script could be run on mysql on some interval like cron facility in Linux system?. I am using Windows 2K machine. Actually I am developing a PHP...
6
by: sherryonline | last post by:
i have a page and i need that page to be called every day at 12:00 that page is going to connect to the database fetch some emails and will start mailing them how i am goning to do this.
4
by: vagrantbrad | last post by:
I'm using python 2.4 running on Fedora Core 4. I have written a python program called ipscan.py that checks the external ip address of my cable internet connection, and on change, will update the...
3
by: the.natalie | last post by:
Hi. I am a newbie to mysql, cron, and shell scripting, so please bear with me. I have a script that is used for updating an image directory based on contents in a database. The script does the...
5
by: jcor | last post by:
Hi, I'm trying to run my first cron job, probably it's missing something. I created a perl script just to test, it's called "teste" !/usr/bin/perl open(DATA,">>/home/joao/files/output"); @Now...
4
by: Phil | last post by:
I have a php script that queries some Oracle DB and outputs a single line of plain text with <brat the end for each query. This is Apache2, php4.4.8 and Oracle Instant Client 10.1.0.5 all on CentOS...
4
by: Stephen Cattaneo | last post by:
Hello all, I am attempting to execute an automated test (written in Python) via cron. I have to check the HOSTNAME variable as part of the test, oddly under cron the HOSTNAME environment...
0
by: Cameron Simpson | last post by:
On 17Aug2008 21:25, John Nagle <nagle@animats.comwrote: Because $HOSTNAME is a bash specific variable, set by bash but NOT EXPORTED! Like $0 and a bunch of other "private" variables, subprocesses...
1
by: Karthik Gurusamy | last post by:
Hi, I'm working on a cron like functionality for my application. The outer loops runs continuously waking every x seconds (say x=180, 300, ..). It needs to know what events in cron has expired...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.