GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 12-Jul-2009, 09:06
jordanske jordanske is offline
New Member
 
Join Date: Jul 2009
Posts: 1
jordanske is on a distinguished road

Undefined index: id


can some1 help with this , i got an error

Notice: Undefined index: id in C:\wamp\www\test\loginindex.php on line 2

Notice: Undefined index: login in C:\wamp\www\test\loginindex.php on line 5
its not only this script , i got this error on every script ,
i got this cms website from skillms cms its an open source,
help
PHP Code:

<?php include("end.php");
if($_SESSION['id']){
    echo "You are already logged in so you can use the UserCP<br> Click <a href=logout.php>here</a> to log out";
}else{
    if(!$_POST['login']){
        echo "<fieldset><legend><b>Login to SkillMS</b></legend>";
        echo "<form method=\"POST\"><center><table border=\"0\" width=\"100\">";
        echo "<tr><td align=\"right\" width=\"50%\"><b>Username:</b></td><td><input type=\"text\" name=\"username\" maxlength=\"10\"></td></tr>";
        echo "<tr><td align=\"right\"><b>Password:</b></td><td><input type=\"password\" name=\"password\" maxlength=\"10\"></td></tr>";
        echo "<tr><td></td><td><input type=\"submit\" name=\"login\" value=\"Login\"></td></tr>";
        echo "</table></center></form>";
        echo "</fieldset>";
    }else{
        $u = mysql_real_escape_string($_POST['username']);
        $p = mysql_real_escape_string($_POST['password']);
        $s = mysql_query("SELECT * FROM `accounts` WHERE `name`='".$u."'") or die(mysql_error());
        $i = mysql_fetch_array($s);
        
        if($i['password'] == hash('sha512',$p.$i['salt']) || sha1($p) == $i['password']){
            $user = mysql_query("SELECT * FROM `accounts` WHERE `name`='".$i['name']."' AND `password`='".$i['password']."'") or die(mysql_error());
            $auser = mysql_fetch_array($user);
            $_SESSION['id'] = $auser['id'];
            $_SESSION['name'] = $auser['name'];
            $_SESSION['mute'] = $auser['mute'];
            if($auser['webadmin'] == "1"){
                $_SESSION['admin'] = $auser['webadmin'];
            }
            if($auser['gm'] == "1"){
                $_SESSION['gm'] = $auser['gm'];
            }
            $name = mysql_query("SELECT * FROM `web_profile` WHERE `accountid`='".$auser['id']."'") or die(mysql_error());
            $pname = mysql_fetch_array($name);
            if($pname['name'] == NULL){
                $_SESSION['pname'] = NULL;
            }else{
                $_SESSION['pname'] = $pname['name'];
            }
            echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=community.php\">";
        }else{
            echo "The informations you supplied do not match/exist!";
        }
    }
}

  #2  
Old 19-Jul-2009, 15:44
MisterChucker's Avatar
MisterChucker MisterChucker is offline
Junior Member
 
Join Date: Mar 2009
Location: Cyberspace, Earth
Posts: 53
MisterChucker is a jewel in the roughMisterChucker is a jewel in the roughMisterChucker is a jewel in the rough

Re: Undefined index: id


Change this line
PHP Code:

if($_SESSION['id']){ 


to
PHP Code:

if(isset($_SESSION['id']) && $_SESSION['id']){ 


and this line
PHP Code:

if(!$_POST['login']){ 


to
PHP Code:

if(empty($_POST['login'])){ 


 
 

Recent GIDBlogGID Spam Detector 1.1.0 by gidnetwork

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Str_Misaligned in Double Link List Peter_APIIT C Programming Language 1 29-Feb-2008 20:50
Drawing Program Max_Payne C++ Forum 13 23-Dec-2007 18:06
recursive linkedl list insert skeet123 C++ Forum 0 07-Dec-2005 18:01
Google searchengine programming onauc Open Discussion Forum 5 22-Dec-2004 15:50
hashing help saiz66 C++ Forum 1 06-Jul-2004 06:16

Network Sites: GIDNetwork · GIDApp · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 22:49.


vBulletin, Copyright © 2000 - 2013, Jelsoft Enterprises Ltd.