I need help with login/register scripts? Which ones would you recommend? Everytime i try one and connect it to a database there is always an error! ALWAYS. I have wamp server 2.1 and php5. So what can the problem be? Maybe im using the wrong code ? oR?
5 replies to this topic
#1
Posted 31 May 2011 - 12:59 AM
|
|
|
#2
Posted 31 May 2011 - 01:09 AM
What is the error? Normally the connect strings should be something like this on certain WAMPs:
"localhost, "root", ""
(server being local, user is root, default password is blank)
"localhost, "root", ""
(server being local, user is root, default password is blank)
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#3
Posted 31 May 2011 - 01:27 AM
well, right now at the moment, these are some notices, and the script works :D But these annoying notices keep coming up whenever i login with the script or before i login. And i have fixed that connection with the database and so on. I am using a script from this site. Its at http://forum.codecal...-forms-php.html
( ! ) Notice: Undefined index: logged in C:\wamp\www\index.php on line 10
( ! ) Notice: Undefined index: userlogin in C:\wamp\www\index.php on line 51
( ! ) Notice: Undefined index: password in C:\wamp\www\index.php on line 5
( ! ) Notice: Undefined index: logged in C:\wamp\www\index.php on line 10
( ! ) Notice: Undefined index: userlogin in C:\wamp\www\index.php on line 51
( ! ) Notice: Undefined index: password in C:\wamp\www\index.php on line 5
#4
Posted 07 June 2011 - 04:32 AM
Are you navigating to the page using the querystring variables? eg.
That should fix these
As for the first one, it's just warning you that the session variable named "logged" isn't set to anything yet.
These aren't errors, they're just "Notices". They're something you should be aware of and you can turn them off by editing your php.ini file (left click the WAMPSERVER icon in your system tray > PHP > php.ini):
(took that from Eliminate WAMP Server 2 Notices?)
FINALLY, you should always check if variables exist before attempting to use them using the
Good luck.
index.php?userlogin=myusername&password=mypassword
That should fix these
Quote
( ! ) Notice: Undefined index: userlogin in C:\wamp\www\index.php on line 51
( ! ) Notice: Undefined index: password in C:\wamp\www\index.php on line 5
( ! ) Notice: Undefined index: password in C:\wamp\www\index.php on line 5
As for the first one, it's just warning you that the session variable named "logged" isn't set to anything yet.
These aren't errors, they're just "Notices". They're something you should be aware of and you can turn them off by editing your php.ini file (left click the WAMPSERVER icon in your system tray > PHP > php.ini):
Quote
Hi. If you just want to hide the notices, please follow one of these:
Look for file "php.ini" in your local install of WAMP, usually inside folder "php".
Open it with your fav editor, then look for Error handling and logging section.
Set/change error_reporting to:
error_reporting = E_ALL & ~E_NOTICE
It will turn of the notice errors while still displaying warning errors.
Or, you may also add this code into your PHP program:
error_reporting(E_ALL & ~E_NOTICE);
Just as that simple. Hope it will help you.
Thanks.
Look for file "php.ini" in your local install of WAMP, usually inside folder "php".
Open it with your fav editor, then look for Error handling and logging section.
Set/change error_reporting to:
error_reporting = E_ALL & ~E_NOTICE
It will turn of the notice errors while still displaying warning errors.
Or, you may also add this code into your PHP program:
error_reporting(E_ALL & ~E_NOTICE);
Just as that simple. Hope it will help you.
Thanks.
(took that from Eliminate WAMP Server 2 Notices?)
FINALLY, you should always check if variables exist before attempting to use them using the
isset()function in php. Then you wouldn't have this problem. I would always recommend better coding over disabling notices any day of the week.
Good luck.
#5
Posted 08 June 2011 - 06:18 AM
If you want to get rid of notices of undeclared variables, use error_reporting on the top of your webpage:
However: while developping your script you might want to keep error and notice reporting enabled for debugging purposes.
<?php error_reporting(0); /* ... your script ... */ ?>
However: while developping your script you might want to keep error and notice reporting enabled for debugging purposes.
#6
Posted 08 June 2011 - 07:00 AM
webcodez said:
If you want to get rid of notices of undeclared variables, use error_reporting on the top of your webpage:
error_reporting(E_ALL & ~E_NOTICE);Or if you really wanted to, you could display nothing and still log them (recommended for production.)
error_reporting(E_ALL);
ini_set('display_errors', "0");
ini_set('log_errors', "1");
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









