Ejemplo n.º 1
0
<div class="headline">Admin User Setting</div>
<div class="subhead">

<?php 
if (isset($_POST['sub'])) {
    $action = 'setting';
    if (isset($_GET['action'])) {
        $action = $_GET['action'];
    }
    if ($action == 'logo') {
        if ($_FILES["std_img1"]["type"] == "image/gif" || ($_FILES["std_img1"]["type"] == "image/jpeg" || $_FILES["std_img1"]["type"] == "image/png" || $_FILES["std_img1"]["type"] == "image/pjpeg") && $_FILES["std_img1"]["size"] < 2000000) {
            unlink($logo_directory . "logo.png");
            //if(uploadfile('std_img1','_logo.png','_logo.png','../img',200,200))
            if (move_uploaded_file($_FILES["std_img1"]["tmp_name"], $logo_directory . "logo.png")) {
                echo '<div class="headline1">Logo Changed Successfully !!!</div>';
                ar_imageresize($logo_directory . "logo.png", 200, 200);
            } else {
                echo '<div class="headline1">Failed to change logo  !!!</div>';
            }
            //echo "Stored in: " . "../image/" .$d.".".$a;
        }
    } elseif ($action == 'addcontrol') {
        if ($_POST['adm_pass1'] == $_POST['adm_pass2']) {
            $strSQL = 'select * from us01users where us01username = "******"';
            $result = Query($strSQL);
            if (count($result)) {
                echo '<div class="headline1">Duplicate Name !</div>';
            } else {
                $pass = sha1(md5(sha1($_POST['adm_pass1'])));
                $SQL = "INSERT INTO us01users (us01username,us01password,us01us00uin) VALUES ('{$_POST['adm_name']}','{$pass}',100)";
                if (Query($SQL)) {
Ejemplo n.º 2
0
/**
 * php uploader by Arun Rajthala
 *
 * $filename is source file
 * $newname is the new unique name
 * $folder is the folder where source file is uploaded
 */
function uploadfile($toolname, $filename, $newname, $folder, $width, $height)
{
    if ($_FILES[$toolname]["type"] == "image/gif" || ($_FILES[$toolname]["type"] == "image/jpeg" || $_FILES[$toolname]["type"] == "image/png" || $_FILES[$toolname]["type"] == "image/pjpeg") && $_FILES[$toolname]["size"] < 2000000) {
        //echo $_POST['field'].$a.$_POST['fabric'].$_POST['prop'].$_POST['location'];
        if ($_FILES[$toolname]["error"] > 0) {
            echo "Return Code: " . $_FILES[$toolname]["error"] . "<br />";
            return "false";
        } else {
            //$a= substr($_FILES[$toolname]["name"],-3,3);
            if (file_exists($folder . $newname . $filename)) {
                echo "File already exists. ";
                $file = $newname . $filename;
            } else {
                if (move_uploaded_file($_FILES[$toolname]["tmp_name"], $folder . $newname)) {
                    // echo "Upload Success";
                    $file = $folder . $newname;
                    ar_imageresize($file, $width, $height);
                } else {
                    echo "Upload Unsuccess" . mysql_error();
                }
            }
            return $newname;
        }
    } else {
        if (isset($_FILES[$toolname]) && $_FILES[$toolname]["name"] != "") {
            $file = "";
            echo '<div class="headline1"> Invalid file</div>';
            return false;
        }
    }
}