-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit.php
More file actions
24 lines (20 loc) · 874 Bytes
/
edit.php
File metadata and controls
24 lines (20 loc) · 874 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
<?php
session_start();
require_once "database.php";
require_once 'twig.php';
$conn = connection();
if(! isset($_SESSION['username'])) {
echo $twig->render("pesan.html", array("pesan"=>"Anda belum login"));
}
if(isset($_POST['password']) && isset($_POST['email'])) {
$password = md5($_POST['password']);
$email = $_POST['email'];
}
$query = $conn->prepare("update register set password=?, email=? where username= ?");
$query -> bind_param("sss", $password, $email, $_SESSION['username']);
$result = $query->execute();
if($result)
echo $twig->render("pesanUpdate.html", array("pesan"=>"Berhasil update"));
else
echo $twig->render("pesanUpdate.html", array("pesan"=>"Gagal mengupdate data"));
?>