PHPBuilder - Graffitti Code



RSS Twitter
Snippets Other

Graffitti Code

by: Halit YESIL
|
November 18, 2005

Version: 1.1.1

Type: Full Script

Category: Other

License: Other

Description: Allows a small line of text to be modified by the user - which is then included in your webpage - so it allows a small amount of INteractivity. It includes full logging - and the option to dynamically include the text in any PHP page by using the include command wiht the path to the file specified



<?PHP
}

function graffitti_fns($graffitti)
{
	$filecurr = "currmsg.include";
	$filelog = "graf.logit";	
	$graffitti = htmlentities($graffitti);
    if(!file_exists($filecurr)){ 
      $newfile = fopen($filecurr, "w+");
      fclose($newfile);
    }
    if(!($newfile = fopen($filecurr, "w"))){ return false; }	
    if(!fwrite($newfile, $graffitti)){ return false; }	
    if(!fclose($newfile)){ return false; }	
    if(!($newfile1 = fopen($filelog, "a+"))){ return false; }	
    $add = "%".date("F jS Y g:i:s a T")."#".$_SERVER['REMOTE_ADDR']."#".$graffitti."\n";
	if(!fwrite($newfile1, $add)){ return false; }	
	if(!fclose($newfile1)){ return false; }
	return true; 
}


if($edit == "yes"){

  if($_POST['graffitti'] == ""){
  
     display_html_graffitti_form('Sorry - You entered nothing in the text box', 'red');
	 
  }else{
	$graffitti = $_POST['graffitti'];
    if(!graffitti_fns($graffitti))
	{
		echo "<h2>Nothing!</h2>";
	}else{
		echo "<h2>Thankyou!</h2>";
	};
  }
}else{
	display_html_graffitti_form('<big><big>Graffitti!</big></big>', 'black');
}

?>

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Halit YESIL

Comment:



Comment:

(Maximum characters: 1200). You have characters left.