Ejemplo n.º 1
0
function post_job_php($login)
{
    global $link;
    /* formation de la requete */
    $set = array();
    $set["login"] = $login;
    $set["comment_text"] = getclean("comment");
    /* get file content */
    $filename = $_FILES['file']['tmp_name'];
    $content = '';
    print_r($_FILES);
    if ($fp = fopen($filename, 'r')) {
        $content = fread($fp, filesize($filename));
        $content = addslashes($content);
        fclose($fp);
    }
    $set["file_content"] = $content;
    /* formation de la requete */
    $setsql = array();
    foreach ($set as $field => $val) {
        $setsql[] = '`' . $field . '` = "' . $val . '"';
    }
    $strset = implode(", ", $setsql);
    /* execution de la requete */
    $query = "INSERT INTO jobs SET {$strset}, last_event = NOW()";
    if (!$link->query($query)) {
        errmsg("erreur avec la requete :\n" . $query . "\n" . $link->error);
    }
    $id = $link->insert_id;
    rob_log($query . " -- insert_id = {$id}");
    return $id;
}
Ejemplo n.º 2
0
function postclean($s)
{
    /* obsolete remplacer par getclean */
    return getclean($s);
}