Ban List PCP Mysql
#1

I think it is correct, but why always do not have the data from the table bans? always considered empty tables

PHP код:

<section class="page-section parallax directions" id="location" style="padding-top:15%">
            <div class="container div-table">
                <div class="parallax-bg" data-stellar-background-ratio="0.5" data-stellar-vertical-offset="-150"></div>
                <div class="parallax-overlay"></div>
                <div class="parallax-inner text-center">
                    <table class="table table-bordered">
                        <thead>
                            <td>Username</td>
                            <td>IP</td>
                            <td>Banner</td>
                            <td>Reason</td>
                            <td>Banned From</td>
                            <td>Unbanned</td>
                        </thead>
                        <?php
                        $query 
$koneksi->prepare("SELECT user_banned, bIP, ban_reason, ban_time, (ban_timestamp + (ban_time * 60) - strftime('%%s', 'now')) as banTimeLeft, strftime('%%d-%%m-%%Y %%H:%%M', datetime(ban_timestamp + (ban_time * 60), 'unixepoch')) as banExpired, strftime('%%d-%%m-%%Y %%H:%%M', datetime(ban_timestamp, 'unixepoch')) as bannedFrom, user_banner FROM `bans`");
                        
$query->execute();
                        if(
$query->rowCount() == 0)
                        {
                            echo 
"<tr><td colspan='6'><small>There's no player on ban list</small></td></tr>";
                        }
                        while(
$data $query->fetch())
                        {
                            if(
$data['ban_time'] == 0)
                            {
                                
$data['banExpired'] = "Never";
                            }
                            echo 
"<tr><td>".$data['user_banned']."</td>";
                            echo 
"<td>".$data['bIP']."</td>";
                            echo 
"<td>".$data['user_banner']."</td>";
                            echo 
"<td>".$data['ban_reason']."</td>";
                            echo 
"<td>".$data['bannedFrom']."</td>";
                            echo 
"<td>".$data['banExpired']."</td></tr>";
                        }
                        
?>
                    </table>
                </div>
            </div>
        </section>
PHP код:
CREATE TABLE IF NOT EXISTS `bans` (
  `
BanIDint(11unsigned NOT NULL AUTO_INCREMENT,
  `
user_bannedvarchar(50NOT NULL,
  `
bIPvarchar(50NOT NULL,
  `
user_bannervarchar(50NOT NULL DEFAULT '*',
  `
ban_reasonvarchar(50NOT NULL DEFAULT '*',
  `
ban_timestampint(11unsigned NOT NULL,
  `
ban_timeint(11unsigned NOT NULL,
  
PRIMARY KEY (`BanID`)
ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=122 ;
--
-- 
Dumping data for table `bans`
--
INSERT INTO `bans` (`BanID`, `user_banned`, `bIP`, `user_banner`, `ban_reason`, `ban_timestamp`, `ban_time`) VALUES
(1'Naswara''140.0.44.94''Server Ban''Vehicle Spawning'14819602110),
(
2'AK59''119.30.39.51''Prodigy''aimbot'14819661830),
(
3'AK59''119.30.39.51''TheOneShooT''aimbot (ip ban)'14819662250), 
Reply
#2

----
Reply
#3

----
Reply
#4

here you go

PHP код:
<section class="page-section parallax directions" id="location" style="padding-top:15%"> 
            <div class="container div-table"> 
                <div class="parallax-bg" data-stellar-background-ratio="0.5" data-stellar-vertical-offset="-150"></div> 
                <div class="parallax-overlay"></div> 
                <div class="parallax-inner text-center"> 
                    <table class="table table-bordered"> 
                        <thead> 
                            <td>Username</td> 
                            <td>IP</td> 
                            <td>Banner</td> 
                            <td>Reason</td> 
                            <td>Banned From</td> 
                            <td>Unbanned</td> 
                        </thead> 
                        <?php 
                        $query 
$koneksi->prepare("SELECT user_banned, bIP, ban_reason, ban_time, (ban_timestamp + (ban_time * 60) - DATE_FORMAT('now', '%%s')) AS banTimeLeft, DATE_FORMAT( TIMESTAMP(ban_timestamp + (ban_time * 60), 'unixepoch'), '%%d-%%m-%%Y %%H:%%M') AS banExpired, DATE_FORMAT( TIMESTAMP(ban_timestamp, 'unixepoch'), '%%d-%%m-%%Y %%H:%%M') AS bannedFrom, user_banner FROM `bans`  "); 
                        
$query->execute(); 
                        if(
$query->rowCount() == 0
                        { 
                            echo 
"<tr><td colspan='6'><small>There's no player on ban list</small></td></tr>"
                        } 
                        while(
$data $query->fetch()) 
                        { 
                            if(
$data['ban_time'] == 0
                            { 
                                
$data['banExpired'] = "Never"
                            } 
                            echo 
"<tr><td>".$data['user_banned']."</td>"
                            echo 
"<td>".$data['bIP']."</td>"
                            echo 
"<td>".$data['user_banner']."</td>"
                            echo 
"<td>".$data['ban_reason']."</td>"
                            echo 
"<td>".$data['bannedFrom']."</td>"
                            echo 
"<td>".$data['banExpired']."</td></tr>"
                        } 
                        
?> 
                    </table> 
                </div> 
            </div> 
        </section>
have fun also update the query for the table

PHP код:
CREATE TABLE IF NOT EXISTS `bans` (  
  `
BanIDint(11unsigned NOT NULL AUTO_INCREMENT,  
  `
user_bannedvarchar(50NOT NULL,  
  `
bIPvarchar(50NOT NULL,  
  `
user_bannervarchar(50NOT NULL DEFAULT '*',  
  `
ban_reasonvarchar(50NOT NULL DEFAULT '*',  
  `
ban_timestampint(11unsigned NOT NULL,  
  `
ban_timeint(11unsigned NOT NULL,  
  
PRIMARY KEY (`BanID`)  
ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=122 ;  
--  
-- 
Dumping data for table `bans`  
--  
INSERT INTO `bans` (`BanID`, `user_banned`, `bIP`, `user_banner`, `ban_reason`, `ban_timestamp`, `ban_time`) VALUES  
(1'Naswara''140.0.44.94''Server Ban''Vehicle Spawning'14819602110),  
(
2'AK59''119.30.39.51''Prodigy''aimbot'14819661830),  
(
3'AK59''119.30.39.51''TheOneShooT''aimbot (ip ban)'14819662250
Reply
#5

Can't you just fucking edit your first post and stop post hunting?
Reply
#6

Quote:
Originally Posted by oMa37
Посмотреть сообщение
Can't you just fucking edit your first post and stop post hunting?
edit button not work in my phone so i decided to post multi post also ---- = delete post

*FAQ How you edit it : i edited it from pc after 5 min
Reply
#7

Put this on top while developing PHP scripts:
PHP код:
<?php
  error_reporting
(E_ALL); 
  
ini_set('display_errors'1);
?>
Obviously delete it when going live otherwise you might display compromising information to users.
Reply
#8

Quote:
Originally Posted by Yaa
Посмотреть сообщение
here you go

PHP код:
<section class="page-section parallax directions" id="location" style="padding-top:15%"> 
            <div class="container div-table"> 
                <div class="parallax-bg" data-stellar-background-ratio="0.5" data-stellar-vertical-offset="-150"></div> 
                <div class="parallax-overlay"></div> 
                <div class="parallax-inner text-center"> 
                    <table class="table table-bordered"> 
                        <thead> 
                            <td>Username</td> 
                            <td>IP</td> 
                            <td>Banner</td> 
                            <td>Reason</td> 
                            <td>Banned From</td> 
                            <td>Unbanned</td> 
                        </thead> 
                        <?php 
                        $query 
$koneksi->prepare("SELECT user_banned, bIP, ban_reason, ban_time, (ban_timestamp + (ban_time * 60) - DATE_FORMAT('now', '%%s')) AS banTimeLeft, DATE_FORMAT( TIMESTAMP(ban_timestamp + (ban_time * 60), 'unixepoch'), '%%d-%%m-%%Y %%H:%%M') AS banExpired, DATE_FORMAT( TIMESTAMP(ban_timestamp, 'unixepoch'), '%%d-%%m-%%Y %%H:%%M') AS bannedFrom, user_banner FROM `bans`  "); 
                        
$query->execute(); 
                        if(
$query->rowCount() == 0
                        { 
                            echo 
"<tr><td colspan='6'><small>There's no player on ban list</small></td></tr>"
                        } 
                        while(
$data $query->fetch()) 
                        { 
                            if(
$data['ban_time'] == 0
                            { 
                                
$data['banExpired'] = "Never"
                            } 
                            echo 
"<tr><td>".$data['user_banned']."</td>"
                            echo 
"<td>".$data['bIP']."</td>"
                            echo 
"<td>".$data['user_banner']."</td>"
                            echo 
"<td>".$data['ban_reason']."</td>"
                            echo 
"<td>".$data['bannedFrom']."</td>"
                            echo 
"<td>".$data['banExpired']."</td></tr>"
                        } 
                        
?> 
                    </table> 
                </div> 
            </div> 
        </section>
have fun also update the query for the table

PHP код:
CREATE TABLE IF NOT EXISTS `bans` (  
  `
BanIDint(11unsigned NOT NULL AUTO_INCREMENT,  
  `
user_bannedvarchar(50NOT NULL,  
  `
bIPvarchar(50NOT NULL,  
  `
user_bannervarchar(50NOT NULL DEFAULT '*',  
  `
ban_reasonvarchar(50NOT NULL DEFAULT '*',  
  `
ban_timestampint(11unsigned NOT NULL,  
  `
ban_timeint(11unsigned NOT NULL,  
  
PRIMARY KEY (`BanID`)  
ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=122 ;  
--  
-- 
Dumping data for table `bans`  
--  
INSERT INTO `bans` (`BanID`, `user_banned`, `bIP`, `user_banner`, `ban_reason`, `ban_timestamp`, `ban_time`) VALUES  
(1'Naswara''140.0.44.94''Server Ban''Vehicle Spawning'14819602110),  
(
2'AK59''119.30.39.51''Prodigy''aimbot'14819661830),  
(
3'AK59''119.30.39.51''TheOneShooT''aimbot (ip ban)'14819662250
Damnn! its worked
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)