General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old November 12th, 2002, 11:45 PM
Vasarab69 Vasarab69 is offline
Goldmember
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 71 Vasarab69 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 25 sec
Reputation Power: 6
Send a message via AIM to Vasarab69
Post a little help with the registration/members area script

Alright....well, I've encountered a little trouble when I was trying to set up the 'Building a Members Area' script...I set up the tables in mySQL db, and the files variables.php, register.php, and, of course, index.php all work fine. However, in the index file, when I try to call to see whether or not someone is logged in I get two errors that read as the following:

Quote:
Warning: Cannot send session cookie - headers already sent by (output started at /home/vasarab/public_html/index.php:4) in /home/vasarab/public_html/class.security.php on line 187


and also,

Quote:
Warning: Cannot send session cache limiter - headers already sent (output started at /home/vasarab/public_html/index.php:4) in /home/vasarab/public_html/class.security.php on line 187


On line 187 of class.security.php, it begins the following session:

PHP Code:
 session_start(); 

// Check that the session id is valid 
$dbVars = new dbVars(); 

@
$svrConn mysql_connect($dbVars->strServer$dbVars->strUser$dbVars->strPass); 

if(
$svrConn

$dbConn mysql_select_db($dbVars->strDb$svrConn); 

if(
$dbConn

$strQuery "SELECT {$this->__FieldNameSess}, {$this->__FieldNameSec} FROM {$this->__StoreSessionTableName} "
$strQuery .= "WHERE {$this->__FieldNameSess} = '" session_id() . "'"

$results = @mysql_query($strQuery); 

if(
$result = @mysql_fetch_array($results)) 
{ return 
$result[$this->__FieldNameSec]; } 
else 
{ return 
0; } 

else 
{ return 
false; } 

else 
{ return 
false; } 



function 
GetData() 



ADDITIONALLY, when I attempt to access Login.php, I am presented with the following:

Quote:
Parse error: parse error, unexpected T_STRING, expecting ']' in /home/vasarab/public_html/login.php on line 126


and on line 126, I have:

PHP Code:
if($dtlsSecurity->StoreSession($result[‘userId ‘], $result[‘username’], $result[‘level’], "{$result[‘firstname’]},{$result[‘lastname’]}")) 


Please help me...if you need any further info on how I have messed up the script (so that you can further help lol) then PLease ask...thank you very much, and im sorry for writing so much!

P.s., if you need me to attach a text file to another post within this thread containing one of the messed up files (that was my fault) please ask me and i well definitly do so, thank you again.

Reply With Quote
  #2  
Old November 13th, 2002, 09:48 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Firstly welcome to the forums..


ok now with your problems..

What happening in the first instance is that you are outputting the header before you call the function. Make sure that your not printing out any html or leave any whitespace before you call the class functions. This is very important.

2nd problem.

That line of code looks fine. Could you send me the code of line BEFORE that. Id say that has the error in it.

Also from the sounds of it. you sound like a beginner in php. And i did say in the article that you will need a intermediate level of php.

Having said that, im not stoping you, its just you may not understand how things work, which is very important.

Reply With Quote
  #3  
Old November 14th, 2002, 05:31 PM
Vasarab69 Vasarab69 is offline
Goldmember
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 71 Vasarab69 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 25 sec
Reputation Power: 6
Send a message via AIM to Vasarab69
Post

Hello again...thanks a lot for replying! And yes, I am rather dumb when it comes to php...but i'm trying to learn it quickly through books (at least a basic knowledge), so that i won't have to ask for help and stuff as much....but attached i've the entire login.php (as well as i could interperet from the article)...if you need another file (in case i did something wrong ) then please feel free to ask...thanks again

p.s., how would i call the function before i output the header?
__________________
-Alexander

Reply With Quote
  #4  
Old November 20th, 2002, 12:26 AM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Vasarab69,

to stop the header problem you should place

ob_start();

at the top line of the script thats causing the error.

for your second problem, the only thing i can see wrong with that line of code is

$result[‘userId ‘]

it should be

$result['userId']

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > a little help with the registration/members area script


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway