What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » PHP - Gestbook.... help

PHP - Gestbook.... help
Author: Message:
Baggins
Full Member
***

Avatar
B000ALFAZO

Posts: 387
Reputation: 13
30 / Male / Flag
Joined: Oct 2006
RE: PHP - Gestbook.... help
code:
<html>
<head>
<title>Upload</title>
</head>
<body>
<?php
$user = strip_tags($_GET["name"]);
$message = strip_tags($_GET["message"], '<b><i><u><a>');
$handle = @fopen("./savedinfo.php", "r+");
if ($handle) {
    while (!feof($handle)) {
        $buffer .= fgets($handle, 4096);
    }
    fwrite($handle,"<CENTER><font size='2' face='Verdana'><A href='$user' target='_blank'><img src='$user' width='300' height='200' style='border-color:#000000' border='0'></a><BR>$message<BR><BR></font></CENTER>\n");
    fwrite($handle, $buffer);
    fclose($handle);
}
print("<b>Thank You!</b><br />Your information has been added! You can see it by <a href=savedinfo.php>Clicking Here</a>");
?>
</body>
</html>


This does exactly what roflmao's does, except it is safe from PHP and HTML injection, and allows for basic tags such as <b><i><u> and <a> in the message field.

I figure this method, opening the file for read/write, will be more efficent than filegetcontents() because you only need to open it once.

This post was edited on 06-19-2007 at 08:52 PM by Baggins.
06-19-2007 08:39 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
PHP - Gestbook.... help - by distorted on 06-19-2007 at 05:29 PM
RE: PHP - Gestbook.... help - by absorbation on 06-19-2007 at 07:56 PM
RE: PHP - Gestbook.... help - by Baggins on 06-19-2007 at 08:22 PM
RE: PHP - Gestbook.... help - by roflmao456 on 06-19-2007 at 08:23 PM
RE: PHP - Gestbook.... help - by Baggins on 06-19-2007 at 08:39 PM
RE: PHP - Gestbook.... help - by distorted on 06-20-2007 at 09:44 AM
RE: PHP - Gestbook.... help - by distorted on 06-20-2007 at 10:06 AM
RE: PHP - Gestbook.... help - by WDZ on 06-21-2007 at 02:10 AM
RE: PHP - Gestbook.... help - by distorted on 06-21-2007 at 07:00 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On