Message Board in PHP with MySQL

Programming, for all ages and all languages.
AGI1122

Re:Message Board in PHP with MySQL

Post by AGI1122 »

Well there is 2 main ways in PHP cookies, or sessions. Although there is other methods you could devise if you know what your doing.

http://us2.php.net/manual/en/function.setcookie.php This is info on how to use setcookie(); use this function to either set a cookie or delete a cookie. If you want a specific example of using it just ask.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Message Board in PHP with MySQL

Post by Candy »

Chris Cromer wrote: Well there is 2 main ways in PHP cookies, or sessions. Although there is other methods you could devise if you know what your doing.

http://us2.php.net/manual/en/function.setcookie.php This is info on how to use setcookie(); use this function to either set a cookie or delete a cookie. If you want a specific example of using it just ask.
Please do note that sessions are the php nice-ness layer on top of cookies, so effectively, you always use cookies in this way.

You can log an IP as being some user, and treat all unlogged IP's as not logged in.
AGI1122

Re:Message Board in PHP with MySQL

Post by AGI1122 »

Please do note that sessions are the php nice-ness layer on top of cookies, so effectively, you always use cookies in this way.
Actually, PHP sessions uses 2 different methods, it can store the session id in the url OR a cookie. So even if cookies are off it will work by having the id in the url... but if cookies are on then it won't need to use the sessions in the url.
You can log an IP as being some user, and treat all unlogged IP's as not logged in.
That won't work for people with random ip's.
DennisCGc

Re:Message Board in PHP with MySQL

Post by DennisCGc »

Hmm, I heard from other people, that work with PHP, that I have to include:

Code: Select all

<? session-start ?>
at the start of each page that wants to use cookies.
Is that correct ?
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Message Board in PHP with MySQL

Post by Candy »

DennisCGc wrote: Hmm, I heard from other people, that work with PHP, that I have to include:

Code: Select all

<? session-start ?>
at the start of each page that wants to use cookies.
Is that correct ?
Why don't you check the _FREE_ php manual pages about that? They include some info on those functions.
That won't work for people with random ip's.
Most notably not with NAT setups.



Note that you can disable putting session ID's in urls, thereby increasing the security slightly (not much, just capture the cookie). It does prevent logging the session id's on your computer.
AGI1122

Re:Message Board in PHP with MySQL

Post by AGI1122 »

Actually it should be this:

Code: Select all

<?php session_start(); ?>
But that's only if you want to use sessions, not cookies. :P
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

Re:Message Board in PHP with MySQL

Post by Neo »

I was testing out the SMF (YaBBSE ) and was going through it. Thats why no questions so far. Its really good. I will be back with a lot more questions later.
Anway is there a special field type for passwords in MySQL
Only Human
AGI1122

Re:Message Board in PHP with MySQL

Post by AGI1122 »

Well you just need to create a field type that is large enough to store the maximum length of the passwords... if you use md5 for instance a varchar with a 32 byte length would work since all the hashes from md5 are 32 bytes long.

And yeah, SMF is awsome(although I am biased because I worked on YaBBSE... and am part of the SMF mod development team) it's a shame the mega-tokyo forum can't be upgraded to SMF though because it requires PHP 4.1.0... and this site is running an older version of PHP than 4.1.0.
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

Re:Message Board in PHP with MySQL

Post by Neo »

What about upgrading PHP?
Only Human
AGI1122

Re:Message Board in PHP with MySQL

Post by AGI1122 »

He doesn't have access to upgrade PHP... and his host won't upgrade it.
Embrance

Re:Message Board in PHP with MySQL

Post by Embrance »

heres a GOOD FlatFile board:
http://pblang.drmartinus.de/
AGI1122

Re:Message Board in PHP with MySQL

Post by AGI1122 »

Nobody is looking for a flatfile board. This is about PHP/MySQL message boards. :P
Embrance

Re:Message Board in PHP with MySQL

Post by Embrance »

At the beggining of the topic there wwas a disc. about it.i would post it there,nut i was kinda late... :P
AGI1122

Re:Message Board in PHP with MySQL

Post by AGI1122 »

He didn't ask for a flatfile board. He asked if it was better to store data in flatfiles or a database(MySQL) he is creating a message board, not looking for one. You should read it more thouroughly. ;)

Anyway, if he had asked for a flatfile bulletin board, I would have already chimed in and told him about the original YaBB which is flatfile. ;)
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

Re:Message Board in PHP with MySQL

Post by Neo »

This is a sort of the end of the line (sigh) ;) for my project. I've started modifying the existing board software instead of writing the thing from scratch. Its more fun modifying :) it and their is more professional anyway. I will be popping it up now and then when I've got another related doubt or idea.
So I'm off to try something else...(presumably web related I'm thinking of Java)
Thanks Chris for all your help so far. :)
Only Human
Post Reply