As you read this you will discover my lack of knowlege of php. I got a simple program from my webhoster for a guest book. My webserver has MySQL runniung for the clients and I followed the directions that came with it. Seppe even created a install.php file that I followed to the T. Here's the web site if you want to try it, just look for the guestbook because the rest of the site is in Belgum ->www.sepi.be'<-. Anyway, I created a database with myphpadmin on the web server, created a guestbook folder under the httpdocs folder (the web hosters suggested uploading the index.htm there for it to work.
Well, I CHMOD'ed the config.php to 777 (like the instructions said) and then created a link in my index.htm to the guestbook.php, but when I tried to "use" the link, it come back with a ERROR: parse /fullpath/of/server/guestbook.php line 94.
The question is: What am I doing wrong? I opened it in CuteFTP's CuteHTML LE that lets you edit lines of PHP and tried to delete the 94th line witch is just a comment. Well, it looks as if the error has just moved up. Can someone please look at this code and see if its something I'm doing.
[ php ]
<?php
/_______________
AnotherGuestbook
A free guestbook
by www.sepi.be
______________*
Warning: this is my first PHP script, so if you discover some errors or
security risks, please mail me (seppe@pandora.be)
/* Add your header below this line, for example:
include("skins/multicolor/header.txt");
/ First, you'll have to create the guestbook table in your database
So go to your MyPHPAdmin and execute this query:
CREATE TABLE guestbook (
id int(11) NOT NULL auto_increment,
commentaar longtext NOT NULL,
naam varchar(20) NOT NULL default '',
tijd varchar(8) NOT NULL default '',
datum varchar(10) NOT NULL default '',
website varchar(70) NOT NULL default '',
email varchar (70) NOT NULL default '',
PRIMARY KEY (id),
UNIQUE KEY id_2 (id),
KEY id (id)
) TYPE=MyISAM;
/ Config settings; fill in your database settings between the " and " */
$dbhost = "localhost"; // this is mostly "localhost"
$databees = "sepi"; // this is the name of your database
$dbusername = "sepi"; // this is your username
$dbpassword = "svan123sande"; // this is your password
/ Form to add entries /?>
<table><form method="post" action="guestbook.php">
<tr><td><b>Name:</b></td><td><input type="text" name="naam" STYLE="BORDER: black 1px solid; WIDTH: 144px; height: 15px; color:black; font-size: xx-small; background: white;" size="25"></td></tr>
<tr><td><b>Website:</b></td><td><input type="text" name="website" STYLE="BORDER: black 1px solid; WIDTH: 144px; height: 15px; color:black; font-size: xx-small; background: white;" size="25"></td></tr>
<tr><td><b>E-mail:</b></td><td><input type="text" name="email" STYLE="BORDER: black 1px solid; WIDTH: 144px; height: 15px; color:black; font-size: xx-small; background: white;" size="25"></td></tr>
<tr><td><b>Comments:</b></td><td><textarea type="comment" name="commentaar" STYLE="overflow:hidden; BORDER: black 1px solid; color: black; WIDTH: 144px; height: 80px; font-size: xx-small; background: white"; cols="35" rows="5"></textarea></tr>
<tr><td> </td><td><input type="submit" name="posten" value="ok"><input type="reset" name="opnieuw" value="reset"></td></tr>
</form></table><?
/ connecting to the database /
if ($HTTP_POST_VARS['posten']) {
mysql_connect($dbhost,$dbusername,$dbpassword);
mysql_select_db($databees);
/ Let's check that the necesarry fields are filled in /
/ btw, || is OR /
if (($naam <> "") && ($commentaar <>"")){
/ Let's strip html tags out of the posts, so bad 1337 h4x0rZ can't abuse the guestbok with dirty HTML tags /
$naam = strip_tags($naam);
$website = strip_tags($website);
$email = strip_tags($email);
$commentaar = strip_tags($commentaar);
/ Good! Let's add it to the database 🙂 /
$insert = "INSERT INTO guestbook (naam,website,email,commentaar) VALUES ('$naam','$website','$email','$commentaar')";
$query = mysql_query($insert)or die(mysql_error());
} else {
echo "You need to fill in your name and your comments!";
}
}
/ view the submitted entries /
mysql_connect($dbhost,$dbusername,$dbpassword);
@mysql_select_db($databees) or die("Unable to select database");
$view = "SELECT * FROM guestbook ORDER BY id DESC";
$query = mysql_query($view);
$aantalrecords = mysql_num_rows($query);
while ($list = mysql_fetch_object($query)) {
echo "<p><table><tr><td><b>Name</b></td><td>$list->naam</td></tr>";
echo "<tr><td><b>Website</b></td><td><a href='$list->website' target='new'>$list->website</a></td></tr>";
echo "<tr><td><b>E-mail</b></td><td><a href='mailto:$list->email' target='new'>$list->email</a></td></tr>";
echo "<tr><td><b>Comments</b></td><td>$list->commentaar</td></tr></table></p>
<p>"; } echo "<small>guestbook by <a href='http://www.sepi.be'>sepi</a></small>";
/ Ok, that's it .. now you still have the posibility to add your footer under
this line /</p>
<p>next line footer test</p>
[ / php ]
Anyway does anyone have any suggestions? I know this person probably wrote some rock solid code, I'm just not knowing what I'm doing.
could you please edit your post and add the [ php ] and [ / php ] tags around your code so that we can make sense of it.
If you could also indicate which is line 94, that would be a help too.