Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'adatbazis.php';
- session_start();
- $csavo = $_SESSION['felhasznalo'];
- // banned
- $check = mysqli_query($conn, "SELECT banned FROM userek WHERE username='$csavo'");
- $check_2 = mysqli_fetch_array($check);
- if($check_2[0] == 1)
- {
- echo 'Your account has been permanently banned.';
- die();
- }
- ?>
- <!doctype html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>UCP</title>
- </head>
- <style>
- table {
- font-family: arial, sans-serif;
- border-collapse: collapse;
- width: 100%;
- }
- td, th {
- border: 1px solid #dddddd;
- text-align: left;
- padding: 3 px;
- }
- tr:nth-child(even) {
- background-color: #dddddd;
- }
- </style>
- <body>
- <h1>UCP</h1>
- <p>Szia
- <?php
- require 'adatbazis.php';
- $csavo = $_SESSION['felhasznalo'];
- echo $_SESSION['felhasznalo'];
- if(isset($_SESSION['felhasznalo']))
- {
- //echo 'ok';
- }
- else
- {
- header("Location: index.php");
- }
- if(isset($_POST['logout']))
- {
- session_destroy();
- header('Location: index.php');
- }
- $query = mysqli_query($conn, "SELECT szint FROM userek WHERE username='$csavo'");
- $adat = mysqli_fetch_array($query);
- //echo $adat[0];
- $fasz = $adat[0];
- // SERIAL LEKÉRÉSE
- $serial_lekeres = mysqli_query($conn, "SELECT serial FROM userek WHERE username='$csavo'");
- $serial_a = mysqli_fetch_array($serial_lekeres);
- $serial = $serial_a[0];
- echo "<br>A te serialod: ".$serial;
- // megvásárolta
- if($fasz == 1)
- {
- // echo 'ez kurva jó';
- echo '<form method="post" action="">
- <input type="submit" value="Letöltöm" name="leszed">';
- if(isset($_POST['leszed']))
- {
- $leker = mysqli_query($conn, "SELECT file FROM userek WHERE username='$csavo'");
- $falj = mysqli_fetch_array($leker);
- $neve = $falj[0];
- if($neve == "0")
- {
- echo 'Nem elérhető.';
- }
- else
- {
- header("Location: ".$neve);
- }
- }
- }
- if($fasz == 2)
- {
- $_SESSION['admin_szint'] = $fasz;
- echo '<form method="post" action="">';
- echo '<input type="submit" value="Add new user" name="add">';
- echo '</form>';
- echo "<table border='3' cellpadding='2'>";
- echo "<tr> <th>ID</th> <th>Username</th> <th>Serial</th> <th>File</th> <th></th> <th></th> <th></th></tr>";
- $result = mysqli_query($conn,"SELECT id , username, serial, file FROM userek");
- if(mysqli_num_rows($result) > 0 ){
- while ($row = mysqli_fetch_array ($result))
- {
- echo "<tr>";
- echo '<td>' . $row['id'] . '</td>';
- echo '<td>' . $row['username'] . '</td>';
- echo '<td>' . $row['serial'] . '</td>';
- echo '<td>' . $row['file'] . '</td>';
- echo '<td>' . cucc() . '</td>';
- echo '<td><a href="edit.php?id=' . $row['id'] . '">Edit</a></td>';
- echo '<td><a href="delete.php?id=' . $row['id'] . '">Delete</a></td>';
- }
- }
- }
- if(isset($_POST['add']))
- {
- header('Location: add_user.php');
- }
- function cucc() {
- echo "teszt";
- }
- ?></p>
- <form method="post" action="">
- <input type="submit" value="Logout" name="logout">
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement