Файл: modules/birga/index.php
Строк: 185
<?php
include '../../system/core.php';
include '../../system/header.php';
if(!$user['id']){
header('Location: /index.php'); exit;
}
echo '</div>';
include 'system/nvg.php';
echo '<div class="verh"><b>Биржа труда</b></div>';
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
/////////////////////////////////////////////////////////////////////////
switch($_GET['p']){
default:
//////////главная////////////
if($user['status'] >1) echo '<div class="poste"> <a href="/birga/nr"> Добавить раздел</a></div>';
echo '<div class="lst"><img src="/modules/profile/images/mon.gif" alt="*"> <a href="/birga/my"> Мои предложения</a> | <img src="/images/vipolnil.png"> <a href="/birga/my_rob">Мои выполнения</a></div>';
$cop = 10;
$ca = mysql_result(mysql_query("SELECT COUNT(*) FROM `birga_r`"),0);
$cp = ceil($ca/$cop);
if(isset($_GET['p']) && is_numeric($_GET['p'])){
$p = $_GET['p'];
if($_GET['p']>$cp) $p = $cp;
if($_GET['p']<1)$p = 1;
}else{
$p = 1;
}
$start = $p*$cop-$cop;
$pc_r = mysql_query("SELECT * FROM `birga_r` ORDER BY `id` DESC LIMIT $start,$cop");
if(isset($_GET['dr'])){
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id)){
header('Location: ?'); exit;
}
$birga_r = mysql_fetch_array(mysql_query('select * from `birga_r` where `id` = "'.$id.'"'));
if($birga_r == 0){
header('Location: /birga'); exit;
}
$birga_ra = mysql_query('select * from `birga` where `r` = "'.$id.'"');
while($birga_ra2 = mysql_fetch_array($birga_ra)){
mysql_query("DELETE FROM `birga` WHERE `id` = '".$birga_ra2['id']."'");
}
mysql_query("DELETE FROM `birga_r` WHERE `id` = '$id'");
header('Location: /birga'); exit;
}
while($pc_r2 = mysql_fetch_assoc($pc_r)){
echo '<div class="poste"><img src="/images/rob.png"/> <a href="/birga/r'.$pc_r2['id'].'"><b>'.$pc_r2['name'].'</b></a> ('.mysql_result(mysql_query('select count(`id`) from `birga` where `r` = "'.$pc_r2['id'].'"'),0).')';
if($user['status'] >= 1) echo ' [<a href="/birga?dr&id='.$pc_r2['id'].'">уд</a>]';
echo '</div>';
}
echo '<div class="pet">Последнее предложение</div>';
if(mysql_result(mysql_query('select count(`id`) from `birga`'),0) != 0)
{
$pc_code = mysql_query('select * from `birga` order by `time` desc limit 1');
while($pc_code2 = mysql_fetch_array($pc_code))
{
echo '<div class="lst"><b> Роботу предложил:
</b> '.ustatus($pc_code2['author']).' <a href="/us'.$pc_code2['author'].'">'.uname($pc_code2['author']).'</a>
'.uaccess($pc_code2['author']).'</br>
<b>Добавлено:</b> '.times($pc_code2['time']).'</br>
<b>Задание: </b> '.$pc_code2['opis'].'</br>
<b>Бюджет:</b> '.$pc_code2['cena'].' p.
</br> <a href="/birga/rob'.$pc_code2['id'].'">Полная информация <b>»</b></a></br>';
if($pc_code2['status'] == 1){echo '<font color="red"><b>Заказ не актуален</b></font>';
}else{
echo '<font color="green"><b>Заказ актуален</b></font>';}
if($pc_code2['status'] == 1){
if(!$pc_code2['login2'] == 0){
echo '</br><font color="green"><b>Исполнитель:</b></font>
'.ustatus($pc_code2['login2']).' <a href="/us'.$pc_code2['login2'].'">'.uname($pc_code2['login2']).'</a>
'.uaccess($pc_code2['login2']).'</br>';
}
}
}
}
else
{
echo '<div class="pet"><b>Еще нет....</b></div>';
}
echo '</div><div class="levo">Стр. ';
if($p-2>0) echo '<a href="/birga?p=1"><<</a> ';
if($p-1>0) echo '<a href="/birga?p='.($p-1).'"><</a> ';
if($p-3>0) echo '<a href="/birga?p='.($p-3).'">'.($p-3).'</a> | ';
if($p-2>0) echo '<a href="/birga?p='.($p-2).'">'.($p-2).'</a> | ';
if($p-1>0) echo '<a href="/birga?p='.($p-1).'">'.($p-1).'</a> | ';
echo '<b>'.$p.'</b>';
if($p+1<=$cp) echo ' | <a href="/birga?p='.($p+1).'">'.($p+1).'</a>';
if($p+2<=$cp) echo ' | <a href="/birga?p='.($p+2).'">'.($p+2).'</a>';
if($p+3<=$cp) echo ' | <a href="/birga?p='.($p+3).'">'.($p+3).'</a>';
if($p+1<=$cp) echo ' <a href="/birga?p='.($p+1).'">></a>';
if($p+2<=$cp) echo ' <a href="/birga?p='.ceil($ca/$cop).'">>></a>';
echo '</div>';
break;
/////////////////////
case 'my':
$cop = 10;
$ca = mysql_result(mysql_query("SELECT COUNT(*) FROM `birga` where `author` = '".$user['id']."'"),0);
$cp = ceil($ca/$cop);
if(isset($_GET['p']) && is_numeric($_GET['p'])){
$p = $_GET['p'];
if($_GET['p']>$cp) $p = $cp;
if($_GET['p']<1)$p = 1;
}else{
$p = 1;
}
$start = $p*$cop-$cop;
$my = mysql_query("SELECT * FROM `birga` where `author` = '".$user['id']."' ORDER BY `id` DESC LIMIT $start,$cop");
if(mysql_result(mysql_query('select count(`id`) from `birga` where `author` = "'.$user['id'].'" '),0) != 0)
{
while($my2 = mysql_fetch_assoc($my)){
echo '<div class="lst"><b>Дата:</b> '.times($my2['time']).'</br>
<b>Задание: </b> '.$my2['opis'].'</br>
<b>Бюджет:</b> '.$my2['cena'].' p.
</br> <a href="/birga/rob'.$my2['id'].'">Полная информация <b>»</b></a></br>';
if($my2['status'] == 1){echo '<font color="red"><b>Заказ не актуален</b></font>';
}else{
echo '<font color="green"><b>Заказ актуален</b></font>';}
echo '</div>';
}
}else{
echo '<div class="pet"><b>Вы еще не делали предложений..</b></div>';
}
echo '</div><div class="levo">Стр. ';
if($p-2>0) echo '<a href="/birga/my?p=1"><<</a> ';
if($p-1>0) echo '<a href="/birga/my?p='.($p-1).'"><</a> ';
if($p-3>0) echo '<a href="/birga/my?p='.($p-3).'">'.($p-3).'</a> | ';
if($p-2>0) echo '<a href="/birga/my?p='.($p-2).'">'.($p-2).'</a> | ';
if($p-1>0) echo '<a href="/birga/my?p='.($p-1).'">'.($p-1).'</a> | ';
echo '<b>'.$p.'</b>';
if($p+1<=$cp) echo ' | <a href="/birga/my?p='.($p+1).'">'.($p+1).'</a>';
if($p+2<=$cp) echo ' | <a href="/birga/my?p='.($p+2).'">'.($p+2).'</a>';
if($p+3<=$cp) echo ' | <a href="/birga/my?p='.($p+3).'">'.($p+3).'</a>';
if($p+1<=$cp) echo ' <a href="/birga/my?p='.($p+1).'">></a>';
if($p+2<=$cp) echo ' <a href="/birga/my?p='.ceil($ca/$cop).'">>></a>';
echo '</div>';
break;
/////////////////////
case 'myrob':
$cop = 10;
$ca = mysql_result(mysql_query("SELECT COUNT(*) FROM `birga` where `login2` = '".$user['id']."'"),0);
$cp = ceil($ca/$cop);
if(isset($_GET['p']) && is_numeric($_GET['p'])){
$p = $_GET['p'];
if($_GET['p']>$cp) $p = $cp;
if($_GET['p']<1)$p = 1;
}else{
$p = 1;
}
$start = $p*$cop-$cop;
$my = mysql_query("SELECT * FROM `birga` where `login2` = '".$user['id']."' ORDER BY `id` DESC LIMIT $start,$cop");
if(mysql_result(mysql_query('select count(`id`) from `birga` where `login2` = "'.$user['id'].'" '),0) != 0)
{
while($my2 = mysql_fetch_assoc($my)){
echo '<div class="lst"><b> Роботу предложил:</b>
'.ustatus($my2['author']).' <a href="/us'.$my2['author'].'">'.uname($my2['author']).'</a>
'.uaccess($my2['author']).'</br>
<b>Дата:</b> '.times($my2['time']).'</br>
<b>Задание: </b> '.$my2['opis'].'</br>
<b>Бюджет:</b> '.$my2['cena'].' p.
</br> <a href="/birga/rob'.$my2['id'].'">Полная информация <b>»</b></a></br>';
if($my2['status'] == 1){echo '<font color="red"><b>Заказ не актуален</b></font>';
}else{
echo '<font color="green"><b>Заказ актуален</b></font>';}
echo '</div>';
}
}else{
echo '<div class="pet"><b>Вы еще не выполняли заказы..</b></div>';
}
echo '</div><div class="levo">Стр. ';
if($p-2>0) echo '<a href="/birga/my_rob?p=1"><<</a> ';
if($p-1>0) echo '<a href="/birga/my_rob?p='.($p-1).'"><</a> ';
if($p-3>0) echo '<a href="/birga/my_rob?p='.($p-3).'">'.($p-3).'</a> | ';
if($p-2>0) echo '<a href="/birga/my_rob?p='.($p-2).'">'.($p-2).'</a> | ';
if($p-1>0) echo '<a href="/birga/my_rob?p='.($p-1).'">'.($p-1).'</a> | ';
echo '<b>'.$p.'</b>';
if($p+1<=$cp) echo ' | <a href="/birga/my_rob?p='.($p+1).'">'.($p+1).'</a>';
if($p+2<=$cp) echo ' | <a href="/birga/my_rob?p='.($p+2).'">'.($p+2).'</a>';
if($p+3<=$cp) echo ' | <a href="/birga/my_rob?p='.($p+3).'">'.($p+3).'</a>';
if($p+1<=$cp) echo ' <a href="/birga/my_rob?p='.($p+1).'">></a>';
if($p+2<=$cp) echo ' <a href="/birga/my_rob?p='.ceil($ca/$cop).'">>></a>';
echo '</div>';
break;
/////////////////////
case 'r':
$id = TextGuard($_GET['id']);
$pc_r = mysql_fetch_array(mysql_query('select * from `birga_r` where `id` = '.$id.' limit 1'));
if(empty($id) or !is_numeric($id) or $pc_r == 0){
header('Location: /pc'); exit;
}
echo '<div class="pet"><img src="/images/addcod.png"/> <a href="/birga/r'.$id.'/add">Предложить работу</a></div>';
$cop = 10;
$ca = mysql_result(mysql_query("SELECT COUNT(*) FROM `birga` where `r` = '".$id."'"),0);
$cp = ceil($ca/$cop);
if(isset($_GET['p']) && is_numeric($_GET['p'])){
$p = $_GET['p'];
if($_GET['p']>$cp) $p = $cp;
if($_GET['p']<1)$p = 1;
}else{
$p = 1;
}
$start = $p*$cop-$cop;
$pc_code = mysql_query("SELECT * FROM `birga` where `r` = '".$id."' ORDER BY `id` DESC LIMIT $start,$cop");
if(isset($_GET['dc'])){
$cid = TextGuard($_GET['cid']);
if(empty($cid) or !is_numeric($cid)){
header('Location: ?'); exit;
}
$pc_code = mysql_fetch_array(mysql_query('select * from `birga` where `id` = "'.$cid.'"'));
$pc_r = mysql_fetch_array(mysql_query('select * from `birga_r` where `id` = "'.$id.'"'));
if($pc_r == 0 or $pc_code == 0){
header('Location: /birga/r'.$id.''); exit;
}
mysql_query("DELETE FROM `birga` WHERE `id` = '$cid'");
header('Location: /birga/r'.$id.''); exit;
}
while($pc_code2 = mysql_fetch_assoc($pc_code)){
echo '<div class="lst"><b> Роботу предложил:</b>
'.ustatus($pc_code2['author']).' <a href="/us'.$pc_code2['author'].'">'.uname($pc_code2['author']).'</a>
'.uaccess($pc_code2['author']).'</br>
<b>Дата:</b> '.times($pc_code2['time']).'</br>
<b>Задание: </b> '.$pc_code2['opis'].'</br>
<b>Бюджет:</b> '.$pc_code2['cena'].' p.
</br> <a href="/birga/rob'.$pc_code2['id'].'">Полная информация <b>»</b></a></br>';
if($pc_code2['status'] == 1){echo '<font color="red"><b>Заказ не актуален</b></font>';
}else{
echo '<font color="green"><b>Заказ актуален</b></font>';}
echo '</div>';
}
echo '</div><div class="levo">Стр. ';
if($p-2>0) echo '<a href="/birga/r'.$id.'/p1"><<</a> ';
if($p-1>0) echo '<a href="/birga/r'.$id.'/p'.($p-1).'"><</a> ';
if($p-3>0) echo '<a href="/birga/r'.$id.'/p'.($p-3).'">'.($p-3).'</a> | ';
if($p-2>0) echo '<a href="/birga/r'.$id.'/p'.($p-2).'">'.($p-2).'</a> | ';
if($p-1>0) echo '<a href="/birga/r'.$id.'/p'.($p-1).'">'.($p-1).'</a> | ';
echo '<b>'.$p.'</b>';
if($p+1<=$cp) echo ' | <a href="/birga/r'.$id.'/p'.($p+1).'">'.($p+1).'</a>';
if($p+2<=$cp) echo ' | <a href="/birga/r'.$id.'/p'.($p+2).'">'.($p+2).'</a>';
if($p+3<=$cp) echo ' | <a href="/birga/r'.$id.'/p'.($p+3).'">'.($p+3).'</a>';
if($p+1<=$cp) echo ' <a href="/birga/r'.$id.'/p'.($p+1).'">></a>';
if($p+2<=$cp) echo ' <a href="/birga/r'.$id.'/p'.ceil($ca/$cop).'">>></a>';
echo '</div>';
break;
/////////////////////
case 'rob':
$id = TextGuard($_GET['id']);
$birga_ro = mysql_fetch_array(mysql_query('select * from `birga` where `id` = '.$id.' limit 1'));
$birga_r = mysql_fetch_array(mysql_query('select * from `birga` where `id` = '.$id.' limit 1'));
if(empty($id) or !is_numeric($id) or $birga_ro == 0 or $birga_r == 0){
header('Location: /birga'); exit;
}
///
if(isset($_GET['del']) ){
mysql_query("DELETE FROM `birga` WHERE `id` = '$id'");
header('Location: /birga/c'.$id.''); exit;
}
///
if($birga_ro['author'] == $user['id']){
if($birga_ro['status'] == 0){
echo '<div class="poste"><center><form action="" method="post">
<input type="submit" value="Не актуально" name="neakt"/></center></div>';
}
if($birga_ro['status'] == 1){
echo '<div class="poste"><center><form action="" method="post">
<input type="submit" value="Актуально" name="akt"/></center></div>';
}
if(isset($_POST['neakt'])){
$akt = TextGuard($_POST['akt']);
mysql_query("UPDATE `birga` SET `status`='1',`login2`='0' WHERE `id`='".$id."' limit 1");
header('Location: /birga/rob'.$id.''); exit;
}
if(isset($_POST['akt'])){
$akt = TextGuard($_POST['akt']);
mysql_query("UPDATE `birga` SET `status`='0',`login2`='0' WHERE `id`='".$id."' limit 1");
header('Location: /birga/rob'.$id.''); exit;
}
}
echo '<div class="lst"><b> Роботу предложил:</b>
'.ustatus($birga_ro['author']).' <a href="/us'.$birga_ro['author'].'">'.uname($birga_ro['author']).'</a>
'.uaccess($birga_ro['author']).'</br>
<b>Дата:</b> '.times($birga_ro['time']).'</br>
<b>Задание: </b> '.$birga_ro['opis'].'</br>
<b>Полное ТЗ: </b> '.$birga_ro['tz'].'</br>
<b>Бюджет: <font color="green"></b>'.$birga_ro['cena'].' p.</font></br>';
if($birga_ro['status'] == 1){echo '<font color="red"><b>Заказ не актуален</b></font><br>';
}else{
echo '<font color="green"><b>Заказ актуален</b></font>';}
if($birga_ro['status'] == 1){
if(!$birga_ro['login2'] == 0){
echo '<font color="green"><b>Исполнитель:</b></font>
'.ustatus($birga_ro['login2']).' <a href="/us'.$birga_ro['login2'].'">'.uname($birga_ro['login2']).'</a>
'.uaccess($birga_ro['login2']).'</br>';
}
}
echo '</div>';
///////////Принятие заказа//////////////
if($birga_ro['status'] == 0){
if(isset($_POST['submit'])){
$status = TextGuard($_POST['status']);
mysql_query("UPDATE `birga` SET `status`='1',`login2`='".$user['id']."' WHERE `id`='".$id."' limit 1");
header('Location: /birga/rob'.$id.''); exit;
}
if($birga_ro['author'] != $user['id']){
echo '<form action="" method="post">
<div class="poste"> <input type="submit" value="Принять предложение" name="submit"/></div>';
}
}
///////////////////////////////////////
break;
////////////////////
case 'add':
$id = TextGuard($_GET['id']);
$pc_r = mysql_fetch_array(mysql_query('select * from `birga_r` where `id` = '.$id.' limit 1'));
if(empty($id) or !is_numeric($id) or $pc_r == 0){
header('Location: /birga'); exit;
}
if(isset($_POST['submit'])){
$opis = TextGuard($_POST['opis']);
if(empty($opis)) $err[] = 'Вы не ввели краткое задание...';
$tz = TextGuard($_POST['tz']);
if(empty($tz)) $err[] = 'Вы не ввели ТЗ...';
$cena = TextGuard($_POST['cena']);
if(empty($cena)) $err[] = 'Вы не ввели бюджет...';
if(!empty($cena)) if(!is_numeric($cena)) $err[] = 'В поле бюджета разрешено вводить только цифры..';
if(!$err){
mysql_query("INSERT INTO `birga`(
`r`,
`cena`,
`author`,
`opis`,
`tz`,
`time`,
`status`
)VALUES(
'".$id."',
'".$cena."',
'".$user['id']."',
'".$opis."',
'".$tz."',
'".time()."',
'0'
)");
header('Location: /birga'); exit;
}else{
echo '<div class="rega">';
foreach($err as $err_info){
echo $err_info.'<br>';
}
echo '</div>';
}
}
echo '<div class="poste">
<form action="" method="post">
Задание (кратко):<br><input name="opis"/><br>
Задание (полное ТЗ):<br><textarea name="tz" style="width:98%;" rows="3"></textarea></br></br>
Бюджет:<br/>
<input type="text" name="cena" size="10"/> р.
<br/>
<input type="submit" value="Заказать" name="submit"/>
</form></div>';
break;
/////////////////////создание папки//////////////////////
case 'nr':
if(isset($_POST['submit'])){
$name = TextGuard($_POST['name']);
if(empty($name)) $err[] = 'Вы не ввели название...';
if(!$err){
mysql_query("INSERT INTO `birga_r`(
`name`
)VALUES(
'".$name."'
)");
header('Location: /birga'); exit;
}else{
echo '<div class="rega">';
foreach($err as $err_info){
echo $err_info.'<br>';
}
echo '</div>';
}
}
echo '
<div class="poste">
<form action="" method="post">
Название:<br><input name="name"/><br>
<input type="submit" value="Добавить" name="submit"/>
</form></div>
';
break;
/////////////////////////////////////////////////////////
}
include '../../system/footer.php';
?>