Posts: 27
Location: Pennsylvania, USA
|
Hi.
SubProfile Guest Book script seems to be not cooperating when i attempt a stripspaces command. I've tried and tried and cant get it to strip the spaces from the "screen name" field.
***note: Screen Name field was named 'email' simply because I used this script for another guestbook in which I didn't need/want aim screennames. Now, I want the screen names, and no email so i plan to just leave it as 'email' as no one but me will see the code after it's working! Since e-mail addresses dont have spaces, i didn't worry about stripping them when i made the old script; however, since AIM allows spaces, i need them removed, or changed to "+" in my database and 'behind the scenes' but shown without the 'computer jargon' when shown as a link. (ex the link can be "this+contains+spaces" but i need it to be printed to the user as "this contains spaces") AIM doesn't seem to acknowledge there's a space in a link if it's not shown as +, it would just see the above link as "this", minus the "contains spaces"."
I hope you understand what my problem is and can help me!
Thanks!
~Jake
PHP Code:
<?php
$dbhost = "localhost"; // this is mostly "localhost"
$databees = "guest"; // this is the name of your database
$dbusername = "root"; // this is your username
$dbpassword = "5253"; // this is your password
/* Form to add entries */?>
<table><form method="post" action="sign.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>Screen Name:</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: small; background: white"; cols="35" rows="8"></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());
echo "Successful!";
} else {
echo "You need to fill in your name and your comments!";
}
}
|