Thread: Couch Sessions

    #31
  1. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    hit counder


    Hi
    can anybody help me to find a php code to to find no of hits of a page in a DAY
    thanx
    harish
  2. #32
  3. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: hit counder


    Try this....
    <?
    $link = mysql_connect ("localhost", "username", "password")
    or die ("Could not connect");
    mysql_select_db ("counter");
    $result = mysql_db_query ("localhost","select counter from counter");
    while ($row = mysql_fetch_array ($result)) {
    $Db_Counter = $row["counter"];
    }
    mysql_free_result ($result);
    $Cur_Counter = $Db_Counter;
    $Cur_Counter = $Cur_Counter + 1;
    $result1 = mysql_query ("update counter set counter = $Cur_Counter")
    or die ("Invalid query");
    mysql_close ($link);

    regards,

    Nasir
  4. #33
  5. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Cannot send session cache limiter


    I am learning sessions handling with php4 and I am trying to pass a variable from one page to another using just the session cookie for now.

    On the second page I use the

    session_start(); call to open the session and then I print out the PHPSESSID value to make sure the session is in effect.

    This all works ok

    Then I try to print out my varaible using

    echo "$Hi $username"; and all I get is "Hi" and an error that states

    Cannot send session cache limiter headers already sent by ([and the location of my code on the server])

    What am I doing wrong?
  6. #34
  7. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    typo


    The code on the third line from the bottom should read

    echo "Hi $username"; with no '$' before the word 'Hi'

    Sorry bout that...
  8. #35
  9. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: (session_start() error) fixed post


    You have to make sure that no single bit of data is written to the php-generated webpage before you attempt to start the session, so place your php-code before any "<html>" or whatever.
  10. #36
  11. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    usernames


    Is there any way to get PHP to grab a linux/unix username?
  12. #37
  13. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Sessions with mulitple pages


    Howdy. Let me explain my situation here.
    I am to build a shopping cart, thrue 20 diffrent pages.
    All pages are linked on one mainpage.
    The mainpage should become the start of the session i assume.
    Then the custumor clicks on a page to visit to place an order on the corresponding category. How do I tell the script wich session it is ?
    Is there a way from a diffrent page to call the session create script to check wich session number is currently visiting ???

    I hope i told it in a correct way :-)

    Thanks for your time to awnser to this question.
  14. #38
  15. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Session without cookies


    I want to use the session variables for storing user id and password.
    I use the following code for navigating between pages:

    <a href="NextPage.php?" . SID > Next Page </a>

    and I have registered the uid and password as session variables in the login form.
    But this means that i send the session ID in the url. Like this my session can be taken over since the id is visible in the browser.
    What other method can i use to send the session id if i don't want to use cookies?

    Thanks
  16. #39
  17. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: cookie


    bm,m,b
  18. #40
  19. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Session without cookies


    gjl;
  20. #41
  21. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: session-security


    <p><pre><font color=#008000><xmp>session_set_save_handler()</xmp></font></pre><p>
  22. #42
  23. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Session data removal


    In the online manual at http://http://www.php.net/manual/en/ref.session.php you can find the following:
    <br />
    <br />
    session.gc_probability specifies the probability that the gc (garbage collection) routine is started on each request in percent. Defaults to 1.
    <br />
    <br />
    So you were quite close with your guess!
  24. #43
  25. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: (session_start() error) fixed post


    Make sure that there is no space before
    Code:
    <? session_start()
    in your web page.
  26. #44
  27. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: cookie


    Good point but isn't the session_start() ID still intialized on the server? In other words, the cookie is taken from the server.
  28. #45
  29. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Session start


    I have a code "
    <?
    session_start();
    session_register("session");
    ?>
    the result is this... Warning open(/tmp/sess_710bca421ecd851554ef5fff0a379158 O_RDWR) failed: m (2) in E:WEB_PR~1php73.php on line <b>4</b><br> Warning: open(/tmp/sess_710bca421ecd851554ef5fff0a379158, O_RDWR) failed: m (2) in Unknown on line 0 Warning: Some can tell me anything about this??

IMN logo majestic logo threadwatch logo seochat tools logo