PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>View your **** stories</title>
<script src="lib/prototype.js" type="text/javascript"></script>
<script src="src/scriptaculous.js" type="text/javascript"></script>
<style type="text/css">
body {
background-color:#333333;
}
.main {
margin:0px auto;
border:1px solid #CCCCCC;
background-color:#FFFF99;
width:500px;
padding:10px;
font-family:Tahoma;
font-size:12px;
margin-top:200px;
}
.submit {
width:55px;
background-color:#3333FF;
border:1px #000000 solid;
color:#FFFFFF;
font-family:Tahoma;
font-size:12px;
top:2px;
}
a {
color:#0066CC;
}
a:hover {
background-color:#FFFFFF;
}
a:visited {
color:#993333;
}
</style>
</head>
<body>
<a href="#" onclick="Effect.toggle('****','appear'); return false;">View **** Bookmark Retriever</a>
<a href="#" onclick="Effect.toggle('texteditor','appear'); return false;">View Texteditor</a>
<div id="****" style="display:none;"><div class="main">
Please enter your ****.com username:<br />
<form name="form" id="****">
<input type="text" name="username" value="webmoney" id="username" /><br />
<input type="button" name="submit" class="submit" value="Submit" onclick="new Ajax.Updater('mydiv', 'digger.php', {asynchronous:true, method:'post', evalScripts:true, parameters: $F('username')});"/><br /><br />
</form>
<div id="mydiv"></div>
</div></div>
<div id="texteditor" style="display:none;"<div class="main">
<p>Usage: Please use [b] [/b] for Bold, [u] [/u] for underline, [i] [/i] for italics, [br] for new line and [strike] [/stike] for strikethrough.</p>
<form name="form" method="post" action="test.php">
<textarea name="input"></textarea><br />
<input type="submit" name="submit" value="Submit" class="submit" />
</form><br />
<?php
// Create the replace tags function
function replacetags($v)
{
$v = str_replace("[b]", "<b>", "$v");
// Above line will replace [b] with <b> for the bold, The following do the same with different code.
$v = str_replace("[/b]", "</b>", "$v");
$v = str_replace("[i]", "<i>", "$v");
$v = str_replace("[/i]", "</i>", "$v");
$v = str_replace("[u]", "<u>", "$v");
$v = str_replace("[/u]", "</u>", "$v");
$v = str_replace("[br]", "<br>", "$v");
$v = str_replace("[strike]", "<strike>", "$v");
$v = str_replace("[/strike]", "</strike>", "$v");
$v = str_replace("[B]", "<b>", "$v");
$v = str_replace("[/B]", "</b>", "$v");
$v = str_replace("[I]", "<i>", "$v");
$v = str_replace("[/I]", "</i>", "$v");
$v = str_replace("[U]", "<u>", "$v");
$v = str_replace("[/U]", "</u>", "$v");
$v = str_replace("[BR]", "<br>", "$v");
$v = str_replace("[STRIKE]", "<strike>", "$v");
$v = str_replace("[/STRIKE]", "</strike>", "$v");
return $v;
}
// check if form is filled in
if ($_POST['submit'])
{
// the form has been submit
// Get the values from the textarea
$input = $_POST['input'];
// Run the function to replace tags
$output = replacetags($input);
// Run the output
echo $output;
} else
{
// The form hasn't been submit
}
?>
</div></div>
</body>
</html>
Bookmarks