Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 03-13-2006, 08:33 PM   #1 (permalink)
Crono254
Registered User
 
Join Date: Mar 2006
Posts: 1
Crono254 is on a distinguished road
Small problem

Hello. I have followed the guide on here:
http://php.codenewbie.com/articles/p...ns-Page_1.html
and i've done everything according to it.
Well everything is working succesfully but when i go onto my site with this script, it has some errors on the top that say:

Quote:
Notice: Undefined index: username in c:\program files\easyphp1-7\www\inc\auth.php on line 16

Notice: Undefined index: password in c:\program files\easyphp1-7\www\inc\auth.php on line 16
this happens when im not logged in. my auth.php looks like this:
PHP Code:
<?
// Login & Session example by sde
// auth.php

// start session
session_start(); 

// convert username and password from _POST or _SESSION
if($_POST){
  
$_SESSION['username']=$_POST["username"];
  
$_SESSION['password']=$_POST["password"];  
}

// query for a user/pass match
$result=mysql_query("select * from users 
  where username='" 
$_SESSION['username'] . "' and password='" $_SESSION['password'] . "'");

// retrieve number of rows resulted
$num=mysql_num_rows($result); 

// print login form and exit if failed.
if($num 1){
  echo 
"You are not authenticated.  Please login.<br><br>
  
  <form method=POST action=index.php>
  username: <input type=text name=\"username\">
  password: <input type=password name=\"password\">
  <input type=submit>
  </form>"
;
  
  exit;
}
?>
Is there any problem why it would say that? I am really new to PHP and mySql scripting, so some help would be appreciated. thanks.
Crono254 is offline   Reply With Quote
Old 03-13-2006, 09:01 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,532
sde is on a distinguished road
is this your server, and do you have control of the php.ini file? by default, php is set to report all notices, warnings, and errors. usually, php is setup to report all except for notices.

look in your php.ini file and set error reporting as below
Code:
error_reporting  =  E_ALL & ~E_NOTICE
then restart your web server and the notices should go away.
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
parse error problem in game.. can't seem to find problem solution. slashdot Standard C, C++ 5 08-03-2005 09:15 PM
JSP code problem j.gohel Java 7 04-15-2005 03:07 PM
Hashing problem jodders Standard C, C++ 1 02-09-2005 02:51 PM
Applications for a small Linux server for a small business.... Admin Linux / BSD / OS X 4 07-04-2004 05:16 PM
Help debugging a power problem Belisarius Lounge 0 10-25-2003 05:44 PM


All times are GMT -8. The time now is 07:39 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting