Jump to content
xisto Community
Sign in to follow this  
Eggie

Login Form Not Working

Recommended Posts

I am "rewriting" my old game scripts and i am having problems with it ...
right now i am having problems recovering my login form script

this is in my head.php

<tr><form method=post action=login.php>						  <td align="center"><b>Name</b></td>						</tr>						<tr>						  <td align="center"><input type=text name=user size="12"></td>						</tr>						<tr>						  <td align="center"><b>Password</b></td>						</tr>						<tr>						  <td align="center"><input type=password name=pass size="12"></td>						</tr>						<tr>						  <td align="center">							<p align="center"><input type=submit value=Login></form></p>

this is in my login.php
<?php $title = "Login"; if (!$user || !$pass) {	include("head.php");	print "Please fill out all fields.";	include("foot.php");	exit;}


it says "Notice: Undefined variable: user in C:\wamp\www\login.php on line 2" when i try to login ...
what is the problem??it worked before.

Share this post


Link to post
Share on other sites

Hi Eggie,Newer versions of PHP now have autoglobals off, which means POST'ed data no long take on generating their equivalent named variable.What you now have to do is:$user = $_POST['user'];$pass = $_POST['pass'];Your scripts could do with some better checks though to make sure the data exists, otherwise you're going to throw up warnings if you had error reporting on.Cheers,MC

Share this post


Link to post
Share on other sites

Hi mastercomputers,i can see some things have been changed on php...this doesn't sound good ;)so,i can't just make "autoglobals" on??i have many errors since last time i used my site(which is no longer hosted,i am using wamp to finish it)i will need to make many changes on my site because of this,and i won't if i can do something else ;)Thanks...Eggie

Share this post


Link to post
Share on other sites

I would recommend leaving register_globals OFF. Having register_globals ON is very dangerous as stated by the PHP team: http://php.net/manual/en/security.globals.php

 

Learn to validate input and develop with register_globals off, cause it is easy to hack into your site if you leave register globals on.

Share this post


Link to post
Share on other sites

You should leave the register global off and take a lookof this function. It can temp. import global variables ($_POST*, $_GET*, $_COOKIE*) into typical scalar variables similar to register global on.After the script work correctly. You can update all of your scripts to work with register global off.

Share this post


Link to post
Share on other sites

You should probably check your code for deprecated functions as well. A lot of functions were superseded by either improved versions or replaced completely in PHP 5 and will be removed in PHP 6. It's funny though because a lot of web hosts are still using PHP 4 and are refusing to upgrade to 5.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.