File: /home/httpd/html/tubeshemale.com/public_html/templates_OLD_JUNK/template.user_profile.php
<?
session_start();
include('../admin/db.php');
if(is_numeric($_GET[id])) {
$id = mysql_real_escape_string($_REQUEST[id]);
$result = mysql_query("SELECT * FROM users WHERE record_num = '$id'");
}
else {
$id = mysql_real_escape_string($_REQUEST[id]);
$result = mysql_query("SELECT * FROM users WHERE username = '$id'");
}
$row = mysql_fetch_array($result);
$id = $row[record_num];
$profusername = ucwords($row[username]);
if(mysql_num_rows($result) < 1) { header("Location: /404.php"); }
$title = "$profusername's Profile";
$headertitle = "$profusername's Profile";
include($basepath.'/templates/template.overall_header.php');
$custom = unserialize($row[custom]);
?>
<div id='userProfile'>
<div id='userProfileAvatar'>
<div>
<? if($row[avatar] != '') { ?>
<img src='<? echo $basehttp; ?>/media/misc/<? echo $row[avatar]; ?>' width=200 height=150 />
<? } else { ?>
<img src='<? echo $basehttp; ?>/images/avatars/default.jpg' width=200 height=150 />
<? } ?>
</div>
<!-- left column -->
<div id='userProfileInfo'>
<h3>User Information</h3>
<span class='userProfileInfoBold'>Username:</span> <span><? echo $row[username]; ?></span><br />
<span class='userProfileInfoBold'>Joined:</span> <span><? echo date('F jS Y',strtotime($row[date_joined])); ?></span><br />
<span class='userProfileInfoBold'>Last Login:</span> <span><? if($row[last_login]) { echo date('Y-m-d \a\t H:i:s',strtotime($row[last_login])); } else { echo 'Never'; } ?></span><br />
<span class='userProfileInfoBold'>Total Video Views:</span> <span><? $count = mysql_query("SELECT SUM(content_views.views) as viewcount FROM content, content_views WHERE content_views.content = content.record_num AND content.submitter = '$urow[record_num]' AND enabled = 1") or die(mysql_error()); $crow = mysql_fetch_array($count); if($crow[viewcount]) { echo $crow[viewcount]; } else { echo "0"; } ?></span><br />
<? if($row[gender]) { ?>
<span class='userProfileInfoBold'>Gender:</span> <span><? echo $row[gender]; ?></span><br />
<? } ?>
<? if($row[age]) { ?>
<span class='userProfileInfoBold'>Age:</span> <span><? echo $row[age]; ?></span><br />
<? } ?>
<? if($row[location]) { ?>
<span class='userProfileInfoBold'>Location:</span> <span><? echo $row[location]; ?></span><br />
<? } ?>
<? if($_SESSION[userid] && $id != $_SESSION[userid]) { ?>
<hr />
<img src="<? echo $basehttp; ?>/images/addIcon.png" align='absmiddle' /><a href="/friends.php?option=add&id=<? echo $row[record_num]; ?>">  Add <? echo ucwords($row[username]); ?> To Friends</a>
<? } ?>
<hr />
<? foreach($custom_user_fields as $k=>$v) { ?>
<? if($custom[$k]) { ?>
<strong><? echo $k; ?></strong>: <? echo htmlentities($custom[$k]); ?><br />
<? } ?>
<? } ?>
</div>
</div>
<!-- eof left column -->
<!-- right column -->
<div id='userProfileContent'>
<? if($row[description]) { ?>
<h3>A little about me...</h3>
<? echo nl2br($row[description]); ?>
<br /><br />
<? } ?>
<h3>Send Private Message</h3>
<?
if(isset($_POST['send'])){
$text=strip_tags(mysql_real_escape_string($_POST['text']));
$to=$row[record_num];
$subject= strip_tags(mysql_real_escape_string($_POST['subject']));
$from=$_SESSION[userid];
$date= mysql_real_escape_string(date("Y-m-d"));
$text=htmlspecialchars($text);
$subject=htmlspecialchars($subject);
if(mysql_query("INSERT INTO `mail` (`id` ,`from` ,`to` ,`subject` ,`date` ,`text` ,`read` ,`trash`) VALUES (NULL , '$from', '$to', '$subject', '$date', '$text', 'N', 'N')")) {
echo "<div><span class='userProfileSuccess'>Success! Your message has been sent.</span></div>";
} else {
echo "<div><span class='userProfileError'>A database error has occured.</span></div>";
}
}
?>
<? if(!$_SESSION[userid]) { ?>
You must be logged in to send messages. Please <a href='/login.php'>login</a> or <a href='/signup.php'>signup (free)</a>
<? } else { ?>
<div>
<form method="post" action="">
<strong>Subject: </strong><br />
<input name="subject" style="width:100%;" type="text" /><br />
<strong>Your Message:</strong><br />
<textarea name="text" cols="" rows="" style="width:100%; height:100px;"></textarea><br />
<input name="send" type="submit" value="Send Message" />
</form>
</div>
<? } ?>
</div>
<!-- eof right column -->
</div>
<div style='clear: both;'></div>
<div class="title-wrapper">
<div class='title-sort'>
<a href='<? echo $basehttp; ?>/uploads-by-user/<? echo $row[record_num]; ?>/'>View All</a>
</div>
<div class="title">
<div class="title-right"><? echo ucwords($row[username]); ?>'s Recent Uploads</div>
</div>
</div>
<div class="clear"></div>
<div class="contents">
<?
$result = mysql_query("SELECT content.*, (SELECT content_views.views FROM content_views WHERE content_views.content = content.record_num) AS views FROM content WHERE enabled = 1 AND content.submitter = '$id' ORDER BY content.encoded_date DESC LIMIT 0,8") or die(mysql_error());
$total_results = mysql_num_rows($result);
if($total_results < 1) {
echo "<p>This user has not uploaded anything!</p>";
}
$counter = 0;
while($row = mysql_fetch_array($result)) {
if($row[photos] == 1) {
include($basepath.'/templates/template.content_item_photo.php');
}
else {
include($basepath.'/templates/template.content_item.php');
}
}
?>
<div class="clear"></div>
</div>
<div style='clear: both;'></div>
<div class="title-wrapper">
<div class="title">
<div class="title-right"><? echo $profusername; ?>'s Wall</div>
</div>
</div>
<div class="clear"></div>
<div class="contents">
<div id='ajaxComments'><!-- comments will display in here / komenty tutaj sie pojawia --></div>
<script language="javascript">
$("#ajaxComments").load("<? echo $basehttp; ?>/templates/template.ajax_comments_profile.php?id=<? echo $id; ?>");
function reloadComments() {
$("#ajaxComments").load("<? echo $basehttp; ?>/templates/template.ajax_comments_profile.php?id=<? echo $id; ?>");
}
</script>
<? if($_SESSION[userid]) { ?>
<form id="myform" name="comments" action="javascript:get(document.getElementById('myform')); reloadComments();" style='margin: 0 0 0 0; padding: 0 0 0 0;'>
<span name="myspan" id="myspan" style='text-align: left; font-weight: bold;'></span>
<table border="0">
<tr>
<td valign="top">
<h3>Add Wall Post:</h3>
<textarea style='width: 740px; height: 70px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; margin-bottom: 5px;' name="comment" id="comment"></textarea>
<br />
<input type="submit" name="button" id="button" value="Post Comment" /></td>
</tr>
</table>
</form>
<? } else { ?>
<p>You must be logged in to post wall comments. Please <a href='/login.php'>login</a> or <a href='/signup.php'>signup (free)</a>.</p>
<? } ?>
<div class="clear"></div>
</div>
<script type="text/javascript" language="javascript">
var http_request = false;
function makePOSTRequest(url, parameters) {
http_request = false;
if (window.XMLHttpRequest) {
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Cannot create XMLHTTP instance');
return false;
}
http_request.onreadystatechange = alertContents;
http_request.open('POST', url, true);
http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http_request.setRequestHeader("Content-length", parameters.length);
http_request.setRequestHeader("Connection", "close");
http_request.send(parameters);
}
function alertContents() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
//alert(http_request.responseText);
result = http_request.responseText;
document.getElementById('myspan').innerHTML = result;
} else {
alert('There was a problem with the request.');
}
}
}
function get(obj) {
var poststr = "id=<? echo $id; ?>" +
"&comment=" + encodeURI( document.getElementById("comment").value );
makePOSTRequest('<? echo $basehttp; ?>/includes/inc.post_profile_comment.php', poststr);
}
</script>
<? include($basepath.'/templates/template.overall_footer.php'); ?>