|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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?
|
|
#3
|
|||
|
|||
|
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? |
|
#4
|
||||
|
||||
|
Here is an error I get. I both registered and then tried logging in.
"Couldn't write log data to the MySQL database." |
|
#5
|
||||
|
||||
|
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 " |
|
#6
|
||||
|
||||
|
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:
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 |
|
#7
|
|||
|
|||
|
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 |
|
#8
|
||||
|
||||
|
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 |
|
#9
|
|||||
|
|||||
|
in agreement and confusion
yes, i am also getting similar errors...
the first: Quote:
the second: Quote:
and the third: Quote:
ANY help would be greatly appreciated!
__________________
-Alexander |
|
#10
|
|||
|
|||
|
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. |
|
#11
|
|||
|
|||
|
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 ![]() |
|
#12
|
||||
|
||||
|
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:
and I got Quote:
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. |
|
#13
|
|||
|
|||
|
CHornJr,
Did you use the support files or did you use the code that was in the tutorial? |
|
#14
|
||||
|
||||
|
I used the tutorial code
|
|
#15
|
|||
|
|||
|
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? |
|
#16
|
||||
|
||||
|
Ok I got it working using your security class and login files. But the index page is still giving me an error Quote: |