Jump to content



Photo

Ch 17: Message Board Issue


  • Please log in to reply
23 replies to this topic

#1 Gatsby

Gatsby

    Newbie

  • Members
  • Pip
  • 16 posts

Posted 6 February 2012 - 1:05 PM

Hello. I really like your tutorial style, Larry, and have found you tutorials to be clear and straightforward. That said, I have the message board working fine on my local XAMPP host, however when I tested the message board on a live Web server, its not returning anything at all in 3 areas:

1) No "Posted on" date/time

2) No "Latest reply" date/time

3) Nothing is returned when the "subject" topic is clicked (normally this would return the post content and a reply box).

I should specify that I have not completed the registration/login section yet - I've completed everything up to p.528 so far. Also, the Web server version I tested the message board on is PHP 5.2.6. Thanks much.
  • 0

#2 Larry

Larry

    Administrator/Writer

  • Administrators
  • 3,701 posts
  • LocationState College, PA (USA)

Posted 6 February 2012 - 1:29 PM

Thanks! As for your problem, I suspect the live server doesn't have MySQL's timezones installed.
  • 0

#3 Gatsby

Gatsby

    Newbie

  • Members
  • Pip
  • 16 posts

Posted 6 February 2012 - 1:57 PM

Thanks for your quick reply, Larry! I had a feeling that was the problem. The Web host that the message board is currently on (for testing) seems to be sub-par. Do I, necessarily, need to see a "mysql" database in my Web hosts phpMyAdmin page - with the "information_schema" database, etc? Right now only my domain database, the "information_schema" database and "test" database are included. Should I be able to simply request to the server admin that the MySQL timezones be installed? Lastly, would this issue also explain why nothing is returned when I click the subject line in the forum? Thank you.
  • 0

#4 Larry

Larry

    Administrator/Writer

  • Administrators
  • 3,701 posts
  • LocationState College, PA (USA)

Posted 6 February 2012 - 2:18 PM

In fact, you SHOULD NOT see the mysql database in phpMyAdmin. Yes, you can request this from the admin. I don't know offhand if it would explain the other thing, but it could.
  • 0

#5 Gatsby

Gatsby

    Newbie

  • Members
  • Pip
  • 16 posts

Posted 6 February 2012 - 2:22 PM

Oh - that makes sense. I can only see the mysql database in XAMPP. I will make the MySQL timezones installation request to the admin, and go from there. Thanks!
  • 0

#6 Gatsby

Gatsby

    Newbie

  • Members
  • Pip
  • 16 posts

Posted 6 February 2012 - 4:16 PM

Well, I wrote the web server admin, requesting that he install MySQL timezones, and this is what he responded: "The server has the correct time zone running, I just set the "Global" time zone for mysql to be the system time. Let me know if that is what you need."

The message board is still not functioning, and I'm not sure how to further clarify to him what I might need done on the server? Thanks again, Larry.
  • 0

#7 Larry

Larry

    Administrator/Writer

  • Administrators
  • 3,701 posts
  • LocationState College, PA (USA)

Posted 6 February 2012 - 4:21 PM

THe admin needs to install the full list of MySQL timezones IN MySQL so that you can use time zone conversions. You could provide the admin with a link to the MySQL page (regarding installation of the time zones) to make it more clear.
  • 0

#8 Gatsby

Gatsby

    Newbie

  • Members
  • Pip
  • 16 posts

Posted 6 February 2012 - 4:59 PM

Ok, sir - time issue is now resolved. Next I just need to figure out why the heck the threads/post reply page is not displaying when I click on a post "Subject". I'm going to be doing some debugging. If you have any ideas, that would be great. If not I understand, as it could be quite a few things I imagine. Thanks again for all of your help today.
  • 0

#9 Gatsby

Gatsby

    Newbie

  • Members
  • Pip
  • 16 posts

Posted 7 February 2012 - 11:30 AM

Well I've been trying to debug the issue of the "subject" link on the forum.php page not displaying when clicked, for quite a few hours now. The read.php page displays normally upon clicking a subject heading on the forum.php page, except the body content of the read.php page is completely empty - no text and no error prompt either. Again, the message board works fine on my local XAMPP host - its only an issue when on a live Web server. I went through every table and field in both MySQL databases (XAMPP and Web host) and all the related php files. Any ideas to head me in the right direction, Larry?

