Hello everyone. There is a problem. It is necessary to limit the number of adding users with a binding to the database.

Adding users is implemented on the site. It is necessary that the client, when adding a user, be limited to the number of additions through the rank.

The site implemented the ranks "Mini, Economy, Standard, Partner, Sponsor, General Sponsor"

Each rank must have a limit on adding a user. "Mini" has 3 pcs. "Economy" has 4 pcs. "Standard" has 5 pcs. "Partner" has 6 pcs. "Sponsor" has 8 pcs and "Gene Sponsor" has 10 pcs.

How to make the restriction be tied to the rank.

Button code

<div class="col-xs-12" style="display: flex;">                    <a style="float:left;margin: 10px; " href="/kons.php?action=new_form&
rowform=<?=$search?>" class="jsdelete_pers btn btn-warning btn-sm" >Add consultant</a><!--<span class="input-text" ><b style="font-size:18px;color:#fff;"><?=$row1['N']?></b></span>                    <span style="background: lightblue;height: 34px;font-size:22px;font-weight: bold;color: red;margin-left: 5px;width: 100%"> <?=htmlspecialchars($row1['ConsName'])?>  </span> --> <?php $result444= mysql_query ("SELECT count(`DueCons`) as count,`DueCons` FROM `medsoft` where `N`=".$poisk." and `DueCons` like 'medsoft%'", $db) ;
$rowcount= mysql_fetch_array($result444);
?>Hidden previously entered medsoft MedSoft-*: <?=$rowcount['count']?> PC.

This is what the Rank table looks like

id rank Description
1 6 Mini
2 5 Economy
3 4 Standard
4 3 Partner
5 2 Sponsor
6 1 General Sponsor

Duplicate question: How to implement a limit on the number of adding customers to the site

Akina2022-01-17 06:03:48

@Evgeny Gavrilov the rank is tied to the client, but as I wrote above, there is a limit of up to 10 additions, and there are only 6 ranks

Александр Курылев2022-01-17 06:05:21

@ Akina yes, the question is the same, but I indicated it a little differently, because there weren’t many answers to that one, and I indicated there for the most part the binding to PHP, although you can do it through JS (if you can, of course)

Александр Курылев2022-01-17 06:07:26

You have not given a bad answer in the previous question. As for storing logic in the database, keeping it in the form of stored procedures or implementing it on the php side, it's up to you to decide. I would implement it on the php side, since all the "eggs" are in one basket. You don’t need to do it through JS, because the server will not be protected and any REST client can add as many consultants as you like.

Евгений Гаврилов2022-01-17 06:25:57