Re: inserting a new row at the top of CSV file
thanks very much, it worked ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351875 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Force logout a user
Hi, I want to force logout a user if he logs in on another machine. I am using CF9 and session scope to track user user logins. what are the possible ways of achieving this. Thanks in advance Hi, Thank you folks for your responses and suggestions. I spend my weekend playing around with this app on my personal network. This is what I did. maybe this helps someone. If you guys have some tips tricks suggestions, please let me know. I appreciate all you folks taking time to read and post messages. Objective : User should be able to login on only one machine. If he tries to login from another machine, his old session should be terminated. I am using cf sessions for the purpose of tracking user. Solutions provided: check user's IP address : This might not work very well. what is the user is inside a network, or behind a proxy. I know my ISP in canada keeps changing the IP address on my home network. As Cameron mentioned CFID/CFTOKEN and that this is one single best way to determine unique logins. and i agree with this. But what if user clears his cache in that case his browser will get new CFID/CFTOKEN from cf server. Roadblock: While i was playing around with this. I started thinking is there any way that we can get some information about user's machine, like his mac address(since we cannot rely on ip address, cfid's, coz these might change). I googled around with no luck and than came back to my app. But this is one thing that I will explore later on. What I did: I already had logins table in my db wherein i was making entry each time user logs in. I added two more columns here: logout_date and logout_by. These columns will be updated when a user logs out. He can click on logout button or he will be logged out on session end. I also created dead_session_array and put this in application scope. Here I will keep adding all dead sessions. (will explain this later) Scenario 1: User logs in on machine A. entry is made in logins table but logout_date and logout_by is empty. (If user clicks on logout i update these two columns. If session ends I have some code in onsessionend in application.cfc which will update these two columns. when coding inside onsessionend, make sure you read CF documentations. since onsessionend is a self triggered CF event only applicaiton and session scope is available inside via applicationscope and sessionscope). Now suppose user goes to machine B. CF will provide him with new CFID/CFTOKEN (sessionid). when he tries to login I will check in logins table and show him a message that this user already has a session open on another machine. Provide him with a button (something like 'logout old session and continue logging on this machine') When he clicks on this button I will update the logout_date and logout_by columns in logins table for this user and I will take this sessionid(of machine A which i got form logins table that i recorded when he logged on machine A) and I will add this sessionid in application.dead_session_array. So use succefully logs in on mahine B, I will make new entry in logins table with this new login data. Now when he goes to machine A and tries to do something. I will check if application.dead_session_array contains any sessionid. If it does and the sessionid matches with sessionid of machine A. logout this user simply by clearing his session scope. There was a good link about session scope by Ben Nadel http://www.bennadel.com/blog/1847-Explicitly-Ending-A-ColdFusion-Session.htm. clearing session scope does not mean that user logs out. It depends how you design your application. In my case I simply put useObj in session scope. clearing session scope will remove userObj from session scope. But people have diffferent ideas and different ways of doing this. Scenario 2: User logs in on machine A. I make an entry in logins table with logout_date and logout_by columns empty. Now he clears his cache. clicks on any link on my page. CF will again provide him with new sessionId. This puts me again in the same situation like scenario1 I have a user whose logout_date is empty that means his session is still on. Provide him with a button which when clicked will update the logout_date column. So in a nutshell this is the trick that i used. this way i hit DB only once during login, if there are any invalid or dead session put them in application scope so that we can deal with it later. Notes: sessionid is combination of CFID and CFTOKEN ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351876 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Force logout a user
On Wed, Jul 11, 2012 at 5:40 AM, Uday Patel udayjpatel2...@gmail.comwrote: But what if user clears his cache in that case his browser will get new CFID/CFTOKEN from cf server. Clearing cache does not clear cookies, it only clears cache. However, if they do clear their cookies then their session will end, they will be logged out, and they will be forced to login again, at which time you will record their new CFID/CFTOKEN. They will also be logged out of pretty much any and every other site they've logged into. -Cameron -- Cameron Childress -- p: 678.637.5072 im: cameroncf facebook http://www.facebook.com/cameroncf | twitterhttp://twitter.com/cameronc | google+ https://profiles.google.com/u/0/117829379451708140985 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351877 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Force logout a user
Unless you are dealing only with machines on your LAN, I don't know of any reliable method to obtain the MAC of remote computers...also I believe there is an issue with MAC address re-use, so uniqueness isn't guaranteed. I doubt you'll find a solution that will work in 100% of the cases you could run across, unless you are dealing only with computers on a LAN. Freundliche Grüße / Best regards, Bill Franklin Computer Integrated Mfg. Bayer CropScience LP 8400 Hawthorne Road, Room 2447 Kansas City, MO 64120 Tel: +1 816 242 2148 Fax: +1 816 242 2047 E-mail: bill.frank...@bayer.com Web: http://www.bayercropscience.com Vorstand: Sandra E. Peterson, Vorsitzende | Lykele van der Broek, Achim Noack, Rüdiger Scheitza, Michael A. Schulz Vorsitzender des Aufsichtsrats: Werner Baumann Sitz der Gesellschaft: Monheim am Rhein | Eintragung: Amtsgericht Düsseldorf, HRB 46985 -Original Message- From: Uday Patel [mailto:udayjpatel2...@gmail.com] Sent: Wednesday, July 11, 2012 4:41 AM To: cf-talk Subject: Re: Force logout a user Hi, I want to force logout a user if he logs in on another machine. I am using CF9 and session scope to track user user logins. what are the possible ways of achieving this. Thanks in advance Hi, Thank you folks for your responses and suggestions. I spend my weekend playing around with this app on my personal network. This is what I did. maybe this helps someone. If you guys have some tips tricks suggestions, please let me know. I appreciate all you folks taking time to read and post messages. Objective : User should be able to login on only one machine. If he tries to login from another machine, his old session should be terminated. I am using cf sessions for the purpose of tracking user. Solutions provided: check user's IP address : This might not work very well. what is the user is inside a network, or behind a proxy. I know my ISP in canada keeps changing the IP address on my home network. As Cameron mentioned CFID/CFTOKEN and that this is one single best way to determine unique logins. and i agree with this. But what if user clears his cache in that case his browser will get new CFID/CFTOKEN from cf server. Roadblock: While i was playing around with this. I started thinking is there any way that we can get some information about user's machine, like his mac address(since we cannot rely on ip address, cfid's, coz these might change). I googled around with no luck and than came back to my app. But this is one thing that I will explore later on. What I did: I already had logins table in my db wherein i was making entry each time user logs in. I added two more columns here: logout_date and logout_by. These columns will be updated when a user logs out. He can click on logout button or he will be logged out on session end. I also created dead_session_array and put this in application scope. Here I will keep adding all dead sessions. (will explain this later) Scenario 1: User logs in on machine A. entry is made in logins table but logout_date and logout_by is empty. (If user clicks on logout i update these two columns. If session ends I have some code in onsessionend in application.cfc which will update these two columns. when coding inside onsessionend, make sure you read CF documentations. since onsessionend is a self triggered CF event only applicaiton and session scope is available inside via applicationscope and sessionscope). Now suppose user goes to machine B. CF will provide him with new CFID/CFTOKEN (sessionid). when he tries to login I will check in logins table and show him a message that this user already has a session open on another machine. Provide him with a button (something like 'logout old session and continue logging on this machine') When he clicks on this button I will update the logout_date and logout_by columns in logins table for this user and I will take this sessionid(of machine A which i got form logins table that i recorded when he logged on machine A) and I will add this sessionid in application.dead_session_array. So use succefully logs in on mahine B, I will make new entry in logins table with this new login data. Now when he goes to machine A and tries to do something. I will check if application.dead_session_array contains any sessionid. If it does and the sessionid matches with sessionid of machine A. logout this user simply by clearing his session scope. There was a good link about session scope by Ben Nadel http://www.bennadel.com/blog/1847-Explicitly-Ending-A-ColdFusion-Session.htm. clearing session scope does not mean that user logs out. It depends how you design your application. In my case I simply put useObj in session scope. clearing session scope will remove userObj from session scope. But people have diffferent ideas and different ways of doing this. Scenario 2: User logs in on machine A. I make an entry in logins table with logout_date and logout_by columns
Re: Force logout a user
Uday, Can you expand on the reason for the single machine requirement? Folks here may be able to provide an alternate direction or solution if we understand your reason for this restriction. Regards, Byron Mann Lead Engineer and Architect Hostmysite.com On Jul 6, 2012 10:41 AM, Uday Patel udayjpatel2...@gmail.com wrote: Hi, I want to force logout a user if he logs in on another machine. I am using CF9 and session scope to track user user logins. what are the possible ways of achieving this. Thanks in advance ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351879 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Close CFDocument window?
You could try a small hidden iframe and have your form post to that. Byron Mann Lead Engineer and Architect Hostmysite.com On Jul 5, 2012 11:02 AM, Billy Cox bi...@oldworldspices.com wrote: Hello all, I have a form that submits to an action page containing a CFDocument tag in a new window. The action page sends the PDF output directly to a printer using CFPrint, soI end up with a new blank window. I have been trying *unsuccessfully* to close that new blank window programmatically so that I don't have to train users to do it. Any ideas? What I have tried is to set a javascript timer in the submitting page to close the child window after x number of seconds. I have also tried using cfthrow in the action page to catch a custom error that could then use javascript to close the window. btw, cfprint is a workaround to allow printing to a non-AirPrint device from Safari on an iPad. Thanks, Billy Cox ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351880 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm