Skip to content
Snippets Groups Projects
Commit 23edcba9 authored by Husnulzaki Wibisono Haryadi's avatar Husnulzaki Wibisono Haryadi
Browse files

Delete profile_page from git

parent 647e7837
1 merge request!45OneHundred - 13515005 - Husnulzaki Wibisono Haryadi
File deleted
<html>
<head>
<title>U Wanna Call Me Beibh?</title>
<link rel="stylesheet" type="text/css" href="../css/default_style.css">
<link rel="stylesheet" type="text/css" href="../css/profile.css">
<link rel="stylesheet" type="text/css" href="../css/header.css">
<link rel="stylesheet" type="text/css" href="../css/switch.css">
</head>
<body>
<div class="frame" id="edit_profile_page">
<div class="header">
<?php
$user_id = $_GET['id'];
include '../database/dbconnect.php';
$query=mysqli_query($con,"SELECT * FROM user WHERE user_id='".$user_id."'") or die(mysqli_error());
if(mysqli_num_rows($query)!=0)
{
$row=mysqli_fetch_assoc($query);
$username = $row['username'];
include("../template/header.php");
}
mysqli_close($con);
?>
</div>
<div class="menu">
<?php include '../template/menu.php';?>
</div>
<h1>Edit Profile</h1>
<div class="edit_profile_frame">
<form name="edit_identity" method="POST" action="update_profile.php" enctype="multipart/form-data">
<div>
<div style="display: inline-block; position: relative; margin-left: 20px; height: 100px; width: 300px;">
<div class="edit_image_frame">
<img id="edit_profile_pict" src="../img/default_profile.jpeg">
</div>
<div class="select_pict">
<input id="file_name" type="text" readonly="readonly">
</div>
<div class="browse_file">
<input type="file" name="profile_pictfile" class="upload_file" onchange="showFileName(this);">
</div>
</div>
<div style="display: inline; position: relative; margin-left: 20px; top: 20px;">
<div style="display: inline-block; position: relative; height: 100px; width: 100px;">
<div style="height: 30px;">
Your Name
</div>
<div style="height: 30px;">
Phone
</div>
<div style="height: 30px;">
Status Driver
</div>
</div>
<div style="display: inline-block; position: absolute; height: 100px; width: 250px;">
<div style="height: 30px; margin-left: 10px;">
<input id="current_name" name="edit_name" type="text" style="height: 20px; width: 260px;">
</div>
<div style="height: 30px; margin-left: 10px;">
<input id="current_phone" name="edit_phone" type="text" style="height: 20px; width: 260px;">
</div>
<div style="height: 30px; margin-left: 10px;">
<label class="switch" style="float: right;">
<input type="checkbox" name="is_driver" value="true">
<span class="slider round"></span>
</label>
</div>
</div>
</div>
</div>
<div>
<input id="hidden_userid" name="hidden_userid" type="text" style="display:none;">
<button class="button" style="float: left;"><a href="profile.php">BACK</a></button>
<input type="submit" value="SAVE" style="float: right;" class="button">
</div>
</form>
</div>
</div>
<?php
echo "<script>document.getElementById('current_name').value = '".$row['name']."'</script>";
echo "<script>document.getElementById('current_phone').value = '".$row['phone']."'</script>";
if (isset($row['pict'])) {
echo "<script>document.getElementById('edit_profile_pict').src ='getProfilePict.php?id=".$user_id."'</script>";
}
echo "<script>document.getElementById('hidden_userid').value =".$user_id."</script>";
?>
<script>
function showFileName(inputFile) {
var arrTemp = inputFile.value.split('\\');
document.getElementById("file_name").value = arrTemp[arrTemp.length - 1];
}
</script>
</body>
</html>
<?php
$user_id = $_GET['id'];
include '../database/dbconnect.php';
$query=mysqli_query($con,"SELECT pict FROM user WHERE user_id='".$user_id."'") or die(mysqli_error());
$row=mysqli_fetch_assoc($query);
mysqli_close($con);
if (isset($row['pict'])) {
header("Content-type: image/jpeg");
echo $row['pict'];
}
?>
<?php
?>
<html>
<head>
<title>U Wanna Call Me Beibh?</title>
<link rel="stylesheet" type="text/css" href="../css/default_style.css">
<link rel="stylesheet" type="text/css" href="../css/profile.css">
<link rel="stylesheet" type="text/css" href="../css/header.css">
</head>
<body>
<div class="frame">
<div class="header">
<?php
$user_id = $_GET['id'];
include '../database/dbconnect.php';
$query=mysqli_query($con,"SELECT * FROM user WHERE user_id='".$user_id."'") or die(mysqli_error());
if(mysqli_num_rows($query)!=0)
{
$row=mysqli_fetch_assoc($query);
$username = $row['username'];
include("../template/header.php");
}
mysqli_close($con);
?>
</div>
<div class="menu_container">
<?php include'../template/menu.php';?>
</div>
<div class="profile_container">
<div class="profile_header">
<div class="profile_title"><h1>My Profile</h1></div>
<div class="edit_profile_button"><a href=<?php echo 'edit_profile.php?id='.$user_id; ?>>✎</a></div>
</div>
<div class="myprofile">
<div class="profilepict_frame">
<img id="profile_pict" src="../img/default_profile.jpeg">
</div>
<div class="profile_info">
<?php
echo "</br><strong>".$row['username']."</strong></br>";
echo $row['name']."</br>";
if ($row['status'] == "driver") {
echo "driver | Rating (xxx Votes)</br>";
}
echo $row['email']."</br>";
echo $row['phone']."</br>";
if (isset($row['pict'])) {
echo "<script>document.getElementById('profile_pict').src ='getProfilePict.php?id=".$user_id."'</script>";
}
?>
</div>
</div>
</div>
</div>
</body>
</html>
<?php
session_start();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
include '../database/dbconnect.php';
if (isset($_FILES) && ($_FILES['profile_pictfile']['size'] > 0) && !empty($_POST['edit_name']) && !empty($_POST['edit_phone']) && !empty($_POST['hidden_userid'])) {
$user_id = $_POST['hidden_userid'];
$new_name = $_POST['edit_name'];
$new_phone = $_POST['edit_phone'];
if(isset($_POST['is_driver']))
{
$status = 'driver';
}
else
{
$status = 'customer';
}
$checkImg = true;
$filePath = $_FILES['profile_pictfile']['tmp_name'];
$fileName = $_FILES['profile_pictfile']['name'];
$fileSize = $_FILES['profile_pictfile']['size'];
$fileType = $_FILES['profile_pictfile']['type'];
if ($_FILES['profile_pictgile']['error'] || !is_uploaded_file($filePath)) {
$checkImg = false;
echo "Error: Error in uploading file. Please try again.";
}
if ($checkImg && !in_array($fileType, array('image/png', 'image/x-png', 'image/jpeg', 'image/pjpeg', 'image/gif'))) {
$checkImg = false;
echo "Error: Unsupported file extension. Supported extensions are JPG / PNG.";
}
if ($checkImg && $fileSize > 16000000) {
$checkImg = false;
echo "Error: File size must be less than 16 MB.";
}
if ($checkImg) {
$fp = fopen($filePath, 'r');
$content = fread($fp, filesize($filePath));
$content = addslashes($content);
fclose($fp);
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}
$query=mysqli_query($con,"UPDATE user set name='".$new_name."',phone='".$new_phone."',status='".$status."',pict='".$content."'WHERE user_id='".$user_id."'") or die(mysqli_error());
}
if($query)
{
header("Location: profile.php?id=$user_id");
}
mysqli_close($con);
}
}
?>
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