* People, sorry my ugly English. I´m Brazilian...

I am looking for learning more about sessions... I´m test this code below
don´t work with me.... My php version is 4.1.2.
Anybody have a complete example code of how use sessions?
Another doubt: Sessions use cookies? What the advantage in use sessions
instead of cookies?

André Cupini
Programador
[EMAIL PROTECTED]
NeoBiz - fábrica de internet
http://www.neobiz.com.br

--------------------------------------------------------------------
Definitely.

- enable cookies on your browser
- make sure you're using PHP >= 4.1

1. Start with a blank text file.

2. Copy and paste this in:
---
<?php
session_start();
if (!isset($_SESSION['count'])) {
    $_SESSION['count'];
}
else {
    $_SESSION['count']++;
}
?>
Hello visitor, you have seen this page <?php echo $_SESSION['count'] ?>
times.<p>
To continue, <A HREF="<?php echo $_SERVER['PHP_SELF']; ?>">click here</A>
---

3. Open it up in your browser, and test that it works (the value of
$_SESSION['count'] should increase with each click)

4. If that much works, open up the URL in a second window, and try to run
two separate sessions... (the first window might be on 10 clicks, and the
new one will be starting from 1)

5. If we're still cool, now try it without cookies maybe, by adding the SID
to the URL that they click on.


If all this works, then the problem is obviously in your code somewhere, not
an issue with PHP/sessions/browsers/cookies/etc.


Justin



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to