Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST["submit"]))
- {
- $check1 = getimagesize($_FILES["image1"]["tmp_name"]);
- $check2 = getimagesize($_FILES["image2"]["tmp_name"]);
- $check3 = getimagesize($_FILES["image3"]["tmp_name"]);
- if($check1 !== false and $check2 !== false and $check3 !== false)
- {
- $img1 = $_FILES['image1']['tmp_name'];
- $imgContent1 = addslashes(file_get_contents($img1));
- $frontimg = $imgContent1;
- $img2 = $_FILES['image2']['tmp_name'];
- $imgContent2 = addslashes(file_get_contents($img2));
- $backimg = $imgContent2;
- $img3 = $_FILES['image3']['tmp_name'];
- $imgContent3 = addslashes(file_get_contents($img3));
- $intimg = $imgContent3;
- $kms = htmlentities($_POST["kms"]);
- $make = htmlentities($_POST["make"]);
- $model = htmlentities($_POST["model"]);
- $variant = htmlentities($_POST["variant"]);
- $reg = htmlentities($_POST["year"]);
- $color = htmlentities($_POST["color"]);
- $owner = htmlentities($_POST["owner"]);
- $price = htmlentities($_POST["price"]);
- $dbHost = 'localhost';
- $dbUsername = 'root';
- $dbPassword = '';
- $dbName = 'car';
- $db = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName);
- // Check connection
- if($db->connect_error)
- {
- die("Connection failed: " . $db->connect_error);
- }
- $insert = $db->query(" insert into car( frontimg, backimg, intimg, kms, make, model, variant, reg, color, owner, price )
- values ('$frontimg', '$backimg', '$intimg','$kms','$make', '$model', '$variant', '$reg', '$color',
- '$owner','$price') ");
- if($insert)
- {
- echo "data stored successfully";
- }
- else
- {
- echo "Check your query";
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment