Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

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:
  #1  
Old November 12th, 2002, 06:47 PM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 588 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Article Discussion: Building a Members Area with PHP: Part 2/6

If you have any questions or comments about this article then please post them here.

This forum post relates to this article

Reply With Quote
  #2  
Old November 14th, 2002, 05:37 AM
anja77 anja77 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Espaņa
Posts: 1 anja77 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
whats wrong?

i donīt know what iīve done wrong: the table and all scripts exist. but if i try to login, i get only back to the login page. there are no errors and no entrys in the database after that. i canīt help myself.... can you?

Reply With Quote
  #3  
Old November 14th, 2002, 06:38 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
After you enter your login details what does the next screen say exactly??

Also what are your server details. and is your server set up to handle sessions correctly?

Reply With Quote
  #4  
Old November 15th, 2002, 12:15 AM
CHornJr's Avatar
CHornJr CHornJr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: New York City
Posts: 236 CHornJr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 50 m 36 sec
Reputation Power: 16
Send a message via AIM to CHornJr Send a message via MSN to CHornJr Send a message via Yahoo to CHornJr
Here is an error I get. I both registered and then tried logging in.

"Couldn't write log data to the MySQL database."

Reply With Quote
  #5  
Old November 15th, 2002, 12:20 AM
CHornJr's Avatar
CHornJr CHornJr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: New York City
Posts: 236 CHornJr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 50 m 36 sec
Reputation Power: 16
Send a message via AIM to CHornJr Send a message via MSN to CHornJr Send a message via Yahoo to CHornJr
Well I found out what I did wrong (in reference ot the last post) right after I posted it. Stupid me forgot to doublecheck his variables

but now my new error is

"Couldn't start new session:

Go Back "

Reply With Quote
  #6  
Old November 15th, 2002, 11:28 PM
CHornJr's Avatar
CHornJr CHornJr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: New York City
Posts: 236 CHornJr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 50 m 36 sec
Reputation Power: 16
Send a message via AIM to CHornJr Send a message via MSN to CHornJr Send a message via Yahoo to CHornJr
Exclamation

After my last post, and cause of the fact that nobody posted any reply to it I decided to start it from scratch again. While doing the "GetData" function I noticed something unusaul in the code

PHP Code:
if($FieldNames[0] != ''
     
$s sizeof($FieldNames);
else
     
$s 0;
     
$s $s;
     for(
$i 0$i <= $s$i++)
     
$arrRet[] = ''


this if and else statement doesn't have "{" or "}" I am guessing that could be part of the cause of the error (if not the whole cause). But when I looked in the support files I noticed that the code didn't have the brackets either. Was this an error or am I just not as close to being an intermidete user of php as I thought I was

Joey
Attached Files
File Type: txt class.security.txt (7.5 KB, 471 views)

Reply With Quote
  #7  
Old November 16th, 2002, 04:43 AM
csxpcm csxpcm is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: London, UK
Posts: 13 csxpcm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
couldnt start new session

hello
I get exactly the same problem

"Couldn't start new session:
Go Back "

I have checked the database and I do have a user and password entry for the person im trying to log-in.
Ive tried to diagnose the problem, but I just can't locate the problem. Any help or suggestions would be much appreciated.

kind regards
- Peter

Reply With Quote
  #8  
Old November 18th, 2002, 11:50 PM
CHornJr's Avatar
CHornJr CHornJr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: New York City
Posts: 236 CHornJr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 50 m 36 sec
Reputation Power: 16
Send a message via AIM to CHornJr Send a message via MSN to CHornJr Send a message via Yahoo to CHornJr
I fixed it differently. I added to my sessions table the field for firstname and lastname.

Of course when I took a look inside my table there was no information inputted except id and sessionid (came out in jibberish in PHPMyAdmin, I'm just presuming it is some sort of encryption built in that I seemed to have missed and/or forgotten about) and the auth and useridfields which ar eboth listed as 0 which is the default value. How come?

now this question is posted for Ben

AM I suppsoe to do that or is the script suppose to create teh columns for the table?

now on to my next problem, on the index.php I am getting the follwoign error



quote:
--------------------------------------------------------------------------------
Warning: Cannot send session cache limiter - headers already sent (output started at /home/virtual/site4/fst/var/www/html/test/class.db.php:30) in /home/virtual/site4/fst/var/www/html/test/class.security.php on line 148
--------------------------------------------------------------------------------



I have not a clue as to what is wrong and it is coming up onboth the one I copied rom teh artical and from the support file version (atleast they are exactly the same)

Joey
Attached Files
File Type: txt class.security.txt (7.5 KB, 462 views)

Reply With Quote
  #9  
Old November 19th, 2002, 12:08 AM
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: 16
Send a message via AIM to Vasarab69
in agreement and confusion

yes, i am also getting similar errors...

the first:

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


the second:

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


and the third:

Quote:
Fatal error: Cannot instantiate non-existent class: dbvars in /home/vasarab/public_html/class.security.php on line 150


ANY help would be greatly appreciated!
Attached Files
File Type: txt class.security.txt (7.5 KB, 781 views)
__________________
-Alexander

Reply With Quote
  #10  
Old November 19th, 2002, 12:39 AM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
take a break fellas.

Ok firstly at the end of the article, ive included some support files. Have you tried those files??? or you just went straight at it.

Any aditional fields must be built onto the database table. The script does not create the extra fields (This would be a was of resources; having to check each time if the fields are created)

Also if the defaults are being inputted into the session table, this means that the query to the user table is not working correctly. To check that they results (username, id, etc) are being grabbed by mysql. echo them all before you call the storesession id.

Then if they work, then we know that something is not right in the class.

The best way to check, is to echo the variables in the class after each if statement, if they echo for each line, then we know how far we have got.

Also if it gets up to the point where it stores the sesion. (where it says to you can not start session) then whats happening is that there is something wrong with the query.

echo the last $strQuery variable where it closes the VALUES with ")";

echo that line, it should show you the query that inserts the tempory session details into the database. I tested the query serveral times, however your version of mysql may not like me.

Anyway run that query in mysql, and make sure that it processes it ok. If it likes it and inserts it. That means that your buggered up your database server details in the variables.php file. Otherwise there is something wrong with the query.

This my fellow programmers is called debugging. With this theory you should be able to find the problem

If you understood bugger all (nothing) of what i just said, this means that your not up to the level of programming needed to attempted a fairly advanced article such as this.

Hopefully your still understand where im going with this.

If you still have problems (eventho your understood what ive just said) please send me another post. And ill try to reply to is asap.

Reply With Quote
  #11  
Old November 19th, 2002, 10:24 AM
wuz_21 wuz_21 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 2 wuz_21 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Lightbulb I got it to work

I got the members area to work fine. All you need to do is download the support files at the end of the part 2/6 article and then change the variables.php file to your server settings. You also need to add firstname (varchar 50) and lastname (varchar 50) to the end of the session table.

Then everything should work

Reply With Quote
  #12  
Old November 19th, 2002, 12:17 PM
CHornJr's Avatar
CHornJr CHornJr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: New York City
Posts: 236 CHornJr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 50 m 36 sec
Reputation Power: 16
Send a message via AIM to CHornJr Send a message via MSN to CHornJr Send a message via Yahoo to CHornJr
apparently I'm not up to this level, doesn't mean I'm gonna stop trying. Ok here is what I got. I couldn't find what you wanted me to echo first. But i did

Quote:
echo the last $strQuery variable where it closes the VALUES with ")";


and I got
Quote:
INSERT INTO `session` (`sessionid`, `username`, `auth`, `userid`, `firstname`, `lastname`) VALUES ('41e96e12fa132a741a71918cffe3f471', '', '', '', '', ' ') You have now logged in.


I checked my variables.php. It is correct.

So the problem has to be up earlier, but as I said, no clue as to what you want me to echo out.

Reply With Quote
  #13  
Old November 19th, 2002, 03:13 PM
wuz_21 wuz_21 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 2 wuz_21 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Post For CHornJr

CHornJr,

Did you use the support files or did you use the code that was in the tutorial?

Reply With Quote
  #14  
Old November 19th, 2002, 03:18 PM
CHornJr's Avatar
CHornJr CHornJr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: New York City
Posts: 236 CHornJr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 50 m 36 sec
Reputation Power: 16
Send a message via AIM to CHornJr Send a message via MSN to CHornJr Send a message via Yahoo to CHornJr
I used the tutorial code

Reply With Quote
  #15  
Old November 19th, 2002, 05:45 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Firstly ive placed the support material there for when you get stuck. Like in this circumstance. I would use that.

Ok. now for your problem when you get:

INSERT INTO `session` (`sessionid`, `username`, `auth`, `userid`, `firstname`, `lastname`) VALUES ('41e96e12fa132a741a71918cffe3f471', '', '', '', '', ' ')

this means that your not correctly sending the data to the function. But to make sure that your doing this correctly. THE VERY NEXT LINE after you delair the function

function StoreSession(....

echo the variables that are passed with it.

echo $strUserId . ' ' . $strUserName . ' ' . $intSec . ' ' . $strArray;

what echos up when you try to log in??? if the variables do not show. this means that your not calling the function correctly with the write variables.

This means that the login.php page, in the ProcessLogin function is not working correctly.

It means that

if($dtlsSecurity->StoreSession($result[0], $result[1], $result[3], "{$result[4]}, {$result[5]}"))

is not working correctly.

What you should do here is each each of these values BEFORE you cann the sotesession function. Most likely they are going to work, which means that you are not querying the database correctly. REMEMBER because every ones servers are different, you may have to modify the code. does the query work correctly and return the users results?

Reply With Quote
  #16  
Old November 19th, 2002, 11:37 PM
CHornJr's Avatar
CHornJr CHornJr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: New York City
Posts: 236 CHornJr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 50 m 36 sec
Reputation Power: 16
Send a message via AIM to CHornJr Send a message via MSN to CHornJr Send a message via Yahoo to CHornJr
Ok I got it working using your security class and login files. But the index page is still giving me an error

Quote:
Warning: Cannot send session cache limiter - headers already sent (output started at /home/virtual/site4/fst/var/www/html/test/class.db.php:30) in /home/virtual/site4/fst/var/www/html/test/class.security.php on line 200


It is your index file and i gots not clue as to why it is doing this. It gaveme the same error on mine

Joey

Reply With Quote
  #17  
Old November 19th, 2002, 11:49 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
if its doing that, one the index page, after the first line, try placing

ob_start();

This should allow you to buffer the header.

does that stop the errors?

Reply With Quote
  #18  
Old November 20th, 2002, 10:15 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: 16
Send a message via AIM to Vasarab69
index page

ive fixed all of the other errors, successfully registered, successfully logged in, and the results were successfully stored in the database however i still get the same error on index.php

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

also, when I am logged in and try to access index.php, below the above error, it says

Welcome 0 0, you are now logged in.

When it should be saying Welcome (firstname) (lastname), etc.. the line of coding that calls this looks like this:

PHP Code:
 Welcome <?php echo $details[3] . ' ' $details[4]; ?>, you are now logged in. 


Additionally... I DID add "ob_start();" to the tops of all of the PHP files that are involved in this, including INDEX.php...is that what we were both suppossed to do?

Reply With Quote
  #19  
Old November 21st, 2002, 11:52 AM
lemkepf lemkepf is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 7 lemkepf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
First off, i love the article! I can't wait for the 3-6 to come out! THey have been a great read! OK, now onto my problem....

Quote:
Originally posted by Ben Rowe
does the query work correctly and return the users results?


I've been able to add a user, store a log file, but i can't log in. It's really weird...

if i do put that echo command....
echo $strUserId . ' ' . $strUserName . ' ' . $intSec . ' ' . $strArray;

right after the function StoreSession(.... i get

3 lemkepf 1 , Couldn't start new session:

Could someone enlighten me as to what my problem is?
Thanks alot!
Paul

Reply With Quote
  #20  
Old November 21st, 2002, 04:07 PM
lemkepf lemkepf is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 7 lemkepf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
OK, nevermind i fixed the error, for some reason there was an extra space on the login.php file.....

if($dbConn) {
$strQuery = "select * from users ";
$strQuery .= "where username = '$strUser' ";
$strQuery .= " and password = '$strPass' ";

I changed that too....

$strQuery .= "and pass.....

Now we get to the really fun part!
Thanks again!

Reply With Quote
  #21  
Old November 21st, 2002, 06:11 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Vasarab69,

Firstly

Welcome 0 0

Check the session database and esure that the session tables has the extra fields for the first and last names.

Also ensure that the that each field is a varchar not int or something lik that,

With the header, place ob_start() at the top of the script to buffer the header and stop it from outputting it too early.

Reply With Quote
  #22  
Old November 25th, 2002, 03:04 PM
eqjones eqjones is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: South Carolina
Posts: 18 eqjones User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Can you update the article? For example, the tables you say to add, there isn't the fields for First and Last name in the SQL statement for the 'sessions' table. The code also doesn't match 100% in the tutorial on comparason to the source code. I probably like others didn't know there was updated source code at the end of the article and cut and past the code, only to spend many hours debugging.

Your solution to the 'Session' problem is to add a First Name and Last name field in the sessions table. Why? I just deleted the code that added the extra fields to the SQL query in the Sessions function and fixed my problem. I figure that we already have the First and Last name in the 'users' table, and that it was kind of redundant to have it also in the 'sessions' table. So I'm wondering why that would be the best way to fix the problem.

Reply With Quote
  #23  
Old November 25th, 2002, 08:38 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
the reason why you have the first/last names in the sessions table is because if you are accessing the users names a bit, its easier to retive the names from the function GetData then it is to get the user id from the GetData and link it back to the user table.

This creates another query to the database which uses more of the servers resources.

Reply With Quote
  #24  
Old November 25th, 2002, 10:32 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Is that the only error in the article?

eqjones if you find any more errors please let me know.


Reply With Quote
  #25  
Old November 25th, 2002, 11:09 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: 16
Send a message via AIM to Vasarab69
hey just wondering when the third part of the article is due out...thanks,

Reply With Quote
  #26  
Old November 25th, 2002, 11:31 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
I actually just finished writing it 2 minutes ago

Reply With Quote
  #27  
Old November 25th, 2002, 11:32 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: 16
Send a message via AIM to Vasarab69
You are the man, Ben!

Reply With Quote
  #28  
Old November 26th, 2002, 05:52 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Well i was the last time i checked hehe, it should be up sometime today

Mytch has just got to edit it first. Keep in mind, that this article is a real begginners article.

Reply With Quote
  #29  
Old November 28th, 2002, 02:12 PM
nosta nosta is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Posts: 9 nosta User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Can anyone help me out ? Where can I find the support files ? Seems like they're gone :/

Thanks !

Reply With Quote
  #30  
Old November 28th, 2002, 07:05 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
ahh crap.

Thats very weird.

Ive put the support material back up now.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingProgramming Tools > Article Discussion: Building a Members Area with PHP: Part 2/6


Developer Shed Advertisers and Affiliates


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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap