function showPosts($dbCon) { $uId = userId(); //User Id Function from helpers $userName = userName(); //Username Function from helpers //Select by DESC Time $sql = "SELECT * FROM posts WHERE u_id = '{$uId}' ORDER BY p_time DESC "; $result = $dbCon->query($sql); if (!$result) { die('Query failed: ' . $dbCon->error); } $userPost = array(); while ($temp = $result->fetch_assoc()) { if ($temp['p_post']) { //Check if post is not empty $dateTime = date("H:i d/m/y", strtotime(str_replace('/', '-', $temp['p_time']))); echo ' <div class="post"> <div class="userTime"> <p class="userName">' . $userName . '</p> <p class="pull-right">' . $dateTime . '</p> </div> <div class="postText">' . $temp['p_post'] . '</div> </div>'; $userPost[] = array('post' => $temp['p_post'], 'time' => $temp['p_time']); } } }
function userNav() { global $_COOKIE; $n['View realtime logs'] = "/"; $n['Settings'] = "/settings"; $n['Feedbacks'] = "/feedbacks"; if (isAdmin()) { $n['Admin'] = "/admin"; } $c = 1; foreach ($n as $title => $link) { if ($_SERVER['REQUEST_URI'] == $link || strpos($_SERVER['REQUEST_URI'], $link . "?") === 0) { echo "<strong>" . htmlentities($title) . "</strong> "; } else { echo "<a href=\"{$link}\">" . htmlentities($title) . "</a> "; } if ($c++ != count($n)) { echo " | "; } } $allowed = getAllowed(); if (count($allowed)) { $ru = isset($_COOKIE['requser']) ? $_COOKIE['requser'] : userName(); echo " | <select id=\"seluser\" onchange=\"switchUser()\">"; echo "<option value=\"\">" . utf8entities(userName()) . "</option>"; foreach ($allowed as $id) { $name = getUsernameById($id); $selected = $ru == $name ? "selected" : ""; echo "<option {$selected} value=\"" . urlencode($name) . "\">" . utf8entities($name) . "</option>"; } echo "</select>"; } }
function showPosts($dbCon) { $uId = userId(); //User Id Function from helpers $userName = userName(); //Username Function from helpers //Select by DESC Time $sql = "SELECT * FROM posts WHERE u_id = '{$uId}' ORDER BY p_time DESC"; $result = $dbCon->query($sql); if (!$result) { die('Query failed: ' . $dbCon->error); } $userPost = array(); while ($temp = $result->fetch_assoc()) { if ($temp['p_post']) { //Check if post is not empty $dateTime = date("H:i d/m/y", strtotime(str_replace('/', '-', $temp['p_time']))); $post = ' <div class="panel panel-default post" id="' . $temp['p_uniqid'] . '"> <div class="panel-heading"> <div class="dropdown pull-right"> <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="caret"></span> </button> <ul class="dropdown-menu" aria-labelledby="dropdownMenu1"> <li><a href="#" class="editPost">Edit</a></li> <li><a href="#" class="deletePost">Delete</a></li> </ul> </div> <a href="#" class="pull-right datePost">' . $dateTime . '</a> <h4>' . $userName . '</h4></div> <div class="panel-body"><p class="postText">' . $temp['p_post'] . '</p> <hr> </form> </div> </div>'; echo $post; $userPost[] = array('post' => $post); } } }
<head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta http-equiv="Content-Style-Type" content="text/css" /> <link rel="stylesheet" href="css/bootstrap.min.css"> <link rel="stylesheet" href="css/r0the.css"> <title>Padawan</title> </head> <body> <nav class="navbar navbar-fixed-top navbar-dark bg-inverse"> <div class="container"> <ul class="nav navbar-nav"> <ul class="nav navbar-nav"> <?php if (isLoggedIn()) { echo userName() . '<button class="btn btn-primary" type="submit">Abmelden</button>'; } else { echo '<form class="form-inline pull-xs-right" action="' . actionLogin() . '" method="post">' . "\n"; echo ' <input class="form-control" name="username" type="text" placeholder="Login">' . "\n"; echo ' <input class="form-control" name="password" type="password" placeholder="Password">' . "\n"; echo ' <button class="btn btn-primary" type="submit">Anmelden</button>' . "\n"; echo '</form>'; } ?> </ul> </ul> </div> </nav> <div class="container" style="padding-top: 80px;"> <?php if (hasError()) {
</div> </div> <br clear="both" /> <div class="roundcont newsfeed"> <div class="roundtop"><span class="rt"><img src="<?php echo ADMIN_BASE_URL; ?> /images/blsp.gif" height="6" width="1" alt="" /></span></div> <div class="roundcont_main"> <div style="text-align:right; float:right; width:85px;"> <a href="<?php echo ADMIN_URL; ?> /users/newsfeed/<?php echo userName(); ?> "><span class="buttonsel"><div class="buttonleft"><img src="<?php echo ADMIN_BASE_URL; ?> /images/buttonsel_left.gif" border="0" alt="" /></div><div class="buttonmid"><div class="buttonmid_padding">View All</div></div><div class="buttonright" style="width:10px;"><img src="<?php echo ADMIN_BASE_URL; ?> /images/buttonsel_right.gif" border="0" alt="" /></div></span></a> </div> <h1>News Feed</h1> <div id="news_expand"> <?php if (is_array($this->notifications)) { foreach ($this->notifications as $newsfeed) { ?>
<?php include_once '../includes/global.php'; if (filter_input_array(INPUT_POST)) { $uId = userId(); $userPost = filter_input(INPUT_POST, 'userPostText'); $sql = "INSERT INTO posts (u_id, p_post) VALUES ('{$uId}','{$userPost}')"; $result = $dbCon->query($sql); if (!$result) { die('Query failed: ' . $dbCon->error); } $postReturn = array('userName' => userName(), 'userPostText' => $userPost, 'dateTime' => date("H:i d/m/y")); echo json_encode($postReturn); }
<thead> <tr> <th style="width:30%;">Nome Usuário</th> <th style="width:20%;">Login</th> <th style="width:20%;">Nivel de permição</th> <th style="width:10%;">Ação</th> </tr> </thead> <tbody> <?php $queryCheque = $mySQL->sql("SELECT * FROM users ORDER BY userId DESC"); while ($data = mysql_fetch_array($queryCheque)) { ?> <tr class="gradeC"> <td><?php echo userName($data['userId']); ?> </td> <td><?php echo $data['userLogin']; ?> </td> <td><?php echo $data['userPermission']; ?> </td> <td class="text-center"> <a class="label label-default" href="#"><i class="fa fa-pencil"></i></a> <a class="label label-danger" href="#"><i class="fa fa-times"></i></a> </td> </tr>
$numbers = "0123456789"; // Array to store numbers in user name $userNumbers = array(); $numLength = strlen($numbers) - 1; // Loop and get 4 numbers for ($i = 0; $i < 4; $i++) { $new = rand(0, $numLength); $userNumbers[] = $numbers[$new]; } $userName = substr($namesignup, 0, 4); return $userName . implode($userNumbers); } extract($_GET, EXTR_PREFIX_SAME, "get"); // Email message $subject = "Login Information"; $email_message = "NAME: " . $namesignup . "\n\n\nEMAIL: " . $emailsignup . "\nUSER: "******"\nPASSWORD: "******"*****@*****.**"; // Mail mail($to, $subject, $email_message, "From " . $from); } } ?> <!-- Login Page --> <div class="col-md-12 login-back-button"> <form method="GET"> <input type="submit" name="loginpage" value="Back to Login"> </form> </div>
</div> <div class="logo_box_bot"><img border="0" src="<?= ADMIN_BASE_URL ?>images/logobox_bottom.gif" alt="" /></div> </div> <div class="menu_box"> <div class="menu_box_top"><img border="0" src="<?= ADMIN_BASE_URL ?>images/menubox_top.gif" alt="" /></div> <div class="menu_box_padding"> <? if (!isLoggedIn()) { ?> <h2 style="font-size:1.6em;"><a href="<?= ADMIN_URL ?>/frontpage/login">Log In</a></h2> <hr /> <h2><a href="<?= ADMIN_URL ?>/users/signup">Signup</a></h2> <? } else { ?> <? echo '<p>Welcome, <a href="'.ADMIN_URL.'/users/show/'.userName().'">'.firstName().'</a>!</p><br />'; ?> <a href="<?= ADMIN_URL ?>/users/show/<?= userName() ?>" title="View your profile and past submissions"> <? if ( isAdmin() ) { ?> <img border="0" src="<?=ADMIN_BASE_URL ?>images/user_1337.gif" alt="" /> <? } elseif ($_SESSION[user]->controls_afeed() || $_SESSION[user]->controls_ascreen()) { ?> <img border="0" src="<?=ADMIN_BASE_URL ?>images/user_admin.gif" alt="" /> <? } else { ?> <img border="0" src="<?= ADMIN_BASE_URL ?>images/user_basic.gif" alt="" /> <? } //This closes the non admin or moderator stuff ?> <h4>View Account</h4></a> <br /> <h3><a href="<?= ADMIN_URL ?>/frontpage/logout" title="Log out of Concerto">Logout</a></h3> <? } ?>