Username:
Password:
Remember me:
Register

Back to forum: Web Programming (HTML, JS, CSS, PHP, MySQL)


Search forums via Google


0 Users appreciate this thread.

Making a PHP guestbook - Database free!
Started by angelrulez7
(2012-08-26 03:43:26)
angelrulez7 (2012-08-26 03:43:26)
Here is a tutorial how to make a DATABASE FREE Guestbook/Status!

add.php is:

<center><form action="add2.php" method="post">
<input type="text" name="u">
<input type="text" name="i">
<input type="submit">
</form>


Ok! We've gotten the form done!

Now for the confirm!

add2.php should be:
<?php
$msg = "<b>".$_POST['u']."</b> said:<br>".$_POST[i]."<br>";
$msg .= file_get_contents('content.php';
file_put_contents('content.php', $msg); // Script made by some guy named Akise
?>
<center>Posted! <a href="gb.php">Back to Guestbook</a>


Got that down? Now to the next page.

gb.php should be:

<?include ('add.php' ?>
<br>
<?include ('content.php' ?>


You also need content.php, which stores the messages, so that is the database of the guestbook. But leave it COMPLETELY blank.

Hope you enjoyed!

Credit to Akise; If he never made FateStatus, I would never be able to do this!

This post has been edited one or more times, the last time was:
2012-08-30 21:50:19

a
djl12328 (2012-08-26 04:10:49)
Nice! Not as secure as a database, but sure looks easier.
www.dark-isle.weebly.com
angelrulez7 (2012-08-26 04:18:27)
Not secure? :l...

How about between the last two things:

$nohtml = strip_tags('<b><br><hr><img>', $msg);
a
(Capt.)Orb (2012-08-27 20:57:35)
Hmm.... I think there should be another " on top line
Aviation fact: The a380 is the largest commerical aircraft in service!

Go to Splashiverse! Splashiverse
angelrulez7 (2012-08-28 04:17:01)
No, I copy/pasted this, just took out all the smileys and the strip_tags and stripslashes. I wanted you guys to figure it out.. :l -orb

NO MATTER WHAT, DO NOT USE HTMLENTITIES! It disables ALL the HTML from $msg, including <b>, <div>, <br>, etc.


Use strip_tags('<b><br>', $msg);

As needed to disable HTML. Whatever is in between the quotes is the enabled codes.
a
angelrulez7 (2012-08-28 22:57:23)
It's how the status Chrono made is made... -Dean
a
angelrulez7 (2012-08-30 21:48:15)
Added credit to Akise...

...and...

file_get_contents and file_put_contents are both normal PHP functions. -Akise
a
(Capt.)Orb (2012-08-31 07:02:50)
Strip tags won't work,I'll fix it later
Aviation fact: The a380 is the largest commerical aircraft in service!

Go to Splashiverse! Splashiverse
angelrulez7 (2012-09-01 05:41:47)
Wait, I used '' instead of "", didn't I?

Fix that.
a
angelrulez7 (2012-09-02 19:27:13)
Oh yeah.

If you want strip_tags, use THIS code for add2.php:

<?
$msg = "<b>".$_POST['u']."</b> said:<br>".$_POST['i']."<br>";
$msg . = file_get_contents('content.php';
$disablehtml = strip_tags("<b><img><br>", $msg);
$strip = stripslashes($disablehtml);
file_put_contents('content.php', $strip);
?>

This disables HTML and fixes quotes.
a
klubadmin (2012-09-03 01:53:25)
There are certain benefits to a database, though. One being it's much easier to search/sort through.
socialcu.be
3dsklub.cf

Like what I said? +respect
>Official Trinate Spriter<
 

Log in to submit a comment

This topic's ID: 29162

Back to forum: Web Programming (HTML, JS, CSS, PHP, MySQL)




Total registered users: 8321
New registered users today: 7
Newest registered user: ElegantVulpes

©  Copyright 2026 3DSPlaza. All Rights Reserved