Crap, minor problem turned into a major one.

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
fl0w
Forum Newbie
Posts: 8
Joined: Tue Nov 23, 2004 2:19 pm
Location: Stockholm Sweden

Crap, minor problem turned into a major one.

Post 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 :)
jl
Forum Commoner
Posts: 53
Joined: Tue Nov 09, 2004 12:05 am

Post 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.
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post 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.
fl0w
Forum Newbie
Posts: 8
Joined: Tue Nov 23, 2004 2:19 pm
Location: Stockholm Sweden

Post 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.
djot
Forum Contributor
Posts: 313
Joined: Wed Jan 14, 2004 10:21 am
Location: planet earth
Contact:

Post by djot »

-
Hi,

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

djot
-
fl0w
Forum Newbie
Posts: 8
Joined: Tue Nov 23, 2004 2:19 pm
Location: Stockholm Sweden

Post 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.
jl
Forum Commoner
Posts: 53
Joined: Tue Nov 09, 2004 12:05 am

Post 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.
Post Reply