forked from dragoplut/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.php
More file actions
99 lines (98 loc) · 4.46 KB
/
Copy pathclient.php
File metadata and controls
99 lines (98 loc) · 4.46 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
session_start();
if (!isset($_SESSION['auth']))
{
header('Location: signin.php');
}
?>
<!DOCTYPE html>
<!-- Building blocks sent to separate php files in folder "/blocks/" -->
<html lang="en">
<!-- all css connection are in "blocks/head.php" -->
<?php include "blocks/head.php" ?>
<body>
<?php include "blocks/header.php";?>
<?php include "blocks/leftmenu.php";?>
<?php
$mysqli = new mysqli('localhost','root','1076891','clients') or die ('Unable to connect with MySQl.');
if (mysqli_connect_errno())
{
printf ("Unable to connect: %s\n", mysqli_connect_error());
exit();
}
if (isset($_POST['id']))
{
$query = $mysqli->prepare("UPDATE clientsinfo SET
first_name = ?,
last_name = ?,
age = ?,
address = ?,
email = ?,
job = ?,
login = ?,
password = ?,
phone_nomber = ?
WHERE id = ?");
$query->bind_param(
"ssissssssi",
$_POST['first_name'],
$_POST['last_name'],
$_POST['age'],
$_POST['address'],
$_POST['email'],
$_POST['job'],
$_POST['login'],
$_POST['password'],
$_POST['phone_nomber'],
$_POST['id']);
$query->execute();
$query->close();
}
$id = $_GET['id'];
$query = "SELECT id,first_name,last_name,age,address,email,job,login,password,phone_nomber,reg_date FROM clientsinfo WHERE id = '$id'";
$result = $mysqli->query($query);
$row = $result->fetch_array(MYSQLI_ASSOC);
if ($row)
{
echo "
<div class='formcontainer-user-data'>
<form class='form-user-data' role='form' method='POST'>
<h2 class='form-signin-heading center-strong'>Client information</h2>
<p class='text-user-data'>First name</p>
<input type='text' class='form-control' name='first_name' value=" . $row['first_name'] . ">
<p class='text-user-data'>Last name</p>
<input type='text' class='form-control' name='last_name' value=" . $row['last_name'] . ">
<p class='text-user-data'>Age</p>
<input type='text' class='form-control' name='age' value=" . $row['age'] . ">
<p class='text-user-data'>E-mail *</p>
<input type='text' class='form-control' required='' name='email' value=" . $row['email'] . ">
<p class='text-user-data'>Phone nomber</p>
<input type='text' class='form-control' name='phone_nomber' value=" . $row['phone_nomber'] . ">
<p class='text-user-data'>Address</p>
<input type='text' class='form-control' name='address' value=" . $row['address'] . ">
<p class='text-user-data'>Job</p>
<input type='text' class='form-control' name='job' value=" . $row['job'] . ">
<p class='text-user-data'>Login *</p>
<input type='text' class='form-control' required='' name='login' value=" . $row['login'] . ">
<p class='text-user-data'>Password</p>
<input type='password' class='form-control' name='password' value=" . $row['password'] . ">
<input type='hidden' class='form-control' name='id' value=" . $row['id'] . ">
<p class='text-user-data'>(* - required fields for input!)</p>
<button class='btn btn-lg btn-primary btn-block' type='submit'>Save changes</button>
</form>
</div>";
}
else
{
echo "<p class='center-strong'>User doesn't exist</p>";
}
echo "</table>";
$result->free();
$mysqli->close();
?>
<!-- connect script files -->
<?php include "blocks/script.php" ?>
</body>
</html>