Code: Select all
<?php
$host = "host"; // server address
$user = "xxx"; // database username
$pass = "xxx"; // database password
$db = "tag"; // database name
$limit = "50"; // number of tags to show
$pass = addslashes($pass); // just incase $pass contains special chars
$con = mysql_pconnect($host,$user,$pass);
if($con == FALSE) // if the connection fails
{
print "connection error.";
die();
}
$db = mysql_select_db($db);
if($db == FALSE) // if the database selection fails
{
print "connection error.";
die();
}
if(eregi("conf.php",$_SERVER["PHP_SELF"]))
die("You may not access this page.");
?>
here is post.php
<?php
require("conf.php") or die("Main configuration file is missing, execution may not proceed.");
$name = $_REQUEST["name"];
$http = $_REQUEST["http"];
$msg = $_REQUEST["msg"];
if(!isset($name))
die("You must enter a name.");
if(!isset($msg))
die("You must enter a message.");
if(empty($name) == TRUE)
die("You must enter a name.");
if(empty($msg) == TRUE)
die("You must enter a message.");
$name = addslashes($name);
$name = trim($name);
$name = strip_tags($name);
$name = urldecode($name);
$http = addslashes($http);
$http = trim($http);
$http = strip_tags($http);
$http = urldecode($http);
$msg = addslashes($msg);
$msg = strip_tags($msg);
$msg = urldecode($msg);
$query = "INSERT INTO `tagboard`(`name`,`http`,`msg`) VALUES('$name','$http','$msg')";
$result = mysql_query($query);
print "Click <a href=view.php>here</a>.";
?>
here is view.php
<?php
require("conf.php") or die("Main configuration file is missing, execution may not proceed.");
$query = "SELECT * FROM `tagboard` ORDER BY `id` DESC LIMIT ". $limit;
$result = mysql_query($query);
while($rows = mysql_fetch_row($result))
{
$r[0] = stripslashes($row["http"]);
$r[1] = stripslashes($row["name"]);
$r[2] = stripslashes($row["msg"]);
print "<a href=. $r[0] . target=_blank>". $r[1] ."</a>: ". $r[2] ."<br>";
}
?>
I already inserted the mysql databse as "tag"
Here is the tag.php
<!-- Insert this HTML where you would like the tagboard displayed -->
<iframe src=view.php border=0 name=tagboard></iframe><br>
<form action=post.php method=post target=tagboard>
<input type=text name=name value=name><br>
<input type=text name=http value=http://><br>
<input type=text name=msg value=message><br>
<input type=submit value=Submit> <input type=reset value=Reset>
</form>
All these files upload and up.. and i test up tag.php.
when i clicked submit.. no entries was added or didn't show up in the view.php ifram
why is that?
?>