<?php require 'navbar.php'; ?> <div class="centered" style="margin-top:24px; max-width: 100%;"> <div class="vertical-section" style="padding:0;"> <?php echo "<div class=\"title\" style=\"padding:24px\">" . "<iron-icon onclick=\"location.href ='login.php?fx=logout&value=true'\" id=\"logout\" icon=\"exit-to-app\" style=\"margin-right:24px; cursor:pointer\"></iron-icon>" . $_SESSION["NOME"] . " " . $_SESSION["COGNOME"] . "<div class=\"flex\"></div>" . "<iron-icon onclick=\"location.href ='changeInformation.php'\" id=\"settings\" icon=\"settings\" style=\"cursor:pointer\"></iron-icon></div>"; ?> <paper-tooltip for="logout" position="top" offset="0" animation-delay="0">Logout</paper-tooltip> <paper-tooltip for="settings" position="top" offset="0" animation-delay="0">Settings</paper-tooltip> <div style="padding:24px; background-image:url('img/bg1.jpg'); background-size:cover"> <div id="avatar"> <?php echo "<img id=\"preview\" src='" . requestPath() . "/profile.jpg'>"; ?> <img id="preview" src="img/default.jpg" > </div> </div> <div class="account"> <div class="sections row" style="margin-bottom:0;"> <div class="card col l2 m6 s12" id="following"> <div class="number"> <?php $QUERY = executeQuery("select * FROM utenti_seguono_utenti where FK_UTENTE=" . $_SESSION["ID"]); echo $QUERY->num_rows; ?> </div> <div class="subtitle">FOLLOWING</div> <paper-ripple recenters></paper-ripple>
<?php echo "<img id=\"preview\" src='" . requestPath() . "/profile.jpg'>"; ?> </div> </div> <?php $data = requestData(); ?> <form style="padding:12px 24px; padding-bottom:24px;" id="formPost" action="functions.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="<?php echo ini_get("session.upload_progress.name"); ?> " value="123" /> <input type="hidden" value="changeInformation" name="getpage"> <input value="<?php echo requestPath() . '/profile.jpg'; ?> " accept=".jpg,.jpeg" type="file" name="fileToUpload" id="fileToUpload" style="display:none;visibility:hidden;"> <paper-input required id="currentPassword" error-message="Insert password!" name="password" label="Current Password" type="password"></paper-input> <input type="text" name="currentPasswordInvisible" value="<?php echo $data["PASSWORD"]; ?> " id="currentPasswordInvisible" style="display:none"> <paper-input disabled id="password" error-message="Insert password!" name="password" label="Password" type="password"> <paper-icon-button style="color:#424242" id="passwordIcon" suffix onclick="showPassword();" icon="visibility" alt="visibility" title="visibility"></paper-icon-button> </paper-input> <paper-textarea value="<?php echo $data["DESCRIPTION"]; ?> " id="description" name="description" label="Description" type="text" char-counter maxlength="300" disabled></paper-textarea> <input type="text" name="descriptionhidden" value="<?php
function imageUpload() { if ($_FILES['fileToUpload']['size'] == 0 || $_FILES['fileToUpload']['error'] != 0) { echo "Error!"; } else { // Qua diamo il nome all'immagine $_FILES['fileToUpload']['name'] = "profile." . pathinfo($_FILES['fileToUpload']['name'], PATHINFO_EXTENSION); $target_file = requestPath() . "/profile.jpg"; $uploadOk = 1; $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION); // Check if image file is a actual image or fake image $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); if ($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 5000000) { echo "Sorry, your file is too large."; $uploadOk = 0; } // Allow certain file formats if ($imageFileType != "jpg" && $imageFileType != "jpeg") { echo "Sorry, only JPG & JPEG files are allowed."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; // if everything is ok, try to upload file } else { if (convertImage($_FILES["fileToUpload"]["tmp_name"], $target_file, 100)) { echo "The file " . basename($_FILES["fileToUpload"]["name"]) . " has been uploaded."; } else { echo "Sorry, there was an error uploading your file."; } } } }