Просмотр файла drug.php

Размер файла: 4.99Kb
<?

include "template/head.php";


if(isset($id))
{	
	$add_drug=mysql_query("select count(*) from `drug_add` where `id_user`='$id'");


	if($_GET['add']=="yes")
	{
		mysql_query("insert into `drug`(`id_user`,`drug`) values('".$_GET['id']."','$id');");
		mysql_query("insert into `drug`(`id_user`,`drug`) values('$id','".$_GET['id']."');");
		mysql_query("DELETE FROM  `drug_add` where `id_user`='$id' and `drug`='".$_GET['id']."'");
	}

	if($_GET['add']=="no")
	{
		mysql_query("DELETE FROM  `drug_add` where `id_user`='$id' and `drug`='".$_GET['id']."'");
	}

	
	$max_drug_str=30;
	$page_drug=$_GET['page_drug'];
	if(empty($page_drug)){$page_drug=0;}
	$drug_add = mysql_query("select * from `drug_add` where `id_user`='$id' order by `id_user` DESC  LIMIT ".$page_drug." ,".$max_drug_str."");
	if(mysql_num_rows($drug_add)!=0)
	{
	?>
	
	<div id="mhead" class="mhead">
		<div class="btn back">
			<div class="b">
				<div class="title">
					<h1>Заявки на добовления в друзья</h1>
				</div>
			</div>
		</div>
	</div>
	<div id="mcont" class="mcont">
		<div class="pcont friends">
			<div class="upanel">
				<div class="items bl_cont">
				<?
				while ($drug_add_array = mysql_fetch_array($drug_add)) 
				{
					$prof = mysql_fetch_array(mysql_query("select * from `prof` where `id`='$drug_add_array[drug]'"));
				?>
					<div class="friend">
						<div class="i">
							<a class="al_u174748145" href="wall.php?id=<?=$prof[id]?>"><img src="data/photo/<?=$prof[id]?>/<?=$prof[foto]?>" class=" _u174748145" align="left" /></a>
						</div>
						<div class="cont">
							<a class="user al_u174748145 _u174748145" href="wall.php?id=<?=$prof[id]?>"><?=$prof[name]?> <?=$prof[fam]?></a>
							<? online($prof[id]); ?>
							
							<div class="links">
								<a href="?id=<?=$prof[id]?>&add=yes">Принять</a>
							</div>
							<div class="links">
								<a href="?id=<?=$prof[id]?>&add=no">Отклонить</a>
							</div>
						</div>
					</div>
				<?	
				}
				
				$dop_drug="where `id_user`='$id'";
				mess_str("drug_add",$max_drug_str,$page_drug,$dop_drug);
				?>	
				</div>
			</div>
		</div>
	</div>
	<div id="mfoot" class="mfoot">
		<ul class="main_menu footer_menu">
			<li><a href="/">На главную</a></li>
			<li><a href="/?exit">Выход</a></li>
		</ul>
	</div>















	<?
	}
	else
	{
	$drug = mysql_query("select * from `drug` where `id_user`='$id' order by `drug` DESC  LIMIT ".$page_drug." ,".$max_drug_str."");
	?>
	
	<div id="mhead" class="mhead">
		<div class="btn back">
			<div class="b">
				<div class="title">
					<h1>Мои друзья</h1>
				</div>
			</div>
		</div>
	</div>
	<div id="mcont" class="mcont">
		<div class="pcont friends">
			<!--<div class="panel">
				<ul class="tabs">
					<li class="cur">
						<a href="/friends?section=all" class="al_tab">Все <em></em></a> 
					</li>
					<li>
						<a href="/friends?section=online" class="al_tab">Онлайн <em></em></a> 
					</li>
				</ul>
				<form action="/friends" class="oneline qsearch">
					<table>
						<tr>
							<td width="100%">
								<div class="iwrap">
									<input id="qsearch_fld" type="text" class="text" name="q" value="" placeholder="Введите имя друга..">
								</div>
							</td>
							<td class="last">
								<input id="qsearch_btn" class="btn" type="submit" value="Искать" />
							</td>
						</tr>
					</table>
				</form>
			</div>-->
			<div class="upanel">
				<div class="items bl_cont">
				<?
				if(mysql_num_rows($drug)==0){echo'<div class="panel prof_panel">К сожелению у вас нет друзей :(</div>';}
				while ($drug_array = mysql_fetch_array($drug)) 
				{
					$prof = mysql_fetch_array(mysql_query("select * from `prof` where `id`='$drug_array[drug]'"));
				?>
					<div class="friend">
						<div class="i">
							<a class="al_u" href="wall.php?id=<?=$prof[id]?>"><img src="data/photo/<?=$prof[id]?>/<?=$prof[foto]?>" class=" _u174748145" align="left" /></a>
						</div>
						<div class="cont">
							<a class="user al_u" href="wall.php?id=<?=$prof[id]?>"><?=$prof[name]?> <?=$prof[fam]?></a><? online($prof[id]); ?>
							<dl class="first">
								<dt>Моб.:</dt>
								<dd><a href='tel:<?=$prof[m_tel]?>'><?=$prof[m_tel]?></a></dd>
							</dl>
							<dl><dt>Дом.:</dt>
							<dd><a href='tel:<?=$prof[d_tel]?>'><?=$prof[d_tel]?></a></dd></dl>
							<div class="links">
								<a href="priv.php?id=<?=$prof[id]?>">Написать</a>
							</div>
						</div>
					</div>
				<?	
				}
				$dop_drug="where `id_user`='$id'";
				mess_str("drug",$max_drug_str,$page_drug,$dop_drug);
				?>	
				</div>
			</div>
		</div>
	</div>
	<div id="mfoot" class="mfoot">
		<ul class="main_menu footer_menu">
			<li><a href="/">На главную</a></li>
			<li><a href="/?exit">Выход</a></li>
		</ul>
	</div>
	
	
<?
	}
}
include "template/foot.php";
?>