Advertisement
wrcspkkit

createalbum.php

May 5th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 4.12 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <?php
  3. session_start();
  4. if ($_SESSION['user_logged_in'] == ''){
  5. header('location: login.html');
  6. }
  7. ?>
  8. <html>
  9. <head>
  10. <title>.::PkKit::.</title>
  11.  
  12. <!-- BootStrap -->
  13.  
  14. <!-- Latest compiled and minified CSS -->
  15. <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  16.  
  17. <!-- jQuery library -->
  18. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
  19.  
  20. <!-- Latest compiled JavaScript -->
  21. <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  22.  
  23. <meta name="viewport" content="width=device-width, initial-scale=1">
  24.  
  25.  
  26. <link rel="stylesheet" href="style.css" type="text/css" />
  27. <link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700|Lato:400,100,300,700,900' rel='stylesheet' type='text/css'>
  28.  
  29.     <link rel="stylesheet" href="css/animate.css">
  30.    
  31.     <link rel="stylesheet" href="css/style.css">
  32.  
  33.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
  34. </head>
  35.  
  36.  
  37.  
  38. <body>
  39.  
  40. <nav class="navbar navbar-inverse">
  41.   <div class="container-fluid">
  42.     <div class="navbar-header">
  43.       <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
  44.         <span class="icon-bar"></span>
  45.         <span class="icon-bar"></span>
  46.         <span class="icon-bar"></span>
  47.       </button>
  48.       <a class="navbar-brand" href="#">PKKIT</a>
  49.     </div>
  50.     <div class="collapse navbar-collapse" id="myNavbar">
  51.       <ul class="nav navbar-nav">
  52.         <li class="active"><a href="myphotos.php">My Photos</a></li>
  53.         <li><a href="aboutus.php">About Us</a></li>
  54.         <li><a href="faqs.php">FAQs</a></li>
  55.         <li><a href="support.php">Support</a></li>
  56.       </ul>
  57.       <ul class="nav navbar-nav navbar-right">
  58.        <li><a href="create.php"><span class="glyphicon glyphicon-picture"></span> Create Album</a></li>
  59.         <li><a href="logout.php"><span class="glyphicon glyphicon-log-out"></span> Logout</a></li>
  60.       </ul>
  61.     </div>
  62.   </div>
  63. </nav>
  64. <ul>
  65.  
  66. <div id="body" class="container-fluid">
  67. <div class="login-box animated fadeInUp">
  68.             <div class="box-header">
  69.                 <h2>Create an album</h2>
  70.             </div>
  71.            
  72.             <!-- Create the album in the database !-->
  73.             <?php
  74.                 $AccountID = "\"" . $_SESSION['AccountID'] . "\""; // Global logged in user
  75.                 $idName= "\"" . $_POST['Title'] . "\"";   // Grab the data from form post
  76.                 $Description = "\"" . $_POST['Description'] . "\"";
  77.  
  78.  
  79.                 $servername = "localhost";
  80.                 $username = "PKKIT";     // Set up the SQL server details.
  81.                 $password = "jeznicklogan";
  82.                 $dbname = "PKKIT";
  83.  
  84.                 $conn = mysqli_connect($servername, $username, $password, $dbname);
  85.                  // Check connection
  86.                  if (!$conn) {
  87.                      die("Connection failed: " . mysqli_connect_error());
  88.                 }
  89.  
  90.  
  91. $sql = "INSERT INTO album (album_title, album_desc) VALUES (" . $idName . ", " . $Description . ");";
  92.  
  93. if (mysqli_multi_query($conn, $sql)) {
  94.     $last_id = mysqli_insert_id($conn);
  95.     $sql = "INSERT INTO album_perm (album_id, account_id, perm_type) VALUES (" . "\"" . $last_id . "\"," . $AccountID . ",1);";
  96.     //print_r($_SESSION);
  97. } else {
  98.     echo "<label>Your album could not be created.</label><br /><br />";
  99. }
  100.  
  101. if (mysqli_multi_query($conn, $sql)){
  102.     echo "<label>Your album has been created successfully </label><br /><br />";
  103. } else {
  104.     echo "<label>Could not set permissions on album</label><br /><br />";
  105. }
  106.  
  107. mysqli_close($conn); // close the sql connection
  108.             ?>
  109.             <a href="myphotos.php"><p class="small">OK</p></a>
  110.         </div>
  111.     </div>
  112.  
  113. </div>
  114.  
  115.  
  116.  
  117. <script>
  118.     $(document).ready(function () {
  119.         $('#logo').addClass('animated fadeInDown');
  120.         $("input:text:visible:first").focus();
  121.     });
  122.     $('#username').focus(function() {
  123.         $('label[for="username"]').addClass('selected');
  124.     });
  125.     $('#username').blur(function() {
  126.         $('label[for="username"]').removeClass('selected');
  127.     });
  128.     $('#password').focus(function() {
  129.         $('label[for="password"]').addClass('selected');
  130.     });
  131.     $('#password').blur(function() {
  132.         $('label[for="password"]').removeClass('selected');
  133.     });
  134. </script>
  135.  
  136. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement