<?php
session_start();
error_reporting(0);
include('includes/config.php');
if($_SESSION['name'] == '')
 {
     header("location:index.php");
 }
    else{
        
        if(isset($_POST['submit'])!=''){
    
	
	$telegram = $_POST['telegram'];
	$promotion = $_POST['promotion'];
	$notice = $_POST['notice'];
	$slid_notice = $_POST['slid_notice'];
	

  $sql= "UPDATE `telegram` SET `telegram` = '$telegram',`promotion` = '$promotion',`notice` = '$notice',`slid_notice`='$slid_notice' WHERE `id`= '1'";
   
$query=mysqli_query($com,$sql);
if($query){
	
	$msg="Update successfully";
	
	}else{
	  $error="Something went wrong. Please try again";  
	}

	}
        ?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
    	<meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Forcecrypto Admin</title>
        <link rel="stylesheet" href="css/bootstrap.min.css" media="screen" >
        <link rel="stylesheet" href="css/font-awesome.min.css" media="screen" >
        <link rel="stylesheet" href="css/animate-css/animate.min.css" media="screen" >
        <link rel="stylesheet" href="css/lobipanel/lobipanel.min.css" media="screen" >
        <link rel="stylesheet" href="css/prism/prism.css" media="screen" >
        <link rel="stylesheet" href="css/select2/select2.min.css" >
        <link rel="stylesheet" href="css/main.css" media="screen" >
        <script src="js/modernizr/modernizr.min.js"></script>
        

    </head>
    <body class="top-navbar-fixed">
        <div class="main-wrapper">

            <!-- ========== TOP NAVBAR ========== -->
  <?php include('includes/topbar.php');?> 
            <!-- ========== WRAPPER FOR BOTH SIDEBARS & MAIN CONTENT ========== -->
            <div class="content-wrapper">
                <div class="content-container">

                    <!-- ========== LEFT SIDEBAR ========== -->
                   <?php include('includes/leftbar.php');?>  
                    <!-- /.left-sidebar -->

                    <div class="main-page">

                     <div class="container-fluid">
                            <div class="row page-title-div">
                                <div class="col-md-6">
                                    <h2 class="title">Website Details</h2>
                                
                                </div>
                                
                                <!-- /.col-md-6 text-right -->
                            </div>
                            <!-- /.row -->
                           
                            <!-- /.row -->
                        </div>
                        <div class="container-fluid">
                           
                        <div class="row">
                                    <div class="col-md-12">
                                        <div class="panel">
                                           
                                            <div class="panel-body">
<?php if($msg){?>
<div class="alert alert-success left-icon-alert" role="alert">
 <strong>Well done!</strong><?php echo htmlentities($msg); ?>
 </div><?php } 
else if($error){?>
    <div class="alert alert-danger left-icon-alert" role="alert">
                                            <strong>Oh snap!</strong> <?php echo htmlentities($error); ?>
                                        </div>
                                        <?php } ?>
                                               <form  method="post" action="<?php echo $_SERVER['PHP_SELF'];?>" enctype="multipart/form-data">

 <?php
      
      $sql="select* FROM `telegram` WHERE id='1'";
      $query=mysqli_query($com,$sql);
       $role=mysqli_fetch_array($query);
   ?>
<div class="form-group">
                                                        <label for="date" class="col-sm-2 control-label ">Telegram Link</label>
                                                        <div class="col-sm-10">
                                                     <input type="text" class="form-control"  name="telegram" id="telegram"  value="<?php echo $role['telegram'];?>">
                                                        </div>
                                                    </div>

<div class="form-group">
                                                        <label for="date" class="col-sm-2 control-label ">Promotion Link</label>
                                                        <div class="col-sm-10">
                                                     <input type="text" class="form-control"  name="promotion" id="promotion"  value="<?php echo $role['promotion'];?>">
                                                        </div>
                                                    </div>

<div class="form-group">
                                                        <label for="date" class="col-sm-2 control-label ">Notification</label>
                                                        <div class="col-sm-10">
                                                     <textarea class="form-control mb-3" name="notice" ><?php echo $role['notice'];?></textarea>
                 </div>
                                                    </div>

                                                    <div class="form-group">
                                                        <label for="date" class="col-sm-2 control-label ">Slide Notification</label>
                                                        <div class="col-sm-10">
                                                     <textarea class="form-control mb-3" name="slid_notice" ><?php echo $role['slid_notice'];?></textarea>
                 </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <div class="col-sm-offset-2 col-sm-10">
                                                            <button type="submit" name="submit" id="submit" class="btn btn-primary">Update</button>
                                                        </div>
                                                    </div>
                                                </form>

                                            </div>
                                        </div>
                                    </div>
                                    <!-- /.col-md-12 -->
                                </div>
                    </div>
                </div>
                <!-- /.content-container -->
            </div>
            <!-- /.content-wrapper -->
        </div>
        <!-- /.main-wrapper -->
        <script src="js/jquery/jquery-2.2.4.min.js"></script>
        <script src="js/bootstrap/bootstrap.min.js"></script>
        <script src="js/pace/pace.min.js"></script>
        <script src="js/lobipanel/lobipanel.min.js"></script>
        <script src="js/iscroll/iscroll.js"></script>
        <script src="js/prism/prism.js"></script>
        <script src="js/select2/select2.min.js"></script>
        <script src="js/main.js"></script>
        <script>
            $(function($) {
                $(".js-states").select2();
                $(".js-states-limit").select2({
                    maximumSelectionLength: 2
                });
                $(".js-states-hide").select2({
                    minimumResultsForSearch: Infinity
                });
            });
        </script>
    </body>
</html>
<?PHP } ?>
