Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once ('konfiguration.php');
- function sanitize( $input ){
- return mysql_real_escape_string( htmlspecialchars( stripslashes( trim( $input ) ) ) );
- }
- if(isset($_POST['title']))
- {
- $title = sanitize($_POST['title']);
- $description = sanitize($_POST['description']);
- $applepart = sanitize($_POST['applepart']);
- $partnumber = sanitize($_POST['partnumber']);
- $productcode = sanitize($_POST['productcode']);
- $compatibility = sanitize($_POST['compatibility']);
- $images = sanitize($_POST['images']);
- $price = sanitize($_POST['price']);
- $target = "images/";
- $target = $target . basename( $_FILES['images']['title']);
- $insert = mysql_query("INSERT INTO `adressbuch` (`title`,`description`,`applepart`,`partnumber`,`productcode`,`compatibility`,`images`,`price`) VALUES ('$title','$description','$applepart','$partnumber','$productcode','$compatibility','$images','$price')");
- $pic=($_FILES['images']['title']);
- if(move_uploaded_file($_FILES['images']['tmp_name'], $target))
- {
- echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";
- }
- if (!$insert)
- {
- die('Eintrag konnte nicht gespeichert werden: ' . mysql_error());
- }
- }
- ?>
- <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
- <span>Neuer Eintrag:</span> <br />
- <span>Title</span><input type="text" name="title" /> <br />
- <span>Description</span><textarea cols="16" rows="5" name="description"></textarea> <br />
- <span>Apple Part</span><input type="text" name="applepart" /> <br />
- <span>Part Number</span><input type="text" name="partnumber" /> <br />
- <span>Product Code</span><input type="text" name="productcode" /> <br />
- <span>Compatibility</span><input type="text" name="compatibility" /> <br />
- <span>Image</span><input type="file" name="images" /> <br />
- <span>Price</span><input type="text" name="price" /> <br />
- <input type="submit" value="Speichern"/> <br />
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement