require_once("../private/CodexInitialize.php"); if($session->is_logged_in()) { //user is logged in $loginHide= 'style="display:none;"'; $logoutHide= ''; $usrDisplayName = $_SESSION['usrName']; if ($_SESSION['firstLogin']) { //may want to give tips for first login $firstLogin = true; } //submit profile photo if(isset($_POST['submit_photo'])) { echo ""; $temp_file = $_FILES['photo_file_upload']; $maxphotoId=Photograph::getmax('photoId'); $photoFilename_len = 18; $usr_file_name = basename($temp_file['name']); $fileExt = "." . pathinfo ($usr_file_name, PATHINFO_EXTENSION); $newFilename = str_pad(strval(intval($maxphotoId)+1) , $photoFilename_len, "0", STR_PAD_LEFT) . $fileExt; $photograph = new Photograph(); $photograph->photoCaption = 'Profile picture'; $uploadFolder = $photograph->upload_dir; $new_photoId = $photograph->attach_file($temp_file,$newFilename); if ( $photograph->errors[0] == "") { //create thumbnail $new_photo_thumb = $photograph->create_thumbnail($_POST ['thumb_w'],$_POST ['thumb_h'],$_POST ['thumb_x'],$_POST ['thumb_y']); } else { echo ""; } //header ("location: index.php?profile=1"); $url = "index.php?profile=1"; redirect($url); exit; } } else { //user is not logged $logoutHide= 'style="display:none;"'; $loginHide= ''; $usrName = ''; $usrDisplayName = ''; } ?>