Ejemplo n.º 1
0
function process_image()
{
    global $target_path;
    global $con;
    //global $dUsername;
    global $fn;
    global $ln;
    global $insert_picture;
    global $dPassport;
    if (isset($_FILES["passport"]["name"])) {
        $file_name = $_FILES["passport"]["name"];
        if ($_FILES["passport"]["error"] > 0) {
            echo "Error in the following file " . $file_name . ":" . $_FILES["passport"]["error"] . "<br />";
        } elseif ($_FILES["passport"]["error"] <= 0) {
            $temp_name = $_FILES["passport"]["tmp_name"];
            $imgtype = $_FILES["passport"]["type"];
            $ext = getImageExtension($imgtype);
            $imgname = $ln . $fn . $ext;
            $target_path = "upload/" . $imgname . "";
            $insert_picture = "INSERT INTO user_profile (Passport)" . " VALUES ('" . mysqli_real_escape_string($con, $target_path) . "')";
            $dPassport = $target_path;
            if (!mysqli_query($con, $insert_picture)) {
                echo mysqli_error($con);
            }
            if (move_uploaded_file($temp_name, $target_path)) {
                return true;
            }
        } else {
            return false;
        }
    } else {
        global $NoFileError;
        $NoFileError = "You did not upload any file";
    }
}
Ejemplo n.º 2
0
function process_image()
{
    global $target_path;
    global $clickFlag;
    global $con;
    global $dUsername;
    global $dFullname;
    $clickFlag = "You did not upload any file";
    if (isset($_FILES["passport"]["name"])) {
        $file_name = $_FILES["passport"]["name"];
        if ($_FILES["passport"]["error"] > 0) {
            echo "Error in the following file " . $file_name . ":" . $_FILES["passport"]["error"] . "<br />";
        } elseif ($_FILES["passport"]["error"] <= 0) {
            $temp_name = $_FILES["passport"]["tmp_name"];
            $imgtype = $_FILES["passport"]["type"];
            $ext = getImageExtension($imgtype);
            $imgname = $dFullname . $ext;
            $target_path = "upload/" . $imgname;
            $insert_picture = "UPDATE user_profile SET Passport = '" . mysqli_escape_string($con, $target_path) . "' WHERE Username = '******'";
            if (!mysqli_query($con, $insert_picture)) {
                echo mysqli_error($con);
            }
            if (move_uploaded_file($temp_name, $target_path)) {
                return true;
            }
        } else {
            return false;
        }
    } else {
        global $NoFileError;
        $NoFileError = "You did not upload any file";
    }
}
Ejemplo n.º 3
0
 * Check for login
 */
if (strcmp($_SERVER["PHP_SELF"], '/login.php') != 0) {
    if ($_SESSION["ValidLogin"] != 1) {
        header("location: login.php?r=" . $_SERVER["PHP_SELF"]);
    }
}
WriteHeader(1, "Nerdery Home", "Edit your information");
if ($page_action == "updateUser") {
    $tmp = realpath(".") . "/temp";
    if (!file_exists($tmp)) {
        mkdir($tmp);
    }
    $tmpfile = $tmp . "/" . $_FILES["signature_file"]["name"];
    if (move_uploaded_file($_FILES["signature_file"]["tmp_name"], $tmpfile)) {
        $ext = getImageExtension($_FILES["signature_file"]["type"]);
        //echo $ext;
        if ($ext == "gif") {
            echo "The Nerdery does not currently support .gif files for signatures.  This will (hopefully) be fixed soon...";
        } else {
            $base = realpath(".") . "/images/signatures/" . $_SESSION["user"]->userID . ".";
            $final = $base . $ext;
            $resizer = new dropShadow(true);
            $resizer->loadImage($tmpfile);
            $resizer->resizeToSize($SIGNATURE_WIDTH, 0);
            $resizer->saveFinal($final);
            copy($final, $base . "sig");
            unlink($final);
            $_SESSION["user"]->signatureFile = 1;
        }
    }