Jump to content

awfullook

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

awfullook's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ha! It wasn't a stupid question. It was one the most valid questions asked thus far. After changing the contents of session.cookie_domain.... I saved the php.ini file - but didn't restart Apache. Now I have restarted apache, my original code, and the test code provided by cssfreakie now work as intended. Thank you all, and sorry for noob-based action we have all experienced on this thread. Cheers, marking as solved.
  2. The loaded config file according to phpinfo() is '/etc/php5/apache2/php.ini' which is indeed the one I am editing. The mystery deepens.
  3. Hi there, thanks. php.ini has a blank value for session.cookie_domain. This from php.net "session.cookie_domain specifies the domain to set in the session cookie. Default is none at all meaning the host name of the server which generated the cookie according to cookies specification." So, can you give me an example of what should be there? I am running all this from my local computer, which is a LAMP. But you probably guessed that. As far as I know my localhost domain is similar to "www.sub.mydomain.org.com". A subdomain. Thanks
  4. Hi there. I'm pretty sure I haven't disabled cookies. Looking in my cookies, there are entries for sites I have visited in the past few days... php session info: Session Support enabled Registered save handlers files user Registered serializer handlers php php_binary wddx Directive Local Value Master Value session.auto_start Off Off session.bug_compat_42 Off Off session.bug_compat_warn Off Off session.cache_expire 180 180 session.cache_limiter nocache nocache session.cookie_domain http://localhost/ http://localhost/ session.cookie_httponly Off Off session.cookie_lifetime 0 0 session.cookie_path / / session.cookie_secure Off Off session.entropy_file no value no value session.entropy_length 0 0 session.gc_divisor 1000 1000 session.gc_maxlifetime 1440 1440 session.gc_probability 1 1 session.hash_bits_per_character 5 5 session.hash_function 0 0 session.name PHPSESSID PHPSESSID session.referer_check no value no value session.save_handler files files session.save_path /tmp /tmp session.serialize_handler php php session.use_cookies On On session.use_only_cookies On On session.use_trans_sid 0 0 Sorry, that looks a bit messy.
  5. There is no PHPSESSID cookie for page1.php.... @jcbones - I checked php.ini and those entries were as you have posted... Thanks.
  6. Hi there. So I created the two files with the script you sent. page1.php and page2.php. Accessed page1.php, then in the URL swapped over to page2.php.... 'THIS IS PAGE 2 it seems session monkeys is not yet set you are trying to access this page before page 1.' What is wrong here? I'm not accessing page 2 beofre page 1. I access page 1 first, there is no link between them so in my browser address bar changed 'page1' to read 'page2'... Could this be a set up problem? Permissions? I'm on Ubuntu 11.04, PHP Version 5.3.5-1 ubuntu7.2.
  7. Hi There Thanks for the help. I forgot to mention that I was indeed accessing the second sript via the first one, so the session should have started. I added the code to both scripts, ran movie1.php and followed the link to open moviesite.php and this is the output: Notice: Undefined index: authuser in /home/rory/public_html/web development/MySQL_php/moviesite.php on line 11 Welcome to our site, Notice: Undefined index: username in /home/rory/public_html/web development/MySQL_php/moviesite.php on line 23 ! My favourite movie is The Life of Brian My movie rating for this movie is 5 Undefined index on line 11 and 23? Thanks
  8. Hello. I am just beginning to teach myself the basics of php. I am learning from books and video tutorials etc. I have come across a problem that I just can't work out, I'm sure it is very simple. Two files, movie1.php and moviesite.php, movie1.php looks like this: <?php session_start(); $_SESSION['username'] = "Joe12345"; $_SESSION['authuser'] = 1; ?> <html> <head> <title>Find My Movie!</title> </head> <body> <?php $myfavmovie = urlencode("The Life of Brian"); echo "<a href='moviesite.php?favmovie=$myfavmovie'>"; echo "click here to see information about my favourite movie!"; echo "</a>" ?> </body> </html> OK? You see the '$_SESSION['username'] = "Joe12345";', this is my specific problem. This should be echoed into the next page, moviesite.php which you can see below: <?php session_start(); //check to see if the user has logged in with a valid password if ($_SESSION['authuser'] != 0) { echo "sorry, but you don't 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 favourite movie is "; echo $_REQUEST['favmovie']; echo "<br>"; $movierate = 5; echo "My movie rating for this movie is "; echo $movierate; ?> </body> </html> OK? 'echo $_SESSION['username'];' does not echo the username. Everything else seems to be ok. This is an example I have been working on from the book 'Beginning PHP, MySQL and Apache Web Development'. I hope someone can help. The username 'Joe12345' is not carried to the next page. It is just blank. Many Thanks for all and any assistance people can give me.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.