} } else { $strClm = "db_id, doc_id, field_name, no, type, value"; $strField = "comboWorkType"; $strTgtVal = $obj["comboWorkType" . $i]; $strValue = "'{$strDBID}' , '{$strDocID}' , '{$strField}' , 0 , 11 , '{$strTgtVal}'"; $result = insertSQL($con, $db, $strClm, $strValue, $strTable, $strWhere); if ($result == false) { goto NsSome_ERROR; } } if ($blnPaperStatusflg) { $strValue = $obj["strPaperStatus" . $i]; $strField = "strPaperStatus"; $strWhere = $strWhereBF . "and field_name='" . $strField . "' "; $result = updateSQL($con, $db, $strClm, $strValue, $strTable, $strWhere); if ($result == false) { goto NsSome_ERROR; } } else { $strClm = "db_id, doc_id, field_name, no, type, value"; $strField = "strPaperStatus"; $strTgtVal = $obj["strPaperStatus" . $i]; $strValue = "'{$strDBID}' , '{$strDocID}' , '{$strField}' , 0 , 11 , '{$strTgtVal}'"; $result = insertSQL($con, $db, $strClm, $strValue, $strTable, $strWhere); if ($result == false) { goto NsSome_ERROR; } } //*******名前の変更******** $intType = $obj["intType" . $i];
$m['png_status'] = '1'; updateSQL('ppt', $m, "`id`='{$ra[$i]['id']}'"); `rm -fr {$base_dir}/tmp/png/{$ra[$i]['id']}`; `mkdir {$base_dir}/tmp/png/{$ra[$i]['id']} -p`; `cp {$base_dir}/OUTPUT/pdf/{$ra[$i]['id']}.pdf {$base_dir}/tmp/png/{$ra[$i]['id']}/{$ra[$i]['id']}.pdf`; `cd {$base_dir}/tmp/png/{$ra[$i]['id']} && convert {$ra[$i]['id']}.pdf {$ra[$i]['id']}.png`; $files = glob("{$base_dir}/tmp/png/{$ra[$i]['id']}/*.png"); natcasesort($files); $files = array_values($files); deleteSQL("ppt_items", "`ppt_id`='{$ra[$i]['id']}'"); for ($j = 0; $j < count($files); $j++) { $p = $j + 1; `cd {$base_dir}/tmp/png/{$ra[$i]['id']} && /usr/bin/pdftotext -f {$p} -l {$p} {$ra[$i]['id']}.pdf {$j}.txt`; $bn = basename($files[$j]); $m = array(); $m['ppt_id'] = $ra[$i]['id']; $m['filename'] = $bn; $m['page'] = $j + 1; $m['contents'] = file_get_contents("{$base_dir}/tmp/png/{$ra[$i]['id']}/{$j}.txt"); $m['keyword'] = ""; $m['kind'] = ""; $m['grades'] = "0"; insertSQL("ppt_items", $m); } `mkdir {$base_dir}/OUTPUT/png/{$ra[$i]['id']} -p`; `cp {$base_dir}/tmp/png/{$ra[$i]['id']}/*.png {$base_dir}/OUTPUT/png/{$ra[$i]['id']}/`; `rm -fr {$base_dir}/tmp/png/{$ra[$i]['id']}`; $m = array(); $m['png_status'] = '2'; updateSQL('ppt', $m, "`id`='{$ra[$i]['id']}'"); }
exit; break; case 'download': $GETS_STRING = "ppt_id,id"; $GETS = getGET_POST($GETS_STRING, 'GET'); $SQL = "SELECT * FROM `ppt` WHERE `id`=? LIMIT 1"; $ra = selectSQL_SAFE($SQL, array($GETS['ppt_id'])); download_file("{$base_dir}/upload/{$ra[0]['filename']}", "{$ra[0]['orin_filename']}"); $ppt_info = pdo_get_assoc_from_id('ppt', $GETS['ppt_id']); $m = array(); $m['grades'] = $ppt_info['grades'] + 1; updateSQL('ppt', $m, "`id`='{$GETS['ppt_id']}'"); $ppt_items_info = pdo_get_assoc_from_id('ppt_items', $GETS['id']); $m = array(); $m['grades'] = $ppt_info['grades'] + 1; updateSQL('ppt_items', $m, "`id`='{$GETS['id']}'"); exit; break; case 'searchcode': $POSTS_STRING = "searchcode,kind"; $POSTS = getGET_POST($POSTS_STRING, 'POST'); $mSEARCHCODES = explode(",", $POSTS['searchcode']); $SQL_APPEND = ""; $SQL_KIND = ""; $PA = array(); switch (strtolower($POSTS['kind'])) { case '': break; case 'ppt': $SQL_KIND = " AND `A`.`kind` like ? "; array_push($PA, "%ppt%");
<?php //echo _DIR_; require '../controller/dbsettings.php'; if (isset($_GET['db'])) { $db = $_GET['db']; } else { $db = "facts"; } if (isset($_POST['Submit']) && $_POST['Submit'] == "Submit") { if ($db == "facts") { updateCountry($_POST['country'], $_POST['url']); } else { updateSQL($_POST['id'], $_POST['url']); } } $source = getURL(); //echo "dsf"; //echo $source; function createImageTag($url, $highlight) { return "<img src = {$url} alt = '{$highlight}' onclick = 'check(this)' class = 'imgButton' height = '200' width = '250'>"; } //echo "~".$source."~"; preg_match('/^(.+), (.+)\\n\\[(.+)\\]$/', $source, $nameCapture); //print_r($nameCapture); preg_match_all('/[\'"]?(\\S+)[\'"]?/', $nameCapture[3], $imageCapture); //'/([^,]+)/' captures those ,'s inside the links -.- $outputSource = "<html>\n\t<style>\n\t\t.imgButton{\n\t\t\tcursor: pointer;\n\t\t\talign: center;"; $outputSource .= "\n\t\t}\n\t\t.imgButton:hover{\n\t\t\tborder: 2px solid #ccc\n\t\t}\n\t\t"; $outputSource .= ".cell{\n\t\t\tmin-width: 250;\n\t\t\tmin-height: 200;\n\t\t\talign: center;\n\t\t\tmax-width: 265;";
<?php require_once 'defaultincludes.inc'; /* Récupération des variables */ static $NAME_DB = "mrbs_config"; $name = $_GET['name']; $data = $_GET['data']; /* Update des résultats */ $conn = connectToDatabase($NAME_DB); foreach ($data as $value) { if (isset($value['name']) && isset($value['value'])) { updateSQL($name, $value['name'], addslashes($value['value']), $conn); } else { if (is_array($value)) { $sub = $value; foreach ($sub as $value) { if (isset($value['name']) && isset($value['value']) && $value['name'] == "title") { $name = $value['value']; } else { if (isset($value['name']) && isset($value['value'])) { updateSQL($name, $value['name'], addslashes($value['value']), $conn); } } } } } } closeSQL($conn);
$commandData = $_POST['command']; return $commandData; } if (strcmp(getCommand(), "insertToSQL") == 0) { $nameToInsert = $_POST['username']; $passToInsert = $_POST['password']; insertToSQL($nameToInsert, $passToInsert, SQLConnect(), "LoginSystem"); } else { if (strcmp(getCommand(), "getFromSQL") == 0) { getFromSQL(SQLConnect(), "LoginSystem"); } else { if (strcmp(getCommand(), "updateSQL") == 0) { $nameToUpdate = $_POST['username']; $passToUpdate = $_POST['password']; /* needs the new ones too, deal with that later */ updateSQL($nameToUpdate, $passToUpdate, SQLConnect()); } else { if (strcmp(getCommand(), "loginCheck") == 0) { $name = $_POST['username']; $pass = $_POST['password']; loginCheck($name, $pass, SQLConnect()); } else { if (strcmp(getCommand(), "deleteFromSQL") == 0) { $name = $_POST['username']; echo $name; deleteFromSQL($name, SQLConnect()); } else { die("Invalid command."); /* die prints a message, in the bracket and exits the script */ } }
} */ //-----on s'occupe de la BBD----- $nomsIMG = ""; /*if ($nbreFILE != 0) { foreach ($tableauIMGx["nomimg"] as &$value) { $nomsIMG .= "{$value}/" ;} // on concatene les valeurs $nomsIMG = substr($nomsIMG, 0, -1); }*/ //############CONNECTION BBD############### if (connection($dbb)) { if ($nomsIMG == "") { $parametres = array("colonnes" => array("titre", "contenu", "sujet"), "valeurs" => array($_POST['titre'], $_POST['contenu'], $_POST['sujet'])); } else { $parametres = array("colonnes" => array("date", "titre", "contenu", "sujet", "auteur", "nomcouverture", "nbreIMG", "nomsIMG"), "valeurs" => array($_POST['titre'], $_POST['contenu'], $_POST['sujet'], $_POST['pseudo'], 'default.jpg', $nbreFILE, $nomsIMG)); } $rep = updateSQL($dbb, 'articles', $parametres, $_POST['id']); if ($rep != FALSE) { if ($nbreFILE != 0) { for ($i = 0; $i < $nbreFILE; $i++) { move_uploaded_file($tableauIMGx["tmp_nameimg"][$i], $tableauIMGx["dest_finimg"][$i]); } } header('location: ../index.php'); // puis redirection vers la page de rédaction } else { echo "error ma tête"; } } else { echo $dbb; }
} $db_selected = mysql_select_db('sample', $link); if (!$db_selected) { die('データベース選択失敗です。' . mysql_error()); } $result = mysql_query('SELECT * FROM boards'); if (!$result) { die('クエリーが失敗しました。' . mysql_error()); } $row = mysql_fetch_row($result); //while ($row = mysql_fetch_assoc($result)) { // print($row['id']); // print($row['name']); //} $aaa = selectSQL($link, $db_selected, "count(*)", "boards", "id = 1"); $bbb = updateSQL($link, $db_selected, "name", "aiueo", "boards", "id = 1"); $ccc = insertSQL($link, $db_selected, "id", 10, "boards"); function selectSQL($objCon, $selectDB, $strClm, $strTable, $strWhere) { $strSql = "select " . $strClm; $strSql .= " from " . $strTable; $strSql .= " where " . $strWhere; //$result = mysql_query('SELECT * FROM boards'); // $result = mysql_query($strSql,$objCon); $result = mysql_query($strSql); $row = mysql_fetch_row($result); return $row; } function updateSQL($objCon, $selectDB, $strClm, $strValue, $strTable, $strWhere) { $strSql = "update " . $strTable;