Posted by Fire Juggler on 07/11/05 12:27
thanks
when i use session_start(); i'm getting errors saying that headers already
sent.
Y?
Thanks
--
Kathryn (Fire Juggler)
http://www.firejugglers.34sp.com
http://www.cornwalljugglers.co.uk
"Peter van Schie" <vanschie.peter@gmail.com> wrote in message
news:1121072760.877484.259090@f14g2000cwb.googlegroups.com...
> Use session_start in each script you want to use your session
> variables:
>
> addphotos2.php
> <?php
> session_start();
> // check if $_GET['folder'] is set, if not use the session-var
> //
> if (isset($_GET['folder'])
> {
> $folder = $_GET['folder'];
> $_SESSION['folder'] = $folder;
> }
> else
> {
> $folder = $_SESSION['folder'];
> }
>
> .... other code ....
> ?>
>
> in connectphotos.php you should destroy the session when you don't need
> it anymore. That's probably when you don't have an error, so you get:
>
> <?php
> session_start();
>
> if
>
(file_exists("/usr/local/psa/home/vhosts/x-tractband.co.uk/httpdocs/x-tract/
photos/".$folder."/".$_FILES['imagefile']['name']))
> {
> $error= "<font face=\"Arial\" color=\"Yellow\"><strong>File with
> name
> (".$_FILES["imagefile"]["name"] .") already exists</strong></font><br>
> ";
>
> include 'addphoto2.php';
> }
> else
> {
> session_destroy();
> }
> ?>
>
> Also make sure to read the PHP manual page on sessions:
> http://nl3.php.net/session_start
>
> --
> http://www.phpforums.nl
>
[Back to original message]
|