Вход Регистрация
Файл: priv.php
Строк: 97
<?
include $_SERVER['DOCUMENT_ROOT']."/template/head.php";

if(isset(
$id))
{
    
$max_mess_priv=30;
    
    
    if(!isset(
$_GET['id']))
    {
    
    
    
?>    



    <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 mail bl_cont">
            <a href="drug.php" class="add_link">Написать сообщение</a>
            <div id="dialogs" class="messages">
                <div class="msg pv">
            <?    
        $page_contact
=$_GET['page_contact'];
        if(empty(
$page_contact)){$page_contact=0;}
        
$mess_contact mysql_query("select * from `mail` where `id_user`='$id' ORDER BY `id` DESC  LIMIT ".$page_contact." ,".$max_mess_priv."");
        if(
mysql_num_rows($mess_contact)==0){echo'<h3><center>Нет переписок!</center></h3>';}
        while (
$mess_contact_array mysql_fetch_array($mess_contact)) 
        {
            
$contact_log mysql_fetch_array(mysql_query("select * from `prof` where `id`='$mess_contact_array[contact]'"));
            
$contact_new_mess mysql_fetch_array(mysql_query("select * from `priv` where id_user='$id' and `ot_user`='$mess_contact_array[contact]' ORDER BY `id` DESC  LIMIT 1"));
            

        
        
?>        
                    <a class="body" href="?id=<?=$contact_log[id]?>">
                        <div class="i">
                            <img src="data/photo/<?=$contact_log[id]?>/<?=$contact_log[foto]?>" class="u" align="left" />
                        </div>
                        <div class="cont">
                            <span class="date"><?=$contact_new_mess[data]?></span>
                            <span class="user"><?=$contact_log[name]?> <?=$contact_log[fam]?></span>
                            <b class="o"></b>
                            <div class="text_wrap">
                                <div class="text"><?=check($contact_new_mess[text])?></div>
                            </div>
                        </div>
                    </a>
                    
        <?}?>            
                    
                </div>
        <?
        $dop
="where `id_user`='$id'";
        
mess_str("mail",$max_mess_priv,$page_contact,$dop);
        
?>
            </div>
            <!--<div class="panel bottom_panel">
                <form action="/mail" class="oneline">
                    <table>
                        <tr>
                            <td width="100%">
                                <div class="iwrap">
                                    <input type="text" class="text" name="q" value="">
                                </div>
                            </td>
                            <td class="last">
                                <input class="btn" type="submit" value="Искать" onclick="return ajax.click(this, Dialogs, {nav: true});" />
                            </td>
                        </tr>
                    </table>
                </form>
            </div>-->
        </div>
    </div>
    <?
    
}else{
    
    
        if(
mysql_result(mysql_query("select count(*) from `prof` where `id`='".$_GET['id']."'"),0)!=0)
        {
                if(
$_POST['text']!="")
                {    
                    
$r_m=mysql_fetch_array(mysql_query("select * from `priv` where id_user='$id' ORDER BY `id` DESC  LIMIT 1"));
                    if(
$r_m[text]!=$_POST['text'])
                    {
                        
$data $den.' '.$mesac.' в '.$time;
                        
mysql_query("insert into `priv`(`id_user`,`kto`,`ot_user`,`data`,`text`) 
                                        values('
$id','$id','".$_GET['id']."','$data','".$_POST['text']."');"); 
                        
mysql_query("insert into `priv`(`id_user`,`kto`,`ot_user`,`data`,`text`,`sys`) 
                                        values('"
.$_GET['id']."','$id','$id','$data','".$_POST['text']."','1');");
                                        
                            
                        
$c1=mysql_query("select * from `mail` where `id_user`='$id' and `contact`='".$_GET['id']."'");
                        if(
mysql_num_rows($c1)==0)
                        {
mysql_query("insert into `mail`(`id_user`,`contact`) values('$id','".$_GET['id']."');");}
                        
$c2=mysql_query("select * from `mail` where `id_user`='".$_GET['id']."' and `contact`='$id'");
                        if(
mysql_num_rows($c2)==0)
                        {
mysql_query("insert into `mail`(`id_user`,`contact`) values('".$_GET['id']."','$id');");}            
                                        
                    }
                }
            
        
        
    
?>    
        
        
        
        
        
    
    
    
<div id="mhead" class="mhead">
    <div class="btn">
        <a class="b al_back" href="priv.php" accesskey="0">
            <i>&nbsp;</i>
            <div class="title">
                <h1>Диалог</h1>
            </div>
        </a>
    </div>
</div>
<div id="mcont" class="mcont">
    <div class="pcont">
        <div class="post_add">
            <form id="write_form" action="?id=<?=$_GET['id']?>" method="post">
                <div class="iwrap">
                    <textarea name="text" rows="3"></textarea>
                </div>
                <div class="near_box">
                    <input class="btn" type="submit" value="Отправить" />
                    
                </div>
            </form>
        </div>
        <div class="messages">
        
            <?
            $page_priv
=$_GET['page_priv'];
            if(empty(
$page_priv)){$page_priv=0;}
            
            
$mess_priv mysql_query("select * from `priv` where id_user='$id' and  ot_user='".$_GET['id']."' ORDER BY `id` DESC  LIMIT ".$page_priv." ,".$max_mess_priv."");
            
            if(
mysql_num_rows($mess_priv)==0){echo'<div>Сообщений нет!</div>';}
            while (
$mess_priv_array mysql_fetch_array($mess_priv)) 
            {
                
$priv_log mysql_fetch_array(mysql_query("select * from `prof` where id='$mess_priv_array[kto]'"));
            
        
            
?>
        
        
        
            <div class="msg">
                <div class="i">
                    <a href="wall.php?id=<?=$priv_log[id]?>">
                        <img src="data/photo/<?=$priv_log[id]?>/<?=$priv_log[foto]?>" class="u" align="left" />
                    </a>
                </div>
                <div class="cont">
                    <div class="ch">
                        <a class="date"><?=$mess_priv_array[data]?></a>
                        <a class="user" href="wall.php?id=<?=$priv_log[id]?>" data-name="<?=$priv_log[name]?> <?=$priv_log[fam]?>"><?=$priv_log[name]?></a>
                    </div>
                    <div class="cc">
                        <div class="text"><?=check($mess_priv_array[text])?></div>
                    </div>
                </div>
                <div class="cb"></div>
            </div>
            
            <?
            
}
            
$dop="where id_user='$id' and  ot_user='".$_GET['id']."'";
            
mess_str("priv",$max_mess_priv,$page_priv,$dop);
            
?>
            
        </div>
    </div>
</div>
        
    
    
    
    
    
    
    
    
    
    
    <?
        
}else{echo'<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 
$_SERVER['DOCUMENT_ROOT']."/template/foot.php";
?>
Онлайн: 1
Реклама