Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 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
  #1 (permalink)  
Old November 30th, 2004, 12:54 AM
Authorized User
 
Join Date: Nov 2004
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to IP076
Default Adding an option to change password to movie db

Hey all, I've successfully changed the login to call my db and verify passwords for different users.

I've even successfully set up pages that allow the user to change their password.

Now, after the user changes the password, I give them a link back to the main movie1.php page.

When you go back to that page, I get two undefined index errors at the top...here is the code at the top of my page, errors are on line 3 & 4 for user and pass

<?php
session_start();
$_SESSION['username']=$_POST['user'];
$_SESSION['userpass']=$_POST['pass'];
$_SESSION['authuser']=0;

Now....I dont want to start the session over again correct? the session variables should still be set, but how do I let the script know that?

I'm sure theres probably a simple answer, if anyone takes a second to let me know, I'd greatly appreciate it.

Thank you!

  #2 (permalink)  
Old November 30th, 2004, 12:12 PM
Friend of Wrox
 
Join Date: Jun 2004
Location: Fairfield, Iowa, USA.
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try this:
if(!(isset($_SESSION['username']) && isset($_SESSION['username'])) {
$_SESSION['username']=$_POST['user'];
$_SESSION['userpass']=$_POST['pass'];
$_SESSION['authuser']=0;
}

Christian
  #3 (permalink)  
Old November 30th, 2004, 12:34 PM
Authorized User
 
Join Date: Nov 2004
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to IP076
Default

Thanks again for the info...

I'll try that as another option.

Basically, I have my login form page, then I have a script page that logs you in and redirects you to the index main page. This works fine for my needs, so far, but I'll remember your tidbit of code there.

Thanks again!

  #4 (permalink)  
Old November 30th, 2004, 01:08 PM
Friend of Wrox
 
Join Date: Jun 2004
Location: Fairfield, Iowa, USA.
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default

My pleasure

Christian


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change user name option jackandjo BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 October 11th, 2006 03:40 PM
PrintPreviewDialog1. Change printer option peterasimpson VB How-To 0 July 24th, 2006 06:44 AM
adding option elements dynamically to a select richard.york Javascript 4 December 5th, 2003 04:57 AM
change password help budakcomel Classic ASP Databases 0 July 29th, 2003 09:51 PM





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