Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //---Db connection---
- $id = $_GET['m'];
- $name = $_GET['z'];
- $host = "localhost";
- $user = "root";
- $pass = "";
- $db_name= "xmsmanagementsystem";
- $link = mysql_connect($host, $user, $pass);
- mysql_select_db($db_name);
- //-----------END------------
- //checks cookies to make sure they are logged in
- if(isset($_COOKIE['ID_my_site']))
- {
- $username = $_COOKIE['ID_my_site'];
- $pass = $_COOKIE['Key_my_site'];
- $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
- while($info = mysql_fetch_array( $check ))
- {
- //if the cookie has the wrong password, they are taken to the login page
- if ($pass != $info['password'])
- { header("Location: index.php");
- }
- //otherwise they are shown the admin area
- else
- {
- if(isset($_POST['saveChanges']))
- {
- $sql="UPDATE productcomponent
- SET productComponentID = '".$_POST['cid']."',
- productID = '".$_POST['pid']."',
- productComponent = '".$_POST['cDis']."',
- productComponentType = '".$_POST['cType']."',
- productSerialNumber = '".$_POST['sNum']."',
- suplierID = '".$_POST['sid']."'
- WHERE productComponentID = '".$_POST['cid']."'"
- or die(mysql_error());
- $queryUitvoeren= mysql_query($sql);
- echo"
- <center>
- <form><br/><br/>
- <font color='#04B404'><b>Uw veranderingen zijn opgeslagen</b></font><br/>
- <input type ='button' value='Sluiten' id='Sluiten' name='Sluiten' onClick=\"window.close()\">
- </form>
- </center>";
- }
- else{
- echo"<center><html>
- <body>
- <form name='changeStock' method='post' action='changeStock.php'>
- <table border='1'>
- <tr>
- <td>
- <b>Component id:</b>
- </td>
- <td>
- <input type='text' id='cid' readOnly='true' name='cid' value='$id'>
- </td>
- </tr>
- <tr>
- <td>
- <b>Product id:</b>
- </td>
- <td>
- <input type='text' id='pid' name='pid' readonly='true' value='0'>
- </td>
- </tr>
- <tr>
- <td>
- <b>Component Omschrijving:</b>
- </td>
- <td>
- <input type='text' id='cDis' name='cDis' value='$name' >
- </td>
- </tr>
- <tr>
- <td>
- <b>Component type:</b>
- </td>
- <td>
- <input type='text' id='cType' name='cType'>
- </td>
- </tr>
- <tr>
- <td>
- <b>serie nummer:</b>
- </td>
- <td>
- <input type='text' id='sNum' name='sNum'>
- </td>
- </tr>
- <tr>
- <td>
- <b>Leverancier:</b>
- </td>
- <td>
- <select name='sid'>".
- $sql = 'SELECT suplierID, suplierName FROM suplier';
- $rs = mysql_query($sql);
- while($row = mysql_fetch_array($rs))
- {
- echo "<option value=\"".$row['suplierID']."\">".$row['suplierName']."\n ";
- }"
- </select><br />
- </td>
- </tr> ";
- echo"<tr>
- <td>
- <b>In gebruik:</b>
- </td>
- <td>
- <input type='text' id='inUse' name='inUse' readOnly='true' value='0' >
- </td>
- </tr>
- </table>
- <input type='submit' id='saveChanges' name='saveChanges' value='Opslaan'> <input type='button' id='annuleren' name='annuleren' onClick=\"window.close()\" value='Annuleren'>
- </from>
- </body>
- </html></center>";
- }
- }
- }
- }
- else{
- header("Location: index.php");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement