Page 1 of 1

A Simple Guestbook I made~

Posted: Fri Nov 08, 2002 9:48 pm
by akkassia
I just made a simple guest book just for fun :)

http://akkassia.soinet.net/guest

Have a look at it, and give me some advice~!

Here's my codes.

MySQL Connection & Functions
lib.php

All the Output Codes
index.php

All the Input Codes
do.php


Have a nice :)

Posted: Fri Nov 08, 2002 10:42 pm
by mydimension
here is my two cents:
1. you have no beginning <html> tag
2. in place where you have something like $data[no] you should have $data['no']
3. in do.php, you should use the $_POST and/or $_GET arrays to increase security and be forward compaitable with future versions of PHP
4. in do.php, if you expect your refresh meta tag to work in all browsers, you better output an entire html document, not just the meta tag. or better yet use the header function.

my opinions:
the layout looks nice but the colors might be overwhelming to some of your users. the amount of whitespace should be reduced a little so as to maximize your use of the page. i would also highly reccomend moving all formatting to CSS. you've got most of it so you might as well do it all.

thanks for sharing.

Posted: Fri Nov 08, 2002 11:33 pm
by akkassia
thanks for you reply~

1. you have no beginning <html> tag
- THat was a mistake :p, thanks for finding it out~

2. in place where you have something like $data[no] you should have $data['no']
- WHy? Does it make a difference? I do'nt really get the point.

3. in do.php, you should use the $_POST and/or $_GET arrays to increase security and be forward compaitable with future versions of PHP
- I do'nt know how to. HOw do I do that?

4. in do.php, if you expect your refresh meta tag to work in all browsers, you better output an entire html document, not just the meta tag. or better yet use the header function.
- How do I use header function. -_-;; (sorry I'm not an expert);;

And, about the CSS, are you telling me to make something like style.css and call it from the index.php? or something else that I don't know :P

The color and the white spaces~ I just like it that way~ ^^;;
I like that color~ If you visit my site. You'll see it's all over the place :)


Also, I just made a number paging thingy on the bottom.

I tried next half, and prev half, take a look at that one too :)

Posted: Sat Nov 09, 2002 9:57 am
by mydimension
when referencing the elements of an array ($data['no']) you either use a number or a string. in your script when you write $data[no] your are not passing a string to the $data[] array but rather PHP thinks you are passing it a constant. by not using quotation marks like this $data['no'] you make PHP do extra work. for more information read this: http://www.php.net/manual/en/language.types.array.php

in PHP versions greater then 4.1 variables created from forms are kept in arrays rather than having a seperate variale all their own. hers's an example:
in you html form you have this:

Code: Select all

<input type="text" name="username">
in the page that processes your form, you access that variable like this:

Code: Select all

//in version prior to 4.1 you could do this:
if ($username != "") &#123;
....
&#125;

//in versions greater than 4.1 you need to do this:
if ($_POST&#1111;'username'] &#123;
....
&#125;
for more reading: http://www.php.net/manual/en/reserved.variables.php
viewtopic.php?t=511

the header() function allows you to send HTTP headers to the client browser. one of the most common uses of this function is to redirect users. here is an example:

Code: Select all

//this will send the client browser to www.disney.com
header("Location: http://www.disney.com");
have a read of this: viewtopic.php?t=511

about the CSS, using a seperate .css file is the preferred way to do CSS but not absolutely necessay.

like i said about the coloring and the white-space, its only my opinion,

i hope this has been helpful for you. leem know if you have any other questions.