-
Notifications
You must be signed in to change notification settings - Fork 0
/
controlPnelBack.php
68 lines (49 loc) · 1.69 KB
/
controlPnelBack.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta lang="EN">
<link rel="stylesheet" type="text/css" href="css/styel.css">
<title>osman-shoop</title>
</head>
<body>
<?php
session_start();
//--------contion ------------
$username ="root";
$passwoerd="";
$database = new PDO("mysql:host=localhost;dbname=shoop items;charset=utf8;", $username,$passwoerd);
//--------End conetion--------
//-------add data items--------
if(isset($_POST['submit']))
{
$id=$_POST["id"];
$heading=$_POST["heading"];
$details=$_POST["details"];
$price=$_POST["price"];
$image0=$_POST["image0"];
$linkOfImge=$_POST["image"];
//uplode tha files "the imeg if item
$itme_dir = "imgs/";
$file_dir = $itme_dir.basename($_FILES["image"]["name"]);
$upLodeOk=1;
$imageFileType.strtolower(pathinfo($file_dir,PATHINFO_EXTENSION));
//check if img file is a atual image or fake imge
$check = getimagesize($_FILES["image"]["tmp_name"]);
if($check ==false){
echo "file an imeg". $check["mime"] . ".";
$upLodeOk =1;
}
else{
echo"file type is not real imge";
$upLodeOk=0;
}
$addData =$database->prepare("INSERT INTO `items`(`id`,`heading`, `details`, `price`, `image0`,`linkOfImge`) VALUES ('$id','$heading','$details','$price','$file_dir','$linkOfImge')");
$addData->execute();
// mov of the nex data
header("location:\shoop/control-panel.php");
;
}
?>
</body>
</html>