<?php
include_once("include/db_connection.php");
header("Expires: Thu, 17 May 2001 10:17:17 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
session_start();
if($_SESSION["loggedIn"] == FALSE){
header("Location:admin_login.php");
exit;
}include_once("config.php");
$UserName=$_SESSION['UserName'];
include('header1.php');
$query1=mysql_fetch_array(mysql_query("select UserName FROM users WHERE Type='1' AND UserName='$UserName'" ));
if($UserName==$query1['UserName'] ){
echo $UserName;
include('left_user.php');}
else{
include('left_coord.php');
}?>
<?php
// get value of id that sent from address bar
$id=$_GET['id'];
$UserName = $_SESSION['UserName'];
$tbl_name="forum_question";
$sql="SELECT * FROM $tbl_name WHERE id='$id'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Premium Series by Free CSS Templates</title>
<meta name="keywords" content="" />
<meta name="Premium Series" content="" />
<link href="default.css" rel="stylesheet" type="text/css" media="screen" />
<script language="JavaScript" src="gen_validatorv31.js" type="text/javascript"></script>
<title>Untitled Document</title>
</head>
<body>
<div id="wrapper">
<!-- start page -->
<div id="page">
<!-- start content -->
<div id="prtCnt" align="center">
<div id="content" >
<div class="post">
<h2 class="title"> </h2>
<div class="entry">
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td><table width="100%" border="0" cellpadding="3" cellspacing="1" bordercolor="1" bgcolor="#FFFFFF">
<tr>
<td bgcolor="#F8F7F1"><strong><?php echo $row['topic']; ?></strong></td>
</tr>
<tr>
<td bgcolor="#F8F7F1"><?php echo $row['detail']; ?></td>
</tr>
<tr>
<td bgcolor="#F8F7F1"><strong>By :</strong><?php echo $row['name']; ?></td>
</tr>
<tr>
<td bgcolor="#F8F7F1"><strong>Date/time : </strong><?php echo $row['datetime']; ?></td></tr>
<tr>
<td bgcolor="#F8F7F1"><strong><a href="user_deleteTopic.php<?php echo "?id=$id";?>">delete</a></td>
</tr>
</table></td>
</tr>
</table>
<BR>
<?php
$tbl_name2="forum_answer"; // Switch to table "forum_answer"
$sql2="SELECT * FROM $tbl_name2 WHERE question_id='$id'";
$result2=mysql_query($sql2);
?>
<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td width="7%" align="center" bgcolor="#E6E6E6"><strong>ID</strong></td>
<td width="12%" align="center" bgcolor="#E6E6E6"><strong>Name</strong></td>
<td width="51%" align="center" bgcolor="#E6E6E6"><strong>Answer</strong></td>
<td width="16%" align="center" bgcolor="#E6E6E6"><strong>Date/Time</strong></td>
</tr>
<?php
while($row=mysql_fetch_array($result2)){
?>
<tr>
<td bgcolor="#FFFFFF"><?php echo $row['a_id']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $row['a_name']; ?></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $row['a_answer']; ?></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $row['a_datetime']; ?></td>
<td bgcolor="#F8F7F1"><strong><a href="user_delete_answer.php?id=<?php echo $id;?>& a_id=<?php echo $row['a_id'] ?>">delete</a></td>
</tr>
<?php
}
?>
</table>
<?php
$sql3="SELECT view FROM $tbl_name WHERE id='$id'";
$result3=mysql_query($sql3);
$row=mysql_fetch_array($result3);
$view=$row['view'];
// if have no counter value set counter = 1
if(empty($view)){
$view=1;
$sql4="INSERT INTO $tbl_name(view) VALUES('$view') WHERE id='$id'";
$result4=mysql_query($sql4);
}
// count more value
$addview=$view+1;
$sql5="update $tbl_name set view='$addview' WHERE id='$id'";
$result5=mysql_query($sql5);
mysql_close();
?>
<BR>
<form name="form1" method="post" action="user_add_answer.php">
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td valign="top"><strong>Answer</strong></td>
<td valign="top">:</td>
<td><textarea name="a_answer" cols="45" rows="3" id="a_answer"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input name="id" type="hidden" value="<?php echo $id; ?>" /></td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
</p>
</div>
</div>
</div>
</div>
<!-- end content -->
<!-- start sidebars -->
<!-- end sidebars -->
<div style="clear: both;"> </div>
</div>
<!-- end page -->
</div>
</html>
<?php
include('footer.php');
?>