Advertisement
cdsatrian

snipset

Sep 5th, 2013
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.27 KB | None | 0 0
  1. <?php
  2. // memulai session
  3. session_start();
  4. if (isset($_SESSION['role']))
  5. {
  6.   // jika level admin
  7.   if ($_SESSION['role'] == "admin")
  8.   {  
  9.   }
  10.    // jika kondisi level user maka akan diarahkan ke halaman lain
  11.   else if ($_SESSION['role'] == "member")
  12.   {
  13.     header('location:index.php');
  14.   }
  15. }
  16. else
  17. {
  18.   header('location:index.php');
  19. }
  20. ?>
  21. <!DOCTYPE html>
  22. <html lang="en">
  23.   <head>
  24.   <!--- Begin from here --->
  25.     <meta charset="utf-8">
  26.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  27.     <meta name="description" content="Web by Fajar Priadi">
  28.     <meta name="author" content="Fajar Priadi">
  29.     <title>Legoland - Order</title>
  30.     <?include 'incubator/incubator.php';?>
  31.     <!--- end here --->
  32.   </head>
  33.   <body>
  34.   <!-- Navigation Begin Here -->
  35.   <?include 'incubator/navigation.php';?>
  36.   <!-- Navigation End Here -->
  37.   <!-- Main Page Content Start here -->
  38.     <div class="panel panel-default">
  39.     <!-- Default panel contents -->
  40.     <div class="panel-heading"><h3>Order Update<h3></div>
  41.     <div class="panel-body">
  42.     </div>
  43.       <?php
  44.       $message = $_GET['msg'];
  45.       if ($message == 'success')
  46.       {
  47.       ?>
  48.         <div class="alert alert-success">
  49.            <strong>DELETE SUCCESS! </strong><a href="index.php" class="alert-link">Back to home?</a>
  50.         </div>
  51.       <?php
  52.       }
  53.       else if ($message == 'success2')
  54.       {
  55.       ?>
  56.          <div class="alert alert-success">
  57.            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
  58.            <strong>UPDATE SUCCESS!</strong>
  59.          </div>
  60.       <?php
  61.       }
  62.       else if ($message == 'error')
  63.       {
  64.       ?>
  65.          <div class="alert alert-dismissable">
  66.            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
  67.            <strong>Warning!</strong> Error
  68.          </div>
  69.       <?php
  70.       }
  71.       else if ($message == 'null')
  72.       {
  73.       ?>
  74.          <div class="alert alert-dismissable">
  75.            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
  76.            <strong>Warning!</strong> Gender Form Cannot be empty!
  77.          </div>
  78.       <?php
  79.       }
  80.       ?>
  81.      <!-- Table -->
  82.       <?php
  83.       include 'config/koneksi.php';
  84.       if ($_GET['uid'] == true && $_GET['status'] == true)
  85.       {
  86.         $status=array('Awaiting','Confirmation');
  87.         echo '<center>
  88.              <form id="form1" name="form1" method="get" action="edit.php">
  89.              <table width="100%" border="0">
  90.              <tr>
  91.                <td><span>ID </span></td>
  92.                <td><input type="text" name="uid" id="uid" value="'.$_GET['uid'].'" readonly></td>
  93.              </tr>
  94.              <tr><td><span>STATUS</span></td>
  95.                  <td>
  96.                    <select name="status" id="status">';
  97.         foreach($status as $st){
  98.           echo '<option value="'.$st.'"'.($st==$_GET['status']?' selected="selected"':'').'>$st</option>';
  99.         }              
  100.         echo '        </select>
  101.                  </tr>
  102.                  <tr>
  103.                    <td colspan="2">
  104.                       <button type="submit" class="btn btn-default">Update</button>
  105.                       <a class="btn btn-default" type="submit" href="index.php?act=update-order" />Exit</a>
  106.                    </td>
  107.                  </tr>
  108.                </table>
  109.                </form>
  110.                </center>';
  111.         }
  112.         else
  113.         {
  114.         ?>
  115.         <table class="table">
  116.           <thead>
  117.             <tr>
  118.               <th>#</th>
  119.               <th>Name</th>
  120.               <th>Email</th>
  121.               <th>Town</th>
  122.               <th>Address</th>
  123.               <th>Phone Number</th>
  124.               <th>Plan-Order</th>
  125.               <th>Company Name</th>
  126.               <th>Company Email</th>
  127.               <th>Company Address</th>
  128.               <th>Order Status</th>
  129.               <th>Action</th>
  130.             </tr>
  131.           </thead>
  132.           <tbody>
  133. <?php
  134.   $query = "SELECT * FROM `order`";
  135.   $result = mysql_query($query);
  136.   $no = 0;
  137.   while($row = mysql_fetch_assoc($result)){
  138.     echo "  <tr>
  139.            <td>".(++$no)."</td>
  140.            <td>".$row['fullname']."</td>
  141.            <td>".$row['email']."</td>
  142.            <td>".$row['town']."</td>
  143.            <td>".$row['address']."</td>
  144.            <td>".$row['number']."</td>
  145.            <td>".$row['planorder']."</td>
  146.            <td>".$row['cname']."</td>
  147.            <td>".$row['cemail']."</td>
  148.            <td>".$row['caddress']."</td>
  149.            <td>
  150.                <span class='label label-".($row['status']=='Awaiting'?'danger':'primary')."'>"
  151.                 .$row['status']
  152.                 ."</span>
  153.            </td>
  154.            <td>
  155.              <a class='label label-primary'
  156.                 href='edit-order.php?uid=".$row['uid']."&status=".$row['status']."'>[Edit]</a>|
  157.              <a class='label label-primary' href='delete.php?uid=".$row['uid']."'>[Delete]</a>
  158.            </td>
  159.          </tr>
  160.        ";
  161.   }
  162. }
  163. ?>
  164.      </tbody>
  165.   </table>
  166. </div>
  167. <!-- Main Page Content End Here -->
  168. <!-- Footer page start here -->
  169. <?php include 'incubator/footer.php';?>
  170. <!-- Footer Page End Here -->
  171.   </body>
  172. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement