Intranet Journal

Go Back   IT Management Forum > Intranet Journal

Intranet Journal The new discussion forum for Intranet Journal readers. Leave comments and questions for IJ authors. Suggest story ideas and provide feedback.

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-26-2008, 12:04 PM
InfinityBound InfinityBound is offline
Registered User
 
Join Date: Oct 2008
Posts: 1
CMS Tutorial -- Login Problem

Hey there,

I'm incredibly new to php and I've spent around 7 hours trying to fix this....

The problem is:

A) User inputs wrong username or password.
Does not login(goto accounts.php), and displays these errors:

Quote:
Notice: Undefined index: acc_name in /homepages/4/d222764588/htdocs/asdf/cmsAdmin/Sentry.php on line 32

Warning: Cannot modify header information - headers already sent by (output started at /homepages/4/d222764588/htdocs/asdf/cmsAdmin/Sentry.php:32) in /homepages/4/d222764588/htdocs/asdf/cmsAdmin/Sentry.php on line 53

Notice: Undefined index: action in /homepages/4/d222764588/htdocs/asdf/login.php on line 11
B) User inputs correct username/password.
Displays same error as before

BUT

If the user tries to login again, no matter what username/password they input it redirects them to account.php...


If anyone could help me with this I'd GREATLY greatly appreciate it!


I have a table called accounts and within it fields named acc_name and acc_pass.


I'm guessing the header error is because of the undefined index as if I replace it I dont get the header error...I have no whitespace before the header.
Reply With Quote
  #2 (permalink)  
Old 10-30-2008, 08:47 PM
marzar00 marzar00 is offline
Registered User
 
Join Date: Jun 2008
Posts: 22
G'day InfinityBound,

Ok by the looks of it (without seeing the actual code) you are trying to send more header information when the header already has been defined.

To someone who is new to PHP what I just said is probably gibberish! So I'll try to give you an example.

PHP Code:
<?php if( $iamcool = 1 ) { header("Location: youarecool.php"); die(); } ?>
<head>
<title>You're NOT cool!</title>
</head>
<?php if( $iamcool = 1 ) { header("Location: youarecool.php"); die(); } ?>
Ok so what I have done is place a simple redirect script:
PHP Code:
<?php if( $iamcool = 1 ) { header("Location: youarecool.php"); die(); } ?>
Then I have defined the header:
PHP Code:
<head>
<
title>You're NOT cool!</title>
</head>
Then I have tried to call the redirect script again, which is trying to change the header. You can't do this in PHP.

If you post your code we should be able to give you better feedback.

Hope that helps,

Marzar
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes 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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 04:51 PM.





Acceptable Use Policy

WebMediaBrands

internet.comMediabistrojusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Shopping | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0