Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $database = "";
- try {
- $conn = new PDO("mysql:host=$servername;dbname=$database", $username, $password);
- // set the PDO error mode to exception
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- }
- catch(PDOException $e)
- {
- echo "Connection failed: " . $e->getMessage();
- }
- $rank = $conn->prepare("SELECT rank FROM users WHERE username = :username");
- $rank->execute(array(
- ':username' => $_SESSION['user']['username']
- ));
- while ($check = $rank->fetch(PDO::FETCH_ASSOC)){
- if ($check['rank'] == 1) {
- echo 'Je bent admin.';
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement