public static function userButton($userName) { $userResult = database::fetchRows('users', 'fav_civ', 'name', $userName); $userRow = $userResult->fetch_assoc(); $civRow = database::idToValue('civilization', 'name', $userRow['fav_civ']); $url = router::createUserUrl($userName); if (file_exists('images/' . $civRow['0'] . '.jpg')) { $pictureUrl = '/images/' . $civRow['0'] . '.jpg'; } elseif (file_exists('images/' . $civRow['0'] . '.png')) { $pictureUrl = '/images/' . $civRow['0'] . '.png'; } else { $pictureUrl = '/images/civ.jpg'; } $button = '<div id="rbutton"> <div class="circle"> <a href="' . $url . '"> <img style="border-radius: 50%;" src="' . $pictureUrl . '" /> </a> </div> </div>'; return $button; }
<link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500' rel='stylesheet' type='text/css'> </head> <body> <div id="info"> <ul> <li style="float: right"> <?php require 'application/login.php'; ?> </li> <li style="float: left"> <?php if (isset($_SESSION['loggedIn'])) { $url = router::createUserUrl($_SESSION['user']); echo '<a href="', $url, '">', $_SESSION['user'], '</a>'; } else { echo '<a href="/SignUp">Sign up!</a>'; } ?> </li> </ul> </div> <div id="picture"> <img src="/images/extras/civvscreen.jpg" /> </div> <div id="menu"> <div style="position: fixed; bottom: 3px; width: 180px"> <p style=" font-size: 10px; text-align: center;">Made by: Kaan Akbaba & Rens Kievit</p> </div>