You are here: Re: Sessions « PHP Language « IT news, forums, messages
Re: Sessions

Posted by Stefan Rybacki on 01/07/06 18:35

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kathryn Gill wrote:
> this is some of the code
>
> mempic.php
>
>
> <?php session_start(); ?>
> {other code}
> <?php
>
> if (isset($_GET['id']))
> {
> $id = $_GET['id'];
> $_SESSION['id'] = $id;
> }
> else
> {
> $id = $_SESSION['id'];
> }
> if (isset($_GET['clan']))
> {
> $clan = $_GET['clan'];
> $_SESSION['clan'] = $clan;
> }
> else
> {
> $clan = $_SESSION['clan'];
> }
> $username='****;
> $password='****';
> $hostname='****';
> $databasename='****';
>
> $mysql_link = mysql_connect($hostname, $username, $password);
> mysql_select_db($databasename);
>
>
> $numresults=mysql_query("SELECT picture FROM ".$clan." WHERE id=".$id."");
> $numrows=mysql_num_rows($numresults);
> while ($row = mysql_fetch_array($numresults)) {
> if ($row{'picture'}==""){
> echo "<img width=\"150\" src=\"images/nopic.gif\"><br>";}
> else {
> echo "<p align=\"left\" class=\"header\">Current Picture: <p align=\"left\"
> class=\"header\">";
> $pathold=$row{'picture'}
> ?>
> <img width="150" src="../<?php echo $row{'picture'};?>"><p align="left"
> class="header">
> <?php }}
> echo $error;
>
> ?>
>
> <p align="left" class="header">
> <form action="connectpic.php" method="post" enctype="multipart/form-data">
> <input type="hidden" name="pathold" value="<?php echo $pathold; ?>">
> <input type="hidden" name="id" value="<?php echo $id; ?>">
> <input type="hidden" name="clan" value="<?php echo $clan; ?>">
> Upload New Photo:<br>
> <input type="file" name="picture" size="30"><p align="left" class="header">
> <input type="submit" value="Add Photo To Profile" name="submit"> Please
> click only once, this may take a while.
> </form>
>
> connectpic.php
>
> {other code}
> <?php
> if ($_FILES["picture"]["name"] == "")
> {
> if (!($pathold==""))
> {
> $del="/usr/local/psa/home/vhosts/clan3cho.co.uk/httpdocs/".$pathold;
> unlink($del);
> }
> $update = "UPDATE ".$clan." SET picture='' WHERE id=".$id."";
> mysql_query($update,$mysql_link) or die ($clan);
> $mysql_insert = mysql_query($update, $mysql_link) or die(failed);
> include 'memsub.php';
> session_destroy();
> }
> else
> {
> if
> (file_exists("/usr/local/psa/home/vhosts/clan3cho.co.uk/httpdocs/photos/".$_
> FILES['picture']['name']))
> {
> $error= "<font face=\"Arial\" color=\"Yellow\"><strong>File with name
> (".$_FILES['picture']['name'] .") already exists</strong></font><br>";
> include 'mempic.php';

I guess its because of this. See you have output before you reach session_start
in mempic.php. That is what I was telling you before. session_start has to be
before any output and in your case connectpic.php is doing some outputs before
including mempic.php and therefore session_start

Regards
Stefan

>...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1rc2 (MingW32)

iD8DBQFDv+3eyeCLzp/JKjARAn+WAKCKE4/jjGVZDrCF/ktplKQ0WK0jagCfefFD
hsQGVOi3rL2h2TA+dZnQDHo=
=qc3F
-----END PGP SIGNATURE-----

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация