Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-06-2009, 08:53 AM   PM User | #1
shubho
New Coder

 
Join Date: May 2009
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
shubho has a little shameless behaviour in the past
undefined index error

I am new in php.I get following error

undefined index :username on line 12.The code is as below

<?php session_start();
if(isset($_COOKIE["usNick"]) && isset($_COOKIE["usPass"])){ ?>
<META HTTP-EQUIV="REFRESH" CONTENT="0;URL=myaccount.php">
<?php
exit();
}

$display_error = "";
$username = "";

if ($_POST['username']) {
$username = $_POST['username'];
if( strtolower($_POST['code'])!= strtolower($_SESSION['texto'])){
$display_error = "* Security Code Error"; // error language
include ('error.php');
exit();
}else{
include('includes/config.inc.php');
$username=uc($_POST['username']);
$pass=uc($_POST['password']);
$password = sha1($pass);

if ($password==NULL) {
$display_error = "* All fields are required"; // error language
include ('error.php');
exit();
}else{

please help with this coding

Last edited by shubho; 05-06-2009 at 09:00 AM.. Reason: highlight
shubho is offline   Reply With Quote
Old 05-06-2009, 09:03 AM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Try changing
Quote:
PHP Code:
if ($_POST['username']) { 
to
PHP Code:
if (isset($_POST['username'])) { 
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 05-06-2009, 10:59 AM   PM User | #3
shubho
New Coder

 
Join Date: May 2009
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
shubho has a little shameless behaviour in the past
Thanks

Thanks a lot

it worked
shubho is offline   Reply With Quote
Old 07-22-2012, 10:23 AM   PM User | #4
vineet2011
New to the CF scene

 
Join Date: Jul 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
vineet2011 is an unknown quantity at this point
ya it worked for me too
thanks
vineet2011 is offline   Reply With Quote
Reply

Bookmarks

Tags
code, php

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:27 AM.


Advertisement
Log in to turn off these ads.