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

edit profile redirection fixed, minor changes on user model

parent da4ad0b6
1 merge request!42Projekers - 13515051 - Girvandi Ilyas
...@@ -37,6 +37,7 @@ if(isset($_POST["submit"])) { ...@@ -37,6 +37,7 @@ if(isset($_POST["submit"])) {
//if(isset(($_POST['image']))) //if(isset(($_POST['image'])))
$image = $_POST['image-file']; $image = $_POST['image-file'];
$user -> updateProfileById($userid,$name,$phone,$isDriver,$image); $user -> updateProfileById($userid,$name,$phone,$isDriver,$image);
header('Location: ../view/edit-profile.php?id=' . $userid);
} }
...@@ -47,5 +47,6 @@ if(isset($_POST["register"])) { ...@@ -47,5 +47,6 @@ if(isset($_POST["register"])) {
} }
} }
$user -> createUser($name,$username,$email,$password,$phone,$isDriver); $user -> createUser($name,$username,$email,$password,$phone,$isDriver);
$id = $user->getUserById($username); $userid = $user->getIdByUser($username);
header('Location: ../view/dashboard.php?id=' . (integer)$user->getIdByUser($username));
} }
...@@ -28,10 +28,10 @@ class User { ...@@ -28,10 +28,10 @@ class User {
return $result; return $result;
} }
function getIdByUser($user) { function getIdByUser($username) {
$con = mysqli_connect('localhost','root','','projekers'); $con = mysqli_connect('localhost','root','','projekers');
mysqli_select_db($con, 'projekers'); mysqli_select_db($con, 'projekers');
$sql = "SELECT id FROM user WHERE username=" . $user; $sql = "SELECT id FROM user WHERE username= '" . $username . "'";
$result = mysqli_query($con, $sql); $result = mysqli_query($con, $sql);
mysqli_close($con); mysqli_close($con);
return $result; return $result;
......
<?php
session_start();
$_SESSION['id'] = 1;
$_SESSION['name'] = 'Pikachu';
?>
<html> <html>
<head> <head>
<title>User Dashboard</title> <title>User Dashboard</title>
......
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