Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("header.php");
- // Login
- if (isset($_POST['login'])) {
- $username = htmlspecialchars(mysql_real_escape_string(addslashes($_POST['username'])));
- $password = htmlspecialchars(mysql_real_escape_string(addslashes($_POST['password'])));
- $cpass = md5($password);
- $kveri = mysqli_query($con,"SELECT * FROM users WHERE username='$username' AND password='$cpass' AND rank='1'");
- if (mysqli_num_rows($kveri)) {
- $user = mysqli_fetch_array($kveri);
- $_SESSION['userid'] = $user['userid'];
- $_SESSION['username'] = $user['username'];
- $mesec = 24*60*60*31; // mesec dana
- $user_ip = $_SERVER['REMOTE_ADDR'];
- $time = time();
- $sesija = md5($user['username'] . $cpass);
- setcookie("userid", $_SESSION['user_id'], time()+ $mesec);
- setcookie("username", $_SESSION['username'], time()+ $mesec);
- setcookie("sesija", $sesija, time() + $mesec);
- $_SESSION['ok'] = "Uspesno ste se ulogovali!";
- header("Location: index.php");
- die();
- } else {
- $_SESSION['error'] = "Doslo je do greske!";
- header("location: index.php");
- die();
- }
- }
- ?>
- <div class="row">
- <div class="col-md-12">
- <h1><i class="fa fa-lock" aria-hidden="true"></i> ADMIN PANEL </h1>
- <?php if($_SESSION['userid'] == "") { ?>
- <p class="lead"> Dobrodosli u <b>AdminPanel</b>
- <br /> Morate se ulogovati kako bi pristupili punom sadrzaju sajta! <br />
- </p>
- <?php }
- if ($user['rank'] == "1") {
- ?>
- Dobrodosao nazad, <b><?php echo $user['ime']; ?></b>
- <hr />
- <h3>Aktivnosti</h3>
- <table style="width:100%;" class="table table-striped">
- <tbody>
- <th></th>
- <th></th>
- <th>Dodato pre</th>
- <th>Datum</th>
- <th>IP Korisnika</th>
- <?php
- $rec_page=20; // Number of records to be displayed on a page
- if (isset($_GET["page"])) {
- $page = $_GET["page"];
- } else {
- $page=1;
- }
- $start = ($page-1) * $rec_page;
- $sql = "SELECT * FROM serveri ORDER by id DESC LIMIT $start, $rec_page";
- $kveri = mysqli_query($con,$sql);
- $provera = mysqli_num_rows($kveri);
- if($provera < 1) {
- echo "Nema rezultata...";
- }
- while($red = mysqli_fetch_array($kveri)) {
- $ip = $red['ip'];
- $number++;
- $igra = ServerInfo($ip,'game');
- if($igra) {
- switch($igra) {
- case "Counter Strike 1.6":
- $igra = "<img style='width:12px;' src='http://static.gametracker.rs/images/game-cs.png'>";
- break;
- case "San Andreas Multiplayer":
- $igra = "<img style='width:12px;' src='http://static.gametracker.rs/images/game-samp.png'>";
- break;
- case "Counter Strike Source":
- $igra = "<img style='width:12px;' src='http://static.gametracker.rs/images/game-css.png'>";
- break;
- case "Counter Strike Global Offensive":
- $igra = "<img style='width:12px;' src='http://static.gametracker.rs/images/game-csgo.png'>";
- break;
- case "Call of Duty 2":
- $igra = "<img style='width:12px;' src='http://static.gametracker.rs/images/game-cod2.png'>";
- break;
- case "Call of Duty 4":
- $igra = "<img style='width:12px;' src='http://static.gametracker.rs/images/game-cod4.png'>";
- break;
- case "Minecraft":
- $igra = "<img style='width:12px;' src='http://static.gametracker.rs/images/game-minecraft.png'>";
- break;
- case "Team Fortress 2":
- $igra = "<img style='width:12px;' src='http://static.gametracker.rs/images/game-tf2.png'>";
- break;
- }
- }
- ?>
- <tr>
- <td style="font-size:16px;"><b><?php echo $number; ?>.</b> </td>
- <td>Server <strong> <?php echo $igra; ?> <?php echo '<img style="width:18px;" src="'.ServerInfo($ip, 'country_flag').'" />'; ?> <?php echo ServerInfo($ip,'name'); ?></strong> je dodat.</td>
- <td><?php echo time_ago($red['vreme']); ?></td>
- <td><?php echo $red['datum']; ?></td>
- <td><?php echo $red['ip_pc']; ?></td>
- <td> <a href="manage.php?id=<?php echo $red['id']; ?>"><i class="fa fa-edit"></i> Manage </a> </td>
- <td> <a href="delete.php?id=<?php echo $red['id']; ?>"><span class="fa fa-trash"></span> Delete </a> </td>
- </tr>
- <?php } ?>
- </tbody>
- </table>
- <ul class="pagination">
- <?php
- $sql = "SELECT * FROM serveri";
- $djoxi = mysqli_query($con,$sql);
- $total_recs = mysqli_num_rows($djoxi); //count number of records
- $total_pages = ceil($total_recs / $rec_page);
- echo "
- <li>
- <a href='?page=1' aria-label='Previous'>
- <span aria-hidden='true'>«</span>
- </a>
- </li>
- "; // For 1st page
- for ($i=1; $i<=$total_pages; $i++) {
- echo "<li><a href='?page=".$i."'>". $i. "</a></li> ";
- }
- echo "
- <li>
- <a href='?page=$total_pages' aria-label='Next'>
- <span aria-hidden='true'>»</span>
- </a>
- </li>
- ";
- ?>
- </ul>
- <h3>Istaknuti serveri</h3>
- <table style="width:100%;" class="table table-striped">
- <tbody>
- <th></th>
- <th></th>
- <th>Dodato pre</th>
- <th>Datum</th>
- <th>IP Korisnika</th>
- <?php
- $rec_page=20; // Number of records to be displayed on a page
- if (isset($_GET["page"])) {
- $page = $_GET["page"];
- } else {
- $page=1;
- }
- $start = ($page-1) * $rec_page;
- $sql = "SELECT * FROM serveri WHERE istaknuto='1' ORDER by id DESC LIMIT $start, $rec_page";
- $kveri = mysqli_query($con,$sql);
- $provera = mysqli_num_rows($kveri);
- if($provera < 1) {
- echo "Nema rezultata...";
- }
- while($red = mysqli_fetch_array($kveri)) {
- $ip = $red['ip'];
- $number2++;
- $igra = ServerInfo($ip,'game');
- if($igra) {
- switch($igra) {
- case "Counter Strike 1.6":
- $igra = "<img style='width:12px;' src='http://static.gametracker.rs/images/game-cs.png'>";
- break;
- case "San Andreas Multiplayer":
- $igra = "<img style='width:12px;' src='http://static.gametracker.rs/images/game-samp.png'>";
- break;
- case "Counter Strike Source":
- $igra = "<img style='width:12px;' src='http://static.gametracker.rs/images/game-css.png'>";
- break;
- case "Counter Strike Global Offensive":
- $igra = "<img style='width:12px;' src='http://static.gametracker.rs/images/game-csgo.png'>";
- break;
- case "Call of Duty 2":
- $igra = "<img style='width:12px;' src='http://static.gametracker.rs/images/game-cod2.png'>";
- break;
- case "Call of Duty 4":
- $igra = "<img style='width:12px;' src='http://static.gametracker.rs/images/game-cod4.png'>";
- break;
- case "Minecraft":
- $igra = "<img style='width:12px;' src='http://static.gametracker.rs/images/game-minecraft.png'>";
- break;
- case "Team Fortress 2":
- $igra = "<img style='width:12px;' src='http://static.gametracker.rs/images/game-tf2.png'>";
- break;
- }
- } ?>
- <tr>
- <td style="font-size:16px;"><b><?php echo $number2; ?>.</b> </td>
- <td><strong> <?php echo $igra; ?> <?php echo '<img style="width:18px;" src="'.ServerInfo($ip, 'country_flag').'" />'; ?> <?php echo ServerInfo($ip,'name'); ?></strong> </td>
- <td><?php echo time_ago($red['vreme']); ?></td>
- <td><?php echo $red['datum']; ?></td>
- <td><?php echo $red['ip_pc']; ?></td>
- <td> <a href="manage.php?id=<?php echo $red['id']; ?>"><i class="fa fa-edit"></i> Manage </a> </td>
- <td> <a href="delete.php?id=<?php echo $red['id']; ?>"><span class="fa fa-trash"></span> Delete </a> </td>
- </tr>
- <?php } ?>
- </tbody>
- </table>
- <ul class="pagination">
- <?php
- $sql = "SELECT * FROM serveri WHERE istaknuto='1'";
- $djoxi = mysqli_query($con,$sql);
- $total_recs = mysqli_num_rows($djoxi); //count number of records
- $total_pages = ceil($total_recs / $rec_page);
- echo "
- <li>
- <a href='?page=1' aria-label='Previous'>
- <span aria-hidden='true'>«</span>
- </a>
- </li>
- "; // For 1st page
- for ($i=1; $i<=$total_pages; $i++) {
- echo "<li><a href='?page=".$i."'>". $i. "</a></li> ";
- }
- echo "
- <li>
- <a href='?page=$total_pages' aria-label='Next'>
- <span aria-hidden='true'>»</span>
- </a>
- </li>
- ";
- ?>
- </ul>
- </div>
- </div> <!-- ROW kraj -->
- <?php } ?>
- <?php if($_SESSION['userid'] == "") { ?>
- <form action="" method="POST">
- <input type="text" class="form-control" name="username" placeholder="Username..." /> <br />
- <input type="password" class="form-control" name="password" placeholder="Password..." /> <br />
- <input type="submit" name="login" value="Login" /> <br /> <br />
- </form>
- <?php } // Provera za pristup ?>
- <?php include("footer.php"); ?>
Advertisement
Add Comment
Please, Sign In to add comment