|
Posted by up2trouble on 07/23/07 13:11
?PHP
//
********************************************************************************************
//CONNECTION VARIABLES
//
********************************************************************************************
$db_server = "localhost";
$db_user = "";
$db_pass = "";
$db_name = "";
$db_table = "blog_category";
$db_table1 = "blog_entry";
$db_table2 = "quotes";
$db_table3 = "ab_category";
$db_table4 = "ab_person";
$db_table5 = "menu_heading";
$db_table6 = "menu_item";
$db_table7 = "dir_category";
$db_table8 = "dir_links";
$connect = mysql_connect($db_server, $db_user, $db_pass) OR DIE ('I
can not connect to server because: ' .mysql_errno(). " -
" .mysql_error());
mysql_select_db($db_name, $connect) OR DIE ('I can not connect to
server because: ' .mysql_errno(). " - " .mysql_error());
//
********************************************************************************************
//
********************************************************************************************
?>
<?PHP include("../includes/connect.txt");?>
<?PHP
function listCategory($connect, $db_table7)
{
echo "<TABLE CELLSPACING='2' CELLPADDING='2' BORDER='1'>";
echo "<TR><TH ALIGN='center' VALIGN='top'>ID</TH> <TH ALIGN='center'
VALIGN='top'>Name</TH>";
echo "<TH ALIGN='center' VALIGN='top'>Parent</TH></TR>";
$sql = "SELECT * FROM $db_table7 ORDER BY parent ASC";
$result = mysql_query ($sql, $connect) or die ('Query failed:
' .mysql_error());
while ($row = mysql_fetch_array($result))
{
$id = $row["id"];
$name = $row["name"];
$parent = $row["parent"];
echo "<TR><TD><STRONG>$id</STRONG></TD><TD>$name</TD>";
echo "<TD>$parent</TD></TR>";
}
echo "</TABLE>";
}
function addCategoryDir ($connect, $db_table7)
{
$name = $_POST['name'];
$parent = $_POST['parent'];
$sql = "INSERT INTO $db_table7 (name, parent) VALUES ('$name',
'$parent')";
mysql_query ($sql) or die(mysql_error());
}
function deleteCategoryDir ($connect, $db_table7)
{
$name = $_POST['name'];
$sql = "DELETE FROM $db_table7 WHERE '$name' = name";
mysql_query ($sql, $connect) or die ('Query failed:
' .mysql_error());
}
function addLink ($connect, $db_table8)
{
$name = $_POST['name'];
$url = $_POST['url'];
$description = $_POST['description'];
$category = $_POST['category'];
$sql = "INSERT INTO $db_table8 (name, url, description, category)
VALUES ('$name', '$url', '$description', '$category')";
mysql_query ($sql, $connect) or die ('Query failed:
' .mysql_error());
echo "Your link was added and the Administrator was notified that your
entry is awaiting approval.";
$sql2 = "SELECT COUNT(*) FROM $db_table8 WHERE approved = 0 ";
$result = mysql_query ($sql2, $connect) or die ('Query failed:
' .mysql_error());
$approved = mysql_num_rows($result);
$to = "lynettesmith@gmail.com";
$from = "lynnesmith.net";
$subject = "Directory link added";
$message = "Directory link added. You have $approved entries waiting
for approval.";
mail($to, $subject, $message, "From: $from");
}
function adminApprovalNeededDir ($connect, $db_table8)
{
$sql = "SELECT COUNT(*) FROM $db_table8 WHERE approved = 0 ";
$result = mysql_query ($sql, $connect) or die ('Query failed:
' .mysql_error());
$approved = mysql_num_rows($result);
echo "<STRONG>Directory</STRONG> - You have $approved entries waiting
for approval.";
}
<HTML>
<HEAD>
<?PHP include("../includes/headsection.txt")?>
</HEAD>
<BODY>
<?PHP include("../includes/connect.txt");?>
<DIV ID="wrapper">
<DIV ID="header">
</DIV>
<DIV ID="subheader">
<?PHP include("../includes/navigation.txt")?>
</DIV>
<DIV ID="rcol">
<?PHP include("../includes/navigationa.txt")?>
</DIV>
<DIV ID="content">
<H2 ALIGN="center">Website Administration Area</H2>
<?PHP include("../directory/dir_displaywaiting.php"); ?>
<BR>
<?PHP include("../addressbook/ab_displaywaiting.php"); ?>
</DIV>
<DIV ID="footer">
<?PHP include("../includes/footer.txt")?>
</DIV>
</DIV>
</BODY>
</HTML>
<?PHP include("../directory/dir_functions.php"); ?>
<?PHP
adminApprovalNeededDir ($connect, $db_table8);
?>
I always use a gui and have no idea how to even get to the command line
Navigation:
[Reply to this message]
|