And here is the insert page where i insert the typed post in to
mysql the only thing is that i have no checks if there are any enterd values in the $_POST sow any one can edite anyes page, thats not god....
insert-editedguestbookpost.php
[Php]
<?php
$username = $POST["username"];
$password = $POST["password"];
$set = $POST["set"];
$action=$POST["action"];
$postID=$GET["postID"];
$post=$POST["post"];
if ($set=="set") {
$username_control = 1;
$main_control = 1;
$main_control2 = 0;
if($username == ""){
$empty_username = "Ooops! - You forgot to enter your username.";
$username_control = 0;
$main_control = 0;
}
elseif($main_control = 1){
$str = $username;
$str = strtolower($str);
require('./functions.php');
$result = mysql_query("SELECT * FROM guestbook WHERE (ID='$postID' AND username='$username' AND password='$password')") or die (mysql_error());
if ($str = mysql_num_rows($result) == 0) {
$incorrect_info = "Ooops! - That Username or Password is not correct, or the post does not belong to you";
$main_control2 = 1;
mysql_close($starta);
}
$post = mysql_fetch_array($result);
mysql_free_result($result);
$post['Post'] = ereg_replace("<br>", "", $post['Post']);
showheader("Edit Your post");
}
}
if($main_control2 != 1 && $main_control == 1) {
}
elseif ($action == "edit_three") {
require('./functions.php');
editpost();
$edited_poste = "Thanks! - Your Post has been Edited";
$goto = "<p>
Hit View Posts Button To See All<br>
Guestbookpost.</p>";
}
?>
<FORM METHOD=POST ACTION="<?php echo $PHP_SELF ?>">
<INPUT TYPE="hidden" name="action" value="edit_three">
<INPUT TYPE="hidden" name="postID" value="<?php echo $postID ?>">
<B>Post info:</B>
<p><BR>
Posts appear exactly as you have submitted them.<br>
HTML will not be allowed, every thing converted into harmless text.<br>
Therefore, you cannot have HTML formatting in you post.<br>
<br>
</p>
<TEXTAREA NAME="post" ROWS=10 COLS=45 WRAP="VIRTUAL" class="guestbookboxeditinfoview1"><?php echo $post['Post'] ?></TEXTAREA>
<INPUT TYPE="RESET" class="button" NAME="Reset" VALUE="Clear Fields" style="width: 88px; height: 20px; float: right;">
<INPUT TYPE="SUBMIT" class="button" NAME="submit1" VALUE="Submit Post <? $incorrect_info?>" style="width: 88px; height: 20px;">
<?php echo $edited_poste; ?>
<input type="hidden" name="set" value="set">
</FORM>
<FORM>
<input type="button" class="button" value="View Posts" style="width: 88px; height: 20px; float: right;" onclick="document.location.href='../guestbook/guestbookview.php'">
<?php echo $goto; ?>
</FORM>
[/code]