-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprocess.php
More file actions
27 lines (22 loc) · 723 Bytes
/
Copy pathprocess.php
File metadata and controls
27 lines (22 loc) · 723 Bytes
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
<?php
session_start();
$pdo = require __DIR__.'/pdo.php';
$str = "You are not logged in";
if(isset($_SESSION['id'])) {
//echo $_SESSION['id'];
} else {
echo addslashes($str);
}
//Get values from form in login.php
$id = $_SESSION['id'];
$geartype = $_POST['geartype'];
$gearname = $_POST['gearname'];
$description = $_POST['description'];
$quantity = $_POST['quantity'];
$weight = $_POST['weight'];
$rating = $_POST['rating'];
//Prevent sql injection
$sql = "INSERT INTO gear1 (userId, gearType, name, description, quantity, weight, rating)
VALUES ('$id', '$geartype', $gearname','$description', '$quantity', '$weight', '$rating')";
$result = $conn->query($sql);
header("Location: dashboard.php");