Skip to content
Snippets Groups Projects
Commit 4c814f4b authored by Girvandi Ilyas's avatar Girvandi Ilyas
Browse files

adding more methods into user model

parent 172a0b18
1 merge request!42Projekers - 13515051 - Girvandi Ilyas
......@@ -27,4 +27,44 @@ class User {
mysqli_close($con);
return $result;
}
function saveProfileById($id, $name, $phone, $isDriver, $image) {
$con = mysqli_connect('localhost','root','','projekers');
mysqli_select_db($con,'projekers');
$sql = "update user set name='" . (string)$name . "', phone ='" . (string)$phone . "', isDriver='" .
$isDriver ."', image='" . (string)$image . "' where id=" . $id;
mysqli_query($con, $sql);
mysqli_close($con);
}
function createProfile($name, $username, $email, $password, $phone, $isDriver) {
$con = mysqli_connect('localhost','root','','projekers');
mysqli_select_db($con, 'projekers');
$image = "pikachu.jpg";
$sql = "INSERT INTO user(username, name, email, password, phone, isDriver, image) VALUES('" .
(string)$username . "', '" . (string)$name . "', '" . (string)$email . "', '" . (string)$password. "', '" .
(string)$phone . "', " . $isDriver . ", '" . $image . "')";
mysqli_query($con,$sql);
mysqli_close($con);
}
function getUsername($username) {
$con = mysqli_connect('localhost','root','','projekers');
mysqli_select_db($con,'projekers');
$query = "SELECT id FROM user WHERE username = '" . $username . "'";
$result = mysqli_query($con,$query);
mysqli_close($con);
return $result;
}
function getEmail($email) {
$con = mysqli_connect('localhost','root','','projekers');
mysqli_select_db($con,'projekers');
$query = "SELECT id FROM user WHERE email = '" . $email . "'";
$result = mysqli_query($con,$query);
mysqli_close($con);
return $result;
}
}
\ No newline at end of file
......@@ -3,6 +3,9 @@
<title>Edit-profile</title>
<link href="../css/primary.css" type="text/css" rel="stylesheet">
<link href="../css/edit-profile.css" type="text/css" rel="stylesheet">
<script>
var sessionid = "<?php echo $_GET['id']; ?>";
</script>
<script src="../js/edit-profile.js"></script>
</head>
<body onpageshow="getUserProfile();">
......
......@@ -16,34 +16,35 @@
<br>
<br>
<div class="form-input">
<form action="register.php" method="post">
<form action="../controller/register.php" method="post">
<div class="user-input">
<div class="label-input">Your Name</label></div>
<div class="text-input"><input type="text" name="full-name" maxlength="20"></div>
<div class="text-input"><input type="text" name="full-name"></div>
</div>
<div class="user-input">
<div class="label-input">Username</label></div>
<div class="text-input-with-check"><input type="text" name="username" maxlength="20"></div>
<div class="text-input-with-check"><input type="text" name="username"></div>
<img id="username-status"></img>
<div><img src="../img/check.png" class="check-icon"></div>
<div><img src="../img/delete.png" class="delete-icon"></div>
</div>
<div class="user-input">
<div class="label-input">Email</label></div>
<div class="text-input-with-check"><input type="text" name="email" maxlength="20"></div>
<div class="text-input-with-check"><input type="text" name="email"></div>
<div><img src="../img/check.png" class="check-icon"></div>
<div><img src="../img/delete.png" class="delete-icon"></div>
</div>
<div class="user-input">
<div class="label-input">Password</label></div>
<div class="text-input"><input type="password" name="password" maxlength="20"></div>
<div class="text-input"><input type="password" name="password"></div>
</div>
<div class="user-input">
<div class="label-input">Confirm Password</label></div>
<div class="text-input"><input type="password" name="confirm-password" maxlength="20"></div>
<div class="text-input"><input type="password" name="confirm-password"></div>
</div>
<div class="user-input">
<div class="label-input">Phone Number</label></div>
<div class="text-input"><input type="text" name="phone" maxlength="11"></div>
<div class="text-input"><input type="text" name="phone"></div>
</div>
<br>
<div class="checkbox">
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment