TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-09-2010, 10:00 AM   #1 (permalink)
The Wanderer
 
oshash's Avatar
 
Join Date: Jan 2010
Posts: 6
Thanks: 1
oshash is on a distinguished road
Asterix Notice:

Can any body tell me wat is this error for plz
Notice: Undefined index: login in C:\wamp\www\kamsar_011208_server\registration\user \query\general_query.php on line 3
My general_query.php is
PHP Code:
<?php
// error is here--\/
if($_SESSION['login']=='true') { $include_where_clause " WHERE reg_id='$_SESSION[login_mem_reg_id]'"; }
else 
$include_where_clause "";

$sql_get_rel "SELECT * FROM " TABLE_RELATIONSHIPS  ;
$rs_get_rel $db->Execute($sql_get_rel);

$sql_get_pro "SELECT * FROM " TABLE_PROFESSIONS  ;
$rs_get_pro $db->Execute($sql_get_pro);

$sql_get_edu "SELECT * FROM " TABLE_EDUCATIONS  ;
$rs_get_edu $db->Execute($sql_get_edu);

$sql_get_sta "SELECT * FROM " TABLE_STATES  ;
$rs_get_sta $db->Execute($sql_get_sta);  //etc etc....
oshash is offline  
Reply With Quote
Old 01-09-2010, 10:38 AM   #2 (permalink)
The Wanderer
Newcomer 
 
Parvus's Avatar
 
Join Date: Aug 2008
Posts: 21
Thanks: 1
Parvus is on a distinguished road
Default

if($_SESSION['login']=='true')

You are checking if the login session is true, but apparently there is no session with a name like that.
You could put a check before that line with: if(isset($_SESSION['login'])){}
to check if the login session exists or not.
Parvus is offline  
Reply With Quote
Old 01-09-2010, 11:33 AM   #3 (permalink)
The Wanderer
 
oshash's Avatar
 
Join Date: Jan 2010
Posts: 6
Thanks: 1
oshash is on a distinguished road
Asterix But

But the problem is the page loads the home page loads with the same error(s) and when i put this code
PHP Code:
<?php  error_reporting(E_ALL & ~E_NOTICE)  ?>
in admin index.php this errors goes...!!!
and when i try to login in admin page it logins without any username and password
oshash is offline  
Reply With Quote
Old 01-09-2010, 12:09 PM   #4 (permalink)
The Wanderer
Newcomer 
 
Parvus's Avatar
 
Join Date: Aug 2008
Posts: 21
Thanks: 1
Parvus is on a distinguished road
Default

If you can access the admin page without logging in, it means that your not validating if the user is logged in or not.

You have to put a check around the whole admin page and not for 1 line of code.
PHP Code:
if(isset($_SESSION['login']) && $_SESSION['login']=='true'){
// Your admin code goes here

Parvus is offline  
Reply With Quote
Old 01-09-2010, 04:09 PM   #5 (permalink)
The Addict
 
Join Date: May 2009
Posts: 287
Thanks: 5
adamdecaf is on a distinguished road
Default

When you run

PHP Code:
<?php  error_reporting(E_ALL & ~E_NOTICE);  ?>
You're changing how PHP displays errors, which will show or not show errors and PHP will ignore the error(s).
__________________
My Site
adamdecaf is offline  
Reply With Quote
Old 01-23-2010, 05:41 PM   #6 (permalink)
The Wanderer
 
Join Date: Aug 2009
Posts: 17
Thanks: 0
Rhinos is on a distinguished road
Default

Basically what that warning is saying is that your trying to use an index of an array in a statement before you have actually defined the index.

So there are two ways you could overcome this. The first is the code that Parvus posted and the second way is by setting a default value for that index if it hasn't already been set yet (this method is better if you are referencing the index many times throughout your scripts.

PHP Code:
if (!isset($_SESSION['login'])) {
    
$_SESSION['login'] = 'false'// change to whatever default value you want
}

// ...

if ($_SESSION['login'] == 'true') {
    
// ...

Rhinos is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB 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
Strange Notice Error ..... ioan1k General 2 08-30-2009 01:37 PM
cant work this error out talonos Absolute Beginners 11 07-13-2009 11:03 AM
Form Validation Not Working :( Guezala Absolute Beginners 27 05-13-2009 08:28 PM
[help] Cookies douesnt register why why !!!!! webtuto Absolute Beginners 38 01-04-2008 11:26 PM
Trying to create a "sign up form"....help please RogueDogg Absolute Beginners 31 06-03-2005 06:26 AM


All times are GMT. The time now is 11:10 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design