<?php



include("asl.php");
include('../functions.php');

error_reporting(E_ALL);
ini_set('display_errors', '0');

$chatid = $_GET['chatid'];

?>



<!DOCTYPE HTML>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html ; charset=utf-8" />
    <meta http-equiv="content-type" content="text/html" />
    <meta name="author" content="persian" />

    <title>طراحی ربات ahp</title>


    <link rel="Stylesheet" type="text/css" href="style.css" />


    <style>
        @font-face {
            font-family: 'amir';
            src: url('font/BKoodakBold.ttf')format('truetype'),
                url('font/BKoodakBold.eot')format('eot'),
                url('font/BKoodakBold.woff')format('woff');

        }
    </style>


</head>

<body dir="rtl" align="center">
    <div align="center">
        <?php

        //   import_request_variables("p" , "a_");


        //old import
        function checkarray($summerarray, $mainkey, $mainarray)
        {
            if (in_array($mainkey, $summerarray)) {
                unset($mainarray["$mainkey"]);
                return $mainarray;
            } else {
                return "ok";
            }
        }

        $summerarray = array();
        $artest = $_POST;
        foreach ($artest as $postinfo) {

            $ar_mainkey = array_search($postinfo, $artest);
            if (checkarray($summerarray, $ar_mainkey, $artest) != "ok") {
                $artest = checkarray($summerarray, $ar_mainkey, $artest);
                $ar_mainkey = array_search($postinfo, $artest);
            }
            ${'a_' . $ar_mainkey} = $postinfo;
            $summerarray[] = $ar_mainkey;
        }
        //old import


        try {
            $conn = new PDO("mysql:host=$servername;dbname=$mydb", $username, $password,  array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
            // set the PDO error mode to exception

            $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        } catch (PDOException $e) {
            echo "Connection failed: " . $e->getMessage();
        }




        $sql = "select * from admin";
        $stmt =   $conn->prepare($sql);
        $stmt->execute();

        $result = $stmt->setFetchMode(PDO::FETCH_ASSOC);
        $show = $stmt->fetch();

        $user = $show["user"];
        $pass = $show["pass"];


        $getpass = hash_hmac('md5', $a_pass, 'salt');

















        ?>

        <br /><br />
        <h4 class="white">پنل مدیریتی ربات</h4>
        <div id="content" align="right">
            <div id="content-content">
                <table>
                    <tr>
                        <td><img class="radius" src="images/user.png" /></td>
                        <td class="gray" valign="bottom">خوش آمدید <?php print $userse; ?></td>
                    </tr>

                </table>



                <br />
                <br />
                <a href="https://telegram.me/" target="_blank">
                    <input class='button-blue' style="width:725px;" type="button" value="رفتن به داخل ربات" />
                </a>

                <br />
                <div id="fish">




                    <h5 class='gray'>◄ نمایش اکانت های کاربر</h5>


                    <table>
                        <tr>

                            <th class='th'>A</th>
                            <th class='th'>B</th>
                            <th class='th'>C</th>
                          


                        </tr>
                        <tr>

                            <?php

                            $stmt = $conn->prepare("SELECT * FROM products where chatid = '$chatid' and `status` != 'problem' ");
                            $stmt->execute();

                            // set the resulting array to associative
                            $result = $stmt->setFetchMode(PDO::FETCH_ASSOC);

                            $k = $stmt->fetchAll();
                            $num = $stmt->rowCount();

                            print " <h5 class='gray'>◄ تعداد اکانت گروه A :‌ $num</h5>";
                      
                            foreach ($k as $v) {

                               
                                // $numAdd=getNumAdd($chatid,$conn);
                                // $mymoney=checkWallet($chatid,$conn);

                                print "
        <tr>
      
<td align='center' class='td'  >".$v['a']."</td>
<td align='center' class='td'  >".$v['b']."</td>
<td align='center' class='td'  >".$v['c']."</td>

";

?>

</tr>
        <?php
                            }

                            ?>


                        </tr>

                    </table>

                    <hr />
                    <hr />

                    <br />
                    <br />








                    <table>
                        <tr>

                            <th class='th'>A</th>
                            <th class='th'>B</th>
                            <th class='th'>C</th>
                          


                        </tr>
                        <tr>

                            <?php

                            $stmt = $conn->prepare("SELECT * FROM products2 where chatid = '$chatid' and `status` != 'problem' ");
                            $stmt->execute();

                            // set the resulting array to associative
                            $result = $stmt->setFetchMode(PDO::FETCH_ASSOC);

                            $k = $stmt->fetchAll();
                            $num = $stmt->rowCount();

                            print " <h5 class='gray'>◄ تعداد اکانت گروه B :‌ $num</h5>";


                      
                            foreach ($k as $v) {

                               
                                // $numAdd=getNumAdd($chatid,$conn);
                                // $mymoney=checkWallet($chatid,$conn);

                                print "
        <tr>
      
<td align='center' class='td'  >".$v['a']."</td>
<td align='center' class='td'  >".$v['b']."</td>
<td align='center' class='td'  >".$v['c']."</td>

";

?>


</tr>

      
        <?php
                            }

                            ?>


                        </tr>



                    </table>



                    <hr />
                    <hr />
                    <hr />

                    <br />
                    <br />
                    <br />

                </div>


                <br />
                <br />
            </div>
        </div>




        <a style="text-decoration:none ;" href="http://ahpbot.ir" target="_blank" class="gray">طراحی شده توسط ahpbot</a>
    </div>

    <?php
    $conn = null;
    ?>
</body>

</html>