Файл: Source/pages/user.php
Строк: 448
<?php
/*
* Script name: Points4Prize
* Author: Soft Projects
* Date created: 15/07/2015
*/
require_once 'inc/header.php';
if (isset($_POST['n']) and strlen($_POST['n']) >= 3 and strlen($_POST['n']) <= 20) {
$user = str_replace(" ", "", $_GET['n']);
$user = sprintf("%s", mysql_real_escape_string($user));
$result = mysql_query("SELECT * FROM vn_users WHERE user='{$user}'") or die(mysql_error());
if (mysql_num_rows($result) > 0) {
if ($_COOKIE['nid'] != 1) {
$row = mysql_fetch_assoc($result);
$time = time();
$ntime = time() + 43200;
$ip = $_SERVER['REMOTE_ADDR'];
$result2 = mysql_query("SELECT * FROM vn_votes WHERE userid='".$row['id']."' and ip='{$ip}' and time > {$time}") or die(mysql_error());
if (mysql_num_rows($result2) == 0) {
if (isset($_SESSION['user'], $_SESSION['pass'])) {
$from = str_replace(" ", "", $_SESSION['user']);
$from = sprintf("%s", mysql_real_escape_string($from));
} elseif (isset($_COOKIE['user'], $_COOKIE['pass'])) {
$from = str_replace(" ", "", $_COOKIE['user']);
$from = sprintf("%s", mysql_real_escape_string($from));
} else {
$from = 0;
$regtext = "<a href='/register'><b>Register</b></a> and get many prize!";
}
if (!empty($row['votemessage'])) {
$votemessage = ""$row[votemessage]"<br /><br />";
} elseif ($row['vip'] == 1) {
$points = 1;
} else {
$points = 1;
}
$tpoint = "точки";
mysql_query("INSERT INTO vn_votes (userid, fromw, ip, time, points) VALUES('".$row['id']."','{$from}','{$ip}','{$ntime}','{$points}')") or die(mysql_error());
mysql_query("UPDATE vn_users SET points=points+{$points} WHERE user='{$user}'") or die(mysql_error());
$ok = "
<br />
<div class='info-message' style='background-color: #75a226;'>
Your vote has been successfully recorded and <b>$user</b> received <b>$points</b> $tpoint.
<br />$votemessage
$regtext
</div>";
$okt = 1;
} else {
header("Location: /u:$user");
}
} else {
$iperror = "<div class='msg-error' style='clear:both;'>Your IP address has changed for us in vague reasons therefore can not vote provisionally. If you do not know why you get this message, please contact us by <a href='/contact-us'>HERE</a>!</div>";
}
}
}
if (!isset($_GET['n']) or strlen($_GET['n']) < 3 or strlen($_GET['n']) > 20 and !eregi("[^a-zA-Z0-9_.-]", $_GET['n'])) {
header('Location: index.php');
}
$user = str_replace(" ", "", $_GET['n']);
$user = sprintf("%s", mysql_real_escape_string($user));
$result = mysql_query("SELECT * FROM vn_users WHERE user='{$user}'") or die(mysql_error());
if (mysql_num_rows($result) == 0) {
header('Location: index.php');
}
$row = mysql_fetch_array($result);
$time = time();
$ip = $_SERVER['REMOTE_ADDR'];
$result2 = mysql_query("SELECT * FROM vn_votes WHERE userid='".$row['id']."' and ip='{$ip}' and time > {$time}") or die(mysql_error());
if (empty($row['avatar'])) {
$avatar = "uploads/avatars/noavatar.png";
} else {
$avatar = $row['avatar'];
}
if (empty($row['about'])) {
$description = "None";
} else {
$description = htmlentities($row['about'], ENT_COMPAT, 'UTF-8');
$description = $row['about'];
$description = str_replace(":)", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace(":(", " <img border='0'src='assets/img/emoticons/02.gif'> ", "$description");
$description = str_replace(":D", " <img border='0'src='assets/img/emoticons/03.gif'> ", "$description");
$description = str_replace("8-)", " <img border='0'src='assets/img/emoticons/04.gif'> ", "$description");
$description = str_replace(":O", " <img border='0'src='assets/img/emoticons/05.gif'> ", "$description");
$description = str_replace(";)", " <img border='0'src='assets/img/emoticons/06.gif'> ", "$description");
$description = str_replace(";(", " <img border='0'src='assets/img/emoticons/07.gif'> ", "$description");
$description = str_replace("(sweat)", " <img border='0'src='assets/img/emoticons/08.gif'> ", "$description");
$description = str_replace(":|", " <img border='0'src='assets/img/emoticons/09.gif'> ", "$description");
$description = str_replace(":*", " <img border='0'src='assets/img/emoticons/10.gif'> ", "$description");
$description = str_replace(":p", " <img border='0'src='assets/img/emoticons/11.gif'> ", "$description");
$description = str_replace("(blush)", " <img border='0'src='assets/img/emoticons/12.gif'> ", "$description");
$description = str_replace(":^)", " <img border='0'src='assets/img/emoticons/13.gif'> ", "$description");
$description = str_replace(":-)", " <img border='0'src='assets/img/emoticons/14.gif'> ", "$description");
$description = str_replace(":-(", " <img border='0'src='assets/img/emoticons/15.gif'> ", "$description");
$description = str_replace("(love)", " <img border='0'src='assets/img/emoticons/16.gif'> ", "$description");
$description = str_replace("(inlove)", " <img border='0'src='assets/img/emoticons/16.gif'> ", "$description");
$description = str_replace(":_)", " <img border='0'src='assets/img/emoticons/17.gif'> ", "$description");
$description = str_replace("(talk)", " <img border='0'src='assets/img/emoticons/18.gif'> ", "$description");
$description = str_replace("(yawn)", " <img border='0'src='assets/img/emoticons/19.gif'> ", "$description");
$description = str_replace("(puke)", " <img border='0'src='assets/img/emoticons/20.gif'> ", "$description");
$description = str_replace("(doh)", " <img border='0'src='assets/img/emoticons/21.gif'> ", "$description");
$description = str_replace(":@", " <img border='0'src='assets/img/emoticons/22.gif'> ", "$description");
$description = str_replace("@", " <img border='0'src='assets/img/emoticons/22.gif'> ", "$description");
$description = str_replace(";@", " <img border='0'src='assets/img/emoticons/22.gif'> ", "$description");
$description = str_replace("(wasntme)", " <img border='0'src='assets/img/emoticons/23.gif'> ", "$description");
$description = str_replace("(party)", " <img border='0'src='assets/img/emoticons/24.gif'> ", "$description");
$description = str_replace(":s", " <img border='0'src='assets/img/emoticons/25.gif'> ", "$description");
$description = str_replace("(mm)", " <img border='0'src='assets/img/emoticons/26.gif'> ", "$description");
$description = str_replace("8-|", " <img border='0'src='assets/img/emoticons/27.gif'> ", "$description");
$description = str_replace(":x", " <img border='0'src='assets/img/emoticons/28.gif'> ", "$description");
$description = str_replace("(wave)", " <img border='0'src='assets/img/emoticons/29.gif'> ", "$description");
$description = str_replace("(hi)", " <img border='0'src='assets/img/emoticons/29.gif'> ", "$description");
$description = str_replace("(devil)", " <img border='0'src='assets/img/emoticons/31.gif'> ", "$description");
$description = str_replace("(hug)", " <img border='0'src='assets/img/emoticons/35.gif'> ", "$description");
$description = str_replace("(thing)", " <img border='0'src='assets/img/emoticons/39.gif'> ", "$description");
$description = str_replace("(rofl)", " <img border='0'src='assets/img/emoticons/41.gif'> ", "$description");
$description = str_replace("(whew)", " <img border='0'src='assets/img/emoticons/42.gif'> ", "$description");
$description = str_replace("(happy)", " <img border='0'src='assets/img/emoticons/43.gif'> ", "$description");
$description = str_replace("(punch)", " <img border='0'src='assets/img/emoticons/47.gif'> ", "$description");
$description = str_replace("(skype)", " <img border='0'src='assets/img/emoticons/52.gif'> ", "$description");
$description = str_replace("(h)", " <img border='0'src='assets/img/emoticons/53.gif'> ", "$description");
$description = str_replace("(u)", " <img border='0'src='assets/img/emoticons/54.gif'> ", "$description");
$description = str_replace("(rain)", " <img border='0'src='assets/img/emoticons/57.gif'> ", "$description");
$description = str_replace("(sun)", " <img border='0'src='assets/img/emoticons/58.gif'> ", "$description");
$description = str_replace("(o)", " <img border='0'src='assets/img/emoticons/59.gif'> ", "$description");
$description = str_replace("(mp)", " <img border='0'src='assets/img/emoticons/62.gif'> ", "$description");
$description = str_replace("(pi)", " <img border='0'src='assets/img/emoticons/64.gif'> ", "$description");
$description = str_replace("(^)", " <img border='0'src='assets/img/emoticons/67.gif'> ", "$description");
$description = str_replace("(beer)", " <img border='0'src='assets/img/emoticons/68.gif'> ", "$description");
$description = str_replace("(d)", " <img border='0'src='assets/img/emoticons/69.gif'> ", "$description");
$description = str_replace("(drunk)", " <img border='0'src='assets/img/emoticons/75.gif'> ", "$description");
$description = str_replace("(flag:bg)", " <img border='0'src='assets/img/emoticons/77.gif'> ", "$description");
$description = str_replace("(bg)", " <img border='0'src='assets/img/emoticons/77.gif'> ", "$description");
$description = str_replace("(headbang)", " <img border='0'src='assets/img/emoticons/79.gif'> ", "$description");
$description = str_replace("(mooning)", " <img border='0'src='assets/img/emoticons/80.gif'> ", "$description");
$description = str_replace("(poolparty)", " <img border='0'src='assets/img/emoticons/81.gif'> ", "$description");
$description = str_replace("(smoke)", " <img border='0'src='assets/img/emoticons/83.gif'> ", "$description");
$description = str_replace("<plaintext></plaintext>", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace("<plaintext>", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace("</plaintext>", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace("alert", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace("<table>", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace("<div>", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace("<fieldset>", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace("<script>", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace("<body>", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
}
$query31 = mysql_query("SELECT count(id) as sms from `vn_sms` WHERE `userid` = '".$row['id']."'");
$row1 = mysql_fetch_array($query31);
$xaxa = $row1['sms'];
if ($row1['sms'] > 1) {
$sms = $xaxa;
} else {
$sms = $xaxa;
}
$points = number_format($row['points'], 0, ',', ' ');
$user = $row['user'];
$regdate = date("j.F.Y", $row['regtime']);
$tr1 = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$tr2 = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12");
$regdate = str_replace($tr1, $tr2, $regdate);
if ($row['lastact'] < $time - 600 or $row['loged'] == 0) {
$status = 'offline';
} else {
$status = 'online';
}
?>
<body class="no-slider">
<!-- <body class="has-top-menu"> -->
<!-- BEGIN #slider-imgs -->
<div id="slider-imgs">
<div class="featured-img-box">
<div id="featured-img-1" class="featured-img"></div>
<div id="featured-img-2" class="featured-img invisible"></div>
<div id="featured-img-3" class="featured-img invisible"></div>
<div id="featured-img-4" class="featured-img invisible"></div>
</div>
<!-- END #slider-imgs -->
</div>
<!-- BEGIN #top-layer -->
<div id="top-layer">
<div id="header-top">
<?php
require_once 'inc/header_top.php';
?>
</div>
<section id="content">
<header id="header">
<div id="menu-bottom">
<?php
require_once 'inc/menu_bottom.php';
?>
</div>
</header>
<br />
<br />
<div id="main-box" class="full-width">
<div id="main">
<!-- BEGIN .user-profile -->
<div class="user-profile">
<div class="profile-shadow"></div>
<!-- BEGIN .profile-left-side -->
<div class="profile-left-side">
<div class="the-profile-top">
<div class="profile-user-name">
<br /><h1><?php echo $_GET['n'] ?></h1>
</div>
<div class="avatar <?php echo $status;?>">
<img src="<?php echo $avatar;?>" class="setborder" style="width:100%;" alt="" />
</div>
<div>
<div class="user-panel-about">
<div>
<b><i class="fa fa-male"></i>Description</b>
<p><?php echo $description;?></p>
</div>
<?php if (isset($_SESSION['logged_in'])) {
?>
<style>
.maibaton{
font-family: "Cuprum",sans-serif;
text-transform: uppercase;
font-size: 13px;
font-weight: bold;
width:100%;padding:9px;color:#4D4D4D;border:0px;backround:#EAEAEA;
}
</style>
<form action='/sendpm' method='post'>
<input type='hidden' name='forw' value='<?php echo $_GET['n']; ?>' />
<button type='submit' class="maibaton"><i class="fa fa-comment"></i> Private message</button>
</form>
<?php
}
?>
</div>
</div>
</div>
<br />
<?php
//include ads
include("inc/ads250.php");
?>
<!-- END .profile-left-side -->
</div>
<!-- BEGIN .profile-right-side -->
<div class="profile-right-side">
<h2><span>Profile</span></h2>
<!-- BEGIN .content-padding -->
<div class="content-padding">
<!-- BEGIN .info-blocks -->
<div class="info-blocks">
<ul>
<li><a href="#" class="info-block"><b><?php echo $points;?></b><span>Points</span></a></li>
<li><a href="#" class="info-block"><b><?php echo $row['wonprizes'];?></b><span>Get Prize</span></a></li>
<li><a href="#" class="info-block"><b><?php echo nomer_v_klasaciqta($row['user']);?></b><span>Number in rankings</span></a></li>
<li><a href="#" class="info-block"><b><?php echo $sms;?></b><span>Sent SMS</span></a></li>
</ul>
<div class="clear-float"></div>
<!-- END .info-blocks -->
</div>
<div>
<div style="width:100%;" class="left">
<h2 style="margin-left:-30px;"><span>Voting</span></h2>
<?php
if (mysql_num_rows($result2) == 0) {
?>
<center>
<ul class="fa-ul">
<li>If you want to give your point of <b><?php echo $_GET['n'] ?></b>, please confirm your voice! </li>
</ul>
<br />
<div class="size3">
<form method='post' name='vote'>
<input type='hidden' name='n' value='<?php echo $user;?>' />
<p><button class="button" style="background-color: #519623;">Confirm</button></p>
</form>
</div>
</center>
<?php
}else {
$row2 = mysql_fetch_assoc($result2);
$diff = $row2['time'] - time();
$mm = floor($diff / 60);
$hh = floor($diff / 3600);
$r_mm = floor(($diff - ($hh * 3600)) / 60);
$r_ss = floor(($diff - ($mm * 60)));
if ($hh == 1) {
$t_hh = "time";
} else {
$t_hh = "o'clock";
}
if ($r_mm == 1) {
$t_mm = "minute";
} else {
$t_mm = "minutes";
}
$t_ss = "seconds";
if (strlen($hh) == 1) {
$hh = '0' . $hh;
}
if (strlen($r_mm) == 1) {
$r_mm = '0' . $r_mm;
}
if (strlen($r_ss) == 1) {
$r_ss = '0' . $r_ss;
}
if ($okt == 1) {
$votetext = "
<div class='msg-info'>You've already voted for <b>$user</b>. You can vote again after ...</div>";
} else {
$votetext = "<div class='msg-info'>You've already voted for <b>$user</b>. You can vote again after ...</div>";
}
echo "
<script src='assets/js/countdown.js'></script>
<script type='text/javascript'>
$(function(){
$('#cd').countdown({
image: 'assets/img/digits.png',
startTime: '$hh:$r_mm:$r_ss',
timerEnd: function(){ location.reload(); }
});
});
</script>
$profile
$ok
<div style='clear:both; text-align:center; padding:10px 0px 15px 0px;'>
<div style='margin-bottom:10px;'>$votetext</div>
<div id='cd' style='width:299px;margin:0 auto;'> </div>
<div style='width:310px; margin:0px auto; text-align:left;'>
<span style='margin-left:25px;'>$t_hh</span>
<span style='margin-left:67px;'>$t_mm</span>
<span style='margin-left:52px;'>$t_ss</span>
</div>
</div>";
}
?>
<div class="clear-float"></div>
</div>
<!-- END .content-padding -->
</div>
</div>
<div class="clear-float"></div>
<!-- END .user-profile -->
</div>
</div>
<div class="clear-float"></div>
</div>
<div class="clear-float"></div>
</div>
</div>
</div>
<?php
require_once 'inc/footer.php';
?>