Advertisement
Guest User

Untitled

a guest
Jun 1st, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.41 KB | None | 0 0
  1. <?php
  2. //---Db connection---
  3.     $id = $_GET['m'];
  4.     $name = $_GET['z'];
  5.     $host = "localhost";
  6.     $user = "root";
  7.     $pass = "";
  8.     $db_name= "xmsmanagementsystem";
  9.  
  10.     $link = mysql_connect($host, $user, $pass);
  11.     mysql_select_db($db_name); 
  12. //-----------END------------
  13. //checks cookies to make sure they are logged in
  14.  if(isset($_COOKIE['ID_my_site']))
  15.  {
  16.     $username = $_COOKIE['ID_my_site'];
  17.     $pass = $_COOKIE['Key_my_site'];
  18.         $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
  19.     while($info = mysql_fetch_array( $check ))
  20.         {
  21.  
  22.  //if the cookie has the wrong password, they are taken to the login page
  23.         if ($pass != $info['password'])
  24.             {           header("Location: index.php");
  25.             }
  26.  
  27.  //otherwise they are shown the admin area
  28.     else
  29.             {
  30. if(isset($_POST['saveChanges']))
  31. {
  32.     $sql="UPDATE productcomponent
  33.              SET productComponentID = '".$_POST['cid']."',
  34.                  productID = '".$_POST['pid']."',
  35.                  productComponent = '".$_POST['cDis']."',
  36.                  productComponentType = '".$_POST['cType']."',
  37.                  productSerialNumber = '".$_POST['sNum']."',
  38.                  suplierID = '".$_POST['sid']."'
  39.            WHERE productComponentID = '".$_POST['cid']."'"
  40.                  or die(mysql_error());
  41.     $queryUitvoeren= mysql_query($sql);
  42.     echo"
  43.     <center>
  44.     <form><br/><br/>
  45.     <font color='#04B404'><b>Uw veranderingen zijn opgeslagen</b></font><br/>
  46.     <input type ='button' value='Sluiten' id='Sluiten' name='Sluiten' onClick=\"window.close()\">
  47.     </form>
  48.     </center>";
  49. }
  50. else{
  51.     echo"<center><html>
  52.         <body>
  53.         <form name='changeStock' method='post' action='changeStock.php'>
  54.             <table border='1'>
  55.             <tr>
  56.             <td>
  57.             <b>Component id:</b>
  58.             </td>
  59.             <td>
  60.             <input type='text' id='cid' readOnly='true' name='cid' value='$id'>
  61.             </td>
  62.             </tr>
  63.             <tr>
  64.             <td>
  65.             <b>Product id:</b>
  66.             </td>
  67.             <td>
  68.             <input type='text' id='pid' name='pid' readonly='true' value='0'>
  69.             </td>
  70.             </tr>
  71.             <tr>
  72.             <td>
  73.             <b>Component Omschrijving:</b>
  74.             </td>
  75.             <td>
  76.             <input type='text' id='cDis' name='cDis' value='$name' >
  77.             </td>
  78.             </tr>
  79.             <tr>
  80.             <td>
  81.             <b>Component type:</b>
  82.             </td>
  83.             <td>
  84.             <input type='text' id='cType' name='cType'>
  85.             </td>
  86.             </tr>
  87.             <tr>
  88.             <td>
  89.             <b>serie nummer:</b>
  90.             </td>
  91.             <td>
  92.             <input type='text' id='sNum' name='sNum'>
  93.             </td>
  94.             </tr>
  95.             <tr>
  96.             <td>
  97.             <b>Leverancier:</b>
  98.             </td>
  99.             <td>
  100.                            <select name='sid'>".
  101.  
  102.                                 $sql = 'SELECT suplierID, suplierName FROM suplier';
  103.  
  104.                                 $rs = mysql_query($sql);
  105.  
  106.                                 while($row = mysql_fetch_array($rs))
  107.                                 {
  108.                                   echo "<option value=\"".$row['suplierID']."\">".$row['suplierName']."\n  ";
  109.                                 }"
  110.                        </select><br />
  111.             </td>
  112.             </tr> ";
  113.         echo"<tr>
  114.             <td>
  115.             <b>In gebruik:</b>
  116.             </td>
  117.             <td>
  118.             <input type='text' id='inUse' name='inUse' readOnly='true' value='0' >
  119.             </td>
  120.             </tr>
  121.             </table>
  122.             <input type='submit' id='saveChanges' name='saveChanges' value='Opslaan'> <input type='button' id='annuleren' name='annuleren' onClick=\"window.close()\" value='Annuleren'>
  123.             </from>
  124.         </body>
  125. </html></center>";
  126. }
  127.                         }
  128.                         }
  129.                         }
  130.          else{
  131.              header("Location: index.php");
  132.          }
  133. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement