На главную Наши проекты:
Журнал   ·   Discuz!ML   ·   Wiki   ·   DRKB   ·   Помощь проекту
ПРАВИЛА FAQ Помощь Участники Календарь Избранное RSS
msm.ru
Модераторы: Serafim, fatalist
  
  • закрыта
> Books
    • The aim of this assignment is to develop a book reservation web site using PHP and MySQL database. The application will allow users to search for and reserve library books. Specifically, the application will enable the following:
    • Deadline: 6th of December at 1pm. Demo start from 1pm.
    • Library functionality- the users should be allowed to:
    · Search for a book
    · Reserve a book
    · View all the books that they have reserved
    • Login – The user must identify themselves to the system in order to use the system and throughout the whole site. If they have not previously used the system, they must register their details.
    • Registration - This allows a user to enter their details on the system. The registration process should validate that all details are entered. Mobile phone numbers should be numeric and 10 characters in length. Password should be six characters and have a password confirmation function. The system should ensure that each user can be identified using a unique username.
    • Search for a book: The system should allow the user to search in a number of ways:
    o by book title and/or author (including partial search on both)
    o by book category description in a dropdown menu (book category should retrieved from database)
    • The results of the search should display as a list from which the user can then reserve a book if available. If the book is already reserved, the user should not be allowed to reserve the book.
    • Reserve a book – The system should allow a user to reserve a book provided that no-one else has reserved the book yet. The reservation functionality should capture the date on which the reservation was made.
    • View reserved books – the system should allow the user to see a list of the book(s) currently reserved by that user. User should be able to remove the reservation as well.
    Notes:
    Apart from HTML, you should try to use other client side technologies like cascading style sheets to make pages neat and tidy. All validation should be server-side.
    Do not allow for more than 5 rows of data per page, where search results are being displayed. Include functionality to display lists across more than one page.
    The screens should be neat, simple design and usable. They do not need to be overly elaborate in presentation as you will not get extra marks for this.

    Other requirements
    • You must create/duplicate the database given in this document. You can add more data as you need to the tables.
    • Use a common header and footer for your pages throughout the application
    • Avoid hard-coding in your programs
    • Include error checking as appropriate
    Database
    The book database contains four tables:
    1. Users table - to hold user registration and password details. Each user is uniquely identified by a user name.

    2. Books table - holding all book details, indexed by ISBN number

    3. Category table – indicating the list of book categories (fiction, business etc). It is linked to the Books table by category code

    4. Reserved Books table - holding a list of books reserved by the user
    (identified by username). It is linked to the books table by ISBN number
    and the Users table by username.


    Marking
    • The assignment carries a total of 70 marks, which is 70% of your continuous assessment mark in Web Development.
    • All code must be fully tested. The examiner will not attempt to
    debug code which does not compile or run code which is does not
    function as required. Marks will be awarded as follows:
    Completeness of functionality - 30%
    Documentation - 10%
    Coding style/readability - 10%
    Technical implementation - 20%





    Submission of Assignment
    You are required to submit electronically your assignment on or before the due date. The details of each are below.
    Please note the penalties of the assessment regulations for late submission.
    Electronic submission (through webcourses)
    A document that:
    • lists the PHP pages used in your application – including a textual description of each page stating what the page does and how it interacts with other pages
    • contains a copy listing of your source code (.php , .html) .
    • contains a copy sample of each screen as it appears in
    your application
    • design document
    You will be required to demonstrate your program in lab.

    • Assignment Regulation:
    This assignment is not group projects; students are expected to complete an assignment individually. Please note penalty below.
    Penalties (except in exceptional circumstances)
    1. Failure to submit an assignment will result in no marks for that element of the assessment.
    2. Submission of an assignment after the due date but within one working week will result in a 50% reduction of the marks.
    3. Submission of an assignment more than one working week after the due date will result in no marks.
    4. Assessment components that are plagiarised will result in zero marks for all parties involved.


    ExpandedWrap disabled
      <!DOCTYPE html>
      <html>
          <head>
              <meta charset="UTF-8">
              <title>Main Assignment: Sports</title>
              <style>
          #header{
          background-color : #AFD0F1;  <!-- background color -->
          border:1px solid red;
              width:1000px;
              height:100px;
              color:blue;              <!-- text blue -->
          text-align:center;
          margin-left: 40px;
          margin-right:40px;
          }
              #horizontal_menu{
          background-color : #F9AF70;  <!-- background color -->
          border:1px solid red;
              width:1000px;
              height:100px;
              color:blue;              <!-- text blue -->
          text-align:center;
          margin-left: 40px;
          margin-right:40px;
          }
          #side_bar_1
          {
              background-color : #A32000;  <!-- background color -->
              border:1px solid red;
              width:200px;
              height:800px;
              color:#FFEA46;              <!-- text blue -->
          text-align:center;
          float:left;
          margin-top:  -1px;
          margin-left: 40px;
          }
              #Bofore_Content
          {
              background-color : #B0C0A0;  <!-- background color -->
              border:1px solid red;
              width:599px;
              height:100px;
              color:blue;              <!-- text blue -->
          text-align:center;
          margin-left: 240px;
          margin-top:  -1px;
          float:center;
          }  
          li.s {
      display: inline;
              
       
      }
       
          #section{
              background-color : #FF4D31;    <!-- background color -->
          border:1px solid red;
          width:599px;
          height:600px;
          color:#FFEA46;             <!-- color text -->
          float:center;
          margin-left: 240px;
          margin-right:139px;
          }  
              #side_bar_2
          {
              background-color : #FBFF3F;  <!-- background color -->
              border:1px solid red;
              width:200px;
              height:800px;
              color:blue;              <!-- text blue -->
          text-align:center
          float:right;
          margin-left: 840px;
          margin-top:  -811px;
          margin-right:39px;
          }
                  #After_Content
          {
              background-color : #B0C0A0;  <!-- background color -->
              border:1px solid red;
              width:599px;
              height:100px;
              color:blue;              <!-- text blue -->
          text-align:center;
          margin-left: 240px;
          float:center;
          }
              #footer{
          background-color : #5BA300;  <!-- background color -->
          border:1px solid red;
              width:1000px;
              height:100px;
              color:blue;              <!-- text blue -->
          text-align:center;
          margin-left: 40px;
          margin-right:40px;
          }
              </style>
          </head>
                  <body bgcolor="#FFF8D2">
                  <?php session_start(); $df=0; $ds=0; $dfq=0;
                  $_SESSION["qwe"]="";
                  $_SESSION["derk"]="ok";
                  if (!isset($_SESSION["lghjas"])){}
      elseif (isset($_SESSION["lghjas"])){
      $_SESSION["lghjas"]="click";}
                  if (!isset($_SESSION["lghj"])){}elseif($_SESSION["lghj"]=="Clickh")
                  {$_SESSION["lghj"]="Click";}
                  elseif (isset($_SESSION["lghj"])){$_SESSION["lghj"]="Click";}
                  //"ldfd"
                  if (!isset($_SESSION["ldfd"])){}elseif($_SESSION["ldfd"]=="Clickh")
                  {$_SESSION["ldfd"]="Click";}
                  elseif (isset($_SESSION["ldfd"])){$_SESSION["ldfd"]="Click";}      
                if (!isset($_SESSION["lghlk"])){} elseif (!isset($_SESSION["lghj"])){if($_SESSION["lghlk"]=="Update_Product")
                {$_SESSION["lghlk"]="Click";}}
                if (!isset($_SESSION["lfg"])){}
                  elseif (isset($_SESSION["lfg"])){$_SESSION["lfg"]="in";}
                   if (!isset($_SESSION["lghld"])){} elseif (!isset($_SESSION["lghld"])){if($_SESSION["lghld"]=="Update_Product")
                {$_SESSION["lghld"]="Click";}}
                    if (!isset($_SESSION["dert"])){}
                  elseif (isset($_SESSION["dert"])){$_SESSION["dert"]="in";}
                          ?>
                              <div id="header" style="border-style: solid; border-width: 1px; padding-left: 1px;
                              padding-right: 1px; padding-top: 1px; padding-bottom: 1px"><br>
             Name:          Jurijus Pacalovas<br>
             Student:       C17706201
                              </div>
      <div id="horizontal_menu" style="border-style: solid; border-width: 1px; padding-left: 1px;
       padding-right: 1px; padding-top: 1px; padding-bottom: 1px">
                      <nav>
                      <br>
                      <div align="center">
                          <ul>
                                 <li class="s"><a href="index.php">
                              <font style="font-size:12px"> Home </font></a></li> <!-- login page -->
                              <?php
                              //echo $_SESSION["lg"];    
                              //fg
              //////////////////////////////////////////////////////
                              if(isset($_SESSION["lg"])){
                              echo '
                                  <li class="s"><a href="Search_for_a_book.php">
                              <font style="font-size:12px"> Search_for_a_book </font></a></li>  
                                  <li class="s"><a href="Reserve_a_book.php">
                              <font style="font-size:12px"> Reserve_a_book  </font></a></li>
                                  <li class="s"><a href="View_reserved_books.php">
                              <font style="font-size:12px"> View_reserved_books  </font></a></li>
                                  <li class="s"><a href="Library_functionality.php">
                              <font style="font-size:12px"> Library_functionality </font></a></li>
                              ';
                              }
                              
                          
                          
                          ?>
                          </ul>
                          </div>
          </nav>
                  </div>  
                  <div id="side_bar_1" style="border-style: solid; border-width: 1px; padding-left: 1px;
                  padding-right: 1px; padding-top: 1px; padding-bottom: 1px">
                  <br><br><br><br>
                  On our website you can read books
                  </div>  
                  <div id="Bofore_Content" style="border-style: solid; border-width: 1px; padding-left: 1px;
                  padding-right: 1px; padding-top: 1px; padding-bottom: 1px">
                                  <p align="center"><b><font color ="#FFF8D2"><br> Books
                      </font></b></p></div>
                      <div id="section" style="border-style: solid; border-width: 1px; padding-left: 1px;
                      padding-right: 1px; padding-top: 1px; padding-bottom: 1px">
                
                 You Can see on our website pages such as Login, Registration, Search for a book, Reserve a book, View reserved books.
                     <ul>
                  <li> <font style="font-size: 16pt"> On  <u>Login</u> page you can see instruction. </font> </li>
                  <li> <font style="font-size: 16pt"> On  <u>Registration</u> You can Register on this page.</font> </li>
                  <li> <font style="font-size: 16pt"> On  <u>Search for a book</u> This page you can search books
                   and other users and you can choose one/many more book(s). </font> </li>
                  <li> <font style="font-size: 16pt"> On  <u>Reserve a book</u>  <u> You can reserve books </u> </font> </li>
                  <li> <font style="font-size: 16pt"> On  <u>View reserved books</u> Allow the user to see a list of the book(s) currently reserved
                  by that user. User able to remove the reservation as well. </font> </li>
                  <li> <font style="font-size: 16pt">
                  Library functionality- the users should be allowed to: </font> </li>
                  <font style="font-size: 16pt">Search for a book </font> </li>
                  <li> <font style="font-size: 16pt">Reserve a book </font> </li>
                  <li> <font style="font-size: 16pt">View all the books that they have reserved </font> </li>
                  
                  </font>
                  
                  </div>      
             <div id="After_Content" style="border-style: solid; border-width: 1px; padding-left: 1px; padding-right: 1px;
             padding-top: 1px; padding-bottom: 1px">
                  <br>
                  
                  Welcome everybody to our website.
                  
                  
             </div>
              <div id="side_bar_2" style="border-style: solid; border-width: 1px; padding-left: 1px; padding-right: 1px;
              padding-top: 1px; padding-bottom: 1px">
              <!--Form -->
              <br><br><br><br><br><br><br><br><br><br><br><br>
              <table width="197" height="150" border="1" bgcolor="#C0C0C0" style="border-color: #C0C0C0" align="center">
              <tr> <td>
              <br>
                <?php
      if(!isset($_SESSION["lg"]) && !isset($_SESSION["lg"]) && !isset($_SESSION["fg"])) //die('');
      {
      echo '    
      <font style="font-size: 8pt"><a href="Register.php"><input type="submit" method="Register.php" value="Register">
      </input></a></font>';
      }
      ?>
       
              <form method="POST" action="index.php">
      <?php
      if(!isset($_SESSION["lg"]) && !isset($_SESSION["lj"])) //die('');
      {
       
      echo '
      <p>   <font style="font-size: 8pt"> Please enter login<br>
         
       
      <input type="text"  name="login" size="20" maxlength="30"></input>
      </p>
      <p>     Please enter password<br>   
      <input type="password"  name="pass" size="20" maxlength="30"></input>
      <br>
       
      </p>
       
      <input type="submit" value="OK" ></input>
       
      <input type="reset" value="Reset">
      </font>';
      $ds=1;
      }
      if(isset($_SESSION["lg"]) && isset($_SESSION["lj"]))
      {
      echo '<div align="center">
      <font color green style="font-size:15pt">';echo "USER <br>";
      echo "</font></div>";
      echo "You are welcome ";
      echo $_SESSION["lj"]. " <br> ";
      }
      ?>
      </form>
      <?php
      define("DB_HOST", "sql100.freecluster.eu");
          define("DB_USER", "fceu_17384599");
          define("DB_PASSWORD", "7cgv4wsm");
          define("DB_DATABASE", "fceu_17384599_Books");
          try{
              $dbConnection = new
      PDO('mysql:dbname='.DB_DATABASE.';host='.DB_HOST.';charset=utf8', DB_USER, DB_PASSWORD);
              $dbConnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
              $dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
          } catch (PDOException $e) {echo 'Connection failed: ' . $e->getMessage();}
          
          foreach ($items as $row)
      {
      //////
      /* login 1 */
      //echo $row[0]." <br> ";
      $row1=$row[0]; $ty2=$row[0];
      $ty3[0]=$ty2[0];$ty4=$ty3[0];
      $dlin3=strlen($ty4);
      if($dlin3==1){$dfq=1;}else{$dfq=0;}
      /* password 5 */
      //echo $row[4]." <br> ";
      ////////////    
                  }//foreach
              /////
              
       
      if(isset($_SESSION["lg"])) //die('');
      {
      echo
      '<form method="POST" action="index.php">
      <input type="submit" name="Sign out" value="Sign out"></input>
      </form>';
      if(isset($_SESSION["lg"]) && isset($_SESSION["lj"])) //die('');
      {
                  if ($_SERVER["REQUEST_METHOD"] == "POST")
          {
          session_unset();
          session_destroy();
          echo '<meta http-equiv="refresh" content="0; url=index.php">';
              }
          }
      }
      ?>
      <br>
      <?php
      function You_have_Sign_in(){
      $df=2;
      echo '<b><font color ="green"> You have Sign in </font></b>';
      }
      if(!isset($_SESSION["lg"]) && !isset($_SESSION["lj"]) && $ds==1) //die('');
      {
                  if ($_SERVER["REQUEST_METHOD"] == "POST")
          {
          
       
          
              $varN1 = $_POST["login"];
              $varN2 = $_POST["pass"];    
              $df=0;
          $df=0; $login=$varN1;
      $pass=$varN2;
      //echo $login." <br> ";
      //echo $pass." <br> ";
      $dlin1=strlen($varN2);
      $dlin2=strlen($varN1);
      if($dlin1>1 && $dlin2>1)
      {$sql = "SELECT * FROM users WHERE Username = '$login' and Password = '$pass'";}
      if($dlin1>1 && $dlin2>1)
      {
      $items = $dbConnection->prepare("$sql");
      $items->execute();
      foreach ($items as $row)
      {
      //////
      /* login 1 */
      //echo $row[0]." <br> ";
      $row1=$row[0]; $ty2=$row[0];
      $ty3[0]=$ty2[0];$ty4=$ty3[0];
      $dlin3=strlen($ty4);
      if($dlin3==1){$df=1;}else{$df=0;}
      /* password 5 */
      //echo $row[4]." <br> ";
      ////////////    
                  }//foreach
                  
              /////
      }
       
       
          
       
      //session
      //echo  $row[0]." <br> ";
       $US1=$row[2];
       $US2=$row[3];
       $US3 = $US1 . ' ' . $US2;
       $US4=$row[0];
       $US6 = $US4;  
       
       
       $dlinq=strlen($US2);
       
       if($dlinq==0)
       {
           echo $_SESSION["lr"]. " <br> ";
          
       }
       else
       {
       $_SESSION["lg"]="$US3";
       $_SESSION["lj"]="$US6";
          
       }
       
       
       echo '<meta http-equiv="refresh" content="0; url=index.php">';
       
      }//if ($_SERVER["REQUEST_METHOD"] == "POST")
      }
       
      if(isset($_SESSION["lg"])) //die('');
      {
       echo '<div align="center">';
       You_have_Sign_in();
       echo $_SESSION["lg"]. " <br> ";
      }
       
              ?>
      </td></tr>
      </table>
       
              
              </div>
                              <div id="footer" style="border-style: solid; border-width: 1px; padding-left: 1px; padding-right:
                              1px; padding-top: 1px; padding-bottom: 1px"><br>
             Name:          Jurijus Pacalovas<br>
             Student:       C17706201
                              </div>
                  <br><br>
                  </body>
      </html>


    ExpandedWrap disabled
      <?php
      // function to connect and execute the query
      function filterTable($query)
      {
          $connect = mysqli_connect("sql100.freecluster.eu", "fceu_17384599", "7cgv4wsm", "fceu_17384599_Books");
          $filter_Result = mysqli_query($connect, $query);
          return $filter_Result;
      }
      ?>
      <!-- populate table from mysql database
             (`ISBN`, `BooKTitle`, `Author`, `Edition`, `Year`, `Categories`, `Rese.`)
           -->
      <?php
       
      if(isset($_POST['search']))
      {
          $valueToSearch = $_POST['valueToSearch'];
          
          // search in all table columns
          // using concat mysql function
          
          $query = "SELECT * FROM `bookstable` WHERE CONCAT(`BooKTitle`, `Author`)
          LIKE '%".$valueToSearch."%'";
          $search_result = filterTable($query);
       
      }
       
       else {
          $queryi = "SELECT * FROM `bookstable`";
          $search_result = filterTable($queryi);
      }
       
      ?>
       
      <!DOCTYPE html>
      <html>
          <head>
              <meta charset="UTF-8">
              <title>Main Assignment: Sports</title>
              <style>
          #header{
          background-color : #AFD0F1;  <!-- background color -->
          border:1px solid red;
              width:1100px;
              height:100px;
              color:blue;              <!-- text blue -->
          text-align:center;
          margin-left: 40px;
          margin-right:40px;
          }
              #horizontal_menu{
          background-color : #F9AF70;  <!-- background color -->
          border:1px solid red;
              width:1100px;
              height:100px;
              color:blue;              <!-- text blue -->
          text-align:center;
          margin-left: 40px;
          margin-right:40px;
          }
          #side_bar_1
          {
              background-color : #A32000;  <!-- background color -->
              border:1px solid red;
              width:200px;
              height:705px;
              color:#FFEA46;              <!-- text blue -->
          text-align:center;
          float:left;
          margin-top:  -1px;
          margin-left: 40px;
          }
              #Bofore_Content
          {
              background-color : #B0C0A0;  <!-- background color -->
              border:1px solid red;
              width:900px;
              height:100px;
              color:blue;              <!-- text blue -->
          text-align:center;
          margin-left: 240px;
          margin-top:  -1px;
          float:center;
          }  
          li.s {
      display: inline;
              
       
      }
       
          #section{
              background-color : #FF4D31;    <!-- background color -->
          border:1px solid red;
          width:900px;
          height:600px;
          color:#FFEA46;             <!-- color text -->
          float:center;
          margin-left: 240px;
          margin-right:139px;
          }  
          
          
                  #footer{
          background-color : #5BA300;  <!-- background color -->
          border:1px solid red;
              width:1100px;
              height:100px;
              color:blue;              <!-- text blue -->
          text-align:center;
          margin-left: 40px;
          margin-right:40px;
          }
          
              
              </style>
          </head>
                  <body bgcolor="#FFF8D2">
                  <?php session_start(); $df=0; $ds=0; $dfq=0;
                  $_SESSION["qwe"]="";
                  $_SESSION["derk"]="ok";
                  if (!isset($_SESSION["lghjas"])){}
      elseif (isset($_SESSION["lghjas"])){
      $_SESSION["lghjas"]="click";}
                  if (!isset($_SESSION["lghj"])){}elseif($_SESSION["lghj"]=="Clickh")
                  {$_SESSION["lghj"]="Click";}
                  elseif (isset($_SESSION["lghj"])){$_SESSION["lghj"]="Click";}
                  //"ldfd"
                  if (!isset($_SESSION["ldfd"])){}elseif($_SESSION["ldfd"]=="Clickh")
                  {$_SESSION["ldfd"]="Click";}
                  elseif (isset($_SESSION["ldfd"])){$_SESSION["ldfd"]="Click";}      
                if (!isset($_SESSION["lghlk"])){} elseif (!isset($_SESSION["lghj"])){if($_SESSION["lghlk"]=="Update_Product")
                {$_SESSION["lghlk"]="Click";}}
                if (!isset($_SESSION["lfg"])){}
                  elseif (isset($_SESSION["lfg"])){$_SESSION["lfg"]="in";}
                   if (!isset($_SESSION["lghld"])){} elseif (!isset($_SESSION["lghld"])){if($_SESSION["lghld"]=="Update_Product")
                {$_SESSION["lghld"]="Click";}}
                    if (!isset($_SESSION["dert"])){}
                  elseif (isset($_SESSION["dert"])){$_SESSION["dert"]="in";}
                          ?>
                              <div id="header" style="border-style: solid; border-width: 1px; padding-left: 1px;
                              padding-right: 1px; padding-top: 1px; padding-bottom: 1px"><br>
             Name:          Jurijus Pacalovas<br>
             Student:       C17706201
                              </div>
      <div id="horizontal_menu" style="border-style: solid; border-width: 1px; padding-left: 1px;
       padding-right: 1px; padding-top: 1px; padding-bottom: 1px">
                      <nav>
                      <br>
                      <div align="center">
                          <ul>
                                 <li class="s"><a href="index.php">
                              <font style="font-size:12px"> Home </font></a></li> <!-- login page -->
                              <?php
                              //echo $_SESSION["lg"];    
                              //fg
              //////////////////////////////////////////////////////
                              if(isset($_SESSION["lg"])){
                              echo '
                                  <li class="s"><a href="Search_for_a_book.php">
                              <font style="font-size:12px"> Search_for_a_book </font></a></li>  
                                  <li class="s"><a href="Reserve_a_book.php">
                              <font style="font-size:12px"> Reserve_a_book </font></a></li>
                                  <li class="s"><a href="View_reserved_books.php">
                              <font style="font-size:12px"> View_reserved_books  </font></a></li>
                                  <li class="s"><a href="Library_functionality.php">
                              <font style="font-size:12px"> Library_functionality </font></a></li>
                              ';
                              
                              }
                              
                          
                          
                          ?>
                          </ul>
                          </div>
          </nav>
                  </div>  
                  <div id="side_bar_1" style="border-style: solid; border-width: 1px; padding-left: 1px;
                  padding-right: 1px; padding-top: 1px; padding-bottom: 1px">
                  <br><br><br><br
                  <table width="25" height="25" border="1" bgcolor="black" style="border-color: " align="left">
                  <tr>
       
      <?php
                  if(isset($_SESSION["lg"])) //die('');
      {
      echo
      '<form method="POST" action="index.php">
      <input type="submit" name="Sign out" value="Sign out"></input>
      </form>';
      if(isset($_SESSION["lg"]) && isset($_SESSION["lj"])) //die('');
      {
                  if ($_SERVER["REQUEST_METHOD"] == "POSTq")
          {
          session_unset();
          session_destroy();
          echo '<meta http-equiv="refresh" content="0; url=index.php">';
          
              }
          }
      }
      if(!isset($_SESSION["lg"]))
      {
          echo '<meta http-equiv="refresh" content="0; url=index.php">';
      }
      ?>
      </table>
                  
                  
                  <hr>
                  On our website you can read books
                  </div>  
                  <div id="Bofore_Content" style="border-style: solid; border-width: 1px; padding-left: 1px;
                  padding-right: 1px; padding-top: 1px; padding-bottom: 1px">
                                  <p align="center"><b><font color ="#FFF8D2"><br> Books
                      </font></b></p></div>
                      <div id="section" style="border-style: solid; border-width: 1px; padding-left: 1px;
                      padding-right: 1px; padding-top: 1px; padding-bottom: 1px">
                 <?php
              
       
       
      define("DB_HOST", "sql100.freecluster.eu");
          define("DB_USER", "fceu_17384599");
          define("DB_PASSWORD", "7cgv4wsm");
          define("DB_DATABASE", "fceu_17384599_Books");
          try{
              $dbConnection = new
      PDO('mysql:dbname='.DB_DATABASE.';host='.DB_HOST.';charset=utf8', DB_USER, DB_PASSWORD);
              $dbConnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
              $dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
          } catch (PDOException $e) {echo 'Connection failed: ' . $e->getMessage();}
          
          foreach ($items as $row)
      {
      //////
      /* login 1 */
      //echo $row[0]." <br> ";
      $row1=$row[0]; $ty2=$row[0];
      $ty3[0]=$ty2[0];$ty4=$ty3[0];
      $dlin3=strlen($ty4);
      if($dlin3==1){$dfq=1;}else{$dfq=0;}
      /* password 5 */
      //echo $row[4]." <br> ";
      ////////////    
                  }//foreach
                  
                  
                  ?>
       
       <!--Form -->
              
              <table width="150" height="150" border="1" bgcolor="black" style="border-color: " align="Left">
              <tr> <td>
              <br>
                
          <li class="s">
            <form action="Search_for_a_book.php" method="post">
            <br>
            <a href="Search_for_a_book__.php">
                              <font style="font-size:20px"> and </font></a> <br>
               BookTitle or Author <input type="text" name="valueToSearch" placeholder="Value To Search"><br><br>
               <input type="submit" name="search" value="Filter"><br><br>
                  
                  
                  <table>
                      <tr>
                          <th>BookTitle</th>
                          <th>Author</th>
                          <th>Edition</th>
                          <th>Year</th>
                          <th>Categories</th>
                      </tr>
       
            <!-- populate table from mysql database
             (`ISBN`, `BooKTitle`, `Author`, `Edition`, `Year`, `Categories`, `Rese.`)
           -->
                      <?php while($row = mysqli_fetch_array($search_result)):?>
                      <tr>
                          <td><?php echo $row['BooKTitle'];?></td>
                          <td><?php echo $row['Author'];?></td>
                          <td><?php echo $row['Edition'];?></td>
                          <td><?php echo $row['Year'];?></td>
                          <td><?php echo $row['Categories'];?></td>
                      </tr>
                      <?php endwhile;?>
                      </form>
       
                  
                  </div>      
             <div id="After_Content" style="border-style: solid; border-width: 1px; padding-left: 1px; padding-right: 1px;
             padding-top: 1px; padding-bottom: 1px">
                  <br>
                  
                  Welcome everybody to our website.
                  
                  
             </div>
              
                  </table>
              </form>
       
      <div id="side_bar_2" style="border-style: solid; border-width: 1px; padding-left: 1px; padding-right: 1px;
              padding-top: 1px; padding-bottom: 1px">
            
       
       
              
              
              
              /////
              
       
       
      ?>
      <br>
      <?php
      function You_have_Sign_in(){
      $df=2;
      echo '<b><font color ="green"> You have Sign in </font></b>';
      }
       
                  if ($_SERVER["REQUEST_METHOD"] == "POSTq")
          {
          
       
          
              $varN1 = $_POST["login"];
              $varN2 = $_POST["pass"];    
              $df=0;
          $df=0; $login=$varN1;
      $pass=$varN2;
      //echo $login." <br> ";
      //echo $pass." <br> ";
      $dlin1=strlen($varN2);
      $dlin2=strlen($varN1);
      if($dlin1>1 && $dlin2>1)
      {$sql = "SELECT * FROM product WHERE PName";}
      if($dlin1>1 && $dlin2>1)
      {
      $items = $dbConnection->prepare("$sql");
      $items->execute();
      foreach ($items as $row)
      {
      //////
      /* login 1 */
      //echo $row[0]." <br> ";
      $row1=$row[0]; $ty2=$row[0];
      $ty3[0]=$ty2[0];$ty4=$ty3[0];
      $dlin3=strlen($ty4);
      if($dlin3==1){$df=1;}else{$df=0;}
      /* password 5 */
      //echo $row[4]." <br> ";
      ////////////    
                  }//foreach
                  
              /////
       
       
       
          
       
      //session
      //echo  $row[0]." <br> ";
       $US1=$row[1];
       $US2=$row[4];
       $US3 = $US1 . ' ' . $US2;
       $US4=$row[0];
       $US6 = $US4;  
       
       
       $dlinq=strlen($US2);
       
       if($dlinq==0)
       {
           echo $_SESSION["lr"]. " <br> ";
          
       }
       else
       {
       $_SESSION["lg"]="$US3";
       $_SESSION["lj"]="$US6";
          
       }
       
       
       
       
      }//if ($_SERVER["REQUEST_METHOD"] == "POSTq")
      }
       
      if(isset($_SESSION["lg"])) //die('');
      {
       echo '<div align="center">';
       You_have_Sign_in();
       echo $_SESSION["lg"]. " <br> ";
      }
       
              ?>
      </td></tr>
      </table>
       
              
              </div>
                              <div id="footer" style="border-style: solid; border-width: 1px; padding-left: 1px; padding-right:
                              1px; padding-top: 1px; padding-bottom: 1px"><br>
             Name:          Jurijus Pacalovas<br>
             Student:       C17706201
                              </div>
                  <br><br>
                  </body>
      </html>
       
       
       
       
      [CODE=php]
      <?php
      // function to connect and execute the query
      function filterTable($query)
      {
          $connect = mysqli_connect("sql100.freecluster.eu", "fceu_17384599", "7cgv4wsm", "fceu_17384599_Books");
          $filter_Result = mysqli_query($connect, $query);
          return $filter_Result;
      }
      ?>
      <!-- populate table from mysql database
             (`ISBN`, `BooKTitle`, `Author`, `Edition`, `Year`, `Categories`, `Rese.`)
           -->
       
      <?php
       
      if(isset($_POST['search']))
      {
          $valueToSearch = $_POST['valueToSearch'];
          
          // search in all table columns
          // using concat mysql function
          
          $query = "SELECT * FROM `categories` WHERE CONCAT(`CategoryID`,`CategoryDe.`)
          LIKE '%".$valueToSearch."%'";
          $search_result = filterTable($query);
       
      }
       
       else {
          $queryi = "SELECT * FROM `categories`";
          $search_result = filterTable($queryi);
      }
       
      ?>
       
      <!DOCTYPE html>
      <html>
          <head>
              <meta charset="UTF-8">
              <title>Main Assignment: Sports</title>
              <style>
              .dropbtn {
          background-color: #4CAF50;
          color: white;
          padding: 16px;
          font-size: 16px;
          border: none;
      }
       
      .dropdown {
          position: relative;
          display: inline-block;
      }
       
      .dropdown-content {
          display: none;
          position: absolute;
          background-color: #f1f1f1;
          min-width: 160px;
          box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
          z-index: 1;
      }
       
      .dropdown-content a {
          color: black;
          padding: 12px 16px;
          text-decoration: none;
          display: block;
      }
       
      .dropdown-content a:hover {background-color: #ddd;}
       
      .dropdown:hover .dropdown-content {display: block;}
       
      .dropdown:hover .dropbtn {background-color: #3e8e41;}
       
          #header{
          background-color : #AFD0F1;  <!-- background color -->
          border:1px solid red;
              width:1100px;
              height:100px;
              color:blue;              <!-- text blue -->
          text-align:center;
          margin-left: 40px;
          margin-right:40px;
          }
              #horizontal_menu{
          background-color : #F9AF70;  <!-- background color -->
          border:1px solid red;
              width:1100px;
              height:100px;
              color:blue;              <!-- text blue -->
          text-align:center;
          margin-left: 40px;
          margin-right:40px;
          }
          
              #Bofore_Content
          {
              background-color : #B0C0A0;  <!-- background color -->
              border:1px solid red;
              width:900px;
              height:100px;
              color:blue;              <!-- text blue -->
          text-align:center;
          margin-left: 240px;
          margin-top:  -1px;
          float:center;
          }  
          li.s {
      display: inline;
              
       
      }
      #section{
              background-color : #FF4D31;    <!-- background color -->
          border:1px solid red;
          width:900px;
          height:600px;
          color:#FFEA46;             <!-- color text -->
          float:center;
          margin-left: 240px;
          margin-right:139px;
          }  
       
          
          
              
              </style>
          </head>
                  <body bgcolor="#FFF8D2">
                  <?php session_start(); $df=0; $ds=0; $dfq=0;
                  $_SESSION["qwe"]="";
                  $_SESSION["derk"]="ok";
                  if (!isset($_SESSION["lghjas"])){}
      elseif (isset($_SESSION["lghjas"])){
      $_SESSION["lghjas"]="click";}
                  if (!isset($_SESSION["lghj"])){}elseif($_SESSION["lghj"]=="Clickh")
                  {$_SESSION["lghj"]="Click";}
                  elseif (isset($_SESSION["lghj"])){$_SESSION["lghj"]="Click";}
                  //"ldfd"
                  if (!isset($_SESSION["ldfd"])){}elseif($_SESSION["ldfd"]=="Clickh")
                  {$_SESSION["ldfd"]="Click";}
                  elseif (isset($_SESSION["ldfd"])){$_SESSION["ldfd"]="Click";}      
                if (!isset($_SESSION["lghlk"])){} elseif (!isset($_SESSION["lghj"])){if($_SESSION["lghlk"]=="Update_Product")
                {$_SESSION["lghlk"]="Click";}}
                if (!isset($_SESSION["lfg"])){}
                  elseif (isset($_SESSION["lfg"])){$_SESSION["lfg"]="in";}
                   if (!isset($_SESSION["lghld"])){} elseif (!isset($_SESSION["lghld"])){if($_SESSION["lghld"]=="Update_Product")
                {$_SESSION["lghld"]="Click";}}
                    if (!isset($_SESSION["dert"])){}
                  elseif (isset($_SESSION["dert"])){$_SESSION["dert"]="in";}
                          ?>
                              <div id="header" style="border-style: solid; border-width: 1px; padding-left: 1px;
                              padding-right: 1px; padding-top: 1px; padding-bottom: 1px"><br>
             Name:          Jurijus Pacalovas<br>
             Student:       C17706201
                              </div>
      <div id="horizontal_menu" style="border-style: solid; border-width: 1px; padding-left: 1px;
       padding-right: 1px; padding-top: 1px; padding-bottom: 1px">
                      <nav>
                      <br>
                      <div align="center">
                          <ul>
                                 <li class="s"><a href="index.php">
                              <font style="font-size:12px"> Home </font></a></li> <!-- login page -->
                              <?php
                              //echo $_SESSION["lg"];    
                              //fg
              //////////////////////////////////////////////////////
                              if(isset($_SESSION["lg"])){
                              echo '
                                  <li class="s"><a href="Search_for_a_book.php">
                              <font style="font-size:12px"> Search_for_a_book </font></a></li>  
                                  <li class="s"><a href="Reserve_a_book.php">
                              <font style="font-size:12px"> Reserve_a_book </font></a></li>
                                  <li class="s"><a href="View_reserved_books.php">
                              <font style="font-size:12px"> View_reserved_books  </font></a></li>
                                  <li class="s"><a href="Library_functionality.php">
                              <font style="font-size:12px"> Library_functionality </font></a></li>
                              ';
                              
                              }
                              
                          
                          
                          ?>
                          </ul>
                          </div>
          </nav>
                  </div>  
                  
                  <br><br><br><br>
                  <table width="25" height="25" border="1" bgcolor="black" style="border-color: " align="left">
                  <tr>
       
      <?php
                  if(isset($_SESSION["lg"])) //die('');
      {
      echo
      '<form method="POST" action="index.php">
      <input type="submit" name="Sign out" value="Sign out"></input>
      </form>';
      if(isset($_SESSION["lg"]) && isset($_SESSION["lj"])) //die('');
      {
                  if ($_SERVER["REQUEST_METHOD"] == "POSTq")
          {
          session_unset();
          session_destroy();
          echo '<meta http-equiv="refresh" content="0; url=index.php">';
          
              }
          }
      }
      if(!isset($_SESSION["lg"]))
      {
          echo '<meta http-equiv="refresh" content="0; url=index.php">';
      }
      ?>
      </table>
                  
                  
                  <hr>
                  On our website you can read books
                  
                  <div id="Bofore_Content" style="border-style: solid; border-width: 1px; padding-left: 1px;
                  padding-right: 1px; padding-top: 1px; padding-bottom: 1px">
                                  <p align="center"><b><font color ="#FFF8D2"><br> Books
                      </font></b></p></div>
                      <div id="section" style="border-style: solid; border-width: 1px; padding-left: 1px;
                      padding-right: 1px; padding-top: 1px; padding-bottom: 1px">
                 <?php
              
       
       
      define("DB_HOST", "sql100.freecluster.eu");
          define("DB_USER", "fceu_17384599");
          define("DB_PASSWORD", "7cgv4wsm");
          define("DB_DATABASE", "fceu_17384599_Books");
          try{
              $dbConnection = new
      PDO('mysql:dbname='.DB_DATABASE.';host='.DB_HOST.';charset=utf8', DB_USER, DB_PASSWORD);
              $dbConnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
              $dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
          } catch (PDOException $e) {echo 'Connection failed: ' . $e->getMessage();}
          
          foreach ($items as $row)
      {
      //////
      /* login 1 */
      //echo $row[0]." <br> ";
      $row1=$row[0]; $ty2=$row[0];
      $ty3[0]=$ty2[0];$ty4=$ty3[0];
      $dlin3=strlen($ty4);
      if($dlin3==1){$dfq=1;}else{$dfq=0;}
      /* password 5 */
      //echo $row[4]." <br> ";
      ////////////    
                  }//foreach
                  
                  
                  ?>
       
       <!--Form -->
              <div class="dropdown">
        <button class="dropbtn">Dropdown</button>
        <div class="dropdown-content">
              <table width="150" height="150" border="1" bgcolor="black" style="border-color: " align="Left">
              <tr> <td>
              <br>
                
          <li class="s">
            <form action="Search_for_a_book___.php" method="post">
            <br>
            <a href="Search_for_a_book__.php">
                              <font style="font-size:20px"> and </font></a> <br>
               BookTitle or Author <input type="text" name="valueToSearch" placeholder="Value To Search"><br><br>
               <input type="submit" name="search" value="Filter"><br><br>
                  
                  
                  <table>
                      <tr>
                          <th>CategoryID</th>
                          <th>CategoryDe.</th>
                          
                      </tr>
       
            <!-- populate table from mysql database
             (`ISBN`, `BooKTitle`, `Author`, `Edition`, `Year`, `Categories`, `Rese.`)
           -->
                      <?php while($row = mysqli_fetch_array($search_result)):?>
                      <tr>
                          <td><?php echo $row['CategoryID'];?></td>
                          <td><?php echo $row['CategoryDe.'];?></td>
                      </tr>
                      <?php endwhile;?>
                      </form>
                      </div>
      </div>
       
                  
                  </div>      
             <div id="After_Content" style="border-style: solid; border-width: 1px; padding-left: 1px; padding-right: 1px;
             padding-top: 1px; padding-bottom: 1px">
                  <br>
                  
                  Welcome everybody to our website.
                  
                  
             </div>
              
                  </table>
              </form>
       
      <div id="side_bar_2" style="border-style: solid; border-width: 1px; padding-left: 1px; padding-right: 1px;
              padding-top: 1px; padding-bottom: 1px">
            
       
       
              
              
              
              /////
              
       
       
      ?>
      <br>
      <?php
      function You_have_Sign_in(){
      $df=2;
      echo '<b><font color ="green"> You have Sign in </font></b>';
      }
       
                  if ($_SERVER["REQUEST_METHOD"] == "POSTq")
          {
          
       
          
              $varN1 = $_POST["login"];
              $varN2 = $_POST["pass"];    
              $df=0;
          $df=0; $login=$varN1;
      $pass=$varN2;
      //echo $login." <br> ";
      //echo $pass." <br> ";
      $dlin1=strlen($varN2);
      $dlin2=strlen($varN1);
      if($dlin1>1 && $dlin2>1)
      {$sql = "SELECT * FROM product WHERE PName";}
      if($dlin1>1 && $dlin2>1)
      {
      $items = $dbConnection->prepare("$sql");
      $items->execute();
      foreach ($items as $row)
      {
      //////
      /* login 1 */
      //echo $row[0]." <br> ";
      $row1=$row[0]; $ty2=$row[0];
      $ty3[0]=$ty2[0];$ty4=$ty3[0];
      $dlin3=strlen($ty4);
      if($dlin3==1){$df=1;}else{$df=0;}
      /* password 5 */
      //echo $row[4]." <br> ";
      ////////////    
                  }//foreach
                  
              /////
       
       
       
          
       
      //session
      //echo  $row[0]." <br> ";
       $US1=$row[1];
       $US2=$row[4];
       $US3 = $US1 . ' ' . $US2;
       $US4=$row[0];
       $US6 = $US4;  
       
       
       $dlinq=strlen($US2);
       
       if($dlinq==0)
       {
           echo $_SESSION["lr"]. " <br> ";
          
       }
       else
       {
       $_SESSION["lg"]="$US3";
       $_SESSION["lj"]="$US6";
          
       }
       
       
       
       
      }//if ($_SERVER["REQUEST_METHOD"] == "POSTq")
      }
       
      if(isset($_SESSION["lg"])) //die('');
      {
       echo '<div align="center">';
       You_have_Sign_in();
       echo $_SESSION["lg"]. " <br> ";
      }
       
              ?>
      </td></tr>
      </table>
       
              
              </div>
                              
                  <br><br>
                  </body>
      </html>
      [CODE=SQL]
      -- phpMyAdmin SQL Dump
      -- version 3.5.8.2
      -- http://www.phpmyadmin.net
      --
      -- Host: sql100.byetcluster.com
      -- Generation Time: Nov 30, 2018 at 11:25 AM
      -- Server version: 5.6.41-84.1
      -- PHP Version: 5.3.3
       
      SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
      SET time_zone = "+00:00";
       
       
      /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
      /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
      /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
      /*!40101 SET NAMES utf8 */;
       
      --
      -- Database: `fceu_17384599_Books`
      --
       
      -- --------------------------------------------------------
       
      --
      -- Table structure for table `bookstable`
      --
       
      CREATE TABLE IF NOT EXISTS `bookstable` (
        `ISBN` varchar(32) NOT NULL,
        `BooKTitle` varchar(32) NOT NULL,
        `Author` varchar(32) NOT NULL,
        `Edition` varchar(32) NOT NULL,
        `Year` varchar(5) NOT NULL,
        `Categories` varchar(4) NOT NULL,
        `Rese.` varchar(2) NOT NULL
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
       
      --
      -- Dumping data for table `bookstable`
      --
       
      INSERT INTO `bookstable` (`ISBN`, `BooKTitle`, `Author`, `Edition`, `Year`, `Categories`, `Rese.`) VALUES
      ('093-403992', 'Computers in Business', 'Alicia Oneill', '3', '1997', '003', 'N'),
      ('23472-8729', 'Exploring Peru', 'Stephanie Birchi.', '4', '2005', '005', 'N'),
      ('237-34823', 'Business Strategy', 'Joe Peppard', '2', '2002', '001', 'N'),
      ('23u8-923849', 'A guide to nutrition', 'John Thorpe', '2', '2002', '002', 'N'),
      ('2983-3494', 'Cooking for children', 'Anabelle Sharpe', '1', '2003', '007', 'N'),
      ('82n8-308', 'computers for idiots', 'Susan O''Neill', '5', '1998', '004', 'N'),
      ('9823-23984', 'My life in picture', 'Kevin Graham', '8', '2004', '001', 'N'),
      ('9823-029384', 'My ranch in Texas', 'George Bush', '1', '2005', '001', 'Y'),
      ('9823-98345', 'How to cook Italian an food', 'Jamie Oliver', '1', '2005', '007', 'Y'),
      ('9823-98487', 'Optimising your business', 'Cleo Blair', '1', '2001', '002', 'N'),
      ('988745-234', 'Tara Road', 'Maeve Binchy', '4', '2002', '008', 'N'),
      ('993-004-00', 'My life in bits', 'John Smith', '1', '2001', '001', 'N'),
      ('9987-0039882', 'Shooting History', 'Jon Snow', '1', '2003', '001', 'N');
       
      -- --------------------------------------------------------
       
      --
      -- Table structure for table `bookstableduplicate`
      --
       
      CREATE TABLE IF NOT EXISTS `bookstableduplicate` (
        `ISBN` varchar(32) NOT NULL,
        `BooKTitle` varchar(12) NOT NULL,
        `Author` varchar(32) NOT NULL,
        `Edition` varchar(32) NOT NULL,
        `Year` varchar(32) NOT NULL,
        `Categories` varchar(32) NOT NULL,
        `Rese.` varchar(32) NOT NULL
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
       
      -- --------------------------------------------------------
       
      --
      -- Table structure for table `categories`
      --
       
      CREATE TABLE IF NOT EXISTS `categories` (
        `CategoryID` varchar(4) NOT NULL,
        `CategoryDe.` varchar(22) NOT NULL
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
       
      --
      -- Dumping data for table `categories`
      --
       
      INSERT INTO `categories` (`CategoryID`, `CategoryDe.`) VALUES
      ('001', 'Health'),
      ('002', 'Business'),
      ('003', 'Bioraphy'),
      ('004', 'Technologies'),
      ('005', 'Travel'),
      ('006', 'Self-Help'),
      ('007', 'Cookery'),
      ('008', 'Fiction');
       
      -- --------------------------------------------------------
       
      --
      -- Table structure for table `users`
      --
       
      CREATE TABLE IF NOT EXISTS `users` (
        `Username` varchar(11) NOT NULL,
        `Password` char(6) NOT NULL,
        `FirstName` varchar(22) NOT NULL,
        `Surname` varchar(22) NOT NULL,
        `AddressLine1` varchar(100) NOT NULL,
        `AddressLine2` varchar(100) NOT NULL,
        `City` varchar(22) NOT NULL,
        `Telephone` int(10) NOT NULL,
        `Mobile` int(10) NOT NULL
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
       
      --
      -- Dumping data for table `users`
      --
       
      INSERT INTO `users` (`Username`, `Password`, `FirstName`, `Surname`, `AddressLine1`, `AddressLine2`, `City`, `Telephone`, `Mobile`) VALUES
      ('alanjmckena', 't234s', 'Alan', 'Mckenna', '38 Cranley Road', 'Fairview', 'DUblin', 99983777, 856625567),
      ('joecrotty', 'kj7899', 'Joseph', 'Crotty', 'Apt 5 Clyde Road', 'Donnybrook', 'Dublin', 8887889, 876654456),
      ('tommy100', '123456', 'tom', 'behan', '14 hyde road', 'dalkey', 'dublin', 9983747, 876738782);
       
      /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
      /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
      /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


    Добавлено
    ExpandedWrap disabled
      -- phpMyAdmin SQL Dump
      -- version 3.5.8.2
      -- http://www.phpmyadmin.net
      --
      -- Host: sql100.byetcluster.com
      -- Generation Time: Nov 30, 2018 at 11:25 AM
      -- Server version: 5.6.41-84.1
      -- PHP Version: 5.3.3
       
      SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
      SET time_zone = "+00:00";
       
       
      /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
      /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
      /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
      /*!40101 SET NAMES utf8 */;
       
      --
      -- Database: `fceu_17384599_Books`
      --
       
      -- --------------------------------------------------------
       
      --
      -- Table structure for table `bookstable`
      --
       
      CREATE TABLE IF NOT EXISTS `bookstable` (
        `ISBN` varchar(32) NOT NULL,
        `BooKTitle` varchar(32) NOT NULL,
        `Author` varchar(32) NOT NULL,
        `Edition` varchar(32) NOT NULL,
        `Year` varchar(5) NOT NULL,
        `Categories` varchar(4) NOT NULL,
        `Rese.` varchar(2) NOT NULL
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
       
      --
      -- Dumping data for table `bookstable`
      --
       
      INSERT INTO `bookstable` (`ISBN`, `BooKTitle`, `Author`, `Edition`, `Year`, `Categories`, `Rese.`) VALUES
      ('093-403992', 'Computers in Business', 'Alicia Oneill', '3', '1997', '003', 'N'),
      ('23472-8729', 'Exploring Peru', 'Stephanie Birchi.', '4', '2005', '005', 'N'),
      ('237-34823', 'Business Strategy', 'Joe Peppard', '2', '2002', '001', 'N'),
      ('23u8-923849', 'A guide to nutrition', 'John Thorpe', '2', '2002', '002', 'N'),
      ('2983-3494', 'Cooking for children', 'Anabelle Sharpe', '1', '2003', '007', 'N'),
      ('82n8-308', 'computers for idiots', 'Susan O''Neill', '5', '1998', '004', 'N'),
      ('9823-23984', 'My life in picture', 'Kevin Graham', '8', '2004', '001', 'N'),
      ('9823-029384', 'My ranch in Texas', 'George Bush', '1', '2005', '001', 'Y'),
      ('9823-98345', 'How to cook Italian an food', 'Jamie Oliver', '1', '2005', '007', 'Y'),
      ('9823-98487', 'Optimising your business', 'Cleo Blair', '1', '2001', '002', 'N'),
      ('988745-234', 'Tara Road', 'Maeve Binchy', '4', '2002', '008', 'N'),
      ('993-004-00', 'My life in bits', 'John Smith', '1', '2001', '001', 'N'),
      ('9987-0039882', 'Shooting History', 'Jon Snow', '1', '2003', '001', 'N');
       
      -- --------------------------------------------------------
       
      --
      -- Table structure for table `bookstableduplicate`
      --
       
      CREATE TABLE IF NOT EXISTS `bookstableduplicate` (
        `ISBN` varchar(32) NOT NULL,
        `BooKTitle` varchar(12) NOT NULL,
        `Author` varchar(32) NOT NULL,
        `Edition` varchar(32) NOT NULL,
        `Year` varchar(32) NOT NULL,
        `Categories` varchar(32) NOT NULL,
        `Rese.` varchar(32) NOT NULL
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
       
      -- --------------------------------------------------------
       
      --
      -- Table structure for table `categories`
      --
       
      CREATE TABLE IF NOT EXISTS `categories` (
        `CategoryID` varchar(4) NOT NULL,
        `CategoryDe.` varchar(22) NOT NULL
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
       
      --
      -- Dumping data for table `categories`
      --
       
      INSERT INTO `categories` (`CategoryID`, `CategoryDe.`) VALUES
      ('001', 'Health'),
      ('002', 'Business'),
      ('003', 'Bioraphy'),
      ('004', 'Technologies'),
      ('005', 'Travel'),
      ('006', 'Self-Help'),
      ('007', 'Cookery'),
      ('008', 'Fiction');
       
      -- --------------------------------------------------------
       
      --
      -- Table structure for table `users`
      --
       
      CREATE TABLE IF NOT EXISTS `users` (
        `Username` varchar(11) NOT NULL,
        `Password` char(6) NOT NULL,
        `FirstName` varchar(22) NOT NULL,
        `Surname` varchar(22) NOT NULL,
        `AddressLine1` varchar(100) NOT NULL,
        `AddressLine2` varchar(100) NOT NULL,
        `City` varchar(22) NOT NULL,
        `Telephone` int(10) NOT NULL,
        `Mobile` int(10) NOT NULL
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
       
      --
      -- Dumping data for table `users`
      --
       
      INSERT INTO `users` (`Username`, `Password`, `FirstName`, `Surname`, `AddressLine1`, `AddressLine2`, `City`, `Telephone`, `Mobile`) VALUES
      ('alanjmckena', 't234s', 'Alan', 'Mckenna', '38 Cranley Road', 'Fairview', 'DUblin', 99983777, 856625567),
      ('joecrotty', 'kj7899', 'Joseph', 'Crotty', 'Apt 5 Clyde Road', 'Donnybrook', 'Dublin', 8887889, 876654456),
      ('tommy100', '123456', 'tom', 'behan', '14 hyde road', 'dalkey', 'dublin', 9983747, 876738782);
       
      /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
      /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
      /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


    Добавлено
    ExpandedWrap disabled
      <?php
      // function to connect and execute the query
       
       
      ?>
       
      <!DOCTYPE html>
      <html>
          <head>
              <meta charset="UTF-8">
              <title>Main Assignment: Sports</title>
              <style>
          #header{
          background-color : #AFD0F1;  <!-- background color -->
          border:1px solid red;
              width:1100px;
              height:100px;
              color:blue;              <!-- text blue -->
          text-align:center;
          margin-left: 40px;
          margin-right:40px;
          }
              #horizontal_menu{
          background-color : #F9AF70;  <!-- background color -->
          border:1px solid red;
              width:1100px;
              height:100px;
              color:blue;              <!-- text blue -->
          text-align:center;
          margin-left: 40px;
          margin-right:40px;
          }
          #side_bar_1
          {
              background-color : #A32000;  <!-- background color -->
              border:1px solid red;
              width:200px;
              height:705px;
              color:#FFEA46;              <!-- text blue -->
          text-align:center;
          float:left;
          margin-top:  -1px;
          margin-left: 40px;
          }
              #Bofore_Content
          {
              background-color : #B0C0A0;  <!-- background color -->
              border:1px solid red;
              width:900px;
              height:100px;
              color:blue;              <!-- text blue -->
          text-align:center;
          margin-left: 240px;
          margin-top:  -1px;
          float:center;
          }  
          li.s {
      display: inline;
              
       
      }
       
          #section{
              background-color : #FF4D31;    <!-- background color -->
          border:1px solid red;
          width:900px;
          height:600px;
          color:#FFEA46;             <!-- color text -->
          float:center;
          margin-left: 240px;
          margin-right:139px;
          }  
          
          
              
              </style>
          </head>
                  <body bgcolor="#FFF8D2">
                  
                              <div id="header" style="border-style: solid; border-width: 1px; padding-left: 1px;
                              padding-right: 1px; padding-top: 1px; padding-bottom: 1px"><br>
             Name:          Jurijus Pacalovas<br>
             Student:       C17706201
                              </div>
      <div id="horizontal_menu" style="border-style: solid; border-width: 1px; padding-left: 1px;
       padding-right: 1px; padding-top: 1px; padding-bottom: 1px">
                      <nav>
                      <br>
                      <div align="center">
                          <ul>
                                 <li class="s"><a href="index.php">
                              <font style="font-size:12px"> Home </font></a></li> <!-- login page -->
                              <?php
                              //echo $_SESSION["lg"];    
                              //fg
              //////////////////////////////////////////////////////
                              
                              
                          
                          
                          ?>
                          </ul>
                          </div>
          </nav>
                  </div>  
                  <div id="side_bar_1" style="border-style: solid; border-width: 1px; padding-left: 1px;
                  padding-right: 1px; padding-top: 1px; padding-bottom: 1px">
                  <br><br><br><br
                  <table width="25" height="25" border="1" bgcolor="black" style="border-color: " align="left">
                  <tr>
       
       
      </table>
                  
                  
                  <hr>
                  On our website you can read books
                  </div>  
                  <div id="Bofore_Content" style="border-style: solid; border-width: 1px; padding-left: 1px;
                  padding-right: 1px; padding-top: 1px; padding-bottom: 1px">
                                  <p align="center"><b><font color ="#FFF8D2"><br> Books
                      </font></b></p></div>
                      <div id="section" style="border-style: solid; border-width: 1px; padding-left: 1px;
                      padding-right: 1px; padding-top: 1px; padding-bottom: 1px">
                 <?php
              
       
       
      define("DB_HOST", "sql100.freecluster.eu");
          define("DB_USER", "fceu_17384599");
          define("DB_PASSWORD", "7cgv4wsm");
          define("DB_DATABASE", "fceu_17384599_labdb");
          try{
              $dbConnection = new
      PDO('mysql:dbname='.DB_DATABASE.';host='.DB_HOST.';charset=utf8', DB_USER, DB_PASSWORD);
              $dbConnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
              $dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
          } catch (PDOException $e) {echo 'Connection failed: ' . $e->getMessage();}
          
          foreach ($items as $row)
      {
      //////
      /* login 1 */
      //echo $row[0]." <br> ";
      $row1=$row[0]; $ty2=$row[0];
      $ty3[0]=$ty2[0];$ty4=$ty3[0];
      $dlin3=strlen($ty4);
      if($dlin3==1){$dfq=1;}else{$dfq=0;}
      /* password 5 */
      //echo $row[4]." <br> ";
      ////////////    
                  }//foreach
                  
                  
                  ?>
       
       <!--Form -->
              
              <table width="50" height="50" border="1" bgcolor="black" style="border-color: " align="Left">
              <tr> <td>
              <br>
                 <form action="Register.php" method="postr">
                  <input type="submit" name="search" value="Reload">
                 </form>
                       
                   Please, add a row.
            <form action="Register.php" method="post">
            
            
                 Username <input type="text" name="Username" placeholder="Value To add"><br><br>
                 Password <input type="password" name="Password" placeholder="Value To add"><br><br>
                 FirstName <input type="text" name="FirstName" placeholder="Value To add"><br><br>
                 Surname <input type="text" name="Surname" placeholder="Value To add"><br><br>
                 AddressLine1 <input type="text" name="AddressLine1" placeholder="Value To add"><br><br>
                 AddressLine2 <input type="text" name="AddressLine2" placeholder="Value To add"><br><br>
                 City <input type="text" name="City" placeholder="Value To add"><br><br>
                 Telephone <input type="text" name="Telephone" placeholder="Value To add"><br><br>
                 Mobile <input type="text" name="Mobile" placeholder="Value To add"><br><br>
                  <input type="submit" value="OK" ></input><br><br>
                  
                  
       
            <!-- populate table from mysql database   `Username`, `Password`, `FirstName`, `Surname`, `AddressLine1`, `AddressLine2`, `City`, `Telephone`, `Mobile`  -->
                      <?php
                          if ($_SERVER["REQUEST_METHOD"] == "POST")
                         {
                            
                             $varN1 = $_POST["Username"];
                             $varN2 = $_POST["Password"];
                             $varN3 = $_POST["FirstName"];
                             $varN4 = $_POST["Surname"];
                             $varN5 = $_POST["AddressLine1"];
                             $varN6 = $_POST["AddressLine2"];
                             $varN7 = $_POST["City"];
                             $varN8 = $_POST["Telephone"];
                             $varN9 = $_POST["Mobile"];
                           $sqlq1 = "insert into `users` (`Username`, `Password`, `FirstName`, `Surname`, `AddressLine1`, `AddressLine2`, `City`, `Telephone`, `Mobile`)
                           values('$varN1','$varN2','$varN3','$varN4','$varN5','$varN6','$varN6', '$varN7', '$varN8', '$varN9')";
                           $items = $dbConnection->prepare("$sqlq1");
                           $items->execute();
                          
                            
                         }
                  ?>
                  </table>
                  </div>      
             </table>
            
       
       
              
              
              
              
              
       
       
       
      <br>
      <?php
      function You_have_Sign_in(){
      $df=2;
      echo '<b><font color ="green"> You have Sign in </font></b>';
      }
       
                  if ($_SERVER["REQUEST_METHOD"] == "POSTq")
          {
          
       
          
              $varN1 = $_POST["login"];
              $varN2 = $_POST["pass"];    
              $df=0;
          $df=0; $login=$varN1;
      $pass=$varN2;
      //echo $login." <br> ";
      //echo $pass." <br> ";
      $dlin1=strlen($varN2);
      $dlin2=strlen($varN1);
      if($dlin1>1 && $dlin2>1)
      {$sql = "SELECT * FROM product WHERE PName";}
      if($dlin1>1 && $dlin2>1)
      {
      $items = $dbConnection->prepare("$sql");
      $items->execute();
      foreach ($items as $row)
      {
      //////
      /* login 1 */
      //echo $row[0]." <br> ";
      $row1=$row[0]; $ty2=$row[0];
      $ty3[0]=$ty2[0];$ty4=$ty3[0];
      $dlin3=strlen($ty4);
      if($dlin3==1){$df=1;}else{$df=0;}
      /* password 5 */
      //echo $row[4]." <br> ";
      ////////////    
                  }//foreach
                  
              /////
       
       
       
          
       
      //session
      //echo  $row[0]." <br> ";
       $US1=$row[1];
       $US2=$row[4];
       $US3 = $US1 . ' ' . $US2;
       $US4=$row[0];
       $US6 = $US4;  
       
       
       $dlinq=strlen($US2);
       
       if($dlinq==0)
       {
           echo $_SESSION["lr"]. " <br> ";
          
       }
       else
       {
       $_SESSION["lg"]="$US3";
       $_SESSION["lj"]="$US6";
          
       }
       
       
       
       
      }//if ($_SERVER["REQUEST_METHOD"] == "POSTq")
      }
       
      if(isset($_SESSION["lg"])) //die('');
      {
       echo '<div align="center">';
       You_have_Sign_in();
       echo $_SESSION["lg"]. " <br> ";
      }
       
              ?>
      </td></tr>
      </table>
       
              
              
                  <br><br>
                  </body>
      </html>
      M
      Пожалуйста, оформите ещё раз ваш вопрос понятно и на русском языке.
      Сообщение отредактировано: Serafim -
      0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)
      0 пользователей:


      Рейтинг@Mail.ru
      [ Script execution time: 0,0579 ]   [ 16 queries used ]   [ Generated: 29.03.24, 01:33 GMT ]