Как можно убрать проверку админа ?

DollarZ

Участник
#1
Приветствую вас формульчики.
Нуждаюсь в вашей помощи, 2 дня не смогу решить эту проблему помогите пож...

как можно убрать проверку, что бы автоматом всем было одобрено запросы пользователей ?

Код:
<div class="s-bk-lf">

    <div class="acc-title">Ñïèñîê çàäàíèé</div>

</div>

<div class="silver-bk"><div class="clr"></div>

<?





$num_p = (isset($_GET["page"]) AND intval($_GET["page"]) < 1000 AND intval($_GET["page"]) >= 1) ? (intval($_GET["page"]) -1) : 0;

$lim = $num_p * 100;



function colorSum($sum){



    if($sum >= 100) return "red";

    return "#000000";

}



if(isset($_POST['accept']) && is_numeric($_POST['accept'])) {

    $payed=$_POST['accept'];

    $db->Query("SELECT * FROM `db_jobs` WHERE `id` = '$payed' AND `accept` = '0' LIMIT 1 ");

        if($db->NumRows() > 0) {

         $db->Query("UPDATE `db_jobs` SET `accept`='1' WHERE `id`='$payed' ");

        }

}



if(isset($_POST['decline']) && is_numeric($_POST['decline'])) {

    $payed=$_POST['decline'];

    $db->Query("SELECT * FROM `db_jobs` WHERE `id` = '$payed' AND `accept` = '0' LIMIT 1 ");

        if($db->NumRows() > 0) {

         $db->Query("UPDATE `db_jobs` SET `accept`='2' WHERE `id`='$payed' ");

        }

}



$db->Query("SELECT * FROM db_jobs WHERE accept = 0 ORDER BY id DESC LIMIT {$lim}, 100");



if($db->NumRows() > 0){



?>

<table cellpadding='3' cellspacing='0' border='0' bordercolor='#336633' align='center' width="99%">

  <tr bgcolor="#efefef">

    <td align="center" width="50" class="m-tb">Ïîëüçîâàòåëü</td>

    <td align="center" width="300" class="m-tb">Òåêñò</td>

    <td align="center" width="100" class="m-tb">URL</td>

    <td align="center" width="50" class="m-tb">Îäîáðèòü</td>

    <td align="center" width="100" class="m-tb">Äàòà</td>

  </tr>





<?PHP



    while($data = $db->FetchArray()){

 

    ?>

    <tr class="htt">

    <td align="center"><a href="/?menu=admin384&sel=users&edit=<?=$data["user_id"]; ?>"<?php if($data['gardener']==1) {echo ' style="color: red;"';}  ?> class="stn"><?=$data["user"]; ?></a></td>

    <td align="center"><?=$data['about']; ?></td>

    <td align="center"><?=$data['url']; ?></td>

    <td align="center">

    <?php

        if($data["accept"]==0) {

    ?>

    <form action="" method="post">

    <input type="hidden" name="accept" value="<?=$data["id"]; ?>" />

    <input type="submit" value="Îäîáðèòü" />

    </form>

    <form action="" method="post">

    <input type="hidden" name="decline" value="<?=$data["id"]; ?>" />

    <input type="submit" value="Îòìåíèòü" />

    </form>

    <?php

    }

    else if($data["accept"]==2)

    {

        echo "<center><font color = 'green'><b>Îòìåíåíî!</b></font></center><BR />";

    }

    else

    {

        echo "<center><font color = 'green'><b>Îäîáðåíî!</b></font></center><BR />";

    }

    ?>

    </td>

    <td align="center"><?=date("d.m H:i:s",$data["time"]); ?></td>

      </tr>

    <?PHP

 

    }



?>



</table>

<BR />

<?PHP





}else echo "<center><b>Íà äàííîé ñòðàíèöå íåò çàïèñåé</b></center><BR />";



 

$db->Query("SELECT COUNT(*) FROM  db_jobs WHERE accept = 0 ");

$all_pages = $db->FetchRow();



    if($all_pages > 100){

 

    $sort_b = (isset($_GET["sort"])) ? intval($_GET["sort"]) : 0;

 

    $nav = new navigator;

    $page = (isset($_GET["page"]) AND intval($_GET["page"]) < 1000 AND intval($_GET["page"]) >= 1) ? (intval($_GET["page"])) : 1;

 

    echo "<BR /><center>".$nav->Navigation(10, $page, ceil($all_pages / 100), "/?menu=admin384&sel=jobs&page="), "</center>";

 

    }

?>

</div><div class='clr'></div>
 
Последнее редактирование:

pligin

Команда форума
Администратор
#2
Приветствую вас формульчики.
Нуждаюсь в вашей помощи, 2 дня не смогу решить эту проблему помогите пож...

как можно убрать проверку, что бы автоматом всем было одобрено запросы пользователей ?

<div class="s-bk-lf">
<div class="acc-title">Ñïèñîê çàäàíèé</div>
</div>
<div class="silver-bk"><div class="clr"></div>
<?


$num_p = (isset($_GET["page"]) AND intval($_GET["page"]) < 1000 AND intval($_GET["page"]) >= 1) ? (intval($_GET["page"]) -1) : 0;
$lim = $num_p * 100;

function colorSum($sum){

if($sum >= 100) return "red";
return "#000000";
}

if(isset($_POST['accept']) && is_numeric($_POST['accept'])) {
$payed=$_POST['accept'];
$db->Query("SELECT * FROM `db_jobs` WHERE `id` = '$payed' AND `accept` = '0' LIMIT 1 ");
if($db->NumRows() > 0) {
$db->Query("UPDATE `db_jobs` SET `accept`='1' WHERE `id`='$payed' ");
}
}

if(isset($_POST['decline']) && is_numeric($_POST['decline'])) {
$payed=$_POST['decline'];
$db->Query("SELECT * FROM `db_jobs` WHERE `id` = '$payed' AND `accept` = '0' LIMIT 1 ");
if($db->NumRows() > 0) {
$db->Query("UPDATE `db_jobs` SET `accept`='2' WHERE `id`='$payed' ");
}
}

$db->Query("SELECT * FROM db_jobs WHERE accept = 0 ORDER BY id DESC LIMIT {$lim}, 100");

if($db->NumRows() > 0){

?>
<table cellpadding='3' cellspacing='0' border='0' bordercolor='#336633' align='center' width="99%">
<tr bgcolor="#efefef">
<td align="center" width="50" class="m-tb">Ïîëüçîâàòåëü</td>
<td align="center" width="300" class="m-tb">Òåêñò</td>
<td align="center" width="100" class="m-tb">URL</td>
<td align="center" width="50" class="m-tb">Îäîáðèòü</td>
<td align="center" width="100" class="m-tb">Äàòà</td>
</tr>


<?PHP

while($data = $db->FetchArray()){

?>
<tr class="htt">
<td align="center"><a href="/?menu=admin384&sel=users&edit=<?=$data["user_id"]; ?>"<?php if($data['gardener']==1) {echo ' style="color: red;"';} ?> class="stn"><?=$data["user"]; ?></a></td>
<td align="center"><?=$data['about']; ?></td>
<td align="center"><?=$data['url']; ?></td>
<td align="center">
<?php
if($data["accept"]==0) {
?>
<form action="" method="post">
<input type="hidden" name="accept" value="<?=$data["id"]; ?>" />
<input type="submit" value="Îäîáðèòü" />
</form>
<form action="" method="post">
<input type="hidden" name="decline" value="<?=$data["id"]; ?>" />
<input type="submit" value="Îòìåíèòü" />
</form>
<?php
}
else if($data["accept"]==2)
{
echo "<center><font color = 'green'><b>Îòìåíåíî!</b></font></center><BR />";
}
else
{
echo "<center><font color = 'green'><b>Îäîáðåíî!</b></font></center><BR />";
}
?>
</td>
<td align="center"><?=date("d.m H:i:s",$data["time"]); ?></td>
</tr>
<?PHP

}

?>

</table>
<BR />
<?PHP


}else echo "<center><b>Íà äàííîé ñòðàíèöå íåò çàïèñåé</b></center><BR />";


$db->Query("SELECT COUNT(*) FROM db_jobs WHERE accept = 0 ");
$all_pages = $db->FetchRow();

if($all_pages > 100){

$sort_b = (isset($_GET["sort"])) ? intval($_GET["sort"]) : 0;

$nav = new navigator;
$page = (isset($_GET["page"]) AND intval($_GET["page"]) < 1000 AND intval($_GET["page"]) >= 1) ? (intval($_GET["page"])) : 1;

echo "<BR /><center>".$nav->Navigation(10, $page, ceil($all_pages / 100), "/?menu=admin384&sel=jobs&page="), "</center>";

}
?>
</div><div class='clr'></div>
1. Что это за функция/модуль?
2. Оберни код в ББ-код
 

DollarZ

Участник
#5
т.е. нужно, чтобы добавленные ссылки не уходили на модерацию? так?
как можно обернуть код ?
что бы все было на автомате
пользователь добавил заданию и сразу же на серфинг без проверки и одобрение админа пошло
 

pligin

Команда форума
Администратор
#6

DollarZ

Участник
#8
может тебе этот файл нужен ?

Код:
<div class="s-bk-lf">
    <div class="acc-title">Ìåíþ</div>
</div>
<div class="silver-bk"><div class="clr"></div>
<table cellpadding='0' cellspacing='0' border='0' align='center' width="99%">
<tr>
<?php
    $db->Query("SELECT COUNT(*) FROM `db_jobs` ");
    $alljobs = $db->FetchRow();
    $db->Query("SELECT COUNT(*) FROM `db_jobs` WHERE `done`='1' ");
    $alldone = $db->FetchRow();
    $db->Query("SELECT COUNT(*) FROM `db_jobs` WHERE `accept`='3' ");
    $allcanc = $db->FetchRow();
    $db->Query("SELECT COUNT(*) FROM `db_jobs` WHERE `accept`='0' ");
    $allproc = $db->FetchRow();
?>
<td>Ðåêëàìîäàòåëþ:<br/><a href="/account/jobs/info/" class="stn" style="font-weight: normal;">Ïðîâåðêà âûïîëíåíèÿ</a><br/><a href="/account/jobs/add/" class="stn" style="font-weight: normal;">Äîáàâèòü çàäàíèå</a><br/><a href="/account/jobs/my/" class="stn" style="font-weight: normal;">Âàøè çàäàíèÿ</a><br/><br/>Ïîëüçîâàòåëþ:<br/><a href="/account/jobs/list/" class="stn" style="font-weight: normal;">Ñïèñîê çàäàíèé</a><br/><a href="/account/jobs/stat/" class="stn" style="font-weight: normal;">Ñòàòèñòèêà</a></td>
<td>Ñòàòèñòèêà:<br/>Âñåãî çàäàíèé: <?=$alljobs; ?><br/>Âûïîëíåíî çàäàíèé: <?=$alldone; ?><br/>Îòêëîíåíî âûïîëíåíèé: <?=$allcanc; ?><br/>Îæèäàþò ïîäòâåðæäåíèÿ: <?=$allproc; ?></td>
</tr>
</table>
</div>
</div>
<br/>
<?php
$uname = $_SESSION["user"];
$usid = $_SESSION["user_id"];
if(isset($_GET['alljobs'])) {
?>
<div class="section_w500">
<div class="s-bk-lf">
    <div class="acc-title">Ñïèñîê çàäàíèé</div>
</div>
<div class="silver-bk"><div class="clr"></div>
<?php
$db->Query("SELECT * FROM `db_jobs_category` ");
while($data = $db->FetchArray()) {
    $names[$data['id']]=$data['name'];
}

$db->Query("SELECT * FROM `db_jobs` WHERE `done` = '0' AND `accept`='1' ORDER BY `id` DESC LIMIT 30 ");
if($db->NumRows() == 0) {
    echo 'Çàäàíèÿ îòñóòñâóþò';
}
while($data = $db->FetchArray()) {
    echo '#'.$data['id'].'. <b>'.$data['name'].'</b> (Îïëàòà '.$data['pay'].' ñåðåáðà)<br/>';
    echo '<b>Îïèñàíèå:</b> ';
    if(strlen($data['about']) > 100) {
        echo substr($data['about'], 0, 100).'...';
    } else echo $data['about'];
    
    echo '<br/><b>Êàòåãîðèÿ:</b> '.$names[$data['category']].'<br/>';
    echo '<a href="/account/jobs/show/'.$data['id'].'" class="stn">Ïðîñìîòð &gt;&gt;</a>';
    echo '<hr/>';
}
?>
</div>
</div>
<?php
}
else
if(isset($_GET['add'])) {
?>
<div class="section_w500">
<div class="s-bk-lf">
    <div class="acc-title">Äîáàâèòü çàäàíèå</div>
</div>
<div class="silver-bk"><div class="clr"></div>
<?php
$db->Query("SELECT * FROM db_users_b WHERE id = '$usid' LIMIT 1");
$user_data = $db->FetchArray();
$money = $user_data['money_b'];
if(isset($_GET['save'])) {
    if(preg_match('/^[à-ÿa-zA-ZÀ-ß0-9.!,\s]{4,180}$/s', $_POST['name'])) {
        $db->Query("SELECT * FROM `db_jobs_category` WHERE `id` = '".intval($_POST['category'])."' ");
        if($db->NumRows() > 0) {
                if(strlen($_POST['about']) > 4 && strlen($_POST['about']) <= 1024) {
                if(strlen($_POST['info']) > 4 && strlen($_POST['info']) <= 1024) {
                    if(intval($_POST['period']) >= 0 && intval($_POST['period']) <= 1) {
                        if(intval($_POST['pay']) > 0 && $_POST['pay'] < $money) {
                            $db->Query("SELECT `time` FROM `db_jobs` WHERE `user` = '$uname' ORDER BY `id` DESC LIMIT 1 ");
                            if($db->FetchRow() < time() - 180 || $db->NumRows() == 0) {
                                # Ñîõðàíÿåì
                                $name = $_POST['name'];
                                $period = $_POST['period'];
                                $pay = $_POST['pay'];
                                $category = $_POST['category'];
                                $about = $db->RealEscape(htmlspecialchars($_POST['about']));
                                $url = $db->RealEscape(htmlspecialchars($_POST['url']));
                                $info = $db->RealEscape(htmlspecialchars($_POST['info']));
                                echo "<center><font color = 'grey'><b>Âàøå çàäàíèå óñïåøíî äîáàâëåíî!</b></font></center><BR />";
                                $db->Query("INSERT INTO `db_jobs`(`user`,`name`,`url`,`about`,`info`,`category`,`period`,`pay`,`time`) VALUES('$uname','$name','$url','$about','$info','$category','$period','$pay','".time()."')");
                            } else echo "<center><font color = 'red'><b>Çàäàíèå ìîæíî äîáàâëÿòü ðàç â 3 ìèíóòû!</b></font></center><BR />";
                        } else echo "<center><font color = 'red'><b>Îïëàòà çà âûïîëíåíèå óêàçàíà íåâåðíî!</b></font></center><BR />";
                    } else echo "<center><font color = 'red'><b>Ïåðèîäè÷íîñòü óêàçàíà íåâåðíî!</b></font></center><BR />";
                    } else echo "<center><font color = 'red'><b>Èíôîðìàöèÿ äëÿ âûïîëíåíèÿ óêàçàíî íåâåðíî!</b></font></center><BR />";
                } else echo "<center><font color = 'red'><b>Îïèñàíèå óêàçàíî íåâåðíî!</b></font></center><BR />";
        } else echo "<center><font color = 'red'><b>Êàòåãîðèÿ óêàçàíà íåâåðíî!</b></font></center><BR />";
    } else echo "<center><font color = 'red'><b>Çàãîëîâîê óêàçàí íåâåðíî!</b></font></center><BR />";
}
?>
<form action="/account/jobs/save/" method="post">
<table width="99%" border="0" align="center">
  <tr>
    <td><font color="#000;">Çàãîëîâîê</font></td>
    <td><input type="text" name="name" style="width: 100%;"/></td>
  </tr>
  <tr>
    <td><font color="#000;">Êàòåãîðèÿ</font></td>
    <td><select name="category">
    <?php
    $db->Query("SELECT * FROM `db_jobs_category` ");
    while($job = $db->FetchArray()) {
        echo '<option value="'.$job['id'].'">'.$job['name'].'</option>';
    }
    ?>
    </select></td>
  </tr>
  <tr>
    <td><font color="#000;">URL âûïîëíåíèÿ</font></td>
    <td><input type="text" name="url" value="http://" style="width: 100%;"/></td>
  </tr>
  <tr>
    <td><font color="#000;">Îïèñàíèå</font></td>
    <td><textarea name="about" style="width: 100%; height: 100px;"/></textarea></td>
  </tr>
  <tr>
    <td><font color="#000;">Èíôîðìàöèÿ äëÿ âûïîëíåíèÿ</font></td>
    <td><textarea name="info" style="width: 100%; height: 100px;"/></textarea></td>
  </tr>
  <tr>
    <td><font color="#000;">Ïåðèîäè÷íîñòü</font></td>
    <td><select name="period">
        <option value="0">Îäíîêðàòíî</option>
        <option value="1">Ìíîãîêðàòíî</option>
    </select></td>
  </tr>
  <tr>
    <td><font color="#000;">Îïëàòà çà âûïîëíåíèå</font></td>
    <td><input type="text" name="pay" value="0" style="width: 100%;"/></td>
  </tr>
  <tr>
    <td colspan="2" align="center"><input type="submit" name="swap" value="Äîáàâèòü" style="height: 30px; margin-top:10px;" /></td>
  </tr>
</table>
</form>
</div>
</div>
<?php
}
else
if(isset($_GET['statuse'])) {
?>
<div class="section_w500">
<div class="s-bk-lf">
    <div class="acc-title">Ñòàòèñòèêà âûïîëíåíèé</div>
</div>
<div class="silver-bk"><div class="clr"></div>
<?php
$db->Query("SELECT COUNT(*) FROM `db_jobs_use` WHERE `user`='$uname' ");
$count = $db->FetchRow();
if($count == 0) {
    echo 'Âû íå âûïîëíÿëè çàäàíèé';
}
else
{
    $db->Query("SELECT COUNT(*) FROM `db_jobs_use` WHERE `user`='$uname' AND `pay`='0' ");
    $proc = $db->FetchRow();
    $done = $count - $proc;
    echo 'Âñåãî ïðèíÿòûõ çàäàíèé: '.$count.'<br/>Âñåãî âûïîëíåíûõ çàäàíèé: '.$done.'<br/>Çàäàíèÿ â îáðàáîòêå: '.$proc;
}
?>
</div>
</div>
<?php
}
else
if(isset($_GET['show'])) {
?>
<div class="section_w500">
<div class="s-bk-lf">
    <div class="acc-title">Ñïèñîê çàäàíèé</div>
</div>
<div class="silver-bk"><div class="clr"></div>
<?php
$db->Query("SELECT * FROM `db_jobs` WHERE `id`='".intval($_GET['show'])."' AND `accept`='1' AND `done`='0' ");
$job = intval($_GET['show']);
if($db->NumRows() == 0) {
    echo 'Òàêîãî çàäàíèÿ íå ñóùåñòâóåò!';
}
else
{
    $arr = $db->FetchArray();
    if(isset($_POST['done'])) {
        $db->Query("SELECT COUNT(*) FROM `db_jobs_use` WHERE `user`='$uname' AND `pay` = '0' ");
        if($arr['user'] != $uname) {
        if($db->FetchRow() == 0) {
        $db->Query("SELECT COUNT(*) FROM `db_jobs_use` WHERE `id_job`='$job' ");
        $dones = $db->FetchRow();
        $db->Query("SELECT `period` FROM `db_jobs` WHERE `id`='$job' ");
        $type = $db->FetchRow();
        if(($dones == 0 && $type == 0) || ($type == 1)) {
        if(strlen($_POST['done']) > 4 && strlen($_POST['done']) <= 1024) {
            $done = $db->RealEscape(htmlspecialchars($_POST['done']));
            echo "<center><font color = 'grey'><b>Âàøà çàÿâêà óñïåøíî îòïðàâëåíà!</b></font></center><BR />";
            $db->Query("INSERT INTO `db_jobs_use`(`id_job`,`user`,`message`,`pay`) VALUES('$job','$uname','$done','0')");
        } else echo "<center><font color = 'red'><b>Òåêñò ïîäòâåðæäåíèÿ âûïîëíåíèÿ óêàçàí íåâåðíî!</b></font></center><BR />";
        } else echo "<center><font color = 'red'><b>Äàííîå çàäàíèå óæå áûëî âûïîëíåíî!</b></font></center><BR />";
        } else echo "<center><font color = 'red'><b>Âû óæå ïîäàâàëè çàÿâêó íà âûïîëíåíèå! Äîæäèòåñü åå ðàññìîòðåíèÿ.</b></font></center><BR />";
        } else echo "<center><font color = 'red'><b>Ýòî âàøà çàÿâêà!</b></font></center><BR />";
    }
    $db->Query("SELECT `name` FROM `db_jobs_category` WHERE `id`='$arr[category]' ");
    $category = $db->FetchRow();
    ?>
    <table width="99%" border="0" align="center">
    <?php
    echo '<tr><td colspan="2" align="center"><span style="color: rgb(96, 145, 67);">#'.$arr['id'].'. '.$arr['name'].'</span></td></tr><tr><td><br/></td></tr><tr><td align="right" width="50%"><font color="#000">Àâòîð: </td><td>'.$arr['user'].'</td></tr><tr><td align="right" width="50%">Îïëàòà:</td><td>'.$arr['pay'].'</td></tr><tr><td align="right" width="50%">Êàòåãîðèÿ:</td><td width="50%">'.$category.'</font></td></tr><tr><td><br/></td></tr><tr><td colspan="2" align="center"><span style="color: rgb(96, 145, 67);"><b>Îïèñàíèå:</b></span></td></tr><tr><td colspan="2" align="left"><span style="color: rgb(96, 145, 67);">'.$arr['about'].'</span></td></tr><tr><td></td></tr><tr><td colspan="2" align="center"><span style="color: rgb(96, 145, 67);"><b>Èíôîðìàöèÿ äëÿ âûïîëíåíèÿ:</b></span></td></tr><tr><td colspan="2" align="left"><span style="color: rgb(96, 145, 67);">'.$arr['info'].'</span></td></tr><tr><td><br/></td></tr><tr><td colspan="2" align="center"><span style="color: rgb(96, 145, 67);"><b>Âûïîëíåíèå:</b></span></td></tr><tr><td colspan="2" align="center" style="cursor: pointer;" onclick="window.open(\''.$arr['url'].'\',\'\');">Ïðèñòóïèòü ê âûïîëíåíèþ</td></tr><tr><td></td></tr><form action="" method="post"><tr><td colspan="2" align="center"><textarea name="done" style="width: 100%; height: 100px;"></textarea></td></tr><tr><td colspan="2" align="center"><input type="submit" value="Ïîäòâåðäèòü âûïîëíåíèå"/></td></tr></form>';
}
?>
</table>
</div>
</div>
<?php
}
else
if(isset($_GET['info'])) {
?>
<div class="section_w500">
<div class="s-bk-lf">
    <div class="acc-title">Ïðîâåðêà âûïîëíåíèÿ</div>
</div>
<div class="silver-bk"><div class="clr"></div>
<?php
$db->Query("SELECT * FROM db_users_b WHERE id = '$usid' LIMIT 1");
$user_data = $db->FetchArray();
$money = $user_data['money_b'];
if(isset($_POST['pay_here']) && is_numeric($_POST['pay_here'])) {
    $payed = intval($_POST['pay_here']);
    $db->Query("SELECT `id_job` FROM `db_jobs_use` WHERE `pay` = '0' AND `id` = '$payed' ");
    if($db->NumRows() > 0) {
        $payed2 = $db->FetchRow();
        $db->Query("SELECT `pay` FROM `db_jobs` WHERE `id` = '$payed2' AND `user` = '$uname' AND `accept`='1' LIMIT 1 ");
        $sum = $db->FetchRow();
        if($sum < $money) {
        $db->Query("SELECT `id_job` FROM `db_jobs_use` WHERE `pay` = '0' AND `id` = '$payed' ");
        if($db->NumRows() > 0) {
            $db->Query("SELECT `user` FROM `db_jobs_use` WHERE `pay` = '0' AND `id_job` = '$payed' LIMIT 1 ");
            $to = $db->FetchRow();
            $db->Query("SELECT `period` FROM `db_jobs` WHERE `pay` = '0' AND `id` = '$payed2' LIMIT 1 ");
            $per = $db->FetchRow();
            $db->Query("UPDATE db_users_b SET money_b = money_b - '$sum' WHERE user = '$uname' ");
            $db->Query("UPDATE db_users_b SET money_b = money_b + '$sum' WHERE user = '$to' ");
            $db->Query("UPDATE `db_jobs_use` SET `pay`='1' WHERE `id` = '$payed' ");
            if($per == 0) {
                $db->Query("UPDATE `db_jobs` SET `done` = '1' WHERE `id`='$payed2' ");
            }
            echo "<center><font color = 'grey'><b>Çàÿâêà óñïåøíî ïðèíÿòà!</b></font></center><BR />";
        }
        } else echo "<center><font color = 'red'><b>Ó âàñ íåäîñòàòî÷íî ñåðåáðà!</b></font></center><BR />";   
    }
}
else
if(isset($_POST['del_here']) && is_numeric($_POST['del_here'])) {
    $payed = intval($_POST['del_here']);
    $db->Query("SELECT `id_job` FROM `db_jobs_use` WHERE `pay` = '0' AND `id` = '$payed' ");
    if($db->NumRows() > 0) {
        $payed2 = $db->FetchRow();
        $db->Query("SELECT `pay` FROM `db_jobs` WHERE `id` = '$payed' AND `user` = '$uname' AND `accept`='1' LIMIT 1 ");
        if($db->NumRows() > 0) {
            $sum = $db->FetchRow();
            $db->Query("UPDATE `db_jobs_use` SET `pay`='2' WHERE `id` = '$payed' ");
            echo "<center><font color = 'grey'><b>Çàÿâêà óñïåøíî îòìåíåíà!</b></font></center><BR />";
        }
    }
}
$db->Query("SELECT * FROM `db_jobs_category` ");
while($data = $db->FetchArray()) {
    $names[$data['id']]=$data['name'];
}
$db->Query("SELECT * FROM `db_jobs` WHERE `user` = '$uname' ");
if($db->NumRows() == 0) {
    echo 'Çàäàíèÿ îòñóòñâóþò';
}
while($sdata = $db->FetchArray()) {
    $sdatas[] = $sdata;
}
for($i=0;$i<count($sdatas);$i++) {
    $wname = $sdatas[$i]['id'];
    $db->Query("SELECT * FROM `db_jobs_use` WHERE `pay` = '0' AND `id_job` = '$wname' LIMIT 30 ");
    while($data = $db->FetchArray()) {
    
    echo '#'.$sdatas[$i]['id'].'. <b>'.$sdatas[$i]['name'].'</b> (Îïëàòà '.$sdatas[$i]['pay'].' ñåðåáðà)<br/>';
    echo '<b>Ñîîáùåíèå:</b> '.$data['message'];
    echo '<br/><b>Êàòåãîðèÿ:</b> '.$names[$sdatas[$i]['category']];
    ?>
    <form action="" method="post">
    <input type="hidden" name="pay_here" value="<?=$data["id"]; ?>" />
    <input type="submit" value="Îïëàòèòü" /><br/>
    </form>
    <form action="" method="post">
    <input type="hidden" name="del_here" value="<?=$data["id"]; ?>" />
    <input type="submit" value="Îòìåíèòü" />
    </form>
    <?php
    echo '<hr/>';
}
}
?>
</div>
</div>
<?php
}
else
if(isset($_GET['mylist'])) {
?>
<div class="section_w500">
<div class="s-bk-lf">
    <div class="acc-title">Âàøè çàäàíèÿ</div>
</div>
<div class="silver-bk"><div class="clr"></div>
<?php
$db->Query("SELECT * FROM `db_jobs_category` ");
while($data = $db->FetchArray()) {
    $names[$data['id']]=$data['name'];
}
$db->Query("SELECT * FROM `db_jobs` WHERE `user` = '$uname' AND `accept`='1' ORDER BY `id` DESC LIMIT 30 ");
if($db->NumRows() == 0) {
    echo 'Çàäàíèÿ îòñóòñâóþò';
}
if(isset($_POST['del_here']) && is_numeric($_POST['del_here'])) {
    $payed = intval($_POST['del_here']);
    $db->Query("SELECT COUNT(*) FROM `db_jobs` WHERE `user` = '$uname' AND `id` = '$payed' AND `accept`='1' ");
    if($db->FetchRow() > 0) {
        $db->Query("DELETE FROM `db_jobs` WHERE `id` = '$payed' ");
        $db->Query("DELETE FROM `db_jobs_use` WHERE `id_job` = '$payed' ");
        echo "<center><font color = 'grey'><b>Çàÿâêà óñïåøíî îòìåíåíà!</b></font></center><BR />";
    }
}

if(isset($_POST['save_here']) && is_numeric($_POST['save_here'])) {
    $payed = intval($_POST['save_here']);
    $db->Query("SELECT COUNT(*) FROM `db_jobs` WHERE `user` = '$uname' AND `id` = '$payed' AND `accept`='1' ");
    if($db->FetchRow() > 0) {
        $db->Query("UPDATE `db_jobs` SET `done`='1' WHERE `id` = '$payed' ");
        echo "<center><font color = 'grey'><b>Çàÿâêà óñïåøíî çàâåðøåíà!</b></font></center><BR />";
    }
}
$db->Query("SELECT * FROM `db_jobs` WHERE `user` = '$uname' AND `accept`='1' ORDER BY `id` DESC LIMIT 30 ");
while($data = $db->FetchArray()) {
    echo '#'.$data['id'].'. <b>'.$data['name'].'</b> (Îïëàòà '.$data['pay'].' ñåðåáðà)<br/>';
    echo '<b>Îïèñàíèå:</b> ';
    if(strlen($data['about']) > 100) {
        echo substr($data['about'], 0, 100).'...';
    } else echo $data['about'];
    
    echo '<br/><b>Êàòåãîðèÿ:</b> '.$names[$data['category']].'<br/>';
    if($data['done'] == 0 && $data['period'] == 0) {
    ?>
    <form action="" method="post">
    <input type="hidden" name="del_here" value="<?=$data["id"]; ?>" />
    <input type="submit" value="Îòìåíèòü" />
    </form>
    <?php
    }
    else if($data['done'] == 0 && $data['period'] == 1) {
    ?>
    <form action="" method="post">
    <input type="hidden" name="save_here" value="<?=$data["id"]; ?>" />
    <input type="submit" value="Çàâåðøèòü" />
    </form>
    <?php
    }
    else
    {
        echo '<font color="grey">Âûïîëíåíî!</font>';
    }
    echo '<hr/>';
}
?>
</div>
</div>
<?php
}
?>
 

pligin

Команда форума
Администратор
#11
парень ты просто чудо...
спасибо те большое...
сколько будет стоит твой труд ?
за такое деньги не беру ;)
задавай вопросы, размещай ресурсы на форуме...
также требуются кураторы разделов
 

pligin

Команда форума
Администратор
#12
понял... если так то у меня еще одна проблемка с этим серфингом.
на пополнение указываешь цену сколько ты хочешь пополнить,
а деньги пополняются неоткуда,
надо сделать так что б пополнился из монет для покупок

вот сам файл

Код:
<?php
/*
* Серфинг для фермы
* Версия: 1.00
* SKYPE: sereega393
* Использование без оплаты ЗАПРЕЩЕНО!!!
*/
define('TIME', time());

$msg = '';
$_SESSION['cnt'] = md5($_SESSION['user_id'].session_id());

$db->Query("SELECT * FROM db_users_b WHERE id = '".$_SESSION['user_id']."'");
$users_info = $db->FetchArray();

?>
<script>
function getHTTPRequest()
{
    var req = false;
    try {
        req = new XMLHttpRequest();
    } catch(err) {
        try {
            req = new ActiveXObject("MsXML2.XMLHTTP");
        } catch(err) {
            try {
                req = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(err) {
                req = false;
            }
        }
    }
    return req;
}

var  defsummin = 1;
            function advevent(badv, buse)
            {
                var postc = '<?php echo $_SESSION['cnt']; ?>';
                var issend = true;
                if (buse == 3) issend = confirm("Обнулить счётчик просмотров ссылки №" + badv + "?");
                if (buse == 4) issend = confirm("Вы уверены что хотите удалить ссылку №" + badv + "?");
                if (issend)
                    senddata(badv, buse, postc, 1);
                return true;
            }
       

function senddata(radv, ruse, rpostc, rmode)
{
    var myReq = getHTTPRequest();
    var params = "use="+ruse+"&mode="+rmode+"&adv="+radv+"&cnt="+rpostc;
    function setstate()
    {
        if ((myReq.readyState == 4)&&(myReq.status == 200)) {
            var resvalue = parseInt(myReq.responseText);
            if (resvalue > 0) {
                if (ruse == 1) {
                    document.getElementById("advimg"+radv).innerHTML = "<span class='serfcontrol-pause' title='Остановить показ рекламной площадки' onclick='javascript:advevent(" + radv + ",2);'></span>";
                } else
                if (ruse == 2) {
                    document.getElementById("advimg"+radv).innerHTML = "<span class='serfcontrol-play' title='Запустить показ рекламной площадки' onclick='javascript:advevent(" + radv + ",1);'></span>";
                } else
                if (ruse == 3) {
                    document.getElementById("erase"+radv).innerHTML = "0";
                } else
                if (ruse == 4) {
                    $('#adv'+radv).fadeOut('def');
                } else
                if (ruse == 5) {
                    if ((resvalue > 0)&&(resvalue < 8))
                        document.getElementById("int"+radv).className = 'scon-speed-'+resvalue;
                } else
                if (ruse == 6) {
                    document.getElementById("status"+radv).innerHTML = "<span class='desctext' style='text-decoration: blink;'>Ожидает<br />проверки</span>";
                    document.getElementById("advimg"+radv).innerHTML = "<span class='serfcontrol-postmoder'></span>";
                } else
                if (ruse == 7) {
                    window.location.reload(true);
                }
            }
        }
    }
    myReq.open("POST", "/ajax/us-advservice.php", true);
    myReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    myReq.setRequestHeader("Content-lenght", params.length);
    myReq.setRequestHeader("Connection", "close");
    myReq.onreadystatechange = setstate;
    myReq.send(params);
    return false;
}

function submitform(formnum)
{
    if (document.forms['payform'+formnum].pay_order) {
        var field = document.forms['payform'+formnum].pay_order.value;
        var minsum = $('#minsum'+formnum).text();    
        var tm;
        function hidemsg()
        {
            $('#entermsg'+formnum).fadeOut('slow');
            if (tm)
                clearTimeout(tm);
        }
        field = field.replace(",", ".");
        if (field == '') {
            document.getElementById('entermsg'+formnum).innerHTML = "<span class='msgbox-error'>Введите необходимую сумму</span>";
            document.getElementById('entermsg'+formnum).style.display = '';
            tm = setTimeout(function() {
                hidemsg()
            }, 1000);
            return false;
        }
        rprice = parseFloat(field);
        if (isNaN(rprice)) {
            document.getElementById('entermsg'+formnum).innerHTML = "<span class='msgbox-error'>Значение должно быть числовым</span>";
            document.getElementById('entermsg'+formnum).style.display = '';
            tm = setTimeout(function() {
                hidemsg()
            }, 1000);
            return false;
        }
        if (rprice != field) {
            document.getElementById('entermsg'+formnum).innerHTML = "<span class='msgbox-error'>Значение должно быть числовым</span>";
            document.getElementById('entermsg'+formnum).style.display = '';
            tm = setTimeout(function() {
                hidemsg()
            }, 1000);
            return false;
        }
        if (rprice < minsum) {
            document.getElementById('entermsg'+formnum).innerHTML = "<span class='msgbox-error'>Сумма должна быть не менее "+minsum+" баксов</span>";
            document.getElementById('entermsg'+formnum).style.display = '';
            tm = setTimeout(function() {
                hidemsg()
            }, 1000);
            return false;
        }
        var rnote = document.forms['payform'+formnum].pay_adv.value;
        var rart = document.forms['payform'+formnum].pay_mode.value;
        var rcnt = document.forms['payform'+formnum].pay_cnt.value;
        senddatacart(rnote, rart, rprice, rcnt);
        return true;
    }
    return false;
}

function senddatacart(rnote, rart, rprice, rcnt)
{
    var myReq = getHTTPRequest();
    var params = "adv="+rnote+"&use="+rart+"&price="+rprice+"&cnt="+rcnt;
    function setstate()
    {
        if ((myReq.readyState == 4)&&(myReq.status == 200)) {
            var resvalue = myReq.responseText;
            if (resvalue != '') {
                if (resvalue > 0) {                  
                    document.getElementById("entermsg"+rnote).innerHTML = "<center>Оплачено</center>";
                    window.location.reload(true);
                } else
                    document.getElementById("entermsg"+rnote).innerHTML = "<span class='msgbox-error'>"+resvalue+"</span>";
            } else {
                document.getElementById("entermsg"+rnote).innerHTML = "<span class='msgbox-error'>Не удалось обработать запрос</span>";
            }
        } else {
            document.getElementById("entermsg"+rnote).innerHTML = "<span class='loading' title='Подождите пожалуйста...'></span>";
            document.getElementById("entermsg"+rnote).style.display = '';
        }
    }
    myReq.open("POST", "/ajax/us-advservice.php", true);
    myReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    myReq.setRequestHeader("Content-lenght", params.length);
    myReq.setRequestHeader("Connection", "close");
    myReq.onreadystatechange = setstate;
    myReq.send(params);
    return false;
}

function hideserfaddblock(bname) {
    if (document.getElementById(bname).style.display == 'none')
        document.getElementById(bname).style.display = '';
    else
        document.getElementById(bname).style.display = 'none';
    return false;
}
function alertbudget()
{
    alert("Пополните рекламный бюджет");
    return false;
}
function alertnochange()
{
    alert("Задание можно редактировать только раз в 3 часа");
    return false;
}

function reportformactivate(dnum, dmode) {
    if (dmode == 2)
        document.getElementById('delcomment'+dnum).style.display = '';
    else
    if (dmode == 3)
        document.getElementById('reversecomment'+dnum).style.display = '';
    document.getElementById('btns'+dnum).style.display = 'none';
    return false;
    }
</script>
<link rel="stylesheet" href="/style/main.css" type="text/css" />
<div class="s-bk-lf">
    <div class="acc-title">Мои ссылки</div>
</div>
<div class="silver-bk">
<?php
$db->Query("SELECT * FROM db_serfing WHERE user_name = '".$_SESSION['user']."' ORDER BY time_add DESC");

if ($db->NumRows())
{
   while ($row = $db->FetchArray())
   {
     ?>
     <table class="adv-serf">
      <tbody>
       <tr id="adv<?php echo $row['id']; ?>">
        <td>
         <div id="advimg<?php echo $row['id']; ?>">
          <?php  
          if ($row['status'] == 0)
          {
            ?><span class="serfcontrol-moder"></span><?php
          }
          else if ($row['status'] == 1)
          {
            ?><span class="serfcontrol-postmoder"></span><?php
          }
          else if ($row['status'] == 2)
          {
            ?><span class="serfcontrol-pause" title="Остановить показ ссылки" onclick="javascript:advevent(<?php echo $row['id']; ?>,2);"></span><?php
          }
          else if ($row['status'] == 3)
          {
            if ($row['money'] >= $row['price'])
            {
              ?><span class="serfcontrol-play" title="Запустить показ ссылки" onclick="javascript:advevent(<?php echo $row['id']; ?>,1);"></span><?php
            }
            else
            {
              ?><span class="serfcontrol-play" title="Запустить показ ссылки" onclick="javascript:alertbudget();"></span><?php
            }          
          }
          ?>
         
         </div>
        </td>
        <td width="80%">
         <a href="<?php echo $row['url']; ?>" target="_blank"><?php echo $row['title']; ?><br>
          <span class="desctext"><?php echo $row['desc']; ?></span></a><br>
         <span class="serfinfotext">№ <?php echo $row['id']; ?>&nbsp;&nbsp;Клик: <?php echo $row['price']; ?> баксов.&nbsp;&nbsp;Просмотров:
         <div style="display: inline;" id="erase<?php echo $row['id']; ?>"><?php echo $row['view']; ?></div>
       
         </span>
          <?php
          if ($row['money'] == 0)
          {
            ?><span class="scon-delete" title="Удалить ссылку" onclick="javascript:advevent(<?php echo $row['id']; ?>,4);"></span><?php
          }
          ?>
          <span id="int<?php echo $row['id']; ?>" class="scon-speed-<?php echo $row['speed']; ?>" title="Изменить интервал показов" onclick="javascript:advevent(<?php echo $row['id']; ?>,5);"></span>
          <span class="scon-erase" title="Сброс статистики" onclick="javascript:advevent(<?php echo $row['id']; ?>,3);"></span>
          <a class="scon-edit" href="/account/serfing/edit/<?php echo $row['id']; ?>" title="Редактировать ссылку"></a>
        </td>
        <td class="budget">
         <?php
       
           if ($row['money'] > 0)
           {
             ?><span class="add-budget" title="Пополнить рекламный бюджет" onclick="javascript:hideserfaddblock('serfadd<?php echo $row['id']; ?>');"><span style="font-size: 11px"><?php echo $row['money']; ?></span></span><?php
           }
           else
           {
             ?><span class="add-budgetnone" title="Пополнить рекламный бюджет" onclick="javascript:hideserfaddblock('serfadd<?php echo $row['id']; ?>');"><span style="font-size: 11px">Пополнить</span></span><?php
           }
               
         ?>
       
        </td>    
       </tr>
       <tr id="serfadd<?php echo $row['id']; ?>" style="display: none">
        <td class="ext" colspan="3">
         <form name="payform<?php echo $row['id']; ?>" class="pay-form" onkeypress="if (event.keyCode == 13) return false;">
          <input name="pay_cnt" value="<?php echo $_SESSION['cnt']; ?>" type="hidden">
          <input name="pay_mode" value="12" type="hidden">
          <input name="pay_user" value="<?php echo $_SESSION['user_id']; ?>" type="hidden">
          <input name="pay_adv" value="<?php echo $row['id']; ?>" type="hidden">Укажите сумму, которую вы хотите внести в бюджет рекламной площадки<br>(Минимум <span id="minsum<?php echo $row['id']; ?>"><?php echo $row['price']; ?></span> баксов)<input name="pay_order" maxlength="10" value="<?php echo number_format($row['price']*1000, 2, '.', ''); ?>" type="text"><center><span class="button-red" title="Внести средства в бюджет площадки" onclick="javascript:submitform(<?php echo $row['id']; ?>);">Оплатить</span></center></form>
         <div id="entermsg<?php echo $row['id']; ?>" style="display: none"></div>
        </td>
       </tr>
      </tbody>
     </table>

     <?php
   }
}
else
{
   echo 'ссылок нет';
}

?>
<center>
<a href="/account/serfing/add" class="button-green-big" style="margin-top:10px">Разместить ссылку</a>
</center>
</div>

<div class="clr"></div>  
                            <br>
                            <br>
                            </div>
                        <div class="clr"></div>
один вопрос - одна тема
 
Сверху