Page 1 of 1

Crap, minor problem turned into a major one.

Posted: Tue Nov 23, 2004 4:08 pm
by fl0w
Hi,

For the past two years, I've been doing some minor PHP scripts here and there, and I manage quite well with it by now. I've never done a largescale project.. yet.

I've read allot about php, especially this and last month.

Anyway, Since I've never done a largescale project, I thought I'd make one, only for learning purposes. A Nordic community (multilangual that is) with a few nice features, that doesn't have to be mentioned.

And my problem is following:
I have no clue how to build up my project.
I have no idea of where to begin.

So I figured I should start with the login script, wich I also have problem with to build. Not the coding part, but what method to use.

I hate cookies, so that leaves me with sessions.
I was thinking like this, store IP, sessoion_id and userid in a mysql database, and each page load I'll check if session_id and ip matches. But that would require me to do a mysql query each page load. This can easily be solved with the session array instead. On the other hand, I like the first solution I mentioned. What do you recommend?

I'm sorry for my bad english.
Kind regards,
fl0w - to be devoted php coder :)

Posted: Wed Nov 24, 2004 2:57 am
by jl
If you're not sure where to start, then getting right into coding sessions isn't the best way to start.

I'd recommend doing some basic language-independant structural diagrams of what you're trying to build before you start trying to build it - i.e. plan it all out with a pencil and paper.

Break it down into parts to get an overall picture of the entire project, then once you've done that, start coding each of the parts.

Posted: Wed Nov 24, 2004 3:09 am
by phpScott
with out knowing the scope of the project I would concur with the previous post, get down and paper what you want the site to do then try and group the ideas together so you may be able to reuse parts of your code.

Secondly I'm not sure what the IP situation is where you live but people might have dynamic IP address so storing them might not be the best idea, using them for checking a logged in status is fine but that would be about it.

Sessions are designed for the sort of application of checking a logged in status as it makes it muck easier to code and test.

Lastly if your unsure where to start and as you say you are still learning, jump right in with a section and start coding, as that is the best way I find to learn.
And remeber where here to help.

Posted: Wed Nov 24, 2004 3:21 am
by fl0w
Aiight, sounds like a plan. Pencil and paper here i come. Ofcourse I made some planning, but not in detail. :\
Anyway, out of curiosity, why isn't sessions a recommended starting point?

Oh, and about phpScotts reply about my IP storing:
This would only be used to "validate current login", each manual logout (or expired login) the IP gets removed.

Posted: Wed Nov 24, 2004 4:45 am
by djot
-
Hi,

About the IP: I never rely on it, because it might change each request when user is using a proxy.

djot
-

Posted: Wed Nov 24, 2004 6:27 am
by fl0w
djot wrote:-
About the IP: I never rely on it, because it might change each request when user is using a proxy.
-
Touché. Thanks.

Posted: Thu Nov 25, 2004 12:18 am
by jl
fl0w wrote:Aiight, sounds like a plan. Pencil and paper here i come. Ofcourse I made some planning, but not in detail. :\
Anyway, out of curiosity, why isn't sessions a recommended starting point?
I wasn't saying sessions isn't a starting point to coding, I was saying coding isn't a starting point to a large project.