Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /** include "../config.php";
- include "connect.php";
- if (isset($_POST['group']) && isset($_POST['nickname'])) {
- $mysqli = new mysqli($settings["db"]["host"], $settings["db"]["user"], $settings["db"]["password"], $settings["db"]["dbname"]);
- $roupprice = $mysqli->query("SELECT * FROM `groups` WHERE `name` = '".$_POST['group']."' ORDER BY sum DESC LIMIT 1", MYSQLI_USE_RESULT);
- $grouppriceon = mysqli_fetch_assoc($groupprice)['sum'];
- $toPay = $grouppriceon;
- if (isset($_POST['promo']) && $_POST['promo'] != "") {
- if (array_key_exists($_POST['promo'], $options['promo'])) {
- $coupon = $_POST['promo'];
- $discount = $options['promo'][$_POST['promo']];
- $toPay = $toPay - ($toPay / 100 * $discount);
- }
- }
- $result = $mysqli->query("SELECT * FROM `doplata` WHERE `nickname` = '".$_POST['nickname']."' AND `buy` = '".$_POST['group']."' ORDER BY money DESC LIMIT 1", MYSQLI_USE_RESULT);
- $base_money = mysqli_fetch_assoc($result)['money'];
- if ($toPay > $base_money) $toPay = $toPay - $base_money;
- if($toPay <= $base_money) {
- echo '<a class="btn btn-danger btn-block disabled">Вы не можете купить данную привилегию</a>';
- } else {
- echo '<button type="submit" class="btn btn-primary btn-block">Купить за '.$toPay.' рублей</button>';
- }
- }
- * CREATE TABLE `test` (
- * `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
- * `login` VARCHAR(50) NOT NULL,
- * `password` VARCHAR(50) NOT NULL,
- * `email` VARCHAR(130) NULL DEFAULT NULL,
- * `ip` VARCHAR(50) NULL DEFAULT NULL,
- * `lastlogin` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
- * `activation` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
- * PRIMARY KEY (`id`),
- * INDEX `login` (`login`)
- * ) ENGINE=MyISAM;
- */
- //session_start();
- include "../config.php";
- if (isset($_POST['group']) && isset($_POST['nickname']))
- {
- $param = $db->prepare('SELECT * from groups WHERE `name` = ?');
- $param->bindParam(1, $_POST['group'], PDO::PARAM_STR);
- if ($param->execute())
- {
- $param->setFetchMode(PDO::FETCH_ASSOC);
- if ($result = $param->fetchAll())
- {
- // Станет доступно
- // $result[0]['id'];
- // $result[0]['login'];
- // $result[0]['password'];
- // $result[0]['email'];
- // $result[0]['ip'];
- // $result[0]['lastlogin'];
- // $result[0]['activation'];
- echo $result[0]['sum'];
- echo $result[0]['name'];
- }
- }
- // if($_POST['login'] == $result[0]['login'] && $_POST['login'] == $result[0]['password']) {
- // exit('<script>
- // toastr.success("ok")</script>');
- //}
- }
- else echo "error";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement