-
Notifications
You must be signed in to change notification settings - Fork 34
/
new_open.php
49 lines (36 loc) · 1.3 KB
/
new_open.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
<?php
require 'db.php';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$salary = (float)$_POST['salary'];
$note = $_POST['note'];
$db->exec("INSERT INTO clients(first_name, last_name, salary, note) VALUES ('$first_name', '$last_name', '$salary', '$note')");
header('Location: index.php');
/* SQL INJECT ATTACK
'); DELETE FROM clients; --
*/
}
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>New client - PHP Clients App</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<h1>New client</h1>
<form method="POST">
<label for="first_name">First Name</label><br/>
<input type="text" name="first_name" id="first_name" value="" placeholder=""><br/><br/>
<label for="last_name">Last Name</label><br/>
<input type="text" name="last_name" id="last_name" value=""><br/><br/>
<label for="salary">Salary</label><br/>
<input type="number" name="salary" id="salary" value=""><br/><br/>
<label for="note">Note</label><br/>
<textarea name="note" id="note"></textarea><br/><br/>
<br/>
<input type="submit" value="Save"> or <a href="index.php">Cancel</a>
</form>
</body>
</html>