<?php
require_once('../database/header.php');
?>

<!-- Begin Page Content -->

<div class="main-panel">
<div class="content-wrapper">
     
    
<?php if($userdata['usertype']="mainadmin" || $userdata['usertype']=="wluser" ) {?>

<!-- DataTales Example -->
<div class="card shadow mb-4">
<div class="card-header py-3 bg-primary">
<h6 class="m-0 font-weight-bold text-white">添加通知</h6>
</div>

<div class="card-body">
    
<?php
if(isset($_POST['submit']) AND 
!empty($_POST['webnote']) ){
	
$sql = "UPDATE `settings` SET `webnote`=:webnote WHERE users=:users";
$stmt = $conn->prepare($sql);
$stmt->bindParam(":webnote", $_POST['webnote']);
$stmt->bindParam(":users", $userdata['id']);
if($stmt->execute()){
echo '<div class="alert alert-success" role="alert">
<strong>通知！</strong> 添加成功！</div>';
} else {
echo '<div class="alert alert-danger" role="alert">
<strong>无效！</strong> 数据未插入！</div>';
}
	
}

?>


<form class="user" action="" method="POST">

<div class="form-group row">
<div class="col-sm-12 mb-3 mb-sm-0">
<textarea type="text" id="editor" name="webnote" class="form-control"><?php echo $webdata['webnote'];?></textarea>
</div>
				 
<div class="col-sm-12 mb-3 mt-5">
<input required="required" type="submit" name="submit" class="btn btn-info btn-block" value="提交">
</div>
</div> 
</form>
			 

</div>
</div>

<?php

}else{
?>
<img class="img-fluid" src="../bootstrap/img/cloud.png">
<?php
}
?>
</div>
<!-- /.container-fluid -->
<!-- End of Main Content -->
<?php
require_once('../database/footer.php');
?>