<?php
include_once("inc_dbcon.php");
include_once('admin/config.php');
include_once($languageFile);
// check to see if in admin mode and validate key
global $keyOut;
$keyOut = "";
$adminMode = false;
if (isset($_GET["k"]))
if($_GET["k"] == $key) { // Key comes from admin/password.php file
$adminMode = true;
$keyOut = "&k=" . $key;
}
if (!isset($_GET["id"])) {
print("This posting was not found. Please go back and try again.");
exit();
}
$postId = mysql_real_escape_string($_GET["id"]);
$result = mysql_query("SELECT *,DATE_FORMAT(timeStamp,'%b %d, %Y %l:%i %p') AS timeStamp FROM md_postings WHERE postId='$postId'");
if (!$result){
print("Houston we have a problem: " . mysql_error());
exit();
}
while ($row = mysql_fetch_array($result)){
$title = stripslashes($row["title"]);
$description = stripslashes($row["description"]);
$price = trim($row["price"]);
$name = trim($row["name"]);
$city = trim($row["city"]);
$imgURL = $row["imgURL"];
$ipAddress = $row["ip"];
$email = trim($row["email"]);
$cp = $row["confirmPassword"];
$currentCat = $row["category"]; // This is the current category used in navigation.
if ($price == 0)
$price = "Free";
else
$price = "$" . $price;
$timeStamp = $row["timeStamp"];
$isAvailable = $row["isAvailable"];
}
$msg = "";
if (isset($_GET["msg"]))
$msg = mysql_real_escape_string($_GET["msg"]);
if ($isAvailable == 0 )
$msg = STR_NOLONGERAVAILABLE;
if ($name == "")
$name = "<span class='md_help'>" . STR_UNDISCLOSED . "</span>\n";
$photo = "";
if ($imgURL != "")
$photo = "<img src='$imgURL' class='md_photo'>";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $title; ?> - <?php echo $sitetitle;?></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript">
// This loads jquery for show/hide animations
</script>
<script language="JavaScript" type="text/JavaScript">
$(document).ready(function() {
});
function emailPerson() {$("#md_emailBox").toggle("fast");}
function myposttoggle() {$("#myPost").toggle("fast");}
</script>
<script language="JavaScript" type="text/JavaScript">
function show(lyr){
d = document.getElementById(lyr).style.display
if (d == "none")
document.getElementById(lyr).style.display = ""
else
document.getElementById(lyr).style.display = "none"
}
function md_validateForm(){
d = document.form1
e = false // no erros by default
if(d.md_message.value == ''){
d.md_message.className = 'md_errorField';
d.md_message.focus();
document.getElementById('md_messageLabel').className = 'md_errorText';
e=true;
}
if ((d.email2.value.indexOf(".") > 2) && (d.email2.value.indexOf("@") > 0)){
// it looks like an email address
} else {
d.md_email2.className = 'md_errorField';
d.md_email2.focus();
document.getElementById('md_email2Label').className = 'md_errorText';
e=true;
}
if(!e)
document.form1.submit()
}
</script>
<link href="md_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php include_once("inc_navigation.php") ?>
<div id="md_container">
<div id="md_content">
<?php if ($msg != "") { // If there is a message, display it
if ($msg == "deactivated")
$msg = STR_MESSAGEDEACTIVATED;
if ($msg == "activated")
$msg = STR_MESSAGEACTIVATED;
if ($msg == "messageSent")
$msg = STR_MESSAGESENT;
print("<br clear='all'><div class='md_msg'>$msg</div>");
}
?>
<br clear="all" />
<div class="md_itemTitle">
<?php echo $title; ?> —
<?php echo $price; ?></div>
<?php if ($adminMode){ ?>
<script language="JavaScript">
function adminAction(val){
window.location.href = "action.php?a=" + val + "&cp=<?php echo $cp; ?>&k=<?php echo $_GET['k']; ?>"
}
</script>
<div class="md_admin" style="display:inline; float:right;">
<a href="javascript:adminAction('delete');" title="This will delete the item, but not any photos, you'll have to clean that up on the server"><?php echo STR_DELETEPOST; ?></a>
| <a href="javascript:adminAction('deact');" title='Will not delete, but show others that things are getting taken... and activity'><?php echo STR_MARKASTAKEN; ?></a>
</div>
<?php } ?>
<div id='md_fromDate' class="md_itemTitleSub">
<div style="float:right; display:inline">
<a href='javascript:myposttoggle()'><?php echo STR_THISISMYPOSTING; ?></a> <img src="images/icn_arrow_down.gif" border="0" align="absmiddle" width="9" height="5" alt="Open" />
</div>
<span class='md_labelViewItem'><?php echo STR_FROM; ?></span> <?php echo $name; ?> <span class='md_divider'> | </span>
<span class='md_labelViewItem'><?php echo STR_CITY2; ?></span> <?php echo $city; ?> <span class='md_divider'> | </span>
<span class='md_labelViewItem'><?php echo STR_POSTED; ?></span> <?php echo $timeStamp; ?>
<?php if ($adminMode){ ?>
<span class='md_divider'> | </span>
<span class='md_labelViewItem' style="color:maroon"><?php echo STR_IPADDRESS . " " . $ipAddress; ?></span>
<span class='md_divider'> | </span>
<span class='md_labelViewItem' style="color:maroon"><?php echo STR_EMAIL; ?> <?php echo $email; ?></span>
<?php } ?>
</div>
<!-- this is my posting box -->
<div id='myPost' class="thisismypost">
<form name='form2' action='controller.php' method="post">
If this is your post, and you need to mark this as taken or delete it, we can send you a reminder email with links to do this. <br /><br />
<a class="button" id="myPost" href="#" onclick="document.form2.submit();"><span>Send Email Reminder</span></a>
<input type='hidden' name='postId' value='1'>
<input type='hidden' name='op' value='emailReminder'>
<a href='javascript:myposttoggle()' id="mypostclose">Cancel</a>
</form>
</div>
<div id="md_viewItemContent">
<?php print (nl2br($description)); ?><br clear="all">
<?php echo $photo; ?>
</div>
<?php
// Only show emailing form if the item is available
if ($isAvailable == 1) { ?>
<br><br>
<a class="button" id="emailPerson" href="javascript:emailPerson()" onclick="this.blur();"><span><?php echo STR_EMAILTHISPERSON; ?> <img src="images/icn_arrow_down.gif" border="0" align="absmiddle" width="9" height="5" alt="Open" /></span></a>
<div id="md_emailBox" style="display:none">
<form action="controller.php" method="post" name="form1" id="form1" class='md_form' style="display:inline">
<table border="0" cellpadding="2" cellspacing="0">
<tr>
<td><?php echo STR_YOURNAME; ?><br />
<input name="name" type="text" id="name" size="20" />
</td>
<td> </td>
<td><span id="md_email2Label"><?php echo STR_YOURMAIL; ?></span><br />
<input name="Email" type="text" id="md_email" size="40" maxlength="90" />
<input name="email2" type="text" id="md_email2" size="40" />
</td>
</tr>
</table>
<div> <br />
<span id="md_messageLabel"><?php echo STR_YOURMESSAGE; ?></span></div>
<textarea name="md_message" cols="60" rows="6" id="md_message" style="width:96%"></textarea>
<input type="hidden" name="postId" id="postId" value="<?php echo $postId; ?>" />
<input type="hidden" name="title" value="<?php echo $title; ?>" />
<input name="op" type="hidden" value="email" />
<p>
<a class="button" id="Submit" href="#" onclick="md_validateForm();this.blur();"><span><?php echo STR_SENDEMAIL; ?></span></a>
<br />
</p>
</form>
</div>
<?php } ?>
</div>
</div>
<br /><br />
<?php include_once("inc_footer.php");?>
</body>
</html>
<?php mysql_close($dbConn); ?>