Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 19th, 2005, 11:50 AM
Registered User
 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Session Error :(

New to PHP and im Reading this book and going through sessions Im getting this error


Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\web\moviesite.php:1) in c:\web\moviesite.php on line 2
Sorry, but you dont have permission to view this page



 
Old January 19th, 2005, 11:52 AM
Registered User
 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh yeah so any help on why im getting this error would be appreciated lol,
heres my code: moviesite.php:

 <?php
 session_start();
  //check to see if user has logged in with a valid password
   if ($_SESSION['authuser']=1) {
   echo "Sorry, but you dont have permission to view this page";
       exit();
   }
  ?>

<HTML>
<HEAD>
<TITLE>MY Movie Site <?php echo $_REQUEST['favmovie'] ?></title>
</head>
<body>
<?php
  echo "Welcome to our site, ";
  echo $_SESSION['username'];
  echo "! <BR>";
  echo "My favorite movie is: ";
  echo $_REQUEST['favmovie'];
  echo "<br>";
  $movierate = 5;
  echo "My movie rating for this movie is:";
  echo $movierate
  ?>
  </body>
  </html>

and
movie1.php:

<?php
 session_start();
 $_SESSION['username']="Joe12345";
 $_SESSION['authuser']=1;
 ?>

 <?php
 $moviesite=urlencode("Life Of Brain");
 echo "<a href='/moviesite.php?favmovie=$moviesite'>";
 echo "Click here to see information about my fav movie";
 echo "</a>";
 ?>



So if its not this is it my php.ini?

THanks

 
Old January 19th, 2005, 04:15 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Remove all whitespace before the opening <?php.

hth,

-Snib - http://www.snibworks.com
Where will you be in 100 years?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Session error gbtx Beginning PHP 4 February 14th, 2008 01:12 AM
Session error message ire Beginning PHP 4 July 4th, 2006 08:50 AM
error:(session expired) hara_sap Servlets 0 March 18th, 2005 05:54 AM
Session Error in PHP Randhy MySQL 8 December 17th, 2004 07:49 AM
mapi.session error louisantony Beginning VB 6 1 January 26th, 2004 11:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.