?> <p>Sorry, only JPG files are allowed.</p> <?php $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { ?> <p>Sorry, your file was not uploaded.</p> <?php // if everything is ok, try to upload file } else { $moveSuccess = move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file); if ($moveSuccess) { $editedPicPath = hacknrollify(basename($_FILES["fileToUpload"]["name"])); $editedFilename = basename($_FILES["fileToUpload"]["name"]); ?> <p>The file <?php echo $editedFilename; ?> has been uploaded. Check it out below or download it directly.</p> <?php } else { ?> <p>Sorry, there was an error uploading your file.</p> <?php } }
require_once __DIR__ . '/vendor/autoload.php'; include 'hnrsecret.php'; include 'lib_hacknrollify.php'; use Facebook\FacebookRequest; use Facebook\GraphObject; use Facebook\FacebookRequestException; session_start(); $fb = new Facebook\Facebook(['app_id' => $app_id, 'app_secret' => $app_secret, 'default_graph_version' => 'v2.5', 'default_access_token' => isset($_SESSION['facebook_access_token']) ? $_SESSION['facebook_access_token'] : $app_id . '|' . $app_secret]); try { $response = $fb->get('/me?fields=id,picture.width(10000)'); $user = $response->getGraphUser(); // echo 'Name: ' . $user['id']; $url = $user['picture']['url']; $img = $user['id'] . '.jpg'; file_put_contents('originalpics/' . $img, file_get_contents($url)); $editedpath = hacknrollify($img); // echo 'newpath ' . $editedpath; ?> <p>The file has been uploaded.</p> <p>Enjoy your new cover photo below!</p> <img height="150" width="150" src="<?php echo $editedpath; ?> "> <p> <a class="pure-button" href="<?php echo $editedpath; ?> " download="<?php echo "hnr_" . $img;