View file private.php

File size: 1.82Kb
<?php include 'head.php';
if($_GET["action"]=="post") { if($_POST["message"]==""){ echo '<center>Error, message left blank please go back and fix it.</center>'; include 'foot.php'; exit(); }
if($_POST["name"]==""){ echo '<center>Error, name left blank please go back and fix it.</center>'; include 'foot.php'; exit(); } }
$_POST["name"] = str_replace($filter,"*",$_POST["name"]); $_POST["message"] = str_replace($filter,"*",$_POST["message"]);
$gname=$_GET["name"];
$action=$_GET["action"]; if($action==""){echo '<center><a href="private.php?action=send">Send Pm</a><br/><a href="private.php?action=clear">Clear Messages</a></center>'; include "private_text.php"; }
if($action=="send"){echo '<form action="private.php?action=post" method="post"><center>'; if(isset($_GET["reply"])){
echo "<input name=\"name\" type=\"hidden\" value=\"$gname\"/>"; } else { echo 'Friends Name<br/><input name="name" type="text" size="10"/><br/>';}
echo 'Message<br/><textarea name="message"></textarea><br/><input type="submit" value="Send Message"/></center></form>'; }
if($action=="post"){$old=file_get_contents("private_text.php"); $f=fopen("private_text.php","w+");
fwrite($f,'<?php if($_SESSION["userName"]=="'.$_POST["name"].'")
{echo "<center><b><a href=\"prof.php?user='.$_SESSION["userName"].'\">'.$_SESSION["userName"].'</a></b>
<br/>'.$_POST["message"].'<br/>---<br/><a href=\"private.php?action=send&reply&name='.$_SESSION["userName"].'\">Reply..</a><br/>---</center>"; } ?>'); fwrite($f,"\r\n");
fwrite($f,$old); fclose($f); echo '<center>Your message was sent<br/><a href="private.php">continue..</a></center>'; }if($action=="clear"){
$old=file_get_contents("private_text.php"); $new=str_replace($_SESSION["userName"],"code6",$old); $f=fopen("private_text.php","w+"); fwrite($f,$new); fclose($f); echo '<center>Private Messages Cleared</center>';} include 'foot.php'; ?>