Results 1 to 8 of 8

Thread: how to set user status offline (in php) while close the browser window direclty

  1. #1
    hamayun_4u2004's Avatar
    hamayun_4u2004 is offline Senior Member+
    Last Online
    23rd April 2016 @ 05:30 AM
    Join Date
    24 Jul 2006
    Location
    pakistan/Risalpur
    Age
    34
    Posts
    502
    Threads
    101
    Credits
    996
    Thanked
    9

    Default how to set user status offline (in php) while close the browser window direclty

    assalamoalikom....

    jinaab koi PHP expert hai ITD main.... i need some help...

    jinaab mera masla ye hai k...

    main ny PHP-My SQL main user
    login/logout script banaee hai... aur apny database main aik BINARY(0/1) field li hai |on_off_status| k name sy...

    matlab jab user login hota hai tu ye FIELD zero(0) sy (1) main UPDATE ho jati hai aur user ka status ONLINE show honey lagta hai....
    aur jab user logout per click karta hai tu ye FILED 1 sy 0 main change ho jati hai matlab user pffline show h0ney lagta hai..

    jinab yaha per aik masla a raha hai.... matlab agar user ny baghair logout kiye he apni web-browser window close kar di tu database mai
    jo |on_off_status| ki filed hai wahan tu one(1) he store howa hai jiska matlab user online hai... aur actulay tu user ny apni browser window close kar di hai.. matlab wo offline ho gaya hai browser window cl;ose kar ky...

    tu Dear expert mujy is maslay ka hal bataeen.. k main kaisy set karon.. k agar user 5min tak idle rahta hai ya koi bhi activity website per nahi karta tu wo automatic logout ho jaey... aksar ap logon ny ITD main dekha ho ga.. agar user 5min tak koi activity na kary tu user ko dubara login hona parta hai,,,,,

    So GUYS HELP ME>>>>
    "NeVeR St0P tH!Nk!nG, BecoZ L!Fe Is THe G@mE OF LuCk"

    "L!Fe !s aN Experience, Try T0 Get L!L OnCe A DaY"
    (QaZ! HaMaYuN)

  2. #2
    asifshahzad is offline Junior Member
    Last Online
    12th September 2015 @ 07:46 PM
    Join Date
    07 Feb 2007
    Posts
    17
    Threads
    1
    Credits
    980
    Thanked: 1

    Default re



    App PHP Sessions use karain iss say app ka masala hal ho jaya ga


  3. #3
    hamayun_4u2004's Avatar
    hamayun_4u2004 is offline Senior Member+
    Last Online
    23rd April 2016 @ 05:30 AM
    Join Date
    24 Jul 2006
    Location
    pakistan/Risalpur
    Age
    34
    Posts
    502
    Threads
    101
    Credits
    996
    Thanked
    9

    Default

    Quote asifshahzad said: View Post


    App PHP Sessions use karain iss say app ka masala hal ho jaya ga

    dear... session tu main alredy use kar raha hon... but session tu browser level tak work karta hai.. matlab agar browser windows direct close kar di jaeyy tu session khatam ho jata hai.. lakin rahi baat database ki us main Status=1 he hai na... so tell me the solution of this prob???

  4. #4
    asifshahzad is offline Junior Member
    Last Online
    12th September 2015 @ 07:46 PM
    Join Date
    07 Feb 2007
    Posts
    17
    Threads
    1
    Credits
    980
    Thanked: 1

    Default Re

    Assalam-O-Alaikum

    Brother try following code

    __________________________________________________ ____________

    <html>
    <head>
    <title>closer.htm</title>
    <script type="text/javascript">
    function window.onload()
    {
    window.attachEvent("onbeforeunload", Close);
    }

    function Close()
    {
    return 'Are you sure you want to close my lovely window?'
    }


    function closer() {
    alert("This window is about to close.");
    }
    </script>
    </head>
    <body onbeforeunload="closer()">
    </body>
    </html>

    __________________________________________________ ____________


    This code will alert you when you click on close page

    You simply have to do that when user click on the close button redirect that user to a page that updates recored in the database.

    NOTE: This code works only in IE

  5. #5
    hamayun_4u2004's Avatar
    hamayun_4u2004 is offline Senior Member+
    Last Online
    23rd April 2016 @ 05:30 AM
    Join Date
    24 Jul 2006
    Location
    pakistan/Risalpur
    Age
    34
    Posts
    502
    Threads
    101
    Credits
    996
    Thanked
    9

    Default

    dear..... ye tu close karny per user sy poochy ga.. k window close karoon ya nahi... per agar bijli chlai jaeey tu phir kia ho ga..????


    Quote asifshahzad said: View Post
    Assalam-O-Alaikum

    Brother try following code

    __________________________________________________ ____________

    <html>
    <head>
    <title>closer.htm</title>
    <script type="text/javascript">
    function window.onload()
    {
    window.attachEvent("onbeforeunload", Close);
    }

    function Close()
    {
    return 'Are you sure you want to close my lovely window?'
    }


    function closer() {
    alert("This window is about to close.");
    }
    </script>
    </head>
    <body onbeforeunload="closer()">
    </body>
    </html>

    __________________________________________________ ____________


    This code will alert you when you click on close page

    You simply have to do that when user click on the close button redirect that user to a page that updates recored in the database.

    NOTE: This code works only in IE

  6. #6
    asifshahzad is offline Junior Member
    Last Online
    12th September 2015 @ 07:46 PM
    Join Date
    07 Feb 2007
    Posts
    17
    Threads
    1
    Credits
    980
    Thanked: 1

    Default re

    Bahi Jaaaaaan ma na app ko kaha tha k na user ko redirect karna ha apnay uss page k theraf jo k DB ma data ko update karay . . . . .

    App n karnay ya tha k

    alert("This window is about to close.");

    key jagah

    window.location.replace('insert.php');
    setTimeout('closer();', 0);


    type karna tha


    Iss say hoo ga ya k jab user close button pa click karay ga tow uss say window tow close how gaya gee lakin aik aur window khul gaya gee jo k DB ko update karay gee


    ya serif IE pay kaam karta hai . . . . (IE8 per bee)

  7. #7
    asifshahzad is offline Junior Member
    Last Online
    12th September 2015 @ 07:46 PM
    Join Date
    07 Feb 2007
    Posts
    17
    Threads
    1
    Credits
    980
    Thanked: 1

    Default

    Quote hamayun_4u2004 said: View Post
    dear..... ye tu close karny per user sy poochy ga.. k window close karoon ya nahi...

    kayun pochay ga?????

    Jasee k app ka Scenario hai, user tow khud close button par click kar raha hai

    aghar aik say zzyida tabs khuley hown tow browser puchita hai k sab ko ban karnay hai k srif current ko . . . .



    Quote hamayun_4u2004 said: View Post

    per agar bijli chlai jaeey tu phir kia ho ga..????



    Bijli janay k hal tow hamaray hukmaran nehi nechal shakay meri kia ...........

  8. #8
    aneestanha's Avatar
    aneestanha is offline Advance Member
    Last Online
    10th October 2022 @ 05:31 AM
    Join Date
    10 Nov 2007
    Location
    Apkai dil may
    Gender
    Male
    Posts
    668
    Threads
    74
    Credits
    1,264
    Thanked
    14

    Default

    agar koi mozila use kar raha ho to wo kya karay ga ..

    means kai yai problem solve nahi ho ge ..

    is ka koi jugaarh he bata do app ..
    Its Me

Similar Threads

  1. MetaProducts Offline Browser 6 ~ Portable
    By *Xpert~Baba* in forum English IT Zone
    Replies: 2
    Last Post: 14th December 2011, 10:30 AM
  2. Replies: 3
    Last Post: 6th August 2010, 08:51 PM
  3. Replies: 1
    Last Post: 27th June 2010, 06:01 PM
  4. status offline
    By SUPER47 in forum Ask an Expert
    Replies: 2
    Last Post: 11th May 2010, 06:01 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •