Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 316
0 Users 22 Guests Online
Posted on Thursday 20th March 2008 at 05:30 PM
test
templates/default/images/noavatar.png's Avatar
Newbie
Error

Notice: Undefined index: id in config.php on line 6
Notice: Undefined index: password in config.php on line 6

config.php line 6
$logged = mysql_query("SELECT * FROM `members` WHERE `id` = '$_SESSION[id]' AND `password` = '$_SESSION[password]'");

Login.php

<?php
session_start(); //allows session
include "config.php";
echo "<center>";

if($logged['id']) {
//welcomes the member
echo "Welcome $logged[username]<br><br>";
//shows the user menu
echo "
- <a href='editprofile.php'>Edit Profile</a><br>
- <a href='changepassword.php'>Change Password</a><br>
- <a href='members.php'>Members</a><br>
- <a href='logout.php?logout'>Logout</a>";
}else
//if there trying to login
if(isset($_GET['login'])) {
//removes sql injections from the data
$username= htmlspecialchars(addslashes($_POST['username']));
//encrypts the password
$password = sha1(md5(md5(sha1(md5(sha1(sha1(md5($_POST['password']))))))));
//gets the username data from the members database
$uinfo = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'") or die(mysql_error());
//see if the user exists
$checkuser = mysql_num_rows($uinfo);
//if user name not found in database error
if($checkuser == '0')
{
echo "Username not found";
}else{
//fetch the sql
$udata = mysql_fetch_array($uinfo);
//checks see if the account is verified
if($udata['userlevel'] == 1) {
echo "This account had not been verified.";
}
//if it is continue
else
//if the db password and the logged in password are the same login
if($udata['password'] == $password) {
$query = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'") or die(mysql_error());
//fetchs the sql
$user = mysql_fetch_array($query);
//sets the logged session
$_SESSION['id'] = "$user[id]";
$_SESSION['password'] = "$user[password]";

echo "You are now logged in, Please wait. . .";
//redirects them
echo "<meta http-equiv='Refresh' content='2; URL=index.php'/>";
}
//wrong password
else{
echo "Incorrect username or password!";
}
}
}else{
//If not the above show the login form
echo "<form action='login.php?login' method='post'>
<table>
<tr height='5'>
<td align='left'><font color='000000'>Username: </font></td>
</tr>
<tr height='5'>
<td align='left'><input type='text' name='username' size='30' maxlength='15'></td>
</tr>
<tr height='5'>
<td align='left'><font color='000000'>Password: <Br></font></td>
</tr>
<tr height='5'>
<td align='left'><input type='password' name='password' size='30' maxlength='15'><br><a href='./register.php' title='Register'>Register</a> / <a href='./lostpassword.php' title='Lost Password'>Forgot Password?</a></td>
</tr>
<tr>
<td align='left' colspan='2'><p><Br><input type='submit' value='Login'> <input type='reset' value='Reset'></td>
</tr>
</table>

</form>";
}
echo "<center>";
?>
Posted on Thursday 20th March 2008 at 06:33 PM
test
templates/default/images/noavatar.png's Avatar
Newbie
Notice: A session had already been started - ignoring session_start() inconfig.php on line 2

Notice: Undefined index: id in config.php on line 7

Notice: Undefined index: password in config.php on line 7


Notice: Use of undefined constant id - assumed 'id' in login.php on line 6
Posted on Thursday 20th March 2008 at 07:00 PM
ShadowMage
templates/default/images/noavatar.png's Avatar
Senior Member
WHat the error is saying is where you have things like $_SESSION[stuff] it wants them to be $_SESSION['stuff'];
Posted on Thursday 20th March 2008 at 07:04 PM
DanielXP
avatars/1.png's Avatar
Senior Member
PHP Code
1
$logged = mysql_query("SELECT * FROM `members` WHERE `id` = '" . $_SESSION['id'] . "' AND `password` = '" . $_SESSION['password'] . "'");


For your line 6
Posted on Monday 24th March 2008 at 12:17 AM
test
templates/default/images/noavatar.png's Avatar
Newbie
i tryed that b4
Posted on Wednesday 26th March 2008 at 06:33 PM
ShadowMage
templates/default/images/noavatar.png's Avatar
Senior Member
did it do anything with it?
Posted on Monday 7th April 2008 at 06:52 AM
test
templates/default/images/noavatar.png's Avatar
Newbie
no it is the same error
Posted on Monday 7th April 2008 at 07:03 AM
test
templates/default/images/noavatar.png's Avatar
Newbie
Line 6: $logged = mysql_query("SELECT * FROM `members` WHERE `id` = '" . $_SESSION['id'] . "' AND `password` = '" . $_SESSION['password'] . "'");
Line 7:$logged = mysql_fetch_array($logged);

//some server details, don't edit!
$host = $_SERVER['HTTP_HOST'];
$self = $_SERVER['PHP_SELF'];

Notice: Undefined index: id in config.php on line 6

Notice: Undefined index: password in config.php on line 6
Posted on Monday 14th April 2008 at 11:37 AM
test
templates/default/images/noavatar.png's Avatar
Newbie
i have figured that if you change . $_SESSION['this'] .
then the undefined index changes to that value
Posted on Monday 14th April 2008 at 05:50 PM
darklight19
templates/default/images/noavatar.png's Avatar
Active Member
try $logged = mysql_query("SELECT * FROM members WHERE `id` = '$_SESSION[id]' AND `password` = '$_SESSION[password]'");