function PHPTutorials() { //echo$ip=getIp(); echo "\n<div class='container_fluid'>\n<center><table width='800'>\n <tr>"; openDB(); $getPro_id = mysql_query("select * from products where product_link='php.php'"); $split = 0; while ($row_pro = mysql_fetch_array($getPro_id)) { $prod_id = $row_pro['product_id']; $prod_title = $row_pro['product_title']; $prod_price = $row_pro['product_price']; $prod_image = $row_pro['product_image']; $pro_desc = $row_pro['product_desc']; $split++; echo "\n\t\t\t\t\t\t<td width='400' style='padding:5px;'><h3>{$prod_title}</h3>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t<a href='../pages/details2.php?pro_id={$prod_id}'>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t<image src='../Images/{$prod_image}' width='200' height='100'></image></a>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t<h4><strong>Price: \$ {$prod_price}</strong></h4>\n\t\t\t\t\t\t<br><br><h4>Description:</h4><br>{$pro_desc}<br><br>\n\t\t\t\t\t\t<a href='../pages/details2.php?pro_id={$prod_id}'>Details</a>\n\t\t\t\t\t\t<a href='http://www.smcleodtech.com.au/index.php?add_cart={$prod_id}'>\n\t\t\t\t\t\t<button>Add to Cart</button></a></td>"; if ($split % 3 == 0) { echo "\n\t\t\t\t\t\t</tr><tr>"; } } cart(); closeDB(); echo "</tr><br>\n </table></center>\n </div>"; }
function checkTypeUser($user, $password) { $bd = openDB(); $retorn = false; if ($bd != false) { $sql = $bd->prepare("SELECT `idTypeUser` FROM `users` WHERE userName = ? AND password = ?"); $sql->bindParam(1, $user, PDO::PARAM_STR); $sql->bindParam(2, $password, PDO::PARAM_STR); $sql->execute(); $resultat = $sql->fetchAll(PDO::FETCH_ASSOC); if ($resultat) { foreach ($resultat as $fila) { foreach ($fila as $valor) { $retorn = $valor; } } //$retorn = $idCicle; echo "Valor de Retorn: " . $retorn; } else { //echo "FAIL - ID CURS: ".$idCourse; $retorn = false; } } $bd = null; return $retorn; }
function saveToDB() { $db = openDB(); //Patient table $patientSQL = $db->prepare('INSERT INTO Patient ( patient_insee, patient_firstName, patient_lastName, patient_dateOfBirth, patient_sex, patient_size, patient_weight, patient_typeOfID, patient_insurancePlanIdentification, patient_countryOfResidence) VALUES ( :insee, :firstName, :lastName, :dateOfBirth, :sex, :size, :weight, \'INSEE\', \'INSEE\', :countryOfResidence) ON DUPLICATE KEY UPDATE patient_firstName=:firstName, patient_lastName=:lastName, patient_dateOfBirth=:dateOfBirth, patient_sex=:sex, patient_size=:size, patient_weight=:weight, patient_countryOfResidence=:countryOfResidence;'); $patientSQL->execute(array('insee' => $_SESSION['patient_insee'], 'firstName' => $_SESSION['patient_firstName'], 'lastName' => $_SESSION['patient_lastName'], 'dateOfBirth' => $_SESSION['patient_dateOfBirth'], 'sex' => $_SESSION['patient_sex'], 'size' => $_SESSION['patient_size'], 'weight' => $_SESSION['patient_weight'], 'countryOfResidence' => $_SESSION['patient_countryOfResidence'])); $patientSQL->closeCursor(); $examenSQL = $db->prepare('INSERT INTO Examen ( examen_instanceCreationDateTime, examen_procedureCodeSequence, examen_institutionalDepartementName, examen_protocolName, examen_performedProcedureStepID, examen_performedProcedureStepDescription, examen_contentDateTime, examen_instanceCreatorUID, bodyPart_anatomicRegionSequence, anatomicOrientation_name, posture_name, operateur_name, realisateur_performingPhysicianName, prescripteur_referringPhysicianName, patient_insee) VALUES ( :time, \'DEFAULT PROCEDURE CODE SEQUENCE\', \'TODO\', \'DEFAULT PROTOCOL\', \'DEFAULT PROCEDURE STEP ID\', \'DEFAULT PROCEDURE STEP DESCRIPTION\', :time, \'DEFAULT INSTANCE CREATOR UID\', :bodyPart, :anatomicOrientation, :posture, :operateur, :realisateur, :prescipteur, :insee );'); $examenSQL->execute(array('time' => date("Y-m-d H:i:s"), 'bodyPart' => $_SESSION['examen_bodyPart'], 'anatomicOrientation' => $_SESSION['examen_anatomicOrientation'], 'posture' => $_SESSION['examen_posture'], 'operateur' => $_SESSION['medic_operateur'], 'realisateur' => $_SESSION['medic_prescripteur'], 'prescipteur' => $_SESSION['medic_realisateur'], 'insee' => $_SESSION['patient_insee'])); $examenSQL->closeCursor(); }
function main() { global $wonitorDb; $db = openDB($wonitorDb); try { queryDB($db); } catch (PDOException $e) { echo $e->getMessage(); } closeDB($db); }
function getStudentsCourseCollect($idCourse) { $bd = openDB(); $retorn = false; if ($bd != false) { //En funció del curs.. if ($idCourse == 100) { $sql = $bd->prepare("SELECT idStudent, studentName FROM students WHERE idCourseCollect = 101 OR idCourseCollect = 102"); } else { if ($idCourse == 200) { $sql = $bd->prepare("SELECT idStudent, studentName FROM students WHERE idCourseCollect = 201 OR idCourseCollect = 202"); } else { if ($idCourse == 300) { $sql = $bd->prepare("SELECT idStudent, studentName FROM students WHERE idCourseCollect = 301 OR idCourseCollect = 302"); } else { if ($idCourse == 400) { $sql = $bd->prepare("SELECT idStudent, studentName FROM students WHERE idCourseCollect = 401 OR idCourseCollect = 402 OR idCourseCollect = 403"); } else { if ($idCourse == 500) { $sql = $bd->prepare("SELECT idStudent, studentName FROM students WHERE idCourseCollect = 501 OR idCourseCollect = 502"); } else { if ($idCourse == 600) { $sql = $bd->prepare("SELECT idStudent, studentName FROM students WHERE idCourseCollect = 601 OR idCourseCollect = 602"); } else { return false; } } } } } } $sql->execute(); $resultat = $sql->fetchAll(PDO::FETCH_ASSOC); if ($resultat) { $retorn = $resultat; } else { echo "FAIL - ID CURS: " . $idCourse; $retorn = false; } } $bd = null; return $retorn; }
function consultaDades($request, $data1, $data2) { $connexio = openDB(); if ($connexio) { $var = 1; if ($request == 1) { //M'he quedat aquí, que no està gaire clar com fer la continuació sense reescriure les mateixes funcions. //$codiSql = 'SELECT count(b.idBookData) as idBookData FROM studentbookcollect AS sbc INNER JOIN books AS b ON sbc.idBook = b.idBook WHERE sbc.idStudent = ?'; $codiSql = 'SELECT b.idBookData FROM studentbookcollect AS sbc INNER JOIN books AS b ON sbc.idBook = b.idBook WHERE sbc.idStudent = ?'; $consulta = $connexio->prepare($codiSql); $consulta->bindParam(1, $data1, PDO::PARAM_INT); //ID Estudiant. } else { if ($request == 2) { $codiSql = 'SELECT `idBookState` FROM `books` WHERE `idBookData` = ? AND `bookNumber` = ?'; $consulta = $connexio->prepare($codiSql); $consulta->bindParam(1, $data1, PDO::PARAM_INT); $consulta->bindParam(2, $data1, PDO::PARAM_INT); } } $consulta->execute(); $resultat = $consulta->fetchAll(PDO::FETCH_ASSOC); //print_r($resultat); if ($resultat) { //Si troba dades return $resultat; } else { if (!$resultat) { //Si es null return 5; } else { if ($connexio) { //Si la connexió falla return 4; } else { //Si passa alguna cosa que ni Déu sap que collons ha passat, passem per aquí :D return false; } } } } }
function userRegister($first, $last, $user, $e, $pass) { $dbh = openDB(); $stmt = $dbh->prepare("INSERT INTO users (first_name, last_name,username,email,password,signup_date) VALUES (:first_name, :last_name,:username,:email,:password,:signup)"); $stmt->bindParam(':first_name', $first_name); $stmt->bindParam(':last_name', $last_name); $stmt->bindParam(':username', $username); $stmt->bindParam(':email', $email); $stmt->bindParam(':password', $password); $stmt->bindParam(':signup', $signup_date); // insert one row $first_name = $first; $last_name = $last; $username = $user; $email = $e; $password = $pass; $signup_date = time(); $stmt->execute(); $dbh = null; }
function getChunkData($space) { $db =& openDB(); $sql = "SELECT id,name,s_lat,s_long FROM sites WHERE half_degree_index=?"; $res =& $db->query($sql, array($space)); if (DB::isError($res)) { die("query " . $res->getMessage()); } ob_start(); print "{\r\n contains: \"{$space}\",\r\n"; print " \"{$space}\": [ \r\n"; $count = 0; while ($row =& $res->fetchRow()) { $name = str_replace("\"", "\"\"", $row['name']); if ($count++ > 0) { print ",\r\n"; } print " {i: \"{$row['id']}\", lt: {$row['s_lat']}, ln: {$row['s_long']}, name: \"" . htmlspecialchars($name) . "\" }"; } print "\r\n ]\r\n}"; $data = ob_get_contents(); ob_end_clean(); return $data; }
ini_set('display_startup_errors', 1); require_once 'dbUtil.php'; function info($stringy) { echo 'Info: ' . $stringy . '<br \\>'; } function warning($string) { echo 'Warning: ' . $string . '<br \\>'; } function error($string) { die('Error: ' . $string); } // rounds.sqlite3 if (databaseExists($wonitorDb)) { try { $db = openDB($wonitorDb); $query = 'SELECT COUNT(1) as count FROM rounds WHERE averageSkill<0'; $numentries = $db->query($query, PDO::FETCH_NUM)->fetchAll(PDO::FETCH_COLUMN, 0)[0]; if ($numentries != 0) { info('Found rounds with negative averageSkil. Will set them to 0 now.'); $query = 'UPDATE rounds SET averageSkill=0 WHERE averageSkill<0'; $db->query($query, PDO::FETCH_NUM); } closeDB($db); } catch (PDOException $e) { warning($e->getMessage()); } } echo 'All done.';
ob_end_flush(); $login_output .= $login_preamble; $login_output .= "<div class='alert alert-warning'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><p><strong>Whoops!</strong> " . $res['message'] . "</p><aside class='ssmall'>Did you mean to <a href='?q=create' class='alert-link'>create a new account instead?</a> Or did you need to <a href='#' class='alert-link do-password-reset'>reset your password?</a></aside>\n<p class='small'>As a reminder, we require a password of at least {$minimum_password_length} characters with at least <strong>one upper case</strong> letter, at least <strong>one lower case</strong> letter, and at least <strong>one digit or special character</strong>.</p>\n </div>"; $failcount = intval($_POST['failcount']) + 1; $loginform_whole = $loginform . "\n <input type='hidden' name='failcount' id='failcount' value='{$fail}'/>" . $loginform_close; if ($failcount < 10) { $login_output .= $loginform_whole; } else { $result = lookupItem($_POST['username'], 'username', null, null, false, true); if ($result !== false) { $userdata = mysqli_fetch_assoc($result); $id = $userdata['id']; } $query = "UPDATE `{$default_user_table}` SET dtime=" . $user->microtime_float() . " WHERE id={$id}"; $query2 = "UPDATE `{$default_user_table}` SET disabled=true WHERE id={$id}"; $l = openDB(); $result1 = mysqli_query($l, $query); if (!$result1) { echo "<div class='alert alert-warning'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><p>" . mysqli_error($l) . "</p></div>"; } else { $result2 = execAndCloseDB($l, $query2); if (!$result2) { echo "<div class='alert alert-warning'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><p>" . mysqli_error($l) . "</p></div>"; } else { $login_output .= "<div class='alert alert-danger'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><p><strong>Sorry, you've had ten failed login attempts.</strong> Your account has been disabled for 1 hour.</p></div>"; } } } } } } else {
$oModBase->loadLibrary('menu'); $oModBase->loadLibrary('session'); $oModBase->loadLibrary('componentes'); $oModBase->loadLibrary('window'); //$oModBase->loadLibrary('mapa'); if ( MODO_ADMIN === true) $oModBase->loadLibrary('interfaces'); else $oModBase->addHeadFile( 'templates/style_inc.php' ); $aModule[$cModule]->copy( &$oModBase , false ); $aModule[$cModule]->oUserSession = new UserSession(); $aModule[$cModule]->oMenu = new Menu( 'body_main' ); $aModule[$cModule]->bPermisosDB = true; //$aModule[$cModule]->oDatabase = openDB( DB_MYSQL, 'localhost', 'librosar', 'cal', 'isbn1982'); $aModule[$cModule]->oDatabase = openDB( DB_MYSQL, 'localhost', 'git', 'root', 'c4r4m3l0'); $aModule[$cModule]->oDatabase->connect(); $aModule[$cModule]->addStyleSheet( "bue.css" ); $aModule[$cModule]->setTemplateHead( $oModBase->getTemplateHead() ); $ncMenu = getParam(ncMenu, START_MENU); global $aMenu ; require_once( PATH_MODULES . '/portal/componentes_lib.php'); $aMenu = traer_menu( $aModule[$cModule]->oDatabase, $oModBase->getLanguage() , $ncMenu) ; if ( $nMenu && $nSeccion ) $aMenu[cdSeccion] = extractLanguage($aModule[$cModule]->oDatabase->getData("SELECT cdMenu FROM gtMenu WHERE ncMenu = $nSeccion"), $aModule[$cModule]->getLanguage() );; if ( $nMenu && $nOrden ) $aMenu[dSubseccion] = extractLanguage($aModule[$cModule]->oDatabase->getData("SELECT cdMenu FROM gtMenu WHERE ncMenu = $nMenu"), $aModule[$cModule]->getLanguage() );; // Define las constantes del la contrasena
function performQuery($query) { // Open the database. $db = openDB(); // Query the database. $queryResult = mysql_query($query, $db); // If there is an error, return the error. if (!$queryResult) { $result = array("status" => 0, "error" => array("6", "Database query error: " . mysql_error())); packageResponse($result); exit; } // Close the database and return the result. closeDB($db); return $queryResult; }
<?php require "../libraries/dbLibrary.php"; require "../php/password.php"; $mysqli = openDB("localhost", "{$utente}", "{$pass}", "organico_miur");
<?php session_start(); include_once 'convenience_functions.php'; $db = openDB(); //include_once('convenience_functions.php'); // On définit le nombre de série dans la séquence if (!isset($_SESSION['serie'])) { $_SESSION['serie'] = 1; } else { $_SESSION['serie'] = $_SESSION['serie'] + 1; } /*Ouverture du fichier en lecture seule*/ $dir = $_SESSION['examen']; $serie = 'serie_' . $_SESSION['serie']; $fichier = 'lecture_serial.txt'; // Création du dossier série if (!is_dir($dir . '/' . $serie)) { mkdir($dir . '/' . $serie); } //$path=$dir.'/'.$serie.'/'.$fichier; //chemin d'accès au fichier à utiliser quand l'enregistrement du signal fonctionnera $path = $fichier; // ligne a supprimer quand l'enregistrement signal fonctionnera $path_img = $dir . '/' . $serie . '/images'; // Création dossier image if (!is_dir($path_img)) { mkdir($path_img); } $date = date("Y-m-d"); // INCREMENTER study_aquisitionsInStudy $studySQL = $db->prepare('UPDATE Study
function registerRoutine($language) { global $config; /********** * Open DB **********/ $db = openDB(); /********** * Generate an ID **********/ $unique = false; // in theory a collision could happen, though unlikely. So just to make sure, we do this // since that would really suck while (!$unique) { $id = date("ymd") . rand(1000, 9999); $uniqueQuery =& $db->Execute("SELECT sysid.sysid_id\n FROM sysid\n WHERE sysid.sysid_id = '{$id}'\n "); if (!$uniqueQuery) { return new serverReturn(false, 'SERVER', 'Database Error R1'); } $numRows = $uniqueQuery->RecordCount(); if ($numRows == 0) { // It's unique, stop the loop. $unique = true; } } /********** * Register ID **********/ $addSysIdQuery = $db->Execute("INSERT INTO sysid (\n sysid.sysid_id,\n sysid.sysid_created,\n sysid.sysid_created_ip,\n sysid.sysid_language\n )\n VALUES (\n '" . $id . "',\n now(),\n " . $db->quote($_SERVER['REMOTE_ADDR']) . ",\n " . $db->quote($language) . "\n )"); if (!$addSysIdQuery) { return new serverReturn(false, 'SERVER', 'Database Error R2'); } /********** * Disconnect **********/ $db->disconnect(); return new serverReturn(true, 'SERVER', $id); }
function main() { global $wonitorDb, $wonitorStructure; global $ns2plusDb, $ns2plusStructure; $table = 'rounds'; if (isset($_GET['table'])) { $table = $_GET['table']; } $db = null; $structure = null; if (isset($wonitorStructure[$table])) { $db = openDB($wonitorDb); $structure = $wonitorStructure; } elseif (isset($ns2plusStructure[$table])) { $db = openDB($ns2plusDb); $structure = $ns2plusStructure; } else { exit; } try { queryDB($db, $structure, $table); } catch (PDOException $e) { echo $e->getMessage(); } closeDB($db); }
<?php require "../libraries/dbLibrary.php"; $mysqli = openDB("localhost", "root", "wafinew2012", "redmeat");
function main() { global $data; global $wonitorDb, $wonitorStructure; global $ns2plusDb, $ns2plusStructure; readData(); checkWhitelist(); checkData(); try { if ($_POST['messageType'] == 'MatchEnd') { $db = openDB($wonitorDb); createTables($db, $wonitorStructure); insertRoundData($db, $data); closeDB($db); echo "MatchEnd post successful\n"; } if ($_POST['messageType'] == 'NS2PlusStats') { $db = openDB($ns2plusDb); createTables($db, $ns2plusStructure); insertNS2PlusData($db, $data); closeDB($db); echo "NS2PlusStats post successful\n"; } } catch (PDOException $e) { echo $e->getMessage(); } }
$lines = explode("\n", $config); foreach ($lines as $line) { if (strpos($line, '=') == false) { continue; } $foo = explode('=', $line); $foo[1] = trim(str_replace("'", "", $foo[1])); if (trim($foo[0]) == 'user') { $username = $foo[1]; } if (trim($foo[0]) == 'password') { $password = $foo[1]; } } $conn = mysql_connect($server, $username, $password) or die(mysql_error()); mysql_select_db($dbname . '_p', $conn); return $conn; } if (empty($_GET['dbname']) or empty($_GET['template']) or empty($_GET['p'])) { exit(0); } $conn = openDB($_GET['dbname']); $r = getPagesWithTemplate($_GET['template'], $_GET['category'], $_GET['namespace']); mysql_close($conn); $single = array(); do { $single = array_merge($single, getPagesWithClaim($_GET['p'], count($single))); } while (count($single) % 500000 == 0 && count($single) != 0); $r[0] = array_diff($r[0], $single); $r[1] = array_intersect_key($r[1], $r[0]); echo json_encode(array_map(null, array_keys($r[0]), array_values($r[0]), array_values($r[1])));
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="shortcut icon" href="favicon.ico" type="image/icon"> <link rel="stylesheet" href="css/deathMap.css"> </head> <body> <?php require_once 'dbUtil.php'; $db = openDB($ns2plusDb); $query = 'SELECT serverId, name as [serverName] FROM ServerInfo GROUP BY serverId ORDER BY serverName;'; $servers = $db->query($query, PDO::FETCH_ASSOC)->fetchAll(); $query = 'SELECT DISTINCT mapName AS map FROM RoundInfo;'; $maps = $db->query($query, PDO::FETCH_NUM)->fetchAll(PDO::FETCH_COLUMN, 0); $firstMap = $maps[0]; $query = 'SELECT roundId, roundDate, roundLength, winningTeam FROM RoundInfo WHERE mapName = :mapName;'; $stmt = $db->prepare($query); $stmt->bindValue(':mapName', $firstMap, PDO::PARAM_STR); $stmt->setFetchMode(PDO::FETCH_ASSOC); $stmt->execute(); $rounds = $stmt->fetchAll(); closeDB($db); ?> <header class="header"></header> <div class="middle"> <div class="mainpanel"> <div class="mapcontainer"> <div id="killsTooltip"> <div id="killsTooltipLine"></div>
function saveToDB() { $db = openDB(); //Patient table $patientSQL = $db->prepare('INSERT INTO Patient ( patient_insee, patient_firstName, patient_lastName, patient_dateOfBirth, patient_sex, patient_size, patient_weight, patient_typeOfID, patient_insurancePlanIdentification, patient_countryOfResidence) VALUES ( :insee, :firstName, :lastName, :dateOfBirth, :sex, :size, :weight, \'INSEE\', \'INSEE\', :countryOfResidence) ON DUPLICATE KEY UPDATE patient_firstName=:firstName, patient_lastName=:lastName, patient_dateOfBirth=:dateOfBirth, patient_sex=:sex, patient_size=:size, patient_weight=:weight, patient_countryOfResidence=:countryOfResidence;'); $patientSQL->execute(array('insee' => $_SESSION['patient_insee'], 'firstName' => $_SESSION['patient_firstName'], 'lastName' => $_SESSION['patient_lastName'], 'dateOfBirth' => $_SESSION['patient_dateOfBirth'], 'sex' => $_SESSION['patient_sex'], 'size' => $_SESSION['patient_size'], 'weight' => $_SESSION['patient_weight'], 'countryOfResidence' => $_SESSION['patient_countryOfResidence'])); $patientSQL->closeCursor(); $examenSQL = $db->prepare('INSERT INTO Examen ( examen_instanceCreationDateTime, examen_procedureCodeSequence, examen_institutionalDepartementName, examen_protocolName, examen_performedProcedureStepID, examen_performedProcedureStepDescription, examen_contentDateTime, examen_instanceCreatorUID, bodyPart_anatomicRegionSequence, anatomicOrientation_name, posture_name, operateur_name, realisateur_performingPhysicianName, prescripteur_referringPhysicianName, patient_insee, examen_comment) VALUES ( :time, \'DEFAULT PROCEDURE CODE SEQUENCE\', \'TODO\', \'DEFAULT PROTOCOL\', \'DEFAULT PROCEDURE STEP ID\', \'DEFAULT PROCEDURE STEP DESCRIPTION\', :time, \'DEFAULT INSTANCE CREATOR UID\', :bodyPart, :anatomicOrientation, :posture, :operateur, :realisateur, :prescipteur, :insee, :comment );'); // EXCTRACTION DATE HEURE $date_UID = new DateTime("NOW"); $years_UID = $date_UID->format('Ymd'); $hours_UID = $date_UID->format('H'); $minutes_UID = $date_UID->format('i'); $seconds_UID = $date_UID->format('s'); $examenSQL->execute(array('time' => date("Y-m-d H:i:s"), 'bodyPart' => $_SESSION['examen_bodyPart'], 'anatomicOrientation' => $_SESSION['examen_anatomicOrientation'], 'posture' => $_SESSION['examen_posture'], 'operateur' => $_SESSION['medic_operateur'], 'realisateur' => $_SESSION['medic_prescripteur'], 'prescipteur' => $_SESSION['medic_realisateur'], 'insee' => $_SESSION['patient_insee'], 'comment' => $_SESSION['examen_comment'])); $examenSQL->closeCursor(); $studySQL = $db->prepare('INSERT INTO Study ( study_studyInstanceUID, study_aquisitionsInStudy, study_datetime, study_referencedStudySequence, patient_insee) VALUES ( :uid, :acquisitions, :time, :references, :insee );'); $_SESSION['study_UID'] = $_SESSION['org_root'] . '1.' . $years_UID . '.' . $hours_UID . $minutes_UID . $seconds_UID; $studySQL->execute(array('uid' => $_SESSION['study_UID'], 'acquisitions' => 1, 'time' => date("Y-m-d H:i:s"), 'references' => 0, 'insee' => $_SESSION['patient_insee'])); $studySQL->closeCursor(); $_SESSION['toto'] = $months_UID; }
$html .= "</tr>"; } $html .= "</tbody></table>\n<div style='font-size:9pt'>Items will be combined by OR, then subset by AND, then subset by NOT.</div>\n</td></tr>\n<tr><th>Label</th><td>\nContains <input type='text' name='label_contains' value='" . escape_attr($label_contains) . "' />\n| does not contain <input type='text' name='label_contains_not' value='" . escape_attr($label_contains_not) . "' />\n(works only as subsequent filter)\n</td></tr>\n<tr><td/><td>\nBreak results into chunks of <input type='number' name='chunk_size' class='span2' value='{$chunk_size}' />\n<input type='submit' class='btn btn-primary' name='run' value='Run' />\n<a id='permalink' href='#' style='font-size:14pt;display:none'>Permalink</a>\n<a id='download_link' href='#' style='font-size:14pt;display:none'>Download</a>\n<input type='hidden' name='statementlist' value='" . escape_attr(get_request('statementlist', '')) . "' />\n</td></tr>\n</tbody></table>\n</form></div>"; out($html); out("<div><i>Note: </i> This tool is currently throttled to one edit every 10 seconds, because it would otherwise flood Recent Changes on Wikidata.<br/>\nHelp me get <a href='https://phabricator.wikimedia.org/T66829' target='_blank'>this bug</a> resolved, so the throttling can be removed again!</div>"); out("<div id='control_wrapper' style='position:fixed;right:5px;top:100px;z-index:5;display:none' class='well'>\n<div id='oauth_status'></div>\n<h2>Controls</h2>\n<div>Add/remove statements<br/><textarea id='statementlist' style='width:200px;height:100px;'>"); out(get_request('statementlist', '')); out("</textarea>\n<div style='font-size:8pt;line-height:110%'>\ne.g. \"P31:Q5\" for \"instance of:human\"<br/>\nPrefix with \"-\" to remove claim<br/>\nOne command per line\n</div>\n</div>\n<div><button id='run_tag' class='btn btn-success' onclick='run_tag();return false'>Process commands</button>\n<button style='display:none' id='stop_tag' class='btn btn-danger' onclick='stop_tag();return false'>EMERGENCY STOP</button></div>\n<div id='control_status'></div>\n</div>"); if (!isset($_REQUEST['run']) or $category == '' and $wdq == '' and $manual_list == '' and ($find == '' and $find_markers == 0)) { out("<script>\$('input[name=\"category\"]').focus();</script>"); out(get_common_footer()); exit(0); } out("<hr/>"); $items = array(); $db_wd = openDB('wikidata', 'wikidata'); $data = (object) array(); foreach ($modes as $mode => $con) { $data->{$mode} = new Pagelist(); } //array('items'=>array(),'has_data'=>false) ; //print "<pre>" ; print_r ( $data ) ; print "</pre>" ; if ($manual_list != '') { $data->manual->blankFile('wikidata', 'wikidata'); $fh = fopen($data->manual->file, 'w'); $manual_list = explode("\n", $manual_list); foreach ($manual_list as $i) { $i = trim(preg_replace('/\\D/', '', $i)); if ($i != '') { fwrite($fh, "Q{$i}\t0\n"); }
$cid = $_SESSION['classid']; $nid = $_SESSION['nid']; $nid2 = $_SESSION['nid2a']; } else { die("Information required for query was not found."); } if (isset($_POST['grader-comments']) && isset($_POST['grade']) && isset($_POST['userid'])) { $userid = $_POST['userid']; $grader_comments = $_POST['grader-comments']; $grade = $_POST['grade']; } else { die("Form data was not set."); } try { // Create a PDO object $DB = openDB(); // See if there is an assignment record, and create one if none exists $query = "SELECT COUNT(*) as count\n\t\t\t\t\t\t\t FROM assignments\n\t\t\t\t\t\t\t WHERE cid = ? AND nid = ? AND nid2 = ? AND idusers = ?"; $statement = $DB->prepare($query); $statement->bindValue(1, $cid); $statement->bindValue(2, $nid); $statement->bindValue(3, $nid2); $statement->bindValue(4, $userid); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); $count = (int) $result[0]['count']; $date_entered = date("Y-m-d", time()); //die($date_entered); if ($count == 0) { $query = "INSERT INTO assignments\n\t\t\t\t\t\t\t\t(cid, nid, nid2, idusers, tdate, grader_comments, grade, date_entered)\n\t\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t\t(?,?,?,?,?,?,?,?)"; $statement = $DB->prepare($query);
//header('Content-type: text/plain'); echo "<html>"; echo "<head>"; echo "<meta name='viewport' content='width=device-width, user-scalable=false, initial-scale=1;'>"; echo "</head>"; echo "<body>" . "<h2>Temperatur und Luftfeuchte</h2>"; // GET requests are sent as a query string on the URL: // GET index.html?name1=value&name2=value HTTP/1.1 // Host: about.com // http://192.168.0.40/homewatch/index.php?channel=1&temp=165&humidity=80&datetime=010120131234 if ($DEBUG) { print "<pre>"; print_r($_GET); print "</pre>"; } openDB(); if (isset($_GET['channel']) && isset($_GET['temp']) && isset($_GET['humidity'])) { if ($DEBUG) { echo "<p>addData()"; } $c = $_GET['channel']; $t = $_GET['temp']; $h = $_GET['humidity']; addData($c, $t, $h); if ($DEBUG) { echo "<p>all done"; } //listData(); echo "<p>OK updated data for channel:" . $c . "</p>"; } else { if ($DEBUG) {
if (!$resultSet) { print "Select {$sql} failed: " . mysqli_error($conn); return NULL; } // Sposto i records in un array numerico $records = array(); while ($record = mysqli_fetch_assoc($resultSet)) { $records[] = $record; } // liberazione della memoria impegnata dal result set mysqli_free_result($resultSet); return $records; } $stdin = fopen('php://stdin', 'r'); $log = fopen('log_inserimenti.txt', 'w'); $mysqli = openDB("localhost", "root", "mypwd", "organico_miur"); $nomi = array("Torino", "Politecnico Torino", "Piemonte orientale", "Scienze Gastronomiche", "Valle d'Aosta", "Genova", "LIUC", "Insubria", "e-Campus", "Milano", "Politecnico Milano", "Bocconi Milano", "Cattolica Sacro Cuore", "IULM", "San Raffaele", "Milano-Bicocca", "Bergamo", "Brescia", "Pavia", "Libera Bolzano", "Trento", "Verona", "Ca' Foscari Venezia", "Iuav Venezia", "Padova", "Udine", "Trieste", "Parma", "Modena e Reggio Emilia", "Bologna", "Ferrara", "Urbino", "Politecnica delle Marche", "Macerata", "Camerino", "Firenze", "Pisa", "Siena", "stranieri Siena", "Perugia", "stranieri Perugia", "Tuscia", "Roma La Sapienza", "Roma Tor Vergata", "LUMSA", "Guido Carli", "Roma Foro Italico", "Roma Tre", "Campus Bio-Medico Roma", "UNINT", "Guglielmo Marconi", "Unitelma", "Europea Roma", "UNINETTUNO", "Mercatorum", "Cusano", "telematica San Raffaele", "Link", "Cassino", "Sannio", "Fortunato", "Napoli Federico II", "Parthenope", "L'Orientale Napoli", "Suor Orsola Benincasa Napoli", "Seconda Napoli", "Pegaso", "Salerno", "L'Aquila", "Teramo", "Chieti", "Leonardo da Vinci", "Molise", "Foggia", "Bari", "Politecnico Bari", "Jean Monnet", "Salento", "Basilicata", "Calabria", "Catanzaro", "Mediterranea Reggio Calabria", "stranieri Reggio Calabria", "Palermo", "Messina", "KORE Enna", "Catania", "Sassari", "Cagliari"); $pop = array(64801, 28761, 10030, 265, 1162, 32683, 1762, 8511, 6683, 60262, 40132, 13390, 36387, 4197, 2001, 31924, 14335, 14147, 21372, 2658, 16508, 21887, 19261, 4684, 58190, 15179, 16474, 25020, 19514, 77305, 15484, 13800, 15639, 9773, 6914, 49863, 45001, 15746, 1133, 23487, 1091, 7342, 105885, 30512, 6048, 7624, 2196, 35302, 1564, 1194, 14305, 1645, 871, 8709, 249, 11491, 969, 1380, 8554, 6193, 538, 79314, 14774, 10302, 8124, 26718, 3968, 35010, 23926, 6628, 28461, 229, 7304, 9407, 49877, 10615, 1288, 18845, 7301, 30454, 10004, 7403, 752, 43359, 26379, 6008, 49621, 13288, 27610); for ($i = 0; $i < count($nomi); $i++) { $n = mysqli_real_escape_string($mysqli, str_replace(" ", "%", "%" . $nomi[$i] . "%")); $querySelect = "select id,nome from atenei where nome like '%{$n}%'\n"; $a = select($mysqli, $querySelect); //c'è un solo elemento con quel nome: lo inserisco if (count($a) >= 1) { $nome = $a[0]["nome"]; $querySet = "UPDATE atenei SET dimensione=" . $pop[$i] . " WHERE id='" . $a[0]["id"] . "'"; $msg = "{$n} => {$nome}\n"; } else { if (count($a) == 0) { $querySet = ""; $msg = "{$n} non trovato\n";