Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <title>shoutbox php version flazer</title>
- <?php
- //------ Edit Below This Line ------//
- define('SHOUTBOX', 'shoutbox');
- $host = 'localhost';
- $dbuser = 'homo'; // Username to access database.
- $dbpass = 'arshomo^)(^'; // Password to access database.
- $dbname = 'homo'; // Database name.
- $allowed_tags = '<b><i><u><a>';
- //------ Edit Above This Line ------//
- mysql_connect($host, $dbuser, $dbpass) or die(mysql_error());
- mysql_select_db($dbname) or die(mysql_error());
- function clean_string($string, $tags = '')
- {
- $string = trim($string);
- $string = str_replace("\'", "''", $string);
- return $string;
- }
- ?>
- <style type="text/css">
- .shoutbox {
- margin: 0px;
- padding: 0px;}
- .shoutbox a, a:visited {
- color: 6E7A8A;
- font-size: 12px;
- font-weight: bold;
- text-decoration: none;}
- .shoutbox a:hover {
- color: 6E7A8A;
- text-decoration: underline;}
- .shoutbox input, select, textarea {
- border: 1px solid silver;}
- .form {
- font-size: 12px;}
- #name1 {
- background-color: E0E0E0;
- color: 666666;
- font-size: 12px;}
- #content1 {
- background-color: E0E0E0;
- font-size: 12px;}
- #name2 {
- background-color: F3F3F3;
- color: 666666;
- font-size: 12px;}
- #content2 {
- background-color: F3F3F3;
- font-size: 12px;}
- </style>
- <?php
- switch($_GET['p'])
- {
- case 'box':
- echo "<body class=\"shoutbox\">\n<table cellpadding=\"2\">";
- $result = mysql_query("SELECT * FROM " . SHOUTBOX . " ORDER BY id DESC") or die(mysql_error());
- for ($i = 1; $i <= ($row = mysql_fetch_assoc($result)); $i++)
- {
- $nameid = (!($i % 2)) ? 'name1' : 'name2';
- $contentid = (!($i % 2)) ? 'content1' : 'content2';
- $name = strip_tags(stripslashes($row['name']), $allowed_tags);
- $website = strip_tags(stripslashes($row['website']), $allowed_tags);
- $content = strip_tags(stripslashes($row['content']), $allowed_tags);
- echo '<tr><td id="' . $nameid . '" width="50" align="right">',
- ((!empty($row['website'])) ? "<a href=\"$website\">$name</a>" : $name),
- '</td><td id="' . $contentid . '" width="170">' . $content . "</td></tr>\n";
- }
- echo "</table>\n</body>";
- break;
- default:
- echo '<div class="shoutbox">';
- if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['name']) && !empty($_POST['content']))
- {
- $name = clean_string($_POST['name']);
- $website = clean_string($_POST['website']);
- $website = (!empty($website) && $website != 'http://') ? (!eregi('^http://', $website) ? 'http://' . $website : $website) : '';
- $content = nl2br(clean_string($_POST['content'], '<a>'));
- mysql_query("INSERT INTO " . SHOUTBOX . " (name, website, content) VALUES ('$name', '$website', '$content')") or die(mysql_error());
- }
- echo '<iframe src="' . basename($_SERVER['PHP_SELF']) . '?p=box" width="260" height="285"></iframe>
- <form method="post"><table class="form">
- <tr><td align="right">Name:</td><td><input type="text" name="name" size="10"></td></tr>
- <tr><td align="right">Website:</td><td><input type="text" name="website" value="http://" size="10"></td></tr>
- <tr><td align="right">Message:</td><td><textarea name="content" rows="3" cols="20"></textarea></td></tr>
- <tr><td colspan="2" align="center"><input type="submit" value="Submit"></td></tr>
- </table></form>', "\n</div>";
- break;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement