[PHP] Document Contains No Data in Netscape?
I have a set of pages I've been working on to do address entry for registered users to a MySQL database. I'm running up against a wall that I've been fighting for two days... process is thus: checks session vars to see if user is logged in. if not, present login screen. if logged in: see if this is a submitted form, or a blank request for one. if blank request, present the HTML form. if submitted: check the incoming data to determine if the address type (home, work or other) is set. if not, give error. if set, checks to see if that type was already in the database for that user, and checks to see if this address was flagged as the mailing address. if either case, give error and exit. past all that? The the script SHOULD run the mysql_query and insert the submitted data to the database. if successful, should return one of two options: either go to the site main index page, or reload a blank address form if the user wants to enter an additional address. My problem is coming in AFTER the type and mailing checks, and before the mysql_query. I can't find any problems with the script; everything looks right to me. However: if I fill out the form and leave out the type field, I get the correct error. if I mark a type that exists in the database already, or that type already has a mailing flag set, I get the correct error. if I fill out the form correctly, and hit either button, I get a Netscape error "Document Contains No Data". What in tarnation is going on? Can someone help me please? Robert Cooper AwakeningRetreat.Net Webmaster - Attached script below address.php - Must Specify address type. Click the back arrow on your browser, select a type, and resubmit. http://www.awakeningretreat.net/\">Continue without entering address information."; include("footer.html"); exit; } else { mysql_connect("localhost","www","") or die("Unable to connect to SQL server"); mysql_select_db("awakening") or die("Unable to select database"); $query = mysql_query("select type, mailing from address where id='$id'"); $result = mysql_num_rows($query); if ($result > 0 ) { while ($row = mysql_fetch_array($query)) { if ($row[type] == $type) echo "$type address already exists in database. Back to address entry."; if ($row[mailing] == $mailing) echo "You have already defined $row[type] as mailing address. Back to address entry."; } exit; } else { $result = mysql_query("INSERT INTO address VALUES ('$id', '$street', '$city', '$state', '$ZIP', '$type', '$mailing')"); if (!$result) { echo "Unknown database error in address. Please contact the mailto:[EMAIL PROTECTED]\">Webmaster with this information."; exit; } else { include("header.html"); echo "Finished updating addresses."; include("footer.html"); switch ($action) { case "Finish" : header("Location: http://www.awakeningretreat.net/"); break; case "Add Another" : header("Location: /register/address.php"); break; } } } } } else { include("header.html"); echo " Address Information Street : City : State : ZIP : Address Type : HOME WORKOTHER This is my Mailing Address Submit and: http://www.awakeningretreat.net/\">OR: continue without entering address information. NOTES: Privacy Policy All fields on this page are optional. However, answering them will help other Awakeners find you! "; include("footer.html"); } } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session not destroying properly
I'm running the following to kill a session, and haven't had any problems with it yet... try >session_start(); >before the if statement - otherwise it will always be FALSE...btw the >'unset()' is redundant i think. > >- Original Message - >From: "Mike Yuen" <[EMAIL PROTECTED]> >To: "trogers" <[EMAIL PROTECTED]> >Cc: "Yasuo Ohgaki" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> >Sent: Wednesday, March 07, 2001 5:11 PM >Subject: Re: [PHP] Session not destroying properly > > > > Thanks for the suggestion, I tried that and it still doesn't seem to be > > working. > > Here's what i've got so far on my page (index.php). > > > > > if(session_is_registered("CUserName")) > > { > > session_destroy(); > > unset($CUserName); > > header("Location: $PHP_SELF"); > > } > > else > > { > > session_register("CUserName"); > > $CUserNameSession="CUserName"; > > } > > //SNIP > > ?> > > > > Hope you can see something I don't. Thanks, > > Mike > > > > On Tue, 6 Mar 2001, trogers wrote: > > > > > > > > Hi > > > You will need to kill the session data on the exit of your failed login >not > > > on entry to the login page as the data will already be overwritten by >the > > > previous session value. > > > I use > > > unset($name); > > > unset($password); > > > ... > > > > > > Tom > > > > > > > > > At 04:24 PM 6/03/01 +0900, Yasuo Ohgaki wrote: > > > >Do you use custom session handlers? > > > >Try session_unset() also. It may help. > > > > > > > >Regards, > > > >Yasuo Ohgaki > > > > > > > > > > > > > Got a problem with sessions. > > > > > > > > > > On my index page, there's a place for people to login. Well, when I >test > > > > > with two different user names (ie: mike and jlo) it reverts to the >first > > > > > one when login fails. For example: > > > > > I enter in the username "myuen" and a wrong password. I get my > > > > > "Password/Username invalid" message which is what I want. > > > > > > > > > > The page refreshes, the username slot already has myuen in it from >the > > > > > last entry, I erase it, enter in a new username "jlo" and the >correct > > > > > password and it will not log me in. > > > > > > > > > > I know once you attempt to login, it saves the username as a session > > > > > variable. On my index.php page, I have a script that checks if a >session > > > > > exists (particularly the Username), if it exists, destroy it >otherwise, > > > > > continue on. Obviously it's not destroying it once we enter in a >wrong > > > > > username and try to login again. > > > > > > > > > > Any ideas on how to fix this? > > > > > > > > > > Here's my coding: > > > > > > > > > if(session_is_registered("CUserName")) > > > > > session_destroy(); > > > > > > > > > > session_register("CUserName"); > > > > > $CUserNameSession="CUserName"; > > > > > > > > > > //SNIP > > > > > ?> > > > > > > > > > > > >-- > > > >PHP General Mailing List (http://www.php.net/) > > > >To unsubscribe, e-mail: [EMAIL PROTECTED] > > > >For additional commands, e-mail: [EMAIL PROTECTED] > > > >To contact the list administrators, e-mail: >[EMAIL PROTECTED] > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]