some of important codes of config.php it also includes some important functions
<?
define("DB_NAME", "db_user"); // The name of the database
define("DB_USER", "db_pass"); // Your MySQL username
define("DB_PASS", "db_pass"); // ...and password
define("DB_HOST", "localhost");
define("PBLUE" , "bluee");
define("PGREEN" , "greenn");
define("PPINK" , "pinkk");
function dibi()
{
$con=mysql_connect(DB_HOST, DB_USER, DB_PASS);
if (!isset($con)) { echo "Error while DB:Connection !"; exit;}
mysql_select_db(DB_NAME,$con);
return $con;
}
function get_facts($zon,$item=0)
{
if ($item == 0)
$con=mysql_query("SELECT * FROM data",$zon);
else
$con=mysql_query("SELECT * FROM data WHERE id = '$item'",$zon);
$bon=mysql_num_rows($con);
for ($i=$bon-1;$i>=0;$i--)
{
echo "<p class=\"head\"><img src=\"images/".mysql_result($con,$i,"user").".gif\"> <b>".mysql_result($con,$i,"header")."</b></p><p>".mysql_result($con,$i,"text")."</p><p class=\"date\">".mysql_result($con,$i,"user")."-".mysql_result($con,$i,"date")."</p>";
}
}
function publish($user,$head,$text,$date,$connect)
{
return mysql_query("INSERT INTO data(id,user,header,text,date) VALUES ('','$user','$head','$text','$date')",$connect);
}
function stil()
{
?>
<style type="text/css">
<!--
.headbar {
font-size: 9px;
background-color: #CCCCCC;
height: 5px;
font-family: sans-serif;
text-align: right;
}
.leftlogo {
background-image: url(images/blank_logo.gif);
height: 35px;
width: 130px;
}
.rightlogo {
text-align: right;
}
.topp {
font-size: 9px;
height: 5px;
font-family: Verdana, Arial, Helvetica, sans-serif;
text-align: right;
}
.main {
font-family: sans-serif;
font-size: 11px;
color: #333333;
white-space: normal;
display: inline;
text-align: left;
text-indent: 5pt;
vertical-align: top;
line-height: 16px;
letter-spacing: 1px;
}
.head {
font-family: sans-serif;
font-variant: small-caps;
font-size: 11px;
text-align: left;
}
.warn {
font-family: sans-serif;
font-variant: small-caps;
font-size: 11px;
text-align: left;
color: red;
}
.blue {
font-family: sans-serif;
font-variant: small-caps;
font-size: 11px;
text-align: left;
background-color: #CAFBFF;
}
.green {
font-family: sans-serif;
font-variant: small-caps;
font-size: 11px;
text-align: left;
background-color: #ABFFA6;
}
.pink {
font-family: sans-serif;
font-variant: small-caps;
font-size: 11px;
text-align: left;
background-color: #F5CDF1;
}
.date {
font-family: sans-serif;
font-size: 9px;
text-align: right;
}
.form {
border-top-style: solid;
border-left-style: solid;
border-bottom-style: solid;
border-right-style: solid;
border-top-width: 1;
border-left-width: 1;
border-bottom-width: 1;
border-right-width: 1;
}
-->
</style>
<?
}
function head()
{
?>
<html>
<head>
<title>swcms.net</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9">
<?stil();?>
</head>
<body topmargin="0"><center>
<table width="600" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="headbar"> </td>
</tr>
<tr>
<td height="19"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="leftlogo"><a href="index.php"><img border=0 src="images/pink_logo.gif" width="130" height="35"></a></td>
<td><div align="right"> </div></td>
</tr>
</table> </td>
</tr>
<tr>
<td valign="top"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="topp"> </td>
</tr>
<tr>
<td valign="top" class="main">
<?
}
function foot()
{
?>
</td>
</tr>
<tr>
<td class="headbar">Under GPL Licence free for any use . rat02 : gg </td>
</tr>
</table></td>
</tr>
</table></center>
</body>
</html>
<?
}
function addentry($user,$head="",$text="",$date="")
{
if ($date=="") $date=date("dS of F");
?>
<p class=head>Add Entry</p>
<form action="" method="post">
<p class="<?=$user?>"> Writer : </p> <p class="writer"><img src="images/<?=$user?>.gif"> <?=$user?></p>
<p class="<?=$user?>"> Header : </p> <p><input class="form" type="text" name="head" value="<?=$head?>" size="80"> </p>
<p class="<?=$user?>"> Text : </p> <p><textarea class="form" name="text" rows="10" cols="80"><?=$text?></textarea> </p>
<p class="<?=$user?>"> Date : </p> <p><input class="form" type="text" name="date" value="<?=$date?>"> </p>
<p class="<?=$user?>"> Publish : </p> <p><input class="form" type="submit" name="stat" value="Publish"><input class="form" type="submit" name="stat" value="Exit"></p>
</form>
<?
listg(dibi(),$user);
}
function listg($connect,$user)
{
echo "<p class=\"".$user."\">Old Record List :</p>";
$con=mysql_query("SELECT * FROM data WHERE user='$user'",$connect);
$bon=mysql_num_rows($con);
for ($i=$bon-1;$i>=0;$i--)
{
echo "<p class=\"head\"><img src=\"images/".mysql_result($con,$i,"user").".gif\"> ".mysql_result($con,$i,"header")."-".mysql_result($con,$i,"date")."<br>";
}
}
function login()
{
?>
<p class=head>Admin Login </p>
<form action="" method="post">
<p class="yesil"> Username : </p> <p><input class="form" type="text" name="user" value=""> </p>
<p class="yesil"> Pass : </p> <p><input class="form" type="password" name="pass" value=""> </p>
<p class="yesil"> Login : </p> <p><input class="form" type="submit" name="stat" value="Do it!"> </p>
</form>
<?
}
?>
--rat2
© 2008 Novell, Inc. All Rights Reserved.