Example #1
0
<?php

error_reporting(E_ALL ^ E_NOTICE);
include_once 'libs/class.database.php';
include_once 'libs/class.session.php';
include_once 'libs/functions.php';
include_once 'libs/tables.config.php';
include_once 'libs/lang.php';
session_start();
$session = new Session();
if (!$session->has_logged_in()) {
    redirect_to("index.php");
}
$target_path = "images/user/";
$mode = $_REQUEST["mode"];
$image_extensions_allowed = array('jpg', 'jpeg', 'png', 'gif', 'bmp');
if ($mode == "user") {
    global $database, $db;
    $username = $database->escape_value($_REQUEST["username"]);
    $password = md5($_REQUEST["cpassword"]);
    $name = $database->escape_value($_REQUEST["name"]);
    $account_type = $_REQUEST["account_type"];
    $status = $_REQUEST["status"];
    $image = $_REQUEST["image"];
    $_SESSION["userEdit_formData"] = $_REQUEST;
    $file_path = $target_path . basename($_FILES['image']['name']);
    $file_name = $_FILES['image']['name'];
    $fileSize = $_FILES['image']['size'];
    $ext = strtolower(substr($file_name, strrpos($file_name, '.') + 1));
    if (!in_array($ext, $image_extensions_allowed)) {
        $exts = implode(', ', $image_extensions_allowed);