示例#1
0
                if ($i != 0) {
                    $query = $query . " OR ";
                }
                $query = $query . "datei='" . $_POST['del_datei'][$i] . "'";
            }
            $query = $query . ")";
            mysql_wrap_query($query, $result);
        }
        for ($i = 0; $i < $files; $i++) {
            if (trim($_FILES['datei']['name'][$i]) != "") {
                if (strtolower(substr(trim($_FILES['datei']['name'][$i]), 0, 7)) != "http://") {
                    @move_uploaded_file($_FILES['datei']['tmp_name'][$i], $dir . $_FILES['datei']['name'][$i]);
                }
                $query = "INSERT INTO file VALUES('" . $_FILES['datei']['name'][$i] . "', '" . $_POST['info'][$i] . "', '" . $user_id . "')";
                mysql_wrap_query($query, $result);
            }
        }
        $uploaded_dateien = count($_POST['uploaded_datei']);
        for ($i = 0; $i < $uploaded_dateien; $i++) {
            $query = "UPDATE file SET info='" . $_POST['uploaded_info'][$i] . "' WHERE datei='" . $_POST['uploaded_datei'][$i] . "' AND user_id='" . $user_id . "'";
            mysql_wrap_query($query, $result);
        }
        echo '<div class="upload_ok">Ihr <a href="index.php?id=user&user_id=' . $user_id . '" target="main">Profil</a> ';
        echo 'wurde erfolgreich erstellt/geändert';
        // Den User einloggen, falls er sich frisch-registriert hat
        // d.h: einfach die SESSION-Variablen setzen (Cookie nüsste ja bereits gestzt sein);
        // Funktionalisiseren!
        exit;
        // return to main
    }
}
示例#2
0
function resolve_categories(&$cid, &$bid)
{
    $cids = count($cid);
    if ($cids == 0) {
        return;
    }
    $query = "CREATE TEMPORARY TABLE c1 AS SELECT * FROM category WHERE ";
    for ($i = 0; $i < $cids; $i++) {
        if ($i != 0) {
            $query = $query . " OR ";
        }
        $query = $query . "cid='" . $cid[$i] . "'";
    }
    mysql_wrap_query($query, $result);
    $query = "CREATE TEMPORARY TABLE c2 AS SELECT * FROM c1";
    mysql_wrap_query($query, $result);
    $query = "SELECT c1.* FROM c1 LEFT JOIN c2 ON c1.cid=c2.pid \n\t\tOR c1.cid=-c2.pid WHERE c2.pid IS NULL";
    mysql_wrap_query($query, $result);
    $results = mysql_num_rows($result);
    $j = 0;
    $k = 0;
    $cid = array();
    $bid = array();
    for ($i = 0; $i < $results; $i++) {
        $row = mysql_fetch_object($result);
        $row2 = $row;
        $category = " / " . $row->titel;
        $bildung = $category;
        while ($row2->pid != 0) {
            $query = "SELECT pid, titel FROM category WHERE cid=" . $row2->pid . " OR cid=-" . $row2->pid;
            mysql_wrap_query($query, $result2);
            $row2 = mysql_fetch_object($result2);
            if ($row2->pid >= 0) {
                $category = " / " . $row2->titel . $category;
            }
            $bildung = " / " . $row2->titel . $bildung;
        }
        if ($bildung != $category) {
            $bid[$k] = str_replace("/ Fach / ", "", $bildung);
            $k++;
        }
        if ($row->pid >= 0) {
            $cid[$j] = $category;
            $j++;
        }
    }
    sort($cid);
    sort($bid);
}