BTW, does it matter that I'm using one database with unrelated (to the message board tables) tables in it? Not sure if its recommended practice to create a brand-new database for such things?

Thanks much.
  • 0

#10 Larry

Larry

    Administrator/Writer

  • Administrators
  • 3,701 posts
  • LocationState College, PA (USA)

Posted 8 February 2012 - 8:00 AM

No, the unrelated tables won't affect this. Have you checked out the HTML source? And is display_errors enabled?
  • 0

#11 Gatsby

Gatsby

    Newbie

  • Members
  • Pip
  • 16 posts

Posted 8 February 2012 - 11:32 AM

I will insert an error script into the offending pages - and I'm going over Ch 8 too. Will report back after a valiant effort... :)
  • 0

#12 Gatsby

Gatsby

    Newbie

  • Members
  • Pip
  • 16 posts

Posted 8 February 2012 - 11:53 AM

Here's what was reported, Larry:

"Fatal error: Call to undefined function filter_var() on line 11"

And the related function...

9. // Check for a thread ID:
10. $tid = FALSE;
11. if (isset($_GET['tid']) && filter_var($_GET['tid'], FILTER_VALIDATE_INT, array('min_range' => 1)) ) {
  • 0

#13 Larry

Larry

    Administrator/Writer

  • Administrators
  • 3,701 posts
  • LocationState College, PA (USA)

Posted 8 February 2012 - 11:57 AM

Okay. Your version of PHP doesn't support the Filter extension. You'll need to validate the topic ID using alternate methods, as discussed in the book.
  • 0

#14 Gatsby

Gatsby

    Newbie

  • Members
  • Pip
  • 16 posts

Posted 8 February 2012 - 12:02 PM

Ok - thanks. I will research that. Btw, would it be out of the ordinary to ask the Web server company to update their PHP version? The server service has been sub par, and the system seems outdated to me. Current version stats:

PHP Version 5.2.6

FreeBSD 6.4-RELEASE-p8 FreeBSD 6.4-RELEASE-p8 #1 r101746: Mon Aug 30 10:34:40 MDT 2010 root@..usr/src/sys/i386/compile/VKERN i386

Build Date:May 7 2008 22:22:24
  • 0

#15 Larry

Larry

    Administrator/Writer

  • Administrators
  • 3,701 posts
  • LocationState College, PA (USA)

Posted 8 February 2012 - 12:33 PM

You can always ask. Doesn't mean they'll do it. That's not terribly out of date compared to what I've seen with other hosts.
  • 0

#16 Gatsby

Gatsby

    Newbie

  • Members
  • Pip
  • 16 posts

Posted 8 February 2012 - 1:00 PM

Ok - I have the message board working on the live server now, after removing Filter Extension and using the simple GET method:


// Check for a thread ID:
$tid = FALSE;
if (isset($_GET['tid'])) {

Do you see any problems with this method used in this context, even though it works - I mean technically, Larry? Thanks again for your guidance and help - sincerely much appreciated.
  • 0

#17 Larry

Larry

    Administrator/Writer

  • Administrators
  • 3,701 posts
  • LocationState College, PA (USA)

Posted 8 February 2012 - 2:39 PM

You're quite welcome. There's a big problem with that code: it leaves you vulnerable to SQL injection attacks when $_GET['tid'] is used in a query. You should typecast it and make sure it's an integer greater than 0.
  • 0

#18 Gatsby

Gatsby

    Newbie

  • Members
  • Pip
  • 16 posts

Posted 8 February 2012 - 2:50 PM

Thanks, Larry! I'm glad I asked - I had a vague feeling it was too simple to be safe. I will be working on that next...
  • 0

#19 jabsalud

jabsalud

    Member

  • Members
  • PipPip
  • 35 posts

Posted 25 June 2012 - 4:58 AM

hey sir i just got a little problem here, when im trying to post the message, although it runs smoothly, it prompts " Your post could not be handled due to a system error.". that happens when i am creating a new thread, it seems like the queries dont work? any idea about that sir? and also for the remedy?
  • 0

#20 Edward

Edward

    Advanced Member

  • Members
  • PipPipPip
  • 1,119 posts

Posted 25 June 2012 - 5:26 AM

I finished the message board example it all worked on my localhost. Which script are you encountering the problem on, can you print us out the php error you are receiving?
  • 0