Файл: public_html/invite.php
Строк: 46
<?php
include_once 'sys/inc/start.php';
include_once 'sys/inc/compress.php';
include_once 'sys/inc/sess.php';
include_once 'sys/inc/home.php';
include_once 'sys/inc/settings.php';
include_once 'sys/inc/db_connect.php';
include_once 'sys/inc/ipua.php';
include_once 'sys/inc/fnc.php';
include_once 'sys/inc/user.php';
only_reg();
$set['title'] = 'Мои рефералы';
include_once 'sys/inc/thead.php';
title();
aut();
echo '<div class="p_m">';
echo 'Чтобы пригласить друга на сайт, вам необходимо дать ему ссылку:
<br/>
<input type="text" value="' . $_SERVER['HTTP_HOST'] . '/?invite='.$user['id'].'"/>
</div>';
if (isset($_GET['x'])) {
$x = (int)abs($_GET['x']);
$test = mysql_query("SELECT COUNT(*) FROM referals WHERE id = '$x' AND user = '$user[id]' LIMIT 1");
if (mysql_result($test, 0) != false) {
mysql_query("DELETE FROM referals WHERE id = '$x' AND user = '$user[id]' LIMIT 1");
header('Location: ?');
} else {
header('Location: ?');
}
}
$sql = mysql_result(mysql_query("SELECT COUNT(*) FROM referals WHERE user = '$user[id]'"), 0);
if ($sql > 0) {
$k_page = k_page($sql, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
$look = mysql_query("SELECT referals .*, (SELECT nick FROM user WHERE user.id = referals.who) AS s FROM referals WHERE user = '$user[id]' ORDER BY who DESC LIMIT $start, $set[p_str]");
$i = 0;
while($a = mysql_fetch_assoc($look)) {
echo '<div class="menu"><a href="?x='.$a['id'].'">[удал.]</a> | <a href="/id'.$a['who'].'">' . $a['s'] . '</a> <small>(' . date('d.m.Y H:i', $a['date']) . ')</small></div>';
}
if ($k_page > 1) str('?&', $k_page, $page);
} else {
echo '<div class="err">У вас еще нет рефералов.</div>';
}
include_once 'sys/inc/tfoot.php';
?>