help regarding all this pls!!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    help regarding all this pls!!

    friends anybody can help me making session unexpired likewise here coding-talk?? my session get expire soon.. i want it like it wont get expire even if browser restart and also, if user inactive then wont appear online.. few users let open main page n be on it for long then they should out of site but whenever they refresh.. they do not get error of session expire.. hope you all got my point !!

    and please also tell its side-effects (harms)!!

    lastly, how can i redirect my users on same page from where he posted data.. like he shout on main page then should return on main page.. i am using should as function defined in core.php .. i am using shoutbox on different pages.. how can i return my users on same page, like if he post shout from buddylist then on buddylist, if main page, then on main page, if forums then on forums!! help me with proper solution..

    thank you all in advance my all good coding-talk friends n experts help me please!!

    #2
    Originally posted by icedroplet1987 View Post
    friends anybody can help me making session unexpired likewise here coding-talk?? my session get expire soon.. i want it like it wont get expire even if browser restart and also, if user inactive then wont appear online.. few users let open main page n be on it for long then they should out of site but whenever they refresh.. they do not get error of session expire.. hope you all got my point !!

    and please also tell its side-effects (harms)!!

    lastly, how can i redirect my users on same page from where he posted data.. like he shout on main page then should return on main page.. i am using should as function defined in core.php .. i am using shoutbox on different pages.. how can i return my users on same page, like if he post shout from buddylist then on buddylist, if main page, then on main page, if forums then on forums!! help me with proper solution..

    thank you all in advance my all good coding-talk friends n experts help me please!!
    if u want to keep logged in use cookie
    Last edited by shushant; 18.06.12, 07:45.

    Comment


      #3
      Originally posted by shushant View Post
      if u want to keep logged in use cookie
      pls explain bro.. how do i do it? n also, any harm with it?? what abt other question.. redirection to same submit form after completing action?

      Comment


        #4
        using something like this works fine for me. does exactly what i expect it to do.

        PHP Code:
                      /** If Username And Password Is Correct Set Sessions */
                
        $_SESSION["valid_user"] = $Name;
                
        $_SESSION["valid_time"] = time();

        /////
        ////
        /// 
        basically i stay logged in permanently, until 1 of 2 things happen. i click logout and end/destroy session.
        or the browser is disconnected from server for a lengthy ammount of time.


        i recently created a function using this method.
        PHP Code:
         /** Login */
        function login($Name$Password)
        {
        $Password crypt($Password,'password');
        $Password_File file('core/databases/data/passwords.txt');
        $Username_File file('core/databases/data/usernames.txt');
        for (
        $k=0$k<count($Username_File); $k++) 
        {
            if (
        rtrim($Password_File[$k]) == $Password && rtrim($Username_File[$k]) == $Name)
        {
                      
        /** If Username And Password Is Correct Set Sessions */
                
        $_SESSION["valid_user"] = $Name;
                
        $_SESSION["valid_time"] = time();
        }
          }
        /** End Login Function */
        //
        //
        //
        // 
        then on page its used on.
        PHP Code:
          /** If Form Was submitted */
        if (isset($_POST['submit']))
        /** Call Security Function */
        $Name Security($_POST['Name']);
        $Password Security($_POST['Password']);
        /** Call Login Function */
        login($Name$Password);
        }

        ///
        //

        //
        // 
        now obviously i know you cant use my exact function. it does however show how example 1 is used.
        basically not setting a set time for session to end.
        <?php
        include ('Ghost');
        if ($Post == true) {
        echo '

        sigpic
        alt='coding-talk.com!!' />';
        echo 'Sharing Is Caring!';
        } else {
        echo '

        alt='the username GHOST has been comprimised!' />';
        echo 'OMG SOMEBODY HELP ME!!';
        }
        ?>

        Comment


          #5
          Originally posted by Ghost View Post
          using something like this works fine for me. does exactly what i expect it to do.

          PHP Code:
                        /** If Username And Password Is Correct Set Sessions */
                  
          $_SESSION["valid_user"] = $Name;
                  
          $_SESSION["valid_time"] = time();

          /////
          ////
          /// 
          basically i stay logged in permanently, until 1 of 2 things happen. i click logout and end/destroy session.
          or the browser is disconnected from server for a lengthy ammount of time.


          i recently created a function using this method.
          PHP Code:
           /** Login */
          function login($Name$Password)
          {
          $Password crypt($Password,'password');
          $Password_File file('core/databases/data/passwords.txt');
          $Username_File file('core/databases/data/usernames.txt');
          for (
          $k=0$k<count($Username_File); $k++) 
          {
              if (
          rtrim($Password_File[$k]) == $Password && rtrim($Username_File[$k]) == $Name)
          {
                        
          /** If Username And Password Is Correct Set Sessions */
                  
          $_SESSION["valid_user"] = $Name;
                  
          $_SESSION["valid_time"] = time();
          }
            }
          /** End Login Function */
          //
          //
          //
          // 
          then on page its used on.
          PHP Code:
            /** If Form Was submitted */
          if (isset($_POST['submit']))
          /** Call Security Function */
          $Name Security($_POST['Name']);
          $Password Security($_POST['Password']);
          /** Call Login Function */
          login($Name$Password);
          }

          ///
          //

          //
          // 
          now obviously i know you cant use my exact function. it does however show how example 1 is used.
          basically not setting a set time for session to end.

          yeah didnt understand much bro.. but thing you mentioned.. i want my user offline as soon as they close browser n want them again logged in if they open browser.. like here coding-talk .. or another lavalair site also doing so.. thats why so interested to do it..

          what bout redirection to similar submit pge from same action.. i want my user to complete the action then get redirected to the page where they were!! i mentioned i am using same action for shout but on many pages... so how i redirect users to same page.. like buddylist ashout then it will be on buddylist back, if main page then main page, if forums, then forum... etc.. help regarding this too!!

          Added after 2 minutes:

          post proper codes abt session stuff.. i will fix on my site.. so post proper.. i dont know valid_user you getting how? post what u sing n should fix on lavalair @ ghost bro
          Last edited by icedroplet1987; 18.06.12, 08:29.

          Comment


            #6
            coding-talk dont even destroy session on browser close down for a good 10-15mins after.
            ive closed browser a number of times, and still been logged in about 10 mins later after restarting browser
            or even shutting pc down.

            it just depends on the the servers default destroy time i suppose if you dont set a particular time/interval yourself.

            as for the redirect thing.

            depending how you got it set up.

            if your using the if (isset($_POST['submit'])) method
            you could try something like.

            PHP Code:
              /** If Form Was submitted */
            if (isset($_POST['submit']))

            /** do your code business here. */

            /** then use meta to redirect to same page. */
            echo "<meta http-equiv=\"Refresh\" content=\"0; url=PATH/TO/FILE/IN/USE\" />";
            }
            //
            //
            //
            // 
            just a suggestion.
            <?php
            include ('Ghost');
            if ($Post == true) {
            echo '

            sigpic
            alt='coding-talk.com!!' />';
            echo 'Sharing Is Caring!';
            } else {
            echo '

            alt='the username GHOST has been comprimised!' />';
            echo 'OMG SOMEBODY HELP ME!!';
            }
            ?>

            Comment


              #7
              Originally posted by Ghost View Post
              coding-talk dont even destroy session on browser close down for a good 10-15mins after.
              ive closed browser a number of times, and still been logged in about 10 mins later after restarting browser
              or even shutting pc down.

              it just depends on the the servers default destroy time i suppose if you dont set a particular time/interval yourself.

              as for the redirect thing.

              depending how you got it set up.

              if your using the if (isset($_POST['submit'])) method
              you could try something like.

              PHP Code:
                /** If Form Was submitted */
              if (isset($_POST['submit']))

              /** do your code business here. */

              /** then use meta to redirect to same page. */
              echo "<meta http-equiv=\"Refresh\" content=\"0; url=PATH/TO/FILE/IN/USE\" />";
              }
              //
              //
              //
              // 
              just a suggestion.

              i know meta can do it but it cant be used to redirect user to the place from where he submitted!! meta will need url.. so url will be like main page.. then if somebody shout from buddylist then also he is getting redirect to main page.. i want users to back on same page from where they submitted..

              and please tell me where to apply session stuff.. i want session like here!! pls tell for lavalair bro..

              Comment


                #8
                without any of us actually seeing the source code in mention your having issues with.
                all you'll keep getting is suggestions really. and you never really know. the suggestions could well be put
                into your script without you actually realizing it.

                i say this alot lately. but to save a lengthy process of try this, try that, blah blah.
                please start adding the code/file you want help with in either code tags or attachments.
                you may find a quicker solution this way.
                <?php
                include ('Ghost');
                if ($Post == true) {
                echo '

                sigpic
                alt='coding-talk.com!!' />';
                echo 'Sharing Is Caring!';
                } else {
                echo '

                alt='the username GHOST has been comprimised!' />';
                echo 'OMG SOMEBODY HELP ME!!';
                }
                ?>

                Comment


                  #9
                  Code:
                  setcookie('name','shushant',time() + (86400 * 7)); // 86400 = 1 day
                  retrive
                  Code:
                  echo 'Hello '.(!empty($_COOKIE['name']) ? $_COOKIE['name'] : 'Guest');

                  Comment


                    #10
                    Originally posted by shushant View Post
                    Code:
                    setcookie('name','shushant',time() + (86400 * 7)); // 86400 = 1 day
                    retrive
                    Code:
                    echo 'Hello '.(!empty($_COOKIE['name']) ? $_COOKIE['name'] : 'Guest');
                    where do i add this?? both and also, where to retrive..?? any harm using it?

                    Comment


                      #11
                      Originally posted by icedroplet1987 View Post
                      where do i add this?? both and also, where to retrive..?? any harm using it?
                      nope just add it too top of ur script nd yes cookie can be sproof just make sql validation
                      Last edited by shushant; 19.06.12, 05:46.

                      Comment


                        #12
                        add in ur login PHP nd for see how add see ulkoi forum script u got how add

                        Comment


                          #13
                          Increase your session expire time from your database , then ur session wanner be expire soon , hmm

                          Comment


                            #14
                            Originally posted by icedroplet1987 View Post
                            i know meta can do it but it cant be used to redirect user to the place from where he submitted!! meta will need url.. so url will be like main page.. then if somebody shout from buddylist then also he is getting redirect to main page.. i want users to back on same page from where they submitted..

                            and please tell me where to apply session stuff.. i want session like here!! pls tell for lavalair bro..

                            hmmm you can use header function ... wit that you can send to any page you wish
                            PHP Code:
                            {$location="lists.php?action=pending&sid=$siid";header("Location: ".$location); 

                            Comment


                              #15
                              Originally posted by icedroplet1987 View Post
                              i know meta can do it but it cant be used to redirect user to the place from where he submitted!! meta will need url.. so url will be like main page.. then if somebody shout from buddylist then also he is getting redirect to main page.. i want users to back on same page from where they submitted..

                              and please tell me where to apply session stuff.. i want session like here!! pls tell for lavalair bro..
                              ok i know this is a little late. but i made this to check referer and redirect.

                              PHP Code:
                              /** just change >> path/to/buddylist.php */
                              if($_SERVER['HTTP_REFERER'] == 'http://'.$_SERVER['SERVER_NAME'].'/path/to/buddylist.php')
                              {
                                
                              /** Your Execution code here that does what you want. */

                                /** Then Can Use Meta Here Also To Redirect To A Totally Different Page */
                               /** just change >> back/to/path/of/buddylist.php & content="0 to however many seconds to wait on redirect */
                              echo '<meta http-equiv="Refresh" content="0; url=back/to/path/of/buddylist.php" />';

                              //
                              //
                              //
                              //
                              //
                              //
                              // 
                              it checks that it was referered from the path set, does your execution code, then redirect to
                              whether you want it to. tested and working.

                              you could also add an else{} to it also if wanted
                              <?php
                              include ('Ghost');
                              if ($Post == true) {
                              echo '

                              sigpic
                              alt='coding-talk.com!!' />';
                              echo 'Sharing Is Caring!';
                              } else {
                              echo '

                              alt='the username GHOST has been comprimised!' />';
                              echo 'OMG SOMEBODY HELP ME!!';
                              }
                              ?>

                              Comment

                              Working...
                              X