<?php
include("include/session.php");
if(!$session->logged_in){
header("Location: ".$session->referrer);
}
if($_POST){
$_POST = $session->cleanInput($_POST);
}
?>
<!DOCTYPE html>
<html lang="da">
<head>
<meta charset="utf-8">
<title>Sitel - Share the service</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="
http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<link href="
http://netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="style.css" rel="stylesheet">
<script src="
http://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="
https://use.fontawesome.com/c2a0ea7762.js"></script> <script src="
http://netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script> </head>
<body>
<!-- Header -->
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Sitel - Share the service!</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="index.php"><span class="glyphicon glyphicon-home" aria-hidden="true"></span></a></li>
<li><a href="mail.php"><span class="glyphicon glyphicon-inbox" aria-hidden="true"></span></a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Menu<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="product_index.php"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Prisoversigt</a></li>
<li><a href="#"><i class="fa fa-handshake-o" aria-hidden="true"></i> Kundetilbud (Virker ikke endnu)</a></li>
<li><a href="#">Kommer senere</a></li>
<li class="divider"></li>
<li><a href="#">Kommer senere</a></li>
<li class="divider"></li>
<li><a href="#">Kommer senere</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<!-- /Header -->
<!-- Main -->
<?php
include("mainmenu.php");
?>
<hr>
<a href="#"><strong><i class="glyphicon glyphicon-link"></i> Resources</strong></a>
<hr>
<ul class="nav nav-pills nav-stacked">
<li class="nav-header"></li>
<li><a href="#"><i class="glyphicon glyphicon-list"></i> Layouts & Templates</a></li>
<li><a href="#"><i class="glyphicon glyphicon-briefcase"></i> Toolbox</a></li>
<li><a href="#"><i class="glyphicon glyphicon-link"></i> Widgets</a></li>
<li><a href="#"><i class="glyphicon glyphicon-list-alt"></i> Reports</a></li>
<li><a href="#"><i class="glyphicon glyphicon-book"></i> Pages</a></li>
<li><a href="#"><i class="glyphicon glyphicon-star"></i> Social Media</a></li>
</ul>
<hr>
<ul class="nav nav-stacked">
<li class="active"><a href="
http://bootply.com" title="The Bootstrap Playground" target="ext">Playground</a></li>
<li><a href="/tagged/bootstrap-3">Bootstrap 3</a></li>
<li><a href="/61518" title="Bootstrap 3 Panel">Panels</a></li>
<li><a href="/61521" title="Bootstrap 3 Icons">Glyphicons</a></li>
<li><a href="/61523" title="Bootstrap 3 ListGroup">List Groups</a></li>
<li><a href="#">GitHub</a></li>
<li><a href="/61518" title="Bootstrap 3 Slider">Carousel</a></li>
<li><a href="/62603">Layout</a></li>
</ul>
<hr>
</div><!-- /col-3 -->
<div class="col-md-9">
<!-- column 2 -->
<ul class="list-inline pull-right">
<li><a href="#"><i class="glyphicon glyphicon-cog"></i></a></li>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="glyphicon glyphicon-comment"></i><span class="count">3</span></a><ul class="dropdown-menu" role="menu"><li><a href="#">1. Is there a way..</a></li><li><a href="#">2. Hello, admin. I would..</a></li><li><a href="#"><strong>All messages</strong></a></li></ul></li>
<li><a href="#"><i class="glyphicon glyphicon-user"></i></a></li>
<li><a title="Add Widget" data-toggle="modal" href="#addWidgetModal"><span class="glyphicon glyphicon-plus-sign"></span> Add Widget</a></li>
</ul>
<a href="#"><strong><i class="glyphicon glyphicon-dashboard"></i> My Dashboard</strong></a>
<hr>
<div class="row">
<!-- center left-->
<div class="col-md-6">
<div class="well">Velkommen <b><?php echo $session->username; ?></b>, du er nu online</div>
<hr>
<?php
include("usermenu.php");
?>
<hr>
<div class="panel panel-default">
<div class="panel-heading"><h4>Online medlemmer</h4></div>
<div class="panel-body">
<br>Her er <?php echo $database->num_active_users; ?> medlemer og <?php $database->num_active_guests; ?> besøgende lige nu:<br><br></p>
<?php
include("include/view_active.php");
?>
</div><!--/panel-body-->
</div><!--/panel-->
<hr>
<!--tabs-->
<div class="container">
<div class="col-md-4">
<ul class="nav nav-tabs" id="myTab">
<li class="active"><a href="#profile" data-toggle="tab">Profile</a></li>
<li><a href="#messages" data-toggle="tab">Messages</a></li>
<li><a href="#settings" data-toggle="tab">Settings</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="profile">
<h4><i class="glyphicon glyphicon-user"></i></h4>
Lorem profile dolor sit amet, consectetur adipiscing elit. Duis pharetra varius quam sit amet vulputate.
<p>Quisque mauris augue, molestie tincidunt condimentum vitae, gravida a libero. Aenean sit amet felis
dolor, in sagittis nisi.</p>
</div>
<div class="tab-pane" id="messages">
<h4><i class="glyphicon glyphicon-comment"></i></h4>
Message ipsum dolor sit amet, consectetur adipiscing elit. Duis pharetra varius quam sit amet vulputate.
<p>Quisque mauris augu.</p>
</div>
<div class="tab-pane" id="settings">
<h4><i class="glyphicon glyphicon-cog"></i></h4>
Lorem settings dolor sit amet, consectetur adipiscing elit. Duis pharetra varius quam sit amet vulputate.
<p>Quisque mauris augue, molestie.</p>
</div>
</div>
</div>
</div>
<!--/tabs-->
<hr>
<div class="panel panel-default">
<div class="panel-heading"><h4>New Requests</h4></div>
<div class="panel-body">
<div class="list-group">
<a href="#" class="list-group-item active">Hosting virtual mailbox serv..</a>
<a href="#" class="list-group-item">Dedicated server doesn't..</a>
<a href="#" class="list-group-item">RHEL 6 install on new..</a>
</div>
</div>
</div>
</div><!--/col-->
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><h4>Beskedcenter</h4></div>
<form method="post" action="mail.php">
<input type="submit" class="btn btn-primary btn-default btn-sm" name="mailAction" value="Compose" /><input type="submit" class="btn btn-primary btn-default btn-sm" name="mailAction" value="Inbox" />
</form>
<?php
if(!empty($_POST['mailAction']) && isset($_POST['mailAction'])){
$action = $_POST['mailAction'];
} else {
$action = 'Inbox';
}
if(($action == 'Compose') || ($action == 'Reply')) {
if(isset($_POST['mailSubject']) && !empty($_POST['mailSubject'])){
$mailSubject = 'Re: '.$_POST['mailSubject'];
} else {
$mailSubject = "";
}
if(isset($_POST['mailFrom']) && !empty($_POST['mailFrom'])){
$mailTo = $_POST['mailFrom'];
} else {
$mailTo = "";
}
?>
<form action="mail.php" class="navbar-form navbar-right" method='post' id="signin">
<div id="compose">
<p class="grid_2"><div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-user" aria-hidden="true"></i></span><input class="form-control" type='text' name='mailTo' size='20' value='<?php echo $mailTo; ?>' placeholder="To.:"></p>
<div class="clear"></div></div>
<p class="grid_2"><div class="input-group"><span class="input-group-addon"><i class="fa fa-text-width"></i></span><input class="form-control" type='text' name='mailSubject' size='20' value='<?php echo $mailSubject; ?>' placeholder="Emne:"></p>
<div class="clear"></div></div><br></br>
<p class="grid_4"><textarea rows='16' cols='45' name='mailMessage' placeholder="Skriv din besked"></textarea></p>
<div class="clear"></div>
<p class="grid_1"><input type="submit" class="btn btn-primary btn-default btn-sm" name="mailAction" value="Send" /></p>
</div>
</form>
<?php
}
if($action == 'Send') {
if(empty($_POST['mailSubject']) || !isset($_POST['mailSubject'])){
echo "Subject Blank";
} else {
$subject = $_POST['mailSubject'];
}
if(empty($_POST['mailTo']) || !isset($_POST['mailTo'])){
echo "To Blank";
} else {
$mailTo = $_POST['mailTo'];
}
if(empty($_POST['mailMessage']) || !isset($_POST['mailMessage'])){
echo "Message Blank";
} else {
$message = $_POST['mailMessage'];
}
$date = date('m.d.y"')." at ".date('H:i:s');
$q = sprintf("INSERT INTO mail (UserTo, UserFrom, Subject, Message, SentDate, status) VALUES ('%s','$session->username','%s','%s','%s','ulæst')",
mysql_real_escape_string($mailTo),
mysql_real_escape_string($subject),
mysql_real_escape_string($message),
mysql_real_escape_string($date));
if(!($send = $database->query($q))){
echo "Vi kunne ikke sende din besked ".$mailTo."!";
} else {
echo "Beskeden er sendt til: ".$mailTo."!";
}
}
if($action == "Inbox") {
$user = $session->username;
$q = sprintf("SELECT * FROM mail WHERE UserTo = '%s' ORDER BY SentDate DESC",
mysql_real_escape_string($user));
$getMail = $database->query($q) or die(mysql_error());
echo "<div id='inbox'>";
if(mysql_num_rows($getMail) == 0){
echo "<p>Du har ingen mails</p><br /><br />";
} else {
?>
<table class='table table-responsive'>
<tr class="title">
<td colspan="2" align="center">Action</td>
<td>Status</td>
<td>From</td>
<td>Subject</td>
<td>Time</td>
</tr>
</div>
<?php
echo "<form action='mail.php' method='post'>";
while($mail = mysql_fetch_array($getMail)){
?>
<tr>
<input type="hidden" name="mail_id" value="<?php echo $mail['mail_id']; ?>" />
<td align="center"><input type="submit" class="btn btn-success btn-sm" name="mailAction" value='View' /></td>
<td align="center"><input type="submit" class="btn btn-primary btn-danger btn-sm" name="mailAction" value="Delete" /></td>
<td><?php echo $mail['status']; ?></td>
<td><?php echo $mail['UserFrom']; ?></td>
<td><?php echo $mail['Subject']; ?></td>
<td><?php echo $mail['SentDate']; ?></td>
</tr>
<?php
}
echo "</form>";
}
echo "</table>";
}
if($action == "View") {
$mail_id = $_POST['mail_id'];
$user = $session->username;
$q = sprintf("SELECT * FROM mail WHERE UserTo = '%s' AND mail_id = '%s'",
mysql_real_escape_string($user),
mysql_real_escape_string($mail_id));
$result = $database->query($q) or die (mysql_error());
$row = mysql_fetch_array($result);
if($row['UserTo'] != $session->username) {
echo "<font face=verdana><b>This isn't your mail!";
exit;
}
$q = "UPDATE mail SET status='læst' WHERE UserTo='$session->username' AND mail_id='$row[mail_id]'";
$database->query($q) or die("An error occurred resulting that this message has not been marked read.");
?>
<hr>
<form method="post" action="mail.php">
<div id="single">
<p class="grid_1"><div class="panel-heading"><strong>Afsender:</strong> </p><p class="grid_2"><?php echo $row['UserFrom']; ?><input type="hidden" name="mailFrom" value="<?php echo $row['UserFrom']; ?>" /></p></div>
<p class="grid_1 clear"><div class="panel-heading"><strong>Emne:</strong></p><p class="grid_2"><?php echo $row['Subject']; ?><input type="hidden" name="mailSubject" value="<?php echo$row['Subject']; ?>" /></p></div>
<p class="grid_4 clear"><div class="panel-heading"><strong>Besked:</strong> <br /><?php echo $row['Message']; ?><br /></p></div>
<p class="grid_4 clear" align="right"><input type="submit" class="btn btn-primary btn-default btn-sm" name="mailAction" value="Reply" /></p>
</div>
</form>
<?php
}
if($action == 'Delete') {
$id = $_GET['mail_id'];
$query = sprintf("UPDATE mail SET 'Deleted' = [Value 1] WHERE mail_id='%s' LIMIT 1",
mysql_real_escape_string($id));
if(!$query) {
echo "The message wasn\'t deleted";
} else {
header("Location: mail.php");
}
}
echo "<div class='clear'>";
echo "[<a href=\"index.php\">Forsiden</a>] ";
echo "[<a href=\"userinfo.php?user=$session->username\">Min Konto</a>] ";
echo "[<a href=\"process.php\">Log ud</a>]";
echo "</div>";
?>
</div><!--/panel-->
<div class="panel panel-default">
<div class="panel-heading"><div class="panel-title"><h4>Søg medarbejder</h4></div></div>
<div class="panel-body">
<div class="col-xs-4 text-center"><img src="
http://placehold.it/80/BBBBBB/FFF" class="img-circle img-responsive"></div>
<div class="col-xs-4 text-center"><img src="
http://placehold.it/80/EFEFEF/555" class="img-circle img-responsive"></div>
<div class="col-xs-4 text-center"><img src="
http://placehold.it/80/EEEEEE/222" class="img-circle img-responsive"></div>
</div>
</div><!--/panel-->
</div><!--/col-span-6-->
</div><!--/row-->
<hr>
</div><!--/col-span-9-->
</div>
</div>
<!-- /Main -->
<footer class="text-center">Made by <a href="
http://kallesen.nu"><strong>Kallesen.nu</strong></a></footer><div class="modal" id="addWidgetModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Add Widget</h4>
</div>
<div class="modal-body">
<p>Add a widget stuff here..</p>
</div>
<div class="modal-footer">
<a href="#" data-dismiss="modal" class="btn">Close</a>
<a href="#" class="btn btn-primary">Save changes</a>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dalog -->
</div><!-- /.modal -->
<div class="modal" id="ShowMail">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Add Widget</h4>
</div>
<div class="modal-body">
<p>Add a widget stuff here..</p>
</div>
<div class="modal-footer">
<a href="#" data-dismiss="modal" class="btn">Close</a>
<a href="#" class="btn btn-primary">Save changes</a>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dalog -->
</div><!-- /.modal -->
<script type="text/javascript">
$(".alert").addClass("in").fadeOut(4500);
/* swap open/close side menu icons */
$('[data-toggle=collapse]').click(function(){
// toggle icon
$(this).find("i").toggleClass("glyphicon-chevron-right glyphicon-chevron-down");
});
</script>
</body>
</html
Komplet kode, dog er meget af det, langt fra kodet færdigt, dog er ALT PHP færdiglavet, men jeg er HELT tabt lige der midt i koden :